Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • putFileContents
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the menu frame (category tree) backend page for article list.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       Backend
  8:  * @version          SVN Revision $Rev:$
  9:  *
 10:  * @author           Jan Lengowski
 11:  * @copyright        four for business AG <www.4fb.de>
 12:  * @license          http://www.contenido.org/license/LIZENZ.txt
 13:  * @link             http://www.4fb.de
 14:  * @link             http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: cInclude("includes", "functions.str.php");
 20: cInclude("includes", "functions.tpl.php");
 21: cInclude('includes', 'functions.lang.php');
 22: 
 23: /**
 24:  *
 25:  * @param unknown_type $iIdcat
 26:  * @param unknown_type $aWholelist
 27:  * @return Ambigous <string, void, mixed>
 28:  */
 29: function showTree($iIdcat, &$aWholelist) {
 30:     global $check_global_rights, $sess, $cfg, $perm, $db, $db2, $db3, $area, $client, $lang, $navigationTree;
 31: 
 32:     $tpl = new cTemplate();
 33:     $tpl->reset();
 34: 
 35:     $iIdcat = (int) $iIdcat;
 36: 
 37:     foreach ($navigationTree[$iIdcat] as $sKey => $aValue) {
 38: 
 39:         $cfgdata = '';
 40:         $aCssClasses = array();
 41: 
 42:         // Check rights per cat
 43:         if (!$check_global_rights) {
 44:             $check_rights = false;
 45:         } else {
 46:             $check_rights = true;
 47:         }
 48: 
 49:         if (!$check_rights) {
 50:             $check_rights = ($aValue['forcedisplay'] == 1) ? true : false;
 51:         }
 52: 
 53:         $idcat = (int) $aValue['idcat'];
 54:         $level = $aValue['level'] - 1;
 55:         $name = $aValue['name'];
 56: 
 57:         if ($check_rights) {
 58: 
 59:             $idtpl = ($aValue['idtpl'] != '') ? $aValue['idtpl'] : 0;
 60: 
 61:             if (($aValue["idlang"] != $lang) || ($aValue['articles'] == true)) {
 62:                 #$aCssClasses[] = 'con_sync';
 63:             }
 64: 
 65:             $check_rights = $perm->have_perm_area_action_item("con", "con_changetemplate", $aValue['idcat']);
 66:             if (!$check_rights) {
 67:                 $check_rights = $perm->have_perm_area_action("con", "con_changetemplate");
 68:             }
 69: 
 70:             $changetemplate = ($check_rights) ? 1 : 0;
 71: 
 72:             $check_rights = $perm->have_perm_area_action_item("con", "con_makecatonline", $aValue['idcat']);
 73:             if (!$check_rights) {
 74:                 $check_rights = $perm->have_perm_area_action("con", "con_makecatonline");
 75:             }
 76: 
 77:             $onoffline = ($check_rights) ? 1 : 0;
 78: 
 79:             $check_rights = $perm->have_perm_area_action_item("con", "con_makepublic", $aValue['idcat']);
 80:             if (!$check_rights) {
 81:                 $check_rights = $perm->have_perm_area_action("con", "con_makepublic");
 82:             }
 83: 
 84:             $makepublic = ($check_rights) ? 1 : 0;
 85: 
 86:             $check_rights = $perm->have_perm_area_action_item("con", "con_tplcfg_edit", $aValue['idcat']);
 87:             if (!$check_rights) {
 88:                 $check_rights = $perm->have_perm_area_action("con", "con_tplcfg_edit");
 89:             }
 90: 
 91:             $templateconfig = ($check_rights) ? 1 : 0;
 92: 
 93:             if ($aValue["idlang"] == $lang) {
 94:                 // Build cfgdata string
 95:                 $cfgdata = $idcat . "-" . $idtpl . "-" . $aValue['online'] . "-" . $aValue['public'] . "-" .
 96:                         $changetemplate . "-" .
 97:                         $onoffline . "-" .
 98:                         $makepublic . "-" . $templateconfig;
 99:             } else {
100:                 $cfgdata = "";
101:             }
102: 
103:             // Select the appropriate folder-image depending on the structure properties
104: 
105:             if ($aValue['online'] == 1) {
106:                 // Category is online
107: 
108:                 if ($aValue['public'] == 0) {
109:                     // Category is locked
110:                     if ($aValue['no_start'] || $aValue['no_online']) {
111:                         $aAnchorClass = 'on_error_locked';
112:                     } else {
113:                         $aAnchorClass = 'on_locked';
114:                     }
115:                 } else {
116:                     // Category is public
117:                     if ($aValue['no_start'] || $aValue['no_online']) {
118:                         $aAnchorClass = 'on_error';
119:                     } else {
120:                         $aAnchorClass = 'on';
121:                     }
122:                 }
123:             } else {
124:                 // Category is offline
125: 
126:                 if ($aValue['public'] == 0) {
127:                     // Category is locked
128:                     if ($aValue['no_start'] || $aValue['no_online']) {
129:                         $aAnchorClass = 'off_error_locked';
130:                     } else {
131:                         $aAnchorClass = 'off_locked';
132:                     }
133:                 } else {
134:                     // Category is public
135:                     if ($aValue['no_start'] || $aValue['no_online']) {
136:                         $aAnchorClass = 'off_error';
137:                     } else {
138:                         $aAnchorClass = 'off';
139:                     }
140:                 }
141:             }
142: 
143:             if ($aValue['islast'] == 1) {
144:                 $aCssClasses[] = 'last';
145:             }
146: 
147:             if ($aValue['collapsed'] == 1 && is_array($navigationTree[$idcat])) {
148:                 $aCssClasses[] = 'collapsed';
149:             }
150: 
151:             if ($aValue['active']) {
152:                 $aCssClasses[] = 'active';
153:             }
154: 
155:             $bIsSyncable = false;
156:             if ($aValue["idlang"] != $lang) {
157:                 // Fetch parent id and check if it is syncronized
158:                 $sql = "SELECT parentid FROM %s WHERE idcat = '%s'";
159:                 $db->query(sprintf($sql, $cfg["tab"]["cat"], $idcat));
160:                 if ($db->nextRecord()) {
161:                     if ($db->f("parentid") != 0) {
162:                         $parentid = $db->f("parentid");
163:                         $sql = "SELECT idcatlang FROM %s WHERE idcat = '%s' AND idlang = '%s'";
164:                         $db->query(sprintf($sql, $cfg["tab"]["cat_lang"], cSecurity::toInteger($parentid), cSecurity::toInteger($lang)));
165: 
166:                         if ($db->nextRecord()) {
167:                             $aCssClasses[] = 'con_sync';
168:                             $bIsSyncable = true;
169:                         }
170:                     } else {
171:                         $aCssClasses[] = 'con_sync';
172:                         $bIsSyncable = true;
173:                     }
174:                 }
175:             }
176: 
177:             // Last param defines if cat is syncable or not, all other rights are disabled at this point
178:             if ($bIsSyncable) {
179:                 if ($cfgdata != '') {
180:                     $cfgdata .= '-1';
181:                 } else {
182:                     $cfgdata = $idcat . "-" . $idtpl . "-" . $aValue['online'] . "-" . $aValue['public'] .
183:                             "-0-0-0-0-1";
184:                 }
185:             } else {
186:                 if ($cfgdata != '') {
187:                     $cfgdata .= '-0';
188:                 } else {
189:                     $cfgdata = $idcat . "-" . $idtpl . "-" . $aValue['online'] . "-" . $aValue['public'] .
190:                             "-0-0-0-0-0";
191:                 }
192:             }
193: 
194:             $strName = cSecurity::unFilter($name);
195:             $mstr = '<a class="' . $aAnchorClass . '" href="#" title="idcat' . '&#58; ' . $idcat . '">' . $strName . '</a>';
196: 
197:             // Build Tree
198:             $tpl->set('d', 'CFGDATA', $cfgdata);
199:             if (is_array($navigationTree[$idcat])) {
200:                 $tpl->set('d', 'SUBCATS', showTree($idcat, $aWholelist));
201:                 $tpl->set('d', 'COLLAPSE', '<a href="#"> </a>');
202:                 $aWholelist[] = $idcat;
203:             } else {
204:                 $tpl->set('d', 'SUBCATS', '');
205:                 $tpl->set('d', 'COLLAPSE', '<span> </span>');
206:             }
207:             $tpl->set('d', 'CAT', $mstr);
208:             $tpl->set('d', 'CSS_CLASS', ' class="' . implode(' ', $aCssClasses) . '"');
209: 
210:             $tpl->next();
211:         } else {
212:             if (is_array($navigationTree[(int) $aValue['idcat']])) {
213:                 $sTpl = showTree((int) $aValue['idcat'], $aWholelist);
214:                 if (!preg_match('/^<ul>\s*<\/ul>$/', $sTpl)) {
215:                     $tpl->set('d', 'CFGDATA', '0-0-0-0-0-0-0-0-0');
216:                     $tpl->set('d', 'SUBCATS', $sTpl);
217:                     $tpl->set('d', 'COLLAPSE', '<a href="#"></a>');
218:                     $tpl->set('d', 'CAT', '<a class="off_disabled" href="#">' . $name . '</a>');
219:                     $tpl->set('d', 'CSS_CLASS', ' class="active"');
220:                     $tpl->next();
221:                 }
222:                 $aWholelist[] = $aValue['idcat'];
223:             }
224:         }
225:     }
226:     return $tpl->generate($cfg['path']['templates'] . 'template.con_str_overview.list.html', 1);
227: }
228: 
229: $db2 = cRegistry::getDb();
230: $db3 = cRegistry::getDb();
231: 
232: // Refresh or reset right frames, when a synclang is changed or a category is synchronized
233: $tpl->reset();
234: 
235: if ($action == "con_synccat" || isset($_GET['refresh_syncoptions']) && $_GET['refresh_syncoptions'] == 'true') {
236:     $tpl->set('s', 'RELOAD_RIGHT', 'reloadRightFrame();');
237: } else {
238:     $tpl->set('s', 'RELOAD_RIGHT', '');
239: }
240: 
241: if ($action == "con_synccat") {
242:     strSyncCategory($syncidcat, $syncfromlang, $lang, $multiple);
243:     $remakeStrTable = true;
244: }
245: 
246: if (!is_object($db2))
247:     $db2 = cRegistry::getDb();
248: 
249: if (!isset($remakeStrTable)) {
250:     $remakeStrTable = false;
251: }
252: 
253: if (!isset($remakeCatTable)) {
254:     $remakeCatTable = false;
255: }
256: 
257: $sess->register("remakeCatTable");
258: $sess->register("CatTableClient");
259: $sess->register("CatTableLang");
260: $sess->register("remakeStrTable");
261: 
262: if (isset($syncoptions)) {
263:     $syncfrom = $syncoptions;
264:     $remakeCatTable = true;
265: }
266: 
267: if (!isset($syncfrom)) {
268:     $syncfrom = 0;
269: }
270: 
271: $sess->register("syncfrom");
272: 
273: $syncoptions = $syncfrom;
274: 
275: if (!isset($CatTableClient)) {
276:     $CatTableClient = 0;
277: }
278: 
279: if ($CatTableClient != $client) {
280:     $remakeCatTable = true;
281: }
282: 
283: if (!isset($CatTableLang)) {
284:     $CatTableLang = 0;
285: }
286: 
287: if ($CatTableLang != $lang) {
288:     $remakeCatTable = true;
289: }
290: 
291: $CatTableClient = $client;
292: $CatTableLang = $lang;
293: 
294: if ($syncoptions == -1) {
295:     $sql = "SELECT
296:                 a.preid AS preid,
297:                 a.postid AS postid,
298:                 a.parentid AS parentid,
299:                 c.idcat AS idcat,
300:                 c.level AS level,
301:                 b.name AS name,
302:                 b.public AS public,
303:                 b.visible AS online,
304:                 d.idtpl AS idtpl,
305:                 b.idlang AS idlang
306:             FROM
307:                 (" . $cfg["tab"]["cat"] . " AS a,
308:                 " . $cfg["tab"]["cat_lang"] . " AS b,
309:                 " . $cfg["tab"]["cat_tree"] . " AS c)
310:             LEFT JOIN
311:                 " . $cfg["tab"]["tpl_conf"] . " AS d
312:                 ON d.idtplcfg = b.idtplcfg
313:             WHERE
314:                 a.idclient = '" . cSecurity::toInteger($client) . "' AND
315:                 b.idlang   = '" . cSecurity::toInteger($lang) . "' AND
316:                 c.idcat    = b.idcat AND
317:                 b.idcat    = a.idcat
318:             ORDER BY
319:                 c.idtree ASC";
320: } else {
321:     $sql = "SELECT
322:                 a.preid AS preid,
323:                 a.postid AS postid,
324:                 a.parentid AS parentid,
325:                 c.idcat AS idcat,
326:                 c.level AS level,
327:                 b.name AS name,
328:                 b.public AS public,
329:                 b.visible AS online,
330:                 d.idtpl AS idtpl,
331:                 b.idlang AS idlang
332:             FROM
333:                 (" . $cfg["tab"]["cat"] . " AS a,
334:                 " . $cfg["tab"]["cat_lang"] . " AS b,
335:                 " . $cfg["tab"]["cat_tree"] . " AS c)
336:             LEFT JOIN
337:                 " . $cfg["tab"]["tpl_conf"] . " AS d
338:                 ON d.idtplcfg = b.idtplcfg
339:             WHERE
340:                 a.idclient = '" . cSecurity::toInteger($client) . "' AND
341:                 (b.idlang  = '" . cSecurity::toInteger($lang) . "' OR
342:                  b.idlang  = '" . cSecurity::toInteger($syncoptions) . "') AND
343:                 c.idcat    = b.idcat AND
344:                 b.idcat    = a.idcat
345:             ORDER BY
346:                 c.idtree ASC";
347: }
348: 
349: $db->query($sql);
350: 
351: if (isset($syncoptions)) {
352:     $remakeCatTable = true;
353: }
354: 
355: if (isset($online)) {
356:     $remakeCatTable = true;
357: }
358: 
359: if (isset($public)) {
360:     $remakeCatTable = true;
361: }
362: 
363: if (isset($idtpl)) {
364:     $remakeCatTable = true;
365: }
366: 
367: if (isset($force)) {
368:     $remakeCatTable = true;
369: }
370: 
371: $arrIn = array();
372: while ($db->nextRecord()) {
373:     $arrIn[] = $db->f('idcat');
374: }
375: 
376: $arrArtCache = array();
377: 
378: if (count($arrIn) > 0) {
379:     $sIn = implode(',', $arrIn);
380: 
381:     $sql2 = "SELECT b.idcat, a.idart, idlang
382:             FROM " . $cfg["tab"]["art_lang"] . " AS a, " . $cfg["tab"]["cat_art"] . " AS b
383:             WHERE b.idcat IN (" . $db->escape($sIn) . ")
384:                 AND (a.idlang = " . cSecurity::toInteger($syncoptions) . " OR a.idlang = " . cSecurity::toInteger($lang) . ")
385:                 AND b.idart = a.idart";
386:     $db->query($sql2);
387: 
388:     while ($db->nextRecord()) {
389:         $arrArtCache[$db->f('idcat')][$db->f('idart')][$db->f('idlang')] = 'x';
390:     }
391: }
392: 
393: $db->query($sql);
394: 
395: while ($db->nextRecord()) {
396:     $entry = array();
397: 
398:     $entry['articles'] = false;
399: 
400:     if ($db->f("idlang") == $lang) {
401: 
402:         $arts = Array();
403: 
404:         if (isset($arrArtCache[$db->f("idcat")])) {
405:             foreach ($arrArtCache[$db->f("idcat")] as $key => $value) {
406:                 foreach ($value as $key2 => $value2) {
407:                     $arts[$key][$key2] = 1;
408:                 }
409:             }
410:         }
411: 
412:         foreach ($arts as $idart => $entry) {
413:             if (is_array($entry)) {
414:                 if (!array_key_exists($lang, $entry)) {
415:                     //$entry['articles'] = true;
416:                     $aIsArticles[$db->f("idcat")] = true;
417:                     break;
418:                 }
419:             }
420:         }
421:     }
422: }
423: 
424: if ($syncoptions == -1) {
425:     $sql2 = "SELECT
426:                     c.idcat AS idcat,
427:                     SUM(a.online) AS online,
428:                     d.startidartlang
429:                 FROM
430:                     " . $cfg["tab"]["art_lang"] . " AS a,
431:                     " . $cfg["tab"]["art"] . " AS b,
432:                     " . $cfg["tab"]["cat_art"] . " AS c,
433:                     " . $cfg["tab"]["cat_lang"] . " AS d
434:                 WHERE
435:                     a.idlang = " . cSecurity::toInteger($lang) . " AND
436:                     a.idart = b.idart AND
437:                     b.idclient = '" . cSecurity::toInteger($client) . "' AND
438:                     b.idart = c.idart AND
439:                     c.idcat = d.idcat
440:                 GROUP BY c.idcat
441:                         ";
442: } else {
443:     $sql2 = "SELECT
444:                     c.idcat AS idcat,
445:                     SUM(a.online) AS online,
446:                     d.startidartlang
447:                 FROM
448:                     " . $cfg["tab"]["art_lang"] . " AS a,
449:                     " . $cfg["tab"]["art"] . " AS b,
450:                     " . $cfg["tab"]["cat_art"] . " AS c,
451:                     " . $cfg["tab"]["cat_lang"] . " AS d
452:                 WHERE
453:                     a.idart = b.idart AND
454:                     b.idclient = '" . cSecurity::toInteger($client) . "' AND
455:                     b.idart = c.idart AND
456:                     c.idcat = d.idcat
457:                 GROUP BY c.idcat";
458: }
459: 
460: $db->query($sql2);
461: $aStartOnlineArticles = array();
462: while ($db->nextRecord()) {
463:     if ($db->f('startidartlang') > 0) {
464:         $aStartOnlineArticles[$db->f('idcat')]['is_start'] = true;
465:     } else {
466:         $aStartOnlineArticles[$db->f('idcat')]['is_start'] = false;
467:     }
468:     if ($db->f('online') > 0) {
469:         $aStartOnlineArticles[$db->f('idcat')]['is_online'] = true;
470:     } else {
471:         $aStartOnlineArticles[$db->f('idcat')]['is_online'] = false;
472:     }
473: }
474: 
475: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleCategoryList.ListItems");
476: 
477: if ($_cecIterator->count() > 0) {
478:     while ($chainEntry = $_cecIterator->next()) {
479:         $listItem = $chainEntry->execute();
480: 
481:         if (is_array($listItem)) {
482:             if (!array_key_exists("expandcollapseimage", $listItem) || $listItem["expandcollapseimage"] == "") {
483:                 $collapseImage = '<img src="images/spacer.gif" width="11" alt="" height="11">';
484:             } else {
485:                 $collapseImage = $listItem["expandcollapseimage"];
486:             }
487: 
488:             if (!array_key_exists("image", $listItem) || $listItem["image"] == "") {
489:                 $image = '<img src="images/spacer.gif" alt="">';
490:             } else {
491:                 $image = $listItem["image"];
492:             }
493: 
494:             if (!array_key_exists("id", $listItem) || $listItem["id"] == "") {
495:                 $id = rand();
496:             } else {
497:                 $id = $listItem["id"];
498:             }
499: 
500:             if (array_key_exists("markable", $listItem)) {
501:                 if ($listItem["markable"] == true) {
502:                     $mmark = $markscript;
503:                 } else {
504:                     $mmark = "";
505:                 }
506:             } else {
507:                 $mmark = "";
508:             }
509:         }
510:     }
511: }
512: 
513: $languages = getLanguageNamesByClient($client);
514: 
515: // Expand all / Collapse all
516: 
517: $selflink = "main.php";
518: $expandlink = $sess->url($selflink . "?area=$area&frame=$frame&expand=all&syncoptions=$syncoptions");
519: $collapselink = $sess->url($selflink . "?area=$area&frame=$frame&collapse=all&syncoptions=$syncoptions");
520: $collapseimg = '<a href="' . $collapselink . '" alt="' . i18n("Close all categories") . '" title="' . i18n("Close all categories") . '"><img src="images/but_minus.gif" border="0"></a>';
521: $expandimg = '<a href="' . $expandlink . '" alt="' . i18n("Open all categories") . '" title="' . i18n("Open all categories") . '"><img src="images/but_plus.gif" border="0"></a>';
522: $allLinks = $expandimg . '<img src="images/spacer.gif" width="3" alt="">' . $collapseimg;
523: $text_direction = langGetTextDirection($lang);
524: 
525: // Check global rights
526: $check_global_rights = $perm->have_perm_area_action("con", "con_makestart");
527: if (!$check_global_rights) {
528:     $check_global_rights = $perm->have_perm_area_action("con_editart", "con_edit");
529: }
530: if (!$check_global_rights) {
531:     $check_global_rights = $perm->have_perm_area_action("con_editart", "con_saveart");
532: }
533: if (!$check_global_rights) {
534:     $check_global_rights = $perm->have_perm_area_action("con_editcontent", "con_editart");
535: }
536: if (!$check_global_rights) {
537:     $check_global_rights = $perm->have_perm_area_action("con_editart", "con_newart");
538: }
539: if (!$check_global_rights) {
540:     $check_global_rights = $perm->have_perm_area_action("con", "con_deleteart");
541: }
542: if (!$check_global_rights) {
543:     $check_global_rights = $perm->have_perm_area_action("con", "con_makeonline");
544: }
545: if (!$check_global_rights) {
546:     $check_global_rights = $perm->have_perm_area_action("con", "con_tplcfg_edit");
547: }
548: if (!$check_global_rights) {
549:     $check_global_rights = $perm->have_perm_area_action("con", "con_makecatonline");
550: }
551: if (!$check_global_rights) {
552:     $check_global_rights = $perm->have_perm_area_action("con", "con_changetemplate");
553: }
554: 
555: if ($lang > $syncoptions) {
556:     $sOrder = 'DESC';
557: } else {
558:     $sOrder = 'ASC';
559: }
560: 
561: $client = (int) $client;
562: $sql = "SELECT DISTINCT " .
563:         "a.idcat, " .
564:         "a.parentid, " .
565:         "a.preid, " .
566:         "a.postid, " .
567:         "a.parentid, " .
568:         "b.name, " .
569:         "b.idlang, " .
570:         "b.visible, " .
571:         "b.public, " .
572:         "c.level, " .
573:         "d.idtpl " .
574:         "FROM {$cfg['tab']['cat']} AS a " .
575:         "LEFT JOIN {$cfg['tab']['cat_lang']} AS b ON a.idcat = b.idcat " .
576:         "LEFT JOIN {$cfg['tab']['cat_tree']} AS c ON (a.idcat = c.idcat AND b.idcat = c.idcat) " .
577:         "LEFT JOIN {$cfg["tab"]["tpl_conf"]} AS d ON b.idtplcfg = d.idtplcfg " .
578:         "WHERE " .
579:         "   a.idclient = {$client} " .
580:         "ORDER BY b.idlang {$sOrder}, c.idtree ASC ";
581: $db->query($sql);
582: if ($client == 0) {
583:     $client = '';
584: }
585: 
586: 
587: $sExpandList = $currentuser->getUserProperty("system", "con_cat_expandstate");
588: if ($sExpandList != '') {
589:     $conexpandedList = unserialize($currentuser->getUserProperty("system", "con_cat_expandstate"));
590: }
591: 
592: if (!is_array($conexpandedList)) {
593:     $conexpandedList = array();
594: }
595: 
596: if (!is_array($conexpandedList[$client])) {
597:     $conexpandedList[$client] = array();
598: }
599: 
600: $navigationTree = array();
601: $aWholelist = array();
602: 
603: while ($db->nextRecord()) {
604:     if (!isset($navigationTree[$db->f('parentid')][$db->f('idcat')]) && ($db->f('idlang') == $lang || $db->f('idlang') == $syncoptions)) {
605:         if (in_array($db->f('idcat'), $conexpandedList[$client])) {
606:             $collapsed = false;
607:         } else {
608:             $collapsed = true;
609:         }
610:         if ($perm->have_perm_item("con", $db->f('idcat'))) {
611:             $forcedisplay = 1;
612:         } else {
613:             $forcedisplay = 0;
614:         }
615:         if ($idcat == $db->f('idcat')) {
616:             $active = true;
617:         } else {
618:             $active = false;
619:         }
620:         $navigationTree[$db->f('parentid')][$db->f('idcat')] = array(
621:             'idcat' => $db->f('idcat'),
622:             'preid' => $db->f('preid'),
623:             'postid' => $db->f('postid'),
624:             'visible' => $db->f('visible'),
625:             'online' => $db->f('visible'),
626:             'public' => $db->f('public'),
627:             'name' => $db->f('name'),
628:             'idlang' => $db->f('idlang'),
629:             'idtpl' => $db->f('idtpl'),
630:             'collapsed' => $collapsed,
631:             'forcedisplay' => $forcedisplay,
632:             'active' => $active,
633:             'islast' => false,
634:             'articles' => $aIsArticles[$db->f("idcat")],
635:             'level' => $db->f('level')
636:         );
637:         if ($aStartOnlineArticles[$db->f('idcat')]['is_start']) {
638:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_start'] = false;
639:         } else {
640:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_start'] = true;
641:         }
642:         if ($aStartOnlineArticles[$db->f('idcat')]['is_online']) {
643:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_online'] = false;
644:         } else {
645:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_online'] = true;
646:         }
647:     }
648: }
649: 
650: cDebug::out(print_r($navigationTree, true));
651: 
652: if (count($navigationTree[0])) {
653:     $sCategories = showTree(0, $aWholelist);
654: }
655: 
656: $tpl->set('s', 'CATS', $sCategories);
657: $tpl->set('s', 'AREA', $area);
658: $tpl->set('s', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
659: $tpl->set('s', 'SYNCOPTIONS', $syncoptions);
660: $tpl->set('s', 'AJAXURL',  cRegistry::getBackendUrl() . 'ajaxmain.php');
661: $tpl->set('s', 'WHOLELIST', implode(', ', $aWholelist));
662: $tpl->set('s', 'EXPANDEDLIST', implode(', ', $conexpandedList[$client]));
663: 
664: $tpl->generate($cfg['path']['templates'] . $cfg['templates']['con_str_overview']);
665: 
666: ?>
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0