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:  * @author           Jan Lengowski
  9:  * @copyright        four for business AG <www.4fb.de>
 10:  * @license          http://www.contenido.org/license/LIZENZ.txt
 11:  * @link             http://www.4fb.de
 12:  * @link             http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: cInclude("includes", "functions.str.php");
 18: cInclude("includes", "functions.tpl.php");
 19: cInclude('includes', 'functions.lang.php');
 20: 
 21: /**
 22:  *
 23:  * @param int $iIdcat
 24:  * @param array $aWholelist
 25:  * @return string
 26:  */
 27: function showTree($iIdcat, &$aWholelist) {
 28:     global $check_global_rights, $sess, $cfg, $perm, $db, $db2, $db3, $area, $client, $lang, $navigationTree;
 29: 
 30:     $tpl = new cTemplate();
 31:     $tpl->reset();
 32: 
 33:     $iIdcat = (int) $iIdcat;
 34: 
 35:     foreach ($navigationTree[$iIdcat] as $sKey => $aValue) {
 36: 
 37:         $cfgdata = '';
 38:         $aCssClasses = array();
 39: 
 40:         // Check rights per cat
 41:         if (!$check_global_rights) {
 42:             $check_rights = false;
 43:         } else {
 44:             $check_rights = true;
 45:         }
 46: 
 47:         if (!$check_rights) {
 48:             $check_rights = ($aValue['forcedisplay'] == 1) ? true : false;
 49:         }
 50: 
 51:         $idcat = (int) $aValue['idcat'];
 52:         $level = $aValue['level'] - 1;
 53:         $name = $aValue['name'];
 54: 
 55:         if ($check_rights) {
 56: 
 57:             $idtpl = ($aValue['idtpl'] != '') ? $aValue['idtpl'] : 0;
 58: 
 59:             // if (($aValue["idlang"] != $lang) || ($aValue['articles'] == true)) {
 60:             //     $aCssClasses[] = 'con_sync';
 61:             // }
 62: 
 63:             $check_rights = $perm->have_perm_area_action_item("con", "con_changetemplate", $aValue['idcat']);
 64:             if (!$check_rights) {
 65:                 $check_rights = $perm->have_perm_area_action("con", "con_changetemplate");
 66:             }
 67: 
 68:             $changetemplate = ($check_rights) ? 1 : 0;
 69: 
 70:             $check_rights = $perm->have_perm_area_action_item("con", "con_makecatonline", $aValue['idcat']);
 71:             if (!$check_rights) {
 72:                 $check_rights = $perm->have_perm_area_action("con", "con_makecatonline");
 73:             }
 74: 
 75:             $onoffline = ($check_rights) ? 1 : 0;
 76: 
 77:             $check_rights = $perm->have_perm_area_action_item("con", "con_makepublic", $aValue['idcat']);
 78:             if (!$check_rights) {
 79:                 $check_rights = $perm->have_perm_area_action("con", "con_makepublic");
 80:             }
 81: 
 82:             $makepublic = ($check_rights) ? 1 : 0;
 83: 
 84:             $check_rights = $perm->have_perm_area_action_item("con", "con_tplcfg_edit", $aValue['idcat']);
 85:             if (!$check_rights) {
 86:                 $check_rights = $perm->have_perm_area_action("con", "con_tplcfg_edit");
 87:             }
 88: 
 89:             $templateconfig = ($check_rights) ? 1 : 0;
 90: 
 91:             if ($aValue["idlang"] == $lang) {
 92:                 // Build cfgdata string
 93:                 $cfgdata = $idcat . "-" . $idtpl . "-" . $aValue['online'] . "-" . $aValue['public'] . "-" .
 94:                         $changetemplate . "-" .
 95:                         $onoffline . "-" .
 96:                         $makepublic . "-" . $templateconfig;
 97:             } else {
 98:                 $cfgdata = "";
 99:             }
100: 
101:             // Select the appropriate folder-image depending on the structure properties
102:             if ($aValue['online'] == 1) {
103:                 // Category is online
104: 
105:                 if ($aValue['public'] == 0) {
106:                     // Category is locked
107:                     if ($aValue['no_start'] || $aValue['no_online']) {
108:                         $aAnchorClass = 'on_error_locked';
109:                     } else {
110:                         $aAnchorClass = 'on_locked';
111:                     }
112:                 } else {
113:                     // Category is public
114:                     if ($aValue['no_start'] || $aValue['no_online']) {
115:                         $aAnchorClass = 'on_error';
116:                     } else {
117:                         $aAnchorClass = 'on';
118:                     }
119:                 }
120:             } else {
121:                 // Category is offline
122: 
123:                 if ($aValue['public'] == 0) {
124:                     // Category is locked
125:                     if ($aValue['no_start'] || $aValue['no_online']) {
126:                         $aAnchorClass = 'off_error_locked';
127:                     } else {
128:                         $aAnchorClass = 'off_locked';
129:                     }
130:                 } else {
131:                     // Category is public
132:                     if ($aValue['no_start'] || $aValue['no_online']) {
133:                         $aAnchorClass = 'off_error';
134:                     } else {
135:                         $aAnchorClass = 'off';
136:                     }
137:                 }
138:             }
139: 
140:             if ($aValue['islast'] == 1) {
141:                 $aCssClasses[] = 'last';
142:             }
143: 
144:             if ($aValue['collapsed'] == 1 && is_array($navigationTree[$idcat])) {
145:                 $aCssClasses[] = 'collapsed';
146:             }
147: 
148:             if ($aValue['active']) {
149:                 $aCssClasses[] = 'active';
150:             }
151: 
152:             $bIsSyncable = false;
153:             if ($aValue["idlang"] != $lang) {
154:                 // Fetch parent id and check if it is syncronized
155:                 $sql = "SELECT parentid FROM %s WHERE idcat = '%s'";
156:                 $db->query(sprintf($sql, $cfg["tab"]["cat"], $idcat));
157:                 if ($db->nextRecord()) {
158:                     if ($db->f("parentid") != 0) {
159:                         $parentid = $db->f("parentid");
160:                         $sql = "SELECT idcatlang FROM %s WHERE idcat = '%s' AND idlang = '%s'";
161:                         $db->query(sprintf($sql, $cfg["tab"]["cat_lang"], cSecurity::toInteger($parentid), cSecurity::toInteger($lang)));
162: 
163:                         if ($db->nextRecord()) {
164:                             $aCssClasses[] = 'con_sync';
165:                             $bIsSyncable = true;
166:                         }
167:                     } else {
168:                         $aCssClasses[] = 'con_sync';
169:                         $bIsSyncable = true;
170:                     }
171:                 }
172:             }
173: 
174:             // Last param defines if cat is syncable or not, all other rights are disabled at this point
175:             if ($bIsSyncable) {
176:                 if ($cfgdata != '') {
177:                     $cfgdata .= '-1';
178:                 } else {
179:                     $cfgdata = $idcat . "-" . $idtpl . "-" . $aValue['online'] . "-" . $aValue['public'] .
180:                             "-0-0-0-0-1";
181:                 }
182:             } else {
183:                 if ($cfgdata != '') {
184:                     $cfgdata .= '-0';
185:                 } else {
186:                     $cfgdata = $idcat . "-" . $idtpl . "-" . $aValue['online'] . "-" . $aValue['public'] .
187:                             "-0-0-0-0-0";
188:                 }
189:             }
190: 
191:             $strName = cSecurity::unFilter($name);
192:             $mstr = '<a class="' . $aAnchorClass . '" href="#" title="idcat' . '&#58; ' . $idcat . '">' . $strName . '</a>';
193: 
194:             // Build Tree
195:             $tpl->set('d', 'CFGDATA', $cfgdata);
196:             if (is_array($navigationTree[$idcat])) {
197:                 $tpl->set('d', 'SUBCATS', showTree($idcat, $aWholelist));
198:                 $tpl->set('d', 'COLLAPSE', '<a href="#"> </a>');
199:                 $aWholelist[] = $idcat;
200:             } else {
201:                 $tpl->set('d', 'SUBCATS', '');
202:                 $tpl->set('d', 'COLLAPSE', '<span> </span>');
203:             }
204:             $tpl->set('d', 'CAT', $mstr);
205:             $tpl->set('d', 'CSS_CLASS', ' class="' . implode(' ', $aCssClasses) . '"');
206: 
207:             $tpl->next();
208:         } else {
209:             if (is_array($navigationTree[(int) $aValue['idcat']])) {
210:                 $sTpl = showTree((int) $aValue['idcat'], $aWholelist);
211:                 if (!preg_match('/^<ul>\s*<\/ul>$/', $sTpl)) {
212:                     $tpl->set('d', 'CFGDATA', '0-0-0-0-0-0-0-0-0');
213:                     $tpl->set('d', 'SUBCATS', $sTpl);
214:                     $tpl->set('d', 'COLLAPSE', '<a href="#"></a>');
215:                     $tpl->set('d', 'CAT', '<a class="off_disabled" href="#">' . $name . '</a>');
216:                     $tpl->set('d', 'CSS_CLASS', ' class="active"');
217:                     $tpl->next();
218:                 }
219:                 $aWholelist[] = $aValue['idcat'];
220:             }
221:         }
222:     }
223:     return $tpl->generate($cfg['path']['templates'] . 'template.con_str_overview.list.html', 1);
224: }
225: 
226: $db2 = cRegistry::getDb();
227: $db3 = cRegistry::getDb();
228: 
229: // Refresh or reset right frames, when a synclang is changed or a category is synchronized
230: $tpl->reset();
231: 
232: if ($action == "con_synccat" || isset($_GET['refresh_syncoptions']) && $_GET['refresh_syncoptions'] == 'true') {
233:     $tpl->set('s', 'RELOAD_RIGHT', 'reloadRightFrame();');
234: } else {
235:     $tpl->set('s', 'RELOAD_RIGHT', '');
236: }
237: 
238: if ($action == "con_synccat") {
239:     strSyncCategory($syncidcat, $syncfromlang, $lang, $multiple);
240:     $remakeStrTable = true;
241: }
242: 
243: if (!is_object($db2))
244:     $db2 = cRegistry::getDb();
245: 
246: if (!isset($remakeStrTable)) {
247:     $remakeStrTable = false;
248: }
249: 
250: if (!isset($remakeCatTable)) {
251:     $remakeCatTable = false;
252: }
253: 
254: $sess->register("remakeCatTable");
255: $sess->register("CatTableClient");
256: $sess->register("CatTableLang");
257: $sess->register("remakeStrTable");
258: 
259: if (isset($syncoptions)) {
260:     $syncfrom = $syncoptions;
261:     $remakeCatTable = true;
262: }
263: 
264: if (!isset($syncfrom)) {
265:     $syncfrom = 0;
266: }
267: 
268: $sess->register("syncfrom");
269: 
270: $syncoptions = $syncfrom;
271: 
272: if (!isset($CatTableClient)) {
273:     $CatTableClient = 0;
274: }
275: 
276: if ($CatTableClient != $client) {
277:     $remakeCatTable = true;
278: }
279: 
280: if (!isset($CatTableLang)) {
281:     $CatTableLang = 0;
282: }
283: 
284: if ($CatTableLang != $lang) {
285:     $remakeCatTable = true;
286: }
287: 
288: $CatTableClient = $client;
289: $CatTableLang = $lang;
290: 
291: if ($syncoptions == -1) {
292:     $sql = "SELECT
293:                 a.preid AS preid,
294:                 a.postid AS postid,
295:                 a.parentid AS parentid,
296:                 c.idcat AS idcat,
297:                 c.level AS level,
298:                 b.name AS name,
299:                 b.public AS public,
300:                 b.visible AS online,
301:                 d.idtpl AS idtpl,
302:                 b.idlang AS idlang
303:             FROM
304:                 (" . $cfg["tab"]["cat"] . " AS a,
305:                 " . $cfg["tab"]["cat_lang"] . " AS b,
306:                 " . $cfg["tab"]["cat_tree"] . " AS c)
307:             LEFT JOIN
308:                 " . $cfg["tab"]["tpl_conf"] . " AS d
309:                 ON d.idtplcfg = b.idtplcfg
310:             WHERE
311:                 a.idclient = '" . cSecurity::toInteger($client) . "' AND
312:                 b.idlang   = '" . cSecurity::toInteger($lang) . "' AND
313:                 c.idcat    = b.idcat AND
314:                 b.idcat    = a.idcat
315:             ORDER BY
316:                 c.idtree ASC";
317: } else {
318:     $sql = "SELECT
319:                 a.preid AS preid,
320:                 a.postid AS postid,
321:                 a.parentid AS parentid,
322:                 c.idcat AS idcat,
323:                 c.level AS level,
324:                 b.name AS name,
325:                 b.public AS public,
326:                 b.visible AS online,
327:                 d.idtpl AS idtpl,
328:                 b.idlang AS idlang
329:             FROM
330:                 (" . $cfg["tab"]["cat"] . " AS a,
331:                 " . $cfg["tab"]["cat_lang"] . " AS b,
332:                 " . $cfg["tab"]["cat_tree"] . " AS c)
333:             LEFT JOIN
334:                 " . $cfg["tab"]["tpl_conf"] . " AS d
335:                 ON d.idtplcfg = b.idtplcfg
336:             WHERE
337:                 a.idclient = '" . cSecurity::toInteger($client) . "' AND
338:                 (b.idlang  = '" . cSecurity::toInteger($lang) . "' OR
339:                  b.idlang  = '" . cSecurity::toInteger($syncoptions) . "') AND
340:                 c.idcat    = b.idcat AND
341:                 b.idcat    = a.idcat
342:             ORDER BY
343:                 c.idtree ASC";
344: }
345: 
346: $db->query($sql);
347: 
348: if (isset($syncoptions)) {
349:     $remakeCatTable = true;
350: }
351: 
352: if (isset($online)) {
353:     $remakeCatTable = true;
354: }
355: 
356: if (isset($public)) {
357:     $remakeCatTable = true;
358: }
359: 
360: if (isset($idtpl)) {
361:     $remakeCatTable = true;
362: }
363: 
364: if (isset($force)) {
365:     $remakeCatTable = true;
366: }
367: 
368: $arrIn = array();
369: while ($db->nextRecord()) {
370:     $arrIn[] = $db->f('idcat');
371: }
372: 
373: $arrArtCache = array();
374: 
375: if (count($arrIn) > 0) {
376:     $sIn = implode(',', $arrIn);
377: 
378:     $sql2 = "SELECT b.idcat, a.idart, idlang
379:             FROM " . $cfg["tab"]["art_lang"] . " AS a, " . $cfg["tab"]["cat_art"] . " AS b
380:             WHERE b.idcat IN (" . $db->escape($sIn) . ")
381:                 AND (a.idlang = " . cSecurity::toInteger($syncoptions) . " OR a.idlang = " . cSecurity::toInteger($lang) . ")
382:                 AND b.idart = a.idart";
383:     $db->query($sql2);
384: 
385:     while ($db->nextRecord()) {
386:         $arrArtCache[$db->f('idcat')][$db->f('idart')][$db->f('idlang')] = 'x';
387:     }
388: }
389: 
390: $db->query($sql);
391: 
392: while ($db->nextRecord()) {
393:     $entry = array();
394: 
395:     $entry['articles'] = false;
396: 
397:     if ($db->f("idlang") == $lang) {
398: 
399:         $arts = array();
400: 
401:         if (isset($arrArtCache[$db->f("idcat")])) {
402:             foreach ($arrArtCache[$db->f("idcat")] as $key => $value) {
403:                 foreach ($value as $key2 => $value2) {
404:                     $arts[$key][$key2] = 1;
405:                 }
406:             }
407:         }
408: 
409:         foreach ($arts as $idart => $entry) {
410:             if (is_array($entry)) {
411:                 if (!array_key_exists($lang, $entry)) {
412:                     //$entry['articles'] = true;
413:                     $aIsArticles[$db->f("idcat")] = true;
414:                     break;
415:                 }
416:             }
417:         }
418:     }
419: }
420: 
421: if ($syncoptions == -1) {
422:     $sql2 = "SELECT
423:                 c.idcat AS idcat,
424:                 SUM(a.online) AS online,
425:                 d.startidartlang
426:             FROM
427:                 " . $cfg["tab"]["art_lang"] . " AS a,
428:                 " . $cfg["tab"]["art"] . " AS b,
429:                 " . $cfg["tab"]["cat_art"] . " AS c,
430:                 " . $cfg["tab"]["cat_lang"] . " AS d
431:             WHERE
432:                 a.idlang = " . cSecurity::toInteger($lang) . " AND
433:                 a.idart = b.idart AND
434:                 b.idclient = '" . cSecurity::toInteger($client) . "' AND
435:                 b.idart = c.idart AND
436:                 c.idcat = d.idcat
437:             GROUP BY c.idcat";
438: } else {
439:     $sql2 = "SELECT
440:                 c.idcat AS idcat,
441:                 SUM(a.online) AS online,
442:                 d.startidartlang
443:             FROM
444:                 " . $cfg["tab"]["art_lang"] . " AS a,
445:                 " . $cfg["tab"]["art"] . " AS b,
446:                 " . $cfg["tab"]["cat_art"] . " AS c,
447:                 " . $cfg["tab"]["cat_lang"] . " AS d
448:             WHERE
449:                 a.idart = b.idart AND
450:                 b.idclient = '" . cSecurity::toInteger($client) . "' AND
451:                 b.idart = c.idart AND
452:                 c.idcat = d.idcat
453:             GROUP BY c.idcat";
454: }
455: $db->query($sql2);
456: 
457: $aStartOnlineArticles = array();
458: while ($db->nextRecord()) {
459:     if ($db->f('startidartlang') > 0) {
460:         $aStartOnlineArticles[$db->f('idcat')]['is_start'] = true;
461:     } else {
462:         $aStartOnlineArticles[$db->f('idcat')]['is_start'] = false;
463:     }
464:     if ($db->f('online') > 0) {
465:         $aStartOnlineArticles[$db->f('idcat')]['is_online'] = true;
466:     } else {
467:         $aStartOnlineArticles[$db->f('idcat')]['is_online'] = false;
468:     }
469: }
470: 
471: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleCategoryList.ListItems");
472: 
473: if ($_cecIterator->count() > 0) {
474:     while ($chainEntry = $_cecIterator->next()) {
475:         $listItem = $chainEntry->execute();
476: 
477:         if (is_array($listItem)) {
478:             if (!array_key_exists("expandcollapseimage", $listItem) || $listItem["expandcollapseimage"] == "") {
479:                 $collapseImage = '<img src="images/spacer.gif" width="11" alt="" height="11">';
480:             } else {
481:                 $collapseImage = $listItem["expandcollapseimage"];
482:             }
483: 
484:             if (!array_key_exists("image", $listItem) || $listItem["image"] == "") {
485:                 $image = '<img src="images/spacer.gif" alt="">';
486:             } else {
487:                 $image = $listItem["image"];
488:             }
489: 
490:             if (!array_key_exists("id", $listItem) || $listItem["id"] == "") {
491:                 $id = rand();
492:             } else {
493:                 $id = $listItem["id"];
494:             }
495: 
496:             if (array_key_exists("markable", $listItem)) {
497:                 if ($listItem["markable"] == true) {
498:                     $mmark = $markscript;
499:                 } else {
500:                     $mmark = "";
501:                 }
502:             } else {
503:                 $mmark = "";
504:             }
505:         }
506:     }
507: }
508: 
509: $languages = getLanguageNamesByClient($client);
510: 
511: // Expand all / Collapse all
512: 
513: $selflink = "main.php";
514: $expandlink = $sess->url($selflink . "?area=$area&frame=$frame&expand=all&syncoptions=$syncoptions");
515: $collapselink = $sess->url($selflink . "?area=$area&frame=$frame&collapse=all&syncoptions=$syncoptions");
516: $collapseimg = '<a href="' . $collapselink . '" alt="' . i18n("Close all categories") . '" title="' . i18n("Close all categories") . '"><img src="images/but_minus.gif" border="0"></a>';
517: $expandimg = '<a href="' . $expandlink . '" alt="' . i18n("Open all categories") . '" title="' . i18n("Open all categories") . '"><img src="images/but_plus.gif" border="0"></a>';
518: $allLinks = $expandimg . '<img src="images/spacer.gif" width="3" alt="">' . $collapseimg;
519: $text_direction = langGetTextDirection($lang);
520: 
521: // Check global rights
522: $check_global_rights = $perm->have_perm_area_action("con", "con_makestart");
523: if (!$check_global_rights) {
524:     $check_global_rights = $perm->have_perm_area_action("con_editart", "con_edit");
525: }
526: if (!$check_global_rights) {
527:     $check_global_rights = $perm->have_perm_area_action("con_editart", "con_saveart");
528: }
529: if (!$check_global_rights) {
530:     $check_global_rights = $perm->have_perm_area_action("con_editcontent", "con_editart");
531: }
532: if (!$check_global_rights) {
533:     $check_global_rights = $perm->have_perm_area_action("con_editart", "con_newart");
534: }
535: if (!$check_global_rights) {
536:     $check_global_rights = $perm->have_perm_area_action("con", "con_deleteart");
537: }
538: if (!$check_global_rights) {
539:     $check_global_rights = $perm->have_perm_area_action("con", "con_makeonline");
540: }
541: if (!$check_global_rights) {
542:     $check_global_rights = $perm->have_perm_area_action("con", "con_tplcfg_edit");
543: }
544: if (!$check_global_rights) {
545:     $check_global_rights = $perm->have_perm_area_action("con", "con_makecatonline");
546: }
547: if (!$check_global_rights) {
548:     $check_global_rights = $perm->have_perm_area_action("con", "con_changetemplate");
549: }
550: 
551: if ($lang > $syncoptions) {
552:     $sOrder = 'DESC';
553: } else {
554:     $sOrder = 'ASC';
555: }
556: 
557: $client = (int) $client;
558: $sql = "SELECT DISTINCT " .
559:         "a.idcat, " .
560:         "a.parentid, " .
561:         "a.preid, " .
562:         "a.postid, " .
563:         "a.parentid, " .
564:         "b.name, " .
565:         "b.idlang, " .
566:         "b.visible, " .
567:         "b.public, " .
568:         "c.level, " .
569:         "d.idtpl " .
570:         "FROM {$cfg['tab']['cat']} AS a " .
571:         "LEFT JOIN {$cfg['tab']['cat_lang']} AS b ON a.idcat = b.idcat " .
572:         "LEFT JOIN {$cfg['tab']['cat_tree']} AS c ON (a.idcat = c.idcat AND b.idcat = c.idcat) " .
573:         "LEFT JOIN {$cfg["tab"]["tpl_conf"]} AS d ON b.idtplcfg = d.idtplcfg " .
574:         "WHERE " .
575:         "   a.idclient = {$client} " .
576:         "ORDER BY b.idlang {$sOrder}, c.idtree ASC ";
577: $db->query($sql);
578: if ($client == 0) {
579:     $client = '';
580: }
581: 
582: 
583: $sExpandList = $currentuser->getUserProperty("system", "con_cat_expandstate");
584: if ($sExpandList != '') {
585:     $conexpandedList = unserialize($currentuser->getUserProperty("system", "con_cat_expandstate"));
586: }
587: 
588: if (!is_array($conexpandedList)) {
589:     $conexpandedList = array();
590: }
591: 
592: if (!is_array($conexpandedList[$client])) {
593:     $conexpandedList[$client] = array();
594: }
595: 
596: $navigationTree = array();
597: $aWholelist = array();
598: 
599: while ($db->nextRecord()) {
600:     if (!isset($navigationTree[$db->f('parentid')][$db->f('idcat')]) && ($db->f('idlang') == $lang || $db->f('idlang') == $syncoptions)) {
601:         if (in_array($db->f('idcat'), $conexpandedList[$client])) {
602:             $collapsed = false;
603:         } else {
604:             $collapsed = true;
605:         }
606:         if ($perm->have_perm_item("con", $db->f('idcat'))) {
607:             $forcedisplay = 1;
608:         } else {
609:             $forcedisplay = 0;
610:         }
611:         if ($idcat == $db->f('idcat')) {
612:             $active = true;
613:         } else {
614:             $active = false;
615:         }
616:         $navigationTree[$db->f('parentid')][$db->f('idcat')] = array(
617:             'idcat' => $db->f('idcat'),
618:             'preid' => $db->f('preid'),
619:             'postid' => $db->f('postid'),
620:             'visible' => $db->f('visible'),
621:             'online' => $db->f('visible'),
622:             'public' => $db->f('public'),
623:             'name' => $db->f('name'),
624:             'idlang' => $db->f('idlang'),
625:             'idtpl' => $db->f('idtpl'),
626:             'collapsed' => $collapsed,
627:             'forcedisplay' => $forcedisplay,
628:             'active' => $active,
629:             'islast' => false,
630:             'articles' => $aIsArticles[$db->f("idcat")],
631:             'level' => $db->f('level')
632:         );
633:         if ($aStartOnlineArticles[$db->f('idcat')]['is_start']) {
634:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_start'] = false;
635:         } else {
636:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_start'] = true;
637:         }
638:         if ($aStartOnlineArticles[$db->f('idcat')]['is_online']) {
639:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_online'] = false;
640:         } else {
641:             $navigationTree[$db->f('parentid')][$db->f('idcat')]['no_online'] = true;
642:         }
643:     }
644: }
645: 
646: cDebug::out(print_r($navigationTree, true));
647: 
648: if (count($navigationTree[0])) {
649:     $sCategories = showTree(0, $aWholelist);
650: }
651: 
652: $tpl->set('s', 'CATS', $sCategories);
653: $tpl->set('s', 'AREA', $area);
654: $tpl->set('s', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
655: $tpl->set('s', 'SYNCOPTIONS', $syncoptions);
656: $tpl->set('s', 'AJAXURL',  cRegistry::getBackendUrl() . 'ajaxmain.php');
657: $tpl->set('s', 'WHOLELIST', implode(', ', $aWholelist));
658: $tpl->set('s', 'EXPANDEDLIST', implode(', ', $conexpandedList[$client]));
659: 
660: $tpl->generate($cfg['path']['templates'] . $cfg['templates']['con_str_overview']);
661: 
662: ?>
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0