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 backend page for displaying articles of a category.
   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.tpl.php');
  18: cInclude('includes', 'functions.str.php');
  19: cInclude('includes', 'functions.pathresolver.php');
  20: 
  21: $db2 = cRegistry::getDb();
  22: 
  23: $idcat = (isset($_REQUEST['idcat']) && is_numeric($_REQUEST['idcat'])) ? $_REQUEST['idcat'] : -1;
  24: $next = (isset($_REQUEST['next']) && is_numeric($_REQUEST['next']) && $_REQUEST['next'] > 0) ? $_REQUEST['next'] : 0;
  25: 
  26: $dateformat = getEffectiveSetting('dateformat', 'date', 'Y-m-d');
  27: $templateDescription = '';
  28: 
  29: if (!isset($syncfrom)) {
  30:     $syncfrom = -1;
  31: }
  32: 
  33: $syncoptions = $syncfrom;
  34: // CON-1752
  35: // init duplicate counter in session
  36: if (!isset($_SESSION['count_duplicate'])) {
  37:     $_SESSION['count_duplicate'] = 0;
  38: }
  39: 
  40: // New Article Selected: Unset Selected Article Id
  41: global $selectedArticleId;
  42: $selectedArticleId = NULL;
  43: 
  44: if ($action == 'con_duplicate' && ($perm->have_perm_area_action("con", "con_duplicate") || $perm->have_perm_area_action_item("con", "con_duplicate", $idcat))) {
  45: 
  46:     $count = (int) $_SESSION['count_duplicate'];
  47: 
  48:     // check if duplicate action was called from click or from back button
  49:     if ($_GET['count_duplicate'] < $count) {
  50:     } else {
  51:         // perfom action only when duplicate action is called from link
  52:         $newidartlang = conCopyArticle($duplicate, $idcat);
  53:         $count++;
  54:         $_SESSION['count_duplicate'] = $count;
  55:     }
  56: }
  57: 
  58: if ($action == 'con_syncarticle' && ($perm->have_perm_area_action("con", "con_syncarticle") || $perm->have_perm_area_action_item("con", "con_syncarticle", $idcat))) {
  59:     if ($_POST['idarts']) {
  60:         $idarts = json_decode($_POST['idarts'], true);
  61:     } else {
  62:         $idarts = array(
  63:             $idart
  64:         );
  65:     }
  66: 
  67:     // Verify that the category is available in this language
  68:     $catLang = new cApiCategoryLanguage();
  69:     foreach ($idarts as $idart) {
  70:         if (!$catLang->loadByCategoryIdAndLanguageId($idcat, $lang)) {
  71:             strSyncCategory($idcat, $sourcelanguage, $lang);
  72:         }
  73:         conSyncArticle($idart, $sourcelanguage, $lang);
  74:     }
  75: }
  76: 
  77: // Which columns to display?
  78: $listColumns = array(
  79:     "mark" => i18n("Mark"),
  80:     "start" => i18n("Article"),
  81:     "title" => i18n("Title"),
  82:     "changeddate" => i18n("Changed"),
  83:     "publisheddate" => i18n("Published"),
  84:     "sortorder" => i18n("Sort order"),
  85:     "template" => i18n("Template"),
  86:     "actions" => i18n("Actions")
  87: );
  88: 
  89: // Which actions to display?
  90: $actionList = array(
  91:     "online",
  92:     "duplicate",
  93:     "locked",
  94:     "todo",
  95:     "delete",
  96:     "usetime"
  97: );
  98: 
  99: // Call chains to process the columns and the action list
 100: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.Columns");
 101: if ($_cecIterator->count() > 0) {
 102:     while ($chainEntry = $_cecIterator->next()) {
 103:         $newColumnList = $chainEntry->execute($listColumns);
 104:         if (is_array($newColumnList)) {
 105:             $listColumns = $newColumnList;
 106:         }
 107:     }
 108: }
 109: 
 110: $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.Actions");
 111: if ($_cecIterator->count() > 0) {
 112:     while ($chainEntry = $_cecIterator->next()) {
 113:         $newActionList = $chainEntry->execute($actionList);
 114:         if (is_array($newActionList)) {
 115:             $actionList = $newActionList;
 116:         }
 117:     }
 118: }
 119: 
 120: $cat_idtpl = 0;
 121: 
 122: if (is_numeric($idcat) && ($idcat >= 0)) {
 123:     // Saving sort and elements per page user settings (if specified)
 124:     // Should be changed to User->setProperty... someday
 125:     if (isset($sortby)) {
 126:         $currentuser->setUserProperty("system", "sortorder-idlang-$lang-idcat-$idcat", $sortby);
 127:     }
 128:     if (isset($sortmode)) {
 129:         $currentuser->setUserProperty("system", "sortmode-idlang-$lang-idcat-$idcat", $sortmode);
 130:     }
 131: 
 132:     if (isset($elemperpage) && is_numeric($elemperpage)) {
 133:         $currentuser->setUserProperty("system", "elemperpage-idlang-$lang-idcat-$idcat", $elemperpage);
 134:     } else {
 135:         $elemperpage = $currentuser->getUserProperty("system", "elemperpage-idlang-$lang-idcat-$idcat");
 136:         if (!is_numeric($elemperpage)) {
 137:             $elemperpage = 10;
 138:         }
 139:     }
 140: 
 141:     $col = new cApiInUseCollection();
 142: 
 143:     if ((($idcat == 0 || $perm->have_perm_area_action('con')) && $perm->have_perm_item('str', $idcat)) || $perm->have_perm_area_action('con', 'con_makestart') || $perm->have_perm_area_action('con', 'con_makeonline') || $perm->have_perm_area_action('con', 'con_deleteart') || $perm->have_perm_area_action('con', 'con_tplcfg_edit') || $perm->have_perm_area_action('con', 'con_lock') || $perm->have_perm_area_action('con', 'con_makecatonline') || $perm->have_perm_area_action('con', 'con_changetemplate') || $perm->have_perm_area_action('con_editcontent', 'con_editart') || $perm->have_perm_area_action('con_editart', 'con_edit') || $perm->have_perm_area_action('con_editart', 'con_newart') || $perm->have_perm_area_action('con_editart', 'con_saveart') || $perm->have_perm_area_action('con_tplcfg', 'con_tplcfg_edit') || $perm->have_perm_area_action_item('con', 'con_makestart', $idcat) || $perm->have_perm_area_action_item('con', 'con_makeonline', $idcat) || $perm->have_perm_area_action_item('con', 'con_deleteart', $idcat) || $perm->have_perm_area_action_item('con', 'con_tplcfg_edit', $idcat) || $perm->have_perm_area_action_item('con', 'con_lock', $idcat) || $perm->have_perm_area_action_item('con', 'con_makecatonline', $idcat) || $perm->have_perm_area_action_item('con', 'con_changetemplate', $idcat) || $perm->have_perm_area_action_item('con_editcontent', 'con_editart', $idcat) || $perm->have_perm_area_action_item('con_editart', 'con_edit', $idcat) || $perm->have_perm_area_action_item('con_editart', 'con_newart', $idcat) || $perm->have_perm_area_action_item('con_tplcfg', 'con_tplcfg_edit', $idcat) || $perm->have_perm_area_action_item('con_editart', 'con_saveart', $idcat)) {
 144: 
 145:         $sortby = $currentuser->getUserProperty("system", "sortorder-idlang-$lang-idcat-$idcat");
 146:         $sortmode = $currentuser->getUserProperty("system", "sortmode-idlang-$lang-idcat-$idcat");
 147: 
 148:         $sql = "SELECT
 149:                     a.idart AS idart,
 150:                     a.idlang AS idlang,
 151:                     a.idartlang AS idartlang,
 152:                     a.title AS title,
 153:                     c.idcat AS idcat,
 154:                     {ISSTART}
 155:                     c.idcatart AS idcatart,
 156:                     a.idtplcfg AS idtplcfg,
 157:                     a.published AS published,
 158:                     a.online AS online,
 159:                     a.created AS created,
 160:                     a.lastmodified AS lastmodified,
 161:                     a.timemgmt AS timemgmt,
 162:                     a.datestart AS datestart,
 163:                     a.dateend AS dateend,
 164:                     a.artsort AS artsort,
 165:                     a.redirect AS redirect,
 166:                     a.locked AS locked
 167:                  FROM
 168:                     " . $cfg["tab"]["art_lang"] . " AS a,
 169:                     " . $cfg["tab"]["art"] . " AS b,
 170:                     " . $cfg["tab"]["cat_art"] . " AS c
 171:                  WHERE
 172:                     (a.idlang   = " . $lang . " {SYNCOPTIONS}) AND
 173:                     a.idart     = b.idart AND
 174:                     b.idclient  = " . $client . " AND
 175:                     b.idart     = c.idart AND
 176:                     c.idcat     = " . $idcat;
 177: 
 178:         // Simple SQL statement to get the number of articles
 179:         $sql_count = "SELECT
 180:                     COUNT(*) AS article_count
 181:                  FROM
 182:                     " . $cfg["tab"]["art_lang"] . " AS a,
 183:                     " . $cfg["tab"]["art"] . " AS b,
 184:                     " . $cfg["tab"]["cat_art"] . " AS c
 185:                  WHERE
 186:                     (a.idlang   = " . cSecurity::toInteger($lang) . " {SYNCOPTIONS}) AND
 187:                     a.idart     = b.idart AND
 188:                     b.idclient  = " . cSecurity::toInteger($client) . " AND
 189:                     b.idart     = c.idart AND
 190:                     c.idcat     = " . cSecurity::toInteger($idcat);
 191: 
 192:         $sql = str_replace("{ISSTART}", '', $sql);
 193: 
 194:         if ($syncoptions == -1) {
 195:             $sql = str_replace("{SYNCOPTIONS}", '', $sql);
 196:             $sql_count = str_replace("{SYNCOPTIONS}", '', $sql_count);
 197:         } else {
 198:             $sql = str_replace("{SYNCOPTIONS}", "OR a.idlang = '" . $syncoptions . "'", $sql);
 199:             $sql_count = str_replace("{SYNCOPTIONS}", "OR a.idlang = '" . $syncoptions . "'", $sql_count);
 200:         }
 201: 
 202:         // Article sort
 203:         if ($sortmode !== 'asc' && $sortmode !== 'desc') {
 204:             $sortmode = 'asc';
 205:         }
 206:         switch ($sortby) {
 207:             case 2:
 208:                 $sql .= ' ORDER BY a.lastmodified ' . strtoupper($sortmode);
 209:                 break;
 210:             case 3:
 211:                 $sql .= ' ORDER BY a.published ' . strtoupper($sortmode) . ', a.lastmodified ' . strtoupper($sortmode);
 212:                 break;
 213:             case 4:
 214:                 $sql .= ' ORDER BY a.artsort ' . strtoupper($sortmode);
 215:                 break;
 216:             default:
 217:                 // Default sort order
 218:                 $sql .= ' ORDER BY a.title ' . strtoupper($sortmode);
 219:                 $sortby = 1;
 220:         }
 221: 
 222:         // Getting article count, if necessary
 223:         if ($elemperpage > 0) {
 224:             $db->query($sql_count);
 225:             $db->nextRecord();
 226:             $iArticleCount = $db->f("article_count");
 227: 
 228:             // If not beyond scope, limit
 229:             if ($iArticleCount == 0) {
 230:                 $next = 0;
 231:             } elseif ($next >= $iArticleCount) {
 232:                 $next = (ceil($iArticleCount / $elemperpage) - 1) * $elemperpage;
 233:             }
 234:             $sql .= " LIMIT $next, $elemperpage";
 235:         } else {
 236:             $iArticleCount = 0; // Will be used to "hide" the browsing area
 237:         }
 238: 
 239:         // Getting data
 240:         $db->query($sql);
 241: 
 242:         // Reset Template
 243:         $tpl->reset();
 244: 
 245:         // No article
 246:         $no_article = true;
 247: 
 248:         $aArticles = array();
 249: 
 250:         while ($db->nextRecord()) {
 251:             $sItem = "k" . $db->f("idart");
 252: 
 253:             if ($db->f("idlang") == $lang || !array_key_exists($sItem, $aArticles)) {
 254:                 $aArticles[$sItem]["idart"] = $db->f("idart");
 255:                 $aArticles[$sItem]["idlang"] = $db->f("idlang");
 256:                 $aArticles[$sItem]["idartlang"] = $db->f("idartlang");
 257:                 $aArticles[$sItem]["title"] = cSecurity::unFilter($db->f("title"));
 258:                 $aArticles[$sItem]["is_start"] = isStartArticle($db->f("idartlang"), $idcat, $lang);
 259:                 $aArticles[$sItem]["idcatart"] = $db->f("idcatart");
 260:                 $aArticles[$sItem]["idtplcfg"] = $db->f("idtplcfg");
 261:                 $aArticles[$sItem]["published"] = $db->f("published");
 262:                 $aArticles[$sItem]["online"] = $db->f("online");
 263:                 $aArticles[$sItem]["created"] = $db->f("created");
 264:                 $aArticles[$sItem]["idcat"] = $db->f("idcat");
 265:                 $aArticles[$sItem]["lastmodified"] = $db->f("lastmodified");
 266:                 $aArticles[$sItem]["timemgmt"] = $db->f("timemgmt");
 267:                 $aArticles[$sItem]["datestart"] = $db->f("datestart");
 268:                 $aArticles[$sItem]["dateend"] = $db->f("dateend");
 269:                 $aArticles[$sItem]["artsort"] = $db->f("artsort");
 270:                 $aArticles[$sItem]["locked"] = $db->f("locked");
 271:                 $aArticles[$sItem]["redirect"] = $db->f("redirect");
 272:             }
 273:         }
 274: 
 275:         $artlist = array();
 276:         $colitem = array();
 277:         $articlesOnline = 0;
 278:         $articlesOffline = 0;
 279:         $articlesLocked = 0;
 280:         $articlesUnlocked = 0;
 281:         $articlesToSync = 0;
 282:         $articlesToRemove = 0;
 283:         $articlesToEdit = 0;
 284: 
 285:         foreach ($aArticles as $sart) {
 286:             $idart = $sart["idart"];
 287:             $idlang = $sart["idlang"];
 288: 
 289:             $idtplcfg = $sart["idtplcfg"];
 290:             $idartlang = $sart["idartlang"];
 291:             $lidcat = $sart["idcat"];
 292:             $idcatlang = 0;
 293:             $idart = $sart["idart"];
 294:             $published = $sart["published"];
 295:             $online = $sart["online"];
 296: 
 297:             $is_start = $sart["is_start"];
 298: 
 299:             $idcatart = $sart["idcatart"];
 300:             $created = $sart["created"];
 301:             $modified = $sart["lastmodified"];
 302: 
 303:             if ($modified === '0000-00-00 00:00:00') {
 304:                 $modified = i18n("not modified yet");
 305:             } else {
 306:                 $modified = date($dateformat, strtotime($modified));
 307:             }
 308:             $title = conHtmlSpecialChars($sart["title"]);
 309:             $timemgmt = $sart["timemgmt"];
 310:             $datestart = $sart["datestart"];
 311:             $dateend = $sart["dateend"];
 312:             $sortkey = $sart["artsort"];
 313:             $locked = $sart["locked"];
 314:             $redirect = $sart["redirect"];
 315: 
 316:             $published = ($published != '0000-00-00 00:00:00') ? date($dateformat, strtotime($published)) : i18n("not yet published");
 317:             $created = date($dateformat, strtotime($created));
 318:             $alttitle = "idart" . '&#58; ' . $idart . ' ' . "idcatart" . '&#58; ' . $idcatart . ' ' . "idartlang" . '&#58; ' . $idartlang;
 319: 
 320:             $articlesToEdit++;
 321: 
 322:             if ($idlang != $lang) {
 323:                 $articlesToSync++;
 324:             } else {
 325:                 if ($online == 1) {
 326:                     $articlesOnline++;
 327:                 } else {
 328:                     $articlesOffline++;
 329:                 }
 330:                 if ($locked == 1) {
 331:                     $articlesLocked++;
 332:                 } else {
 333:                     $articlesUnlocked++;
 334:                 }
 335:                 $articlesToRemove++;
 336:             }
 337: 
 338:             if ((($obj = $col->checkMark("article", $idartlang)) === false) || $obj->get("userid") == $auth->auth['uid']) {
 339:                 $inUse = false;
 340:             } else {
 341:                 $vuser = new cApiUser($obj->get("userid"));
 342:                 $inUseUser = $vuser->getField("username");
 343:                 $inUseUserRealName = $vuser->getField("realname");
 344: 
 345:                 $inUse = true;
 346:                 $title = $title . " (" . i18n("Article is in use") . ")";
 347:                 $alttitle = sprintf(i18n("Article in use by %s (%s)"), $inUseUser, $inUseUserRealName) . " " . $alttitle;
 348:             }
 349: 
 350:             // Id of the row, stores informations about the article and category
 351:             $tmp_rowid = $idart . "-" . $idartlang . "-" . $lidcat . "-" . $idcatlang . "-" . $idcatart . "-" . $idlang;
 352:             $tpl->set('d', 'ROWID', $tmp_rowid);
 353: 
 354:             if ($idlang != $lang) {
 355:                 $colitem[$tmp_rowid] = 'con_sync';
 356:             }
 357: 
 358:             // Article Title
 359:             if ($perm->have_perm_area_action('con_editcontent', 'con_editart') || $perm->have_perm_area_action_item('con_editcontent', 'con_editart', $idcat)) {
 360:                 if ($idlang != $lang) {
 361:                     $tmp_alink = $sess->url("main.php?area=con_editcontent&action=con_editart&changeview=prev&idartlang=$idartlang&idart=$idart&idcat=$idcat&frame=$frame&tmpchangelang=$idlang");
 362:                     $titlelink = '<a href="' . $tmp_alink . '" title="' . $alttitle . '">' . $title . '</a>';
 363:                 } else {
 364:                     $tmp_alink = $sess->url("main.php?area=con_editcontent&action=con_editart&changeview=edit&idartlang=$idartlang&idart=$idart&idcat=$idcat&frame=$frame");
 365:                     $titlelink = '<a href="' . $tmp_alink . '" title="' . $alttitle . '">' . $title . '</a>';
 366:                 }
 367:             } else {
 368:                 $tmp_alink = '';
 369:                 $titlelink = $title;
 370:             }
 371: 
 372:             if ($timemgmt == "1") {
 373:                 $sql = "SELECT NOW() AS TIME";
 374: 
 375:                 $db3 = cRegistry::getDb();
 376: 
 377:                 $db3->query($sql);
 378:                 $db3->nextRecord();
 379: 
 380:                 $starttimestamp = strtotime($datestart);
 381:                 $endtimestamp = strtotime($dateend);
 382:                 $nowtimestamp = strtotime($db3->f("TIME"));
 383: 
 384:                 if (($nowtimestamp < $endtimestamp) && ($nowtimestamp > $starttimestamp)) {
 385:                     $usetime = '<img class="vAlignMiddle tableElement" src="images/but_time_2.gif" alt="' . i18n("Article with time control online") . '" title="' . i18n("Article with time control online") . '">';
 386:                 } else {
 387:                     $usetime = '<img class="vAlignMiddle tableElement" src="images/but_time_1.gif" alt="' . i18n("Article with time control offline") . '" title="' . i18n("Article with time control offline") . '">';
 388:                 }
 389:             } else {
 390:                 $usetime = '';
 391:             }
 392: 
 393:             // Article Title
 394:             if (($perm->have_perm_area_action('con', 'con_lock') || $perm->have_perm_area_action_item('con', 'con_lock', $idcat)) && $inUse == false) {
 395:                 if ($locked == 1) {
 396:                     $lockimg = 'images/article_locked.gif';
 397:                     $lockalt = i18n("Unfreeze article");
 398:                 } else {
 399:                     $lockimg = 'images/article_unlocked.gif';
 400:                     $lockalt = i18n("Freeze article");
 401:                 }
 402:                 $tmp_lock = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_lock&frame=4&idart=$idart&next=$next") . '" title="' . $lockalt . '"><img class="vAlignMiddle tableElement" src="' . $lockimg . '" title="' . $lockalt . '" alt="' . $lockalt . '" border="0"></a>';
 403:             } else {
 404:                 if ($locked == 1) {
 405:                     $lockimg = 'images/article_locked.gif';
 406:                     $lockalt = i18n("Article is frozen");
 407:                 } else {
 408:                     $lockimg = 'images/article_unlocked.gif';
 409:                     $lockalt = i18n("Article is not frozen");
 410:                 }
 411:                 $tmp_lock = '<img class="vAlignMiddle tableElement" src="' . $lockimg . '" title="' . $lockalt . '" alt="' . $lockalt . '" border="0">';
 412:             }
 413: 
 414:             if ($idlang != $lang) {
 415:                 $lockedlink = '';
 416:             } else {
 417:                 $lockedlink = $tmp_lock;
 418:             }
 419: 
 420:             if ($sortkey == '') {
 421:                 $sortkey = '&nbsp;';
 422:             }
 423: 
 424:             $tmp_articletitle = $titlelink;
 425: 
 426:             // Article conf button
 427:             if ($perm->have_perm_area_action('con_editart', 'con_edit') || $perm->have_perm_area_action_item('con_editart', 'con_edit', $idcat)) {
 428:                 $tmp_artconf = '<a href="' . $sess->url("main.php?area=con_editart&action=con_edit&frame=4&idart=$idart&idcat=$idcat") . '" title="' . i18n("Article properties") . '"><img class="vAlignMiddle tableElement" src="' . $cfg["path"]["images"] . 'but_art_conf2.gif" alt="' . i18n("Article properties") . '" title="' . i18n("Article properties") . '" border="0"></a>';
 429:             } else {
 430:                 $tmp_artconf = '';
 431:             }
 432: 
 433:             $tmp_sync = '';
 434:             if ($idlang != $lang) {
 435:                 $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat='" . cSecurity::toInteger($idcat) . "' AND idlang='" . cSecurity::toInteger($lang) . "'";
 436:                 $db->query($sql);
 437: 
 438:                 if ($db->nextRecord()) {
 439:                     $tmp_sync = '<a href="' . $sess->url("main.php?area=con&action=con_syncarticle&idart=$idart&sourcelanguage=$idlang&frame=4&idcat=$idcat&next=$next") . '" title="' . i18n("Copy article to the current language") . '"><img class="vAlignMiddle tableElement" src="' . $cfg["path"]["images"] . 'but_sync_art.gif" alt="' . i18n("Copy article to the current language") . '" title="' . i18n("Copy article to the current language") . '" border="0"></a>';
 440:                 } else {
 441:                     $tmp_sync = '';
 442:                     $articlesToSync--;
 443:                     $articlesToRemove--;
 444:                 }
 445:             }
 446: 
 447:             // Article Template
 448:             if (!is_object($db2)) {
 449:                 $db2 = cRegistry::getDb();
 450:             }
 451: 
 452:             $sql2 = "SELECT
 453:                         b.name AS tplname,
 454:                         b.idtpl AS idtpl,
 455:                         b.description AS description
 456:                      FROM
 457:                         " . $cfg["tab"]["tpl_conf"] . " AS a,
 458:                         " . $cfg["tab"]["tpl"] . " AS b
 459:                      WHERE
 460:                         a.idtplcfg = " . cSecurity::toInteger($idtplcfg) . " AND
 461:                         a.idtpl = b.idtpl";
 462: 
 463:             $db2->query($sql2);
 464:             $db2->nextRecord();
 465: 
 466:             $a_tplname = $db2->f("tplname");
 467:             $a_idtpl = $db2->f("idtpl");
 468:             $templateDescription = $db2->f("description");
 469: 
 470:             // Uses Category Template
 471:             if (0 == $idtplcfg) {
 472:                 $sql2 = "SELECT
 473:                     c.idtpl AS idtpl,
 474:                     c.name AS name,
 475:                     c.description,
 476:                     b.idtplcfg AS idtplcfg
 477:                 FROM
 478:                     " . $cfg['tab']['tpl_conf'] . " AS a,
 479:                     " . $cfg['tab']['cat_lang'] . " AS b,
 480:                     " . $cfg['tab']['tpl'] . " AS c
 481:                 WHERE
 482:                     b.idcat     = " . cSecurity::toInteger($idcat) . " AND
 483:                     b.idlang    = " . cSecurity::toInteger($lang) . " AND
 484:                     b.idtplcfg  = a.idtplcfg AND
 485:                     c.idtpl     = a.idtpl AND
 486:                     c.idclient  = " . cSecurity::toInteger($client);
 487:                 $db2->query($sql2);
 488:                 $db2->nextRecord();
 489:                 $a_tplname = $db2->f("name") ? '<i>' . $db2->f("name") . '</i>' : "--- " . i18n("None") . " ---";
 490:             }
 491: 
 492:             // CON-2137 check admin permission
 493:             $aAuthPerms = explode(',', $auth->auth['perm']);
 494: 
 495:             $admin = false;
 496:             if (count(preg_grep("/admin.*/", $aAuthPerms)) > 0) {
 497:                 $admin = true;
 498:             }
 499: 
 500:             // Make Startarticle button
 501:             $imgsrc = "isstart";
 502: 
 503:             if ($is_start == false) {
 504:                 $imgsrc .= '0';
 505:             } else {
 506:                 $imgsrc .= '1';
 507:             }
 508:             if (isArtInMultipleUse($idart)) {
 509:                 $imgsrc .= 'm';
 510:             }
 511:             if ((int) $redirect == 1) {
 512:                 $imgsrc .= 'r';
 513:             }
 514: 
 515:             $imgsrc .= '.gif';
 516: 
 517:             if ($idlang == $lang && ($perm->have_perm_area_action('con', 'con_makestart') || $perm->have_perm_area_action_item('con', 'con_makestart', $idcat)) && $idcat != 0 && ((int) $locked === 0 || $admin)) {
 518:                 if ($is_start == false) {
 519:                     $tmp_link = '<a href="' . $sess->url("main.php?area=con&amp;idcat=$idcat&amp;action=con_makestart&amp;idcatart=$idcatart&amp;frame=4&is_start=1&amp;next=$next") . '" title="' . i18n("Flag as start article") . '"><img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . i18n("Flag as start article") . '" alt="' . i18n("Flag as start article") . '"></a>';
 520:                 } else {
 521:                     $tmp_link = '<a href="' . $sess->url("main.php?area=con&amp;idcat=$idcat&amp;action=con_makestart&amp;idcatart=$idcatart&amp;frame=4&amp;is_start=0&amp;next=$next") . '" title="' . i18n("Flag as normal article") . '"><img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . i18n("Flag as normal article") . '" alt="' . i18n("Flag as normal article") . '"></a>';
 522:                 }
 523:             } else {
 524:                 if ($is_start == true) {
 525:                     $sTitle = i18n("Start article");
 526:                 } else {
 527:                     $sTitle = i18n("Normal article");
 528:                 }
 529: 
 530:                 $tmp_img = '<img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . $sTitle . '" alt="' . $sTitle . '">';
 531: 
 532:                 $tmp_link = $tmp_img;
 533:             }
 534: 
 535:             $tmp_start = $tmp_link;
 536: 
 537:             // Make copy button
 538:             if (($perm->have_perm_area_action('con', 'con_duplicate') || $perm->have_perm_area_action_item('con', 'con_duplicate', $idcat)) && $idcat != 0 && ((int) $locked === 0 || $admin )) {
 539:                 $imgsrc = "but_copy.gif";
 540:                 // add count_duplicate param to identify if the duplicate action
 541:                 // is called from click or back button.
 542:                 $tmp_link = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_duplicate&duplicate=$idart&frame=4&next=$next") . "&count_duplicate=" . $_SESSION['count_duplicate'] . '" title="' . i18n("Duplicate article") . '"><img class="vAlignMiddle tableElement" src="images/' . $imgsrc . '" border="0" title="' . i18n("Duplicate article") . '" alt="' . i18n("Duplicate article") . '"></a>';
 543:             } else {
 544:                 $tmp_link = '';
 545:             }
 546: 
 547:             if ($idlang != $lang) {
 548:                 $duplicatelink = '';
 549:             } else {
 550:                 $duplicatelink = $tmp_link;
 551:             }
 552: 
 553:             // Make todo link
 554:             $todolink = '';
 555: 
 556:             $subject = urlencode(sprintf(i18n("Reminder for article '%s'"), $title));
 557:             $mycatname = '';
 558:             conCreateLocationString($idcat, "&nbsp;/&nbsp;", $mycatname);
 559:             $message = urlencode(sprintf(i18n("Reminder for article '%s'\nCategory: %s"), $title, $mycatname));
 560: 
 561:             $todolink = new TODOLink("idart", $idart, $subject, $message);
 562: 
 563:             // Make On-/Offline button
 564:             if ($online) {
 565:                 if (($perm->have_perm_area_action('con', 'con_makeonline') || $perm->have_perm_area_action_item('con', 'con_makeonline', $idcat)) && ($idcat != 0) && ((int) $locked === 0 || $admin)) {
 566:                     $tmp_online = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_makeonline&frame=4&idart=$idart&next=$next") . '" title="' . i18n("Make offline") . '"><img class="vAlignMiddle tableElement" src="images/online.gif" title="' . i18n("Make offline") . '" alt="' . i18n("Make offline") . '" border="0"></a>';
 567:                 } else {
 568:                     $tmp_online = '<img class="vAlignMiddle tableElement" src="images/online.gif" title="' . i18n("Article is online") . '" alt="' . i18n("Article is online") . '" border="0">';
 569:                 }
 570:             } else {
 571:                 if (($perm->have_perm_area_action('con', 'con_makeonline') || $perm->have_perm_area_action_item('con', 'con_makeonline', $idcat)) && ($idcat != 0) && ((int) $locked === 0 || $admin)) {
 572:                     $tmp_online = '<a href="' . $sess->url("main.php?area=con&idcat=$idcat&action=con_makeonline&frame=4&idart=$idart&next=$next") . '" title="' . i18n("Make online") . '"><img class="vAlignMiddle tableElement" src="images/offline.gif" title="' . i18n("Make online") . '" alt="' . i18n("Make online") . '" border="0"></a>';
 573:                 } else {
 574:                     $tmp_online = '<img class="vAlignMiddle tableElement" src="images/offline.gif" title="' . i18n("Article is offline") . '" alt="' . i18n("Article is offline") . '" border="0">';
 575:                 }
 576:             }
 577: 
 578:             if ($idlang != $lang) {
 579:                 $onlinelink = '';
 580:             } else {
 581:                 $onlinelink = $tmp_online;
 582:             }
 583: 
 584:             // Delete button
 585:             if (($perm->have_perm_area_action('con', 'con_deleteart') || $perm->have_perm_area_action_item('con', 'con_deleteart', $idcat)) && $inUse == false && ((int) $locked === 0  || $admin)) {
 586:                 $tmp_title = $title;
 587:                 if (strlen($tmp_title) > 30) {
 588:                     $tmp_title = substr($tmp_title, 0, 27) . "...";
 589:                 }
 590: 
 591:                 $confirmString = sprintf(i18n("Are you sure to delete the following article:<br><br><b>%s</b>"), conHtmlSpecialChars($tmp_title));
 592:                 $tmp_del = '<a href="javascript:void(0)" onclick="Con.showConfirmation(&quot;' . $confirmString . '&quot;, function() { deleteArticle(' . $idart . ', ' . $idcat . ', ' . $next . '); });return false;" title="' . i18n("Delete article") . '"><img class="vAlignMiddle tableElement" src="images/delete.gif" title="' . i18n("Delete article") . '" alt="' . i18n("Delete article") . '"></a>';
 593:             } else {
 594:                 $tmp_del = '';
 595:             }
 596: 
 597:             if ($idlang != $lang) {
 598:                 $deletelink = '';
 599:             } else {
 600:                 $deletelink = $tmp_del;
 601:             }
 602: 
 603:             // DIRECTION
 604:             cInclude('includes', 'functions.lang.php');
 605:             $tpl->set('d', 'DIRECTION', 'dir="' . langGetTextDirection($lang) . '"');
 606: 
 607:             // Next iteration
 608:             // Articles found
 609:             $no_article = false;
 610:             $oArtLang = new cApiArticleLanguage();
 611:             foreach ($listColumns as $listColumn => $ctitle) {
 612:                 $oArtLang->loadBy($oArtLang->getPrimaryKeyName(), $idartlang);
 613: 
 614:                 switch ($listColumn) {
 615:                     case "mark":
 616:                         $value = '<input type="checkbox" name="mark" value="' . $idart . '" class="mark_articles">';
 617:                         break;
 618:                     case "start":
 619:                         $value = $tmp_start . $usetime;
 620:                         break;
 621:                     case "title":
 622:                         $value = $tmp_articletitle;
 623:                         break;
 624:                     case "changeddate":
 625:                         $value = $modified;
 626:                         break;
 627:                     case "publisheddate":
 628:                         if ('1' === $oArtLang->get('online')) {
 629:                             $value = $published;
 630:                         } else {
 631:                             $value = i18n("not yet published");
 632:                         }
 633:                         break;
 634:                     case "sortorder":
 635:                         $value = $sortkey;
 636:                         break;
 637:                     case "template":
 638:                         $value = $a_tplname;
 639:                         break;
 640:                     case "actions":
 641:                         $actions = array();
 642:                         foreach ($actionList as $actionItem) {
 643:                             switch ($actionItem) {
 644:                                 case "todo":
 645:                                     $actionValue = $todolink;
 646:                                     break;
 647:                                 case "artconf":
 648:                                     $actionValue = $tmp_artconf;
 649:                                     break;
 650:                                 case "online":
 651:                                     $actionValue = $onlinelink;
 652:                                     break;
 653:                                 case "locked":
 654:                                     $actionValue = $lockedlink;
 655:                                     break;
 656:                                 case "duplicate":
 657:                                     $actionValue = $duplicatelink;
 658:                                     break;
 659:                                 case "delete":
 660:                                     $actionValue = $deletelink;
 661:                                     break;
 662:                                 case "usetime":
 663:                                     $actionValue = '';
 664:                                     break;
 665:                                 default:
 666:                                     // Ask chain about the entry
 667:                                     $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.RenderAction");
 668:                                     $contents = array();
 669:                                     if ($_cecIterator->count() > 0) {
 670:                                         while ($chainEntry = $_cecIterator->next()) {
 671:                                             $contents[] = $chainEntry->execute($idcat, $idart, $idartlang, $actionItem);
 672:                                         }
 673:                                     }
 674:                                     $actionValue = implode('', $contents);
 675:                                     break;
 676:                             }
 677: 
 678:                             $actions[] = $actionValue;
 679:                         }
 680: 
 681:                         if ($tmp_sync != '') {
 682:                             $actions[] = $tmp_sync;
 683:                         }
 684: 
 685:                         // add properties button
 686:                         if ($tmp_sync != '') {
 687:                             $actions[] = '<a id="properties" href="main.php?area=con_editart&action=con_edit&frame=4&idcat=' . $idcat . '&idart=' . $idart . '&contenido=' . $contenido . '">
 688:                                 <img class="vAlignMiddle tableElement" onmouseover="this.style.cursor=\'pointer\'" src="images/but_art_conf2.gif" title="' . i18n("Display properties") . '" alt="' . i18n("Display properties") . '" style="cursor: pointer;">
 689:                             </a>';
 690:                         }
 691: 
 692:                         $value = implode("\n", $actions);
 693:                         break;
 694:                     default:
 695:                         $contents = array();
 696:                         // Call chain to retrieve value
 697:                         $_cecIterator = $_cecRegistry->getIterator("Contenido.ArticleList.RenderColumn");
 698:                         if ($_cecIterator->count() > 0) {
 699:                             $contents = array();
 700:                             while ($chainEntry = $_cecIterator->next()) {
 701:                                 $contents[] = $chainEntry->execute($idcat, $idart, $idartlang, $listColumn);
 702:                             }
 703:                         }
 704:                         $value = implode('', $contents);
 705:                 }
 706:                 $artlist[$tmp_rowid][$listColumn] = $value;
 707:                 $artlist[$tmp_rowid]['templateDescription'] = $templateDescription;
 708:             }
 709:             unset($oArtLang);
 710:         }
 711: 
 712:         $headers = array();
 713: 
 714:         // keep old keys so that saved user properties still work
 715:         $sortColumns = array(
 716:             'title' => 1,
 717:             'changeddate' => 2,
 718:             'publisheddate' => 3,
 719:             'sortorder' => 4
 720:         );
 721:         foreach ($listColumns as $key => $listColumn) {
 722:             // Dirty hack to force column widths
 723:             $width = ($key == 'title' || $listColumn == i18n('Title')) ? '100%' : '1%';
 724:             // if it should be possible to sort by this column, add a link
 725:             if (in_array($key, array_keys($sortColumns))) {
 726:                 $newSortmode = 'asc';
 727:                 // revert the sorting if it already has been sorted by this
 728:                 // column
 729:                 if ($sortby == $sortColumns[$key] && $sortmode == 'asc') {
 730:                     $newSortmode = 'desc';
 731:                 }
 732:                 // add the appropriate sorting image if necessary
 733:                 if ($sortby == $sortColumns[$key]) {
 734:                     $imageSrc = ($sortmode == 'asc') ? 'images/sort_up.gif' : 'images/sort_down.gif';
 735:                     $sortImage = '<img src="' . $imageSrc . '">';
 736:                 } else {
 737:                     $sortImage = '';
 738:                 }
 739:                 $sortLink = $sess->url("main.php?area=con&frame=4&idcat=$idcat&sortby=$sortColumns[$key]&sortmode=$newSortmode");
 740:                 $col = '<a href="' . $sortLink . '" class="gray">' . $listColumn . $sortImage . '</a>';
 741:             } else {
 742:                 $col = $listColumn;
 743:             }
 744:             $headers[] = '<th width="' . $width . '" nowrap="nowrap">' . $col . '</th>';
 745:         }
 746: 
 747:         $tpl->set('s', 'HEADERS', implode("\n", $headers));
 748: 
 749:         if ($elemperpage > 0 && $iArticleCount > 0 && $iArticleCount > $elemperpage) {
 750:             for ($i = 1; $i <= ceil($iArticleCount / $elemperpage); $i++) {
 751:                 $iNext = ($i - 1) * $elemperpage;
 752:                 if ($sBrowseLinks !== '') {
 753:                     $sBrowseLinks .= '&nbsp;';
 754:                 }
 755:                 if ($next == $iNext) {
 756:                     $sBrowseLinks .= $i . "\n"; // I'm on the current page, no
 757:                                                     // link
 758:                 } else {
 759:                     $tmp_alink = $sess->url("main.php?area=con&frame=$frame&idcat=$idcat&next=$iNext");
 760:                     $sBrowseLinks .= '<a href="' . $tmp_alink . '">' . $i . '</a>' . "\n";
 761:                 }
 762:             }
 763:             $tpl->set('s', 'NEXT', $next);
 764:             $tpl->set('s', 'BROWSE', sprintf(i18n("Go to page: %s"), $sBrowseLinks));
 765:         } else {
 766:             $tpl->set('s', 'NEXT', "0");
 767:             $tpl->set('s', 'BROWSE', '&nbsp;');
 768:         }
 769:         $tpl->set('s', 'CLICK_ROW_NOTIFICATION', i18n("Click on a row to select an article for editing"));
 770: 
 771:         // construct the bulk editing functions
 772:         $bulkEditingFunctions = '';
 773:         if ($articlesOffline > 0 && ($perm->have_perm_area_action("con", "con_makeonline") || $perm->have_perm_area_action_item("con", "con_makeonline", $idcat))) {
 774:             $bulkEditingFunctions .= createBulkEditingFunction('con_makeonline', 'images/online.gif', i18n('Set articles online'));
 775:         }
 776:         if ($articlesOnline > 0 && ($perm->have_perm_area_action("con", "con_makeonline") || $perm->have_perm_area_action_item("con", "con_makeonline", $idcat))) {
 777:             $bulkEditingFunctions .= createBulkEditingFunction('con_makeonline invert', 'images/offline.gif', i18n('Set articles offline'));
 778:         }
 779:         if ($articlesUnlocked > 0 && ($perm->have_perm_area_action("con", "con_lock") || $perm->have_perm_area_action_item("con", "con_lock", $idcat))) {
 780:             $bulkEditingFunctions .= createBulkEditingFunction('con_lock', 'images/article_unlocked.gif', i18n('Freeze articles'));
 781:         }
 782:         if ($articlesLocked > 0 && ($perm->have_perm_area_action("con", "con_lock") || $perm->have_perm_area_action_item("con", "con_lock", $idcat))) {
 783:             $bulkEditingFunctions .= createBulkEditingFunction('con_lock invert', 'images/article_locked.gif', i18n('Unfreeze articles'));
 784:         }
 785:         if ($articlesToSync > 0 && ($perm->have_perm_area_action("con", "con_syncarticle") || $perm->have_perm_area_action_item("con", "con_syncarticle", $idcat))) {
 786:             $bulkEditingFunctions .= createBulkEditingFunction('con_syncarticle', 'images/but_sync_art.gif', i18n('Copy article to the current language'));
 787:         }
 788:         if ($articlesToRemove > 0 && ($perm->have_perm_area_action("con", "con_deleteart") || $perm->have_perm_area_action_item("con", "con_deleteart", $idcat))) {
 789:             $bulkEditingFunctions .= createBulkEditingFunction('con_deleteart', 'images/delete.gif', i18n('Delete articles'), 'Con.showConfirmation("' . i18n('Are you sure to delete the selected articles') . '", deleteArticles)');
 790:         }
 791:         if ($articlesToEdit > 0 && ($perm->have_perm_area_action("con", "con_editart") || $perm->have_perm_area_action_item("con", "con_editart", $idcat))) {
 792:             $bulkEditingFunctions .= createBulkEditingFunction('con_inlineeditart', 'images/editieren.gif', i18n('Edit articles'));
 793:         }
 794: 
 795:         if ($bulkEditingFunctions == "") {
 796:             $bulkEditingFunctions = i18n("Your permissions do not allow any actions here");
 797:         }
 798: 
 799:         $tpl->set('s', 'BULK_EDITING_FUNCTIONS', $bulkEditingFunctions);
 800:         $tpl->set('s', 'SAVE_ARTICLES', i18n('Save articles'));
 801: 
 802:         if (count($artlist) > 0) {
 803:             foreach ($artlist as $key2 => $artitem) {
 804: 
 805:                 $cells = array();
 806: 
 807:                 foreach ($listColumns as $key => $listColumn) {
 808:                     // Description for hover effect
 809:                     if ($key == 'template') {
 810:                         $templateDescription = $artitem['templateDescription'];
 811:                         $descString = '<b>' . $artitem[$key] . '</b>';
 812: 
 813:                         $sTemplatename = cString::trimHard($artitem[$key], 20);
 814:                         if (strlen($artitem[$key]) > 20) {
 815:                             $cells[] = '<td nowrap="nowrap" class="bordercell tooltip" title="' . $descString . '">' . $sTemplatename . '</td>';
 816:                         } else {
 817:                             $cells[] = '<td nowrap="nowrap" class="bordercell">' . $artitem[$key] . '</td>';
 818:                         }
 819:                     } else {
 820:                         $cells[] = '<td nowrap="nowrap" class="bordercell">' . $artitem[$key] . '</td>';
 821:                     }
 822:                 }
 823:                 $tpl->set('d', 'CELLS', implode("\n", $cells));
 824: 
 825:                 if ($colitem[$key2] == 'con_sync') {
 826:                     $tpl->set('d', 'CSS_CLASS', 'class="con_sync"');
 827:                 } else {
 828:                     $tpl->set('d', 'CSS_CLASS', '');
 829:                 }
 830: 
 831:                 $tpl->set('d', 'ROWID', $key2);
 832:                 $tpl->next();
 833:             }
 834:         } else {
 835:             $emptyCell = '<td nowrap="nowrap" class="bordercell" colspan="' . count($listColumns) . '">' . i18n("No articles found") . '</td>';
 836:             $tpl->set('d', 'CELLS', $emptyCell);
 837:             $tpl->set('d', 'CSS_CLASS', '');
 838:             $tpl->set('d', 'ROWID', '');
 839:         }
 840: 
 841:         // Elements per Page select
 842:         $aElemPerPage = array(
 843:             0 => i18n("All"),
 844:             10 => "10",
 845:             25 => "25",
 846:             50 => "50",
 847:             75 => "75",
 848:             100 => "100"
 849:         );
 850: 
 851:         $tpl2 = new cTemplate();
 852:         $tpl2->set('s', 'NAME', 'sort');
 853:         $tpl2->set('s', 'CLASS', 'text_medium');
 854:         $tpl2->set('s', 'OPTIONS', 'onchange="changeElemPerPage(this)"');
 855: 
 856:         foreach ($aElemPerPage as $key => $value) {
 857:             $selected = ($elemperpage == $key) ? 'selected="selected"' : '';
 858:             $tpl2->set('d', 'VALUE', $key);
 859:             $tpl2->set('d', 'CAPTION', $value);
 860:             $tpl2->set('d', 'SELECTED', $selected);
 861:             $tpl2->next();
 862:         }
 863: 
 864:         $select = (!$no_article) ? $tpl2->generate($cfg["path"]["templates"] . $cfg['templates']['generic_select'], true) : '&nbsp;';
 865:         $caption = (!$no_article) ? i18n("Items per page:") : '&nbsp;';
 866: 
 867:         $tpl->set('s', 'ELEMPERPAGECAPTION', $caption);
 868:         $tpl->set('s', 'ELEMPERPAGE', $select);
 869: 
 870:         $tpl->set('s', 'IDCAT', $idcat);
 871:         $tpl->set('s', 'SOURCELANGUAGE', $idlang);
 872: 
 873:         // Extract Category and Catcfg
 874:         $sql = "SELECT
 875:                     b.name AS name,
 876:                     d.idtpl AS idtpl
 877:                 FROM
 878:                     (" . $cfg["tab"]["cat"] . " AS a,
 879:                     " . $cfg["tab"]["cat_lang"] . " AS b,
 880:                     " . $cfg["tab"]["tpl_conf"] . " AS c)
 881:                 LEFT JOIN
 882:                     " . $cfg["tab"]["tpl"] . " AS d
 883:                 ON
 884:                     d.idtpl = c.idtpl
 885:                 WHERE
 886:                     a.idclient = " . cSecurity::toInteger($client) . " AND
 887:                     a.idcat    = " . cSecurity::toInteger($idcat) . " AND
 888:                     b.idlang   = " . cSecurity::toInteger($lang) . " AND
 889:                     b.idcat    = a.idcat AND
 890:                     c.idtplcfg = b.idtplcfg";
 891: 
 892:         $db->query($sql);
 893: 
 894:         if ($db->nextRecord()) {
 895:             // $foreignlang = false;
 896:             // conCreateLocationString($idcat, "&nbsp;/&nbsp;", $cat_name);
 897:         }
 898: 
 899:         $cat_idtpl = $db->f("idtpl");
 900: 
 901:         $cat_name = renderBackendBreadcrumb($syncoptions, false, true);
 902: 
 903:         // Hinweis wenn kein Artikel gefunden wurde
 904:         if ($no_article) {
 905:             $tpl->set('d', "START", '&nbsp;');
 906:             $tpl->set('d', "ARTICLE", i18n("No articles found"));
 907:             $tpl->set('d', "PUBLISHED", '&nbsp;');
 908:             $tpl->set('d', "LASTMODIFIED", '&nbsp;');
 909:             $tpl->set('d', "ARTCONF", '&nbsp;');
 910:             $tpl->set('d', "TPLNAME", '&nbsp;');
 911:             $tpl->set('d', "LOCKED", '&nbsp;');
 912:             $tpl->set('d', "DUPLICATE", '&nbsp;');
 913:             $tpl->set('d', "TPLCONF", '&nbsp;');
 914:             $tpl->set('d', "ONLINE", '&nbsp;');
 915:             $tpl->set('d', "DELETE", '&nbsp;');
 916:             $tpl->set('d', "USETIME", '&nbsp;');
 917:             $tpl->set('d', "TODO", '&nbsp;');
 918:             $tpl->set('d', "SORTKEY", '&nbsp;');
 919: 
 920:             $tpl->next();
 921:         }
 922: 
 923:         // Kategorie anzeigen und Konfigurieren button
 924:         /*
 925:          * JL 23.06.03 Check right from "Content" instead of "Category" if
 926:          * ($perm->have_perm_area_action("str_tplcfg", "str_tplcfg") ||
 927:          * $perm->have_perm_area_action_item("str_tplcfg", "str_tplcfg",
 928:          * $lidcat))
 929:          */
 930: 
 931:         if (($perm->have_perm_area_action_item('con', 'con_tplcfg_edit', $idcat) || $perm->have_perm_area_action('con', 'con_tplcfg_edit')) && $foreignlang == false) {
 932:             if (0 != $idcat) {
 933:                 $tpl->set('s', 'CATEGORY', $cat_name);
 934:                 $tpl->set('s', 'CATEGORY_CONF', $tmp_img);
 935:                 $tpl->set('s', 'CATEGORY_LINK', $tmp_link);
 936:             } else {
 937:                 $tpl->set('s', 'CATEGORY', $cat_name);
 938:                 $tpl->set('s', 'CATEGORY_CONF', '&nbsp;');
 939:                 $tpl->set('s', 'CATEGORY_LINK', '&nbsp;');
 940:             }
 941:         } else {
 942:             $tpl->set('s', 'CATEGORY', $cat_name);
 943:             $tpl->set('s', 'CATEGORY_CONF', '&nbsp;');
 944:             $tpl->set('s', 'CATEGORY_LINK', '&nbsp;');
 945:         }
 946: 
 947:         // SELF_URL (Variable f�r das javascript);
 948:         $tpl->set('s', 'SELF_URL', $sess->url("main.php?area=con&frame=4&idcat=$idcat"));
 949: 
 950:         // Categories without start article
 951:         $warningBox = '';
 952:         if (strHasStartArticle($idcat, $lang) === false) {
 953:             $warningBox = $notification->returnNotification('warning', i18n('This category does not have a configured start article.'));
 954:         }
 955: 
 956:         // New Article link
 957:         if (($perm->have_perm_area_action('con_editart', 'con_newart') || $perm->have_perm_area_action_item('con_editart', 'con_newart', $idcat)) && $foreignlang == false) {
 958:             // check if category has an assigned template
 959:             if ($idcat != 0 && $cat_idtpl != 0) {
 960:                 $tpl->set('s', 'NEWARTICLE_TEXT', '<a id="newArtTxt" href="' . $sess->url("main.php?area=con_editart&frame=$frame&action=con_newart&idcat=$idcat") . '">' . i18n("Create new article") . '</a>');
 961:                 $tpl->set('s', 'NEWARTICLE_IMG', '<a id="newArtImg" href="' . $sess->url("main.php?area=con_editart&frame=$frame&action=con_newart&idcat=$idcat") . '" title="' . i18n("Create new article") . '"><img src="images/but_art_new.gif" border="0" alt="' . i18n("Create new article") . '"></a>');
 962:                 $tpl->set('s', 'CATTEMPLATE', $warningBox);
 963:             } else {
 964:                 // category is either not in sync or does not exist
 965:                 // check if category does not exist for current language if syncoptions is turned on to find out if current category is unsynchronized
 966:                 $oArtLang = new cApiArticleLanguage($idcat);
 967:                 if (0 < $syncoptions && false === $oArtLang->isLoaded()) {
 968:                     $notification_text = $notification->returnNotification("error", i18n("Creation of articles is only possible if the category has is synchronized."));
 969:                 } else {
 970:                     $notification_text = $notification->returnNotification("error", i18n("Creation of articles is only possible if the category has a assigned template."));
 971:                 }
 972:                 $tpl->set('s', 'CATTEMPLATE', $notification_text);
 973:                 $tpl->set('s', 'NEWARTICLE_TEXT', '&nbsp;');
 974:                 $tpl->set('s', 'NEWARTICLE_IMG', '&nbsp;');
 975:             }
 976:         } else {
 977:             $tpl->set('s', 'NEWARTICLE_TEXT', '&nbsp;');
 978:             $tpl->set('s', 'NEWARTICLE_IMG', '&nbsp;');
 979:             $tpl->set('s', 'CATTEMPLATE', $warningBox);
 980:         }
 981: 
 982:         $str = '';
 983: 
 984:         $tpl->set('s', 'NOTIFICATION', $str);
 985:         // modified by fulai.zhang 17.07.2012
 986:         // display if there are articles
 987:         if ($no_article) {
 988:             $tpl->set('s', 'NOARTICLE_CSS', "display: none;");
 989:             $tpl->set('s', 'NOARTICLE_JS', 'true');
 990:         } else {
 991:             $tpl->set('s', 'NOARTICLE_CSS', "");
 992:             $tpl->set('s', 'NOARTICLE_JS', 'false');
 993:         }
 994: 
 995:         // breadcrumb onclick
 996:         $tpl->set('s', 'IDTPL', $idtpl ? $idtpl : $cat_idtpl);
 997:         $tpl->set('s', 'SYNCOPTIONS', $syncoptions);
 998:         $tpl->set('s', 'DISPLAY_MENU', 1);
 999: 
1000:         // Generate template
1001:         $tpl->generate($cfg['path']['templates'] . $cfg['templates']['con_art_overview']);
1002:     } else {
1003:         $notification->displayNotification("error", i18n("Permission denied"));
1004:     }
1005: } else {
1006:     $tpl->reset();
1007:     $tpl->set('s', 'CONTENTS', '');
1008:     $tpl->generate($cfg['path']['templates'] . $cfg['templates']['blank']);
1009: }
1010: 
1011: /**
1012:  * Creates HTML code for the bulk editing functions in the article overview.
1013:  *
1014:  * @param string $class
1015:  *         the class for the link
1016:  * @param string $imageSrc
1017:  *         the path to the image
1018:  * @param string $alt
1019:  *         the alt tag for the image
1020:  * @param string $onclick [optional]
1021:  *         the onlick attribute for the link
1022:  * @return string
1023:  *         rendered HTML code
1024:  */
1025: function createBulkEditingFunction($class, $imageSrc, $alt, $onclick = '') {
1026:     $function = new cHTMLLink();
1027:     $function->setClass($class);
1028:     if ($onclick !== '') {
1029:         $function->setEvent('click', $onclick);
1030:     }
1031:     $image = new cHTMLImage($imageSrc);
1032:     $image->setAlt($alt);
1033:     $function->setContent($image);
1034: 
1035:     return $function->render();
1036: }
1037: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0