Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

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