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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

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