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