Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • 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
  • cRights
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageCheckImageEditingPossibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUniqueArticleUrlname
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsArticleUrlnameUnique
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSetStartArticle
  • consoleLog
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParentAreaId
  • getRightsList
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckAlias
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains CONTENIDO content functions.
  5:  *
  6:  * Please add only stuff which is relevant for the frontend
  7:  * AND the backend. This file should NOT contain any backend editing
  8:  * functions to improve frontend performance:
  9:  *
 10:  * @package          Core
 11:  * @subpackage       Backend
 12:  * @author           Willi Man
 13:  * @author           Timo Hummel
 14:  * @copyright        four for business AG <www.4fb.de>
 15:  * @license          http://www.contenido.org/license/LIZENZ.txt
 16:  * @link             http://www.4fb.de
 17:  * @link             http://www.contenido.org
 18:  */
 19: 
 20: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 21: 
 22: /**
 23:  * Generates the code for one article
 24:  *
 25:  * @param int      $idcat
 26:  *                           Id of category
 27:  * @param int      $idart
 28:  *                           Id of article
 29:  * @param int      $lang
 30:  *                           Id of language
 31:  * @param int      $client
 32:  *                           Id of client
 33:  * @param bool     $layout   [optional]
 34:  *                           Layout-ID of alternate Layout (if false, use associated layout)
 35:  * @param bool     $save     [optional]
 36:  *                           Flag to persist generated code in database
 37:  * @param bool     $contype  [optional]
 38:  *                           Flag to enable/disable replacement of CMS_TAGS[].
 39:  * @param bool     $editable [optional]
 40:  *                           deprecated?
 41:  * @param int|NULL $version  [optional]
 42:  *                           version number if article is a revision, else NULL;
 43:  *
 44:  * @return string
 45:  *         The generated code or "0601" if neither article
 46:  *         nor category configuration was found.
 47:  * 
 48:  * @throws cDbException
 49:  * @throws cException
 50:  * @throws cInvalidArgumentException
 51:  */
 52: function conGenerateCode($idcat, $idart, $lang, $client, $layout = false, $save = true, $contype = true, $editable = false, $version = NULL) {
 53:     global $cfg, $frontend_debug;
 54: 
 55:     // @todo make generator configurable
 56:     $codeGen = cCodeGeneratorFactory::getInstance($cfg['code_generator']['name']);
 57:     if (isset($frontend_debug) && is_array($frontend_debug)) {
 58:         $codeGen->setFrontendDebugOptions($frontend_debug);
 59:     }
 60: 
 61:     $code = $codeGen->generate($idcat, $idart, $lang, $client, $layout, $save, $contype, $editable, $version);
 62: 
 63:     // execute CEC hook
 64:     $code = cApiCecHook::executeAndReturn('Contenido.Content.conGenerateCode', $code);
 65: 
 66:     return $code;
 67: }
 68: 
 69: /**
 70:  * Returns the idartlang for a given article and language
 71:  *
 72:  * @param int $idart
 73:  *         ID of the article
 74:  * @param int $idlang
 75:  *         ID of the language
 76:  *
 77:  * @return mixed
 78:  *         idartlang of the article or false if nothing was found
 79:  * 
 80:  * @throws cDbException
 81:  */
 82: function getArtLang($idart, $idlang) {
 83:     $oArtLangColl = new cApiArticleLanguageCollection();
 84:     $idartlang = $oArtLangColl->getIdByArticleIdAndLanguageId($idart, $idlang);
 85:     return ($idartlang) ? $idartlang : false;
 86: }
 87: 
 88: /**
 89:  * Returns all available meta tag types
 90:  *
 91:  * @return array
 92:  *         Assoziative meta tags list
 93:  * 
 94:  * @throws cDbException
 95:  * @throws cException
 96:  */
 97: function conGetAvailableMetaTagTypes() {
 98:     $oMetaTypeColl = new cApiMetaTypeCollection();
 99:     $oMetaTypeColl->select();
100:     $aMetaTypes = array();
101: 
102:     while (($oMetaType = $oMetaTypeColl->next()) !== false) {
103:         $rs = $oMetaType->toArray();
104:         $aMetaTypes[$rs['idmetatype']] = array(
105:             'metatype' => $rs['metatype'],
106:             'fieldtype' => $rs['fieldtype'],
107:             'maxlength' => $rs['maxlength'],
108:             'fieldname' => $rs['fieldname'],
109:             'idmetatype' => $rs["idmetatype"]
110:         );
111:     }
112: 
113:     return $aMetaTypes;
114: }
115: 
116: /**
117:  * Get the meta tag value or its version for a specific article
118:  *
119:  * @param int $idartlang
120:  *         ID of the article
121:  * @param int $idmetatype
122:  *         Metatype-ID
123:  * @param int $version
124:  *         version number
125:  *
126:  * @return string
127:  * 
128:  * @throws cDbException
129:  * @throws cException
130:  */
131: function conGetMetaValue($idartlang, $idmetatype, $version = null)
132: {
133:     static $oMetaTagColl = null;
134:     static $metaTagVersionColl = null;
135: 
136:     if ((int)$idartlang <= 0) {
137:         return '';
138:     }
139: 
140:     if ($version === null) {
141:         if (!isset($oMetaTagColl)) {
142:             $oMetaTagColl = new cApiMetaTagCollection();
143:         }
144:         $oMetaTag = $oMetaTagColl->fetchByArtLangAndMetaType($idartlang, $idmetatype);
145:     } elseif (is_numeric($version)) {
146:         if (!isset($metaTagVersionColl)) {
147:             $metaTagVersionColl = new cApiMetaTagVersionCollection();
148:         }
149:         $oMetaTag = $metaTagVersionColl->fetchByArtLangMetaTypeAndVersion($idartlang, $idmetatype, $version);
150:     } else {
151:         $oMetaTag = null;
152:     }
153: 
154:     if (is_object($oMetaTag)) {
155:         $metavalue = $oMetaTag->get('metavalue');
156:         $metavalue = stripslashes($metavalue);
157:     } else {
158:         $metavalue = '';
159:     }
160: 
161:     return $metavalue;
162: }
163: 
164: /**
165:  * Set the meta tag value or its version for a specific article.
166:  *
167:  * @param int    $idartlang
168:  *         ID of the article
169:  * @param int    $idmetatype
170:  *         Metatype-ID
171:  * @param string $value
172:  *         Value of the meta tag
173:  * @param int    $version
174:  *         version number
175:  *
176:  * @return bool
177:  *         whether the meta value has been saved successfully
178:  * 
179:  * @throws cDbException
180:  * @throws cException
181:  * @throws cInvalidArgumentException
182:  */
183: function conSetMetaValue($idartlang, $idmetatype, $value, $version = NULL) {
184:     static $metaTagColl = NULL;
185:     //$ids[] = array ();
186:     $versioning = new cContentVersioning();
187: 
188:     if (!isset($metaTagColl)) {
189:         $metaTagColl = new cApiMetaTagCollection();
190:     }
191:     //echo "version0:";var_export($version);
192:     $metaTag = $metaTagColl->fetchByArtLangAndMetaType($idartlang, $idmetatype);
193: 
194:     // check if the original version already has been saved
195:     //$where = 'idartlang = ' . $idartlang . ' AND idmetatype = ' . $idmetatype . '';
196:     //$metaTagVersionColl = new cApiMetaTagVersionCollection();
197:     //$ids = $metaTagVersionColl->getIdsByWhereClause($where);
198: 
199:     switch ($versioning->getState()) {
200:         case 'simple':
201:             // if its only a robot-update, only update and don't create a version
202:             if ($version == NULL) {
203:                 if (is_object($metaTag)) {
204:                     $return = $metaTag->updateMetaValue($value);
205:                     return $return;
206:                 } else {
207:                     $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
208:                     return true;
209:                 }
210:             }
211: 
212:             // get metatagid
213:             if (is_object($metaTag)) {
214:                 $idmetatag = $metaTag->get('idmetatag');
215:                 //$valueTemp = $metaTag->getField('value');
216:             }
217: 
218:             // safe original version if nothing has been versioned yet
219:             // foreach ($ids AS $key => $id) {
220:             //     $metaTagTemp = new cApiMetaTagVersion();
221:             //     if ($metaTagTemp->getField('idmetatype') == 7) {
222:             //         unset($ids[$key]);
223:             //     }
224:             // }
225:             //
226:             // if (empty($ids)) {
227:             //         $metaTagVersionParameters = array(
228:             //             'idmetatag' => $idmetatag,
229:             //             'idartlang' => $idartlang,
230:             //             'idmetatype' => $idmetatype,
231:             //             'value' => $valueTemp,
232:             //             'version' => $version
233:             //         );
234:             //         $versioning->createMetaTagVersion($metaTagVersionParameters);
235:             //
236:             //         // create new article version for the change
237:             //         $artLang = new cApiArticleLanguage(cSecurity::toInteger($idartlang));
238:             //         $artLangVersion = $versioning->createArticleLanguageVersion($artLang->toArray());
239:             //         $version = $artLangVersion->getField('version');
240:             // }
241:             // echo "version1:";var_export($version);
242:             
243:             // update article
244:             $artLang = new cApiArticleLanguage($idartlang);
245:             $artLang->set('lastmodified', date('Y-m-d H:i:s'));
246:             $artLang->store();
247:             // update or create meta tag
248:             if (is_object($metaTag)) {
249:                 $return = $metaTag->updateMetaValue($value);
250: 
251:             } else {
252:                 $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
253:             }
254: 
255:             // create meta tag version
256:             $metaTagVersionParameters = array(
257:                 'idmetatag' => $idmetatag,
258:                 'idartlang' => $idartlang,
259:                 'idmetatype' => $idmetatype,
260:                 'value' => $value,
261:                 'version' => $version
262:             );
263:             $versioning->createMetaTagVersion($metaTagVersionParameters);
264:             //echo "version2:";var_export($version);echo "<hr>";
265:             break;
266:         case 'disabled':
267:             // update article
268:             $artLang = new cApiArticleLanguage($idartlang);
269:             $artLang->set('lastmodified', date('Y-m-d H:i:s'));
270:             $artLang->store();
271:             //update meta tag
272:             if (is_object($metaTag)) {
273:                 $return = $metaTag->updateMetaValue($value);
274:                 return $return;
275: 
276:             } else {
277:                 $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
278:                 return true;
279: 
280:             }
281: 
282:             break;
283:         case 'advanced':
284:             if ($version == NULL) {
285:                 if (is_object($metaTag)) {
286:                     $return = $metaTag->updateMetaValue($value);
287:                 } else {
288:                     $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
289:                 }
290:                 $version = 1;
291:             }
292: 
293:             if (is_object($metaTag)) {
294:                 $idmetatag = $metaTag->get('idmetatag');
295:             }
296:             $metaTagVersionParameters = array(
297:                 'idmetatag' => $idmetatag,
298:                 'idartlang' => $idartlang,
299:                 'idmetatype' => $idmetatype,
300:                 'value' => $value,
301:                 'version' => $version
302:             );
303:             $versioning->createMetaTagVersion($metaTagVersionParameters);
304: 
305:             break;
306:         default:
307:             break;
308: 
309:     }
310: 
311: }
312: 
313: /**
314:  * (Re-)generate keywords for all articles of a given client (with specified language)
315:  *
316:  * @param int $client
317:  *         Client
318:  * @param int $lang
319:  *         Language of a client
320:  *
321:  * @throws cDbException
322:  * @throws cInvalidArgumentException
323:  * 
324:  * @deprecated [2014-07-24]
325:  *         Not used anymore
326:  */
327: function conGenerateKeywords($client, $lang) {
328:     $cfg = cRegistry::getConfig();
329: 
330:     static $oDB = NULL;
331:     if (!isset($oDB)) {
332:         $oDB = cRegistry::getDb();
333:     }
334: 
335:     // cms types to be excluded from indexing
336:     $options = $cfg['search_index']['excluded_content_types'];
337: 
338:     $sql = 'SELECT a.idart, b.idartlang FROM ' . $cfg['tab']['art'] . ' AS a, ' . $cfg['tab']['art_lang'] . ' AS b
339:             WHERE a.idart=b.idart AND a.idclient=' . (int) $client . ' AND b.idlang=' . (int) $lang;
340: 
341:     $oDB->query($sql);
342: 
343:     $aArticles = array();
344:     while ($oDB->nextRecord()) {
345:         $aArticles[$oDB->f('idart')] = $oDB->f('idartlang');
346:     }
347: 
348:     foreach ($aArticles as $artid => $artlangid) {
349:         $aContent = conGetContentFromArticle($artlangid);
350:         if (count($aContent) > 0) {
351:             $oIndex = new cSearchIndex($oDB);
352:             $oIndex->start($artid, $aContent, 'auto', $options);
353:         }
354:     }
355: }
356: 
357: /**
358:  * Get content from article by article language.
359:  *
360:  * @param int $iIdArtLang
361:  *         ArticleLanguageId of an article (idartlang)
362:  *
363:  * @return array
364:  *         Array with content of an article indexed by content-types as follows:
365:  *         - $arr[type][typeid] = value;
366:  * 
367:  * @throws cDbException
368:  */
369: function conGetContentFromArticle($iIdArtLang) {
370:     global $cfg;
371: 
372:     static $oDB = NULL;
373:     if (!isset($oDB)) {
374:         $oDB = cRegistry::getDb();
375:     }
376: 
377:     $aContent = array();
378: 
379:     $sql = 'SELECT * FROM ' . $cfg['tab']['content'] . ' AS A, ' . $cfg['tab']['art_lang'] . ' AS B, ' . $cfg['tab']['type'] . ' AS C
380:             WHERE A.idtype=C.idtype AND A.idartlang=B.idartlang AND A.idartlang=' . (int) $iIdArtLang;
381:     $oDB->query($sql);
382:     while ($oDB->nextRecord()) {
383:         $aContent[$oDB->f('type')][$oDB->f('typeid')] = $oDB->f('value');
384:     }
385: 
386:     return $aContent;
387: }
388: 
389: /**
390:  * Returns list of all container with configured modules by template id
391:  *
392:  * @param int $idtpl
393:  *         Template id
394:  *
395:  * @return array
396:  *         Assoziative array where the key is the number and value the module id
397:  * 
398:  * @throws cDbException
399:  * @throws cException
400:  */
401: function conGetUsedModules($idtpl) {
402:     $modules = array();
403: 
404:     $oContainerColl = new cApiContainerCollection();
405:     $oContainerColl->select('idtpl = ' . (int) $idtpl, '', 'number ASC');
406:     while (($oContainer = $oContainerColl->next()) !== false) {
407:         $modules[(int) $oContainer->get('number')] = (int) $oContainer->get('idmod');
408:     }
409: 
410:     return $modules;
411: }
412: 
413: /**
414:  * Returns list of all configured container configurations by template configuration id
415:  *
416:  * @param int $idtplcfg
417:  *         Template configuration id
418:  *
419:  * @return array
420:  *         Assoziative array where the key is the number
421:  *         and value the container configuration.
422:  * 
423:  * @throws cDbException
424:  * @throws cException
425:  */
426: function conGetContainerConfiguration($idtplcfg) {
427:     $containerConfColl = new cApiContainerConfigurationCollection();
428:     return $containerConfColl->getByTemplateConfiguration($idtplcfg);
429: }
430: 
431: /**
432:  * Returns category article id
433:  *
434:  * @param int $idcat
435:  * @param int $idart
436:  *
437:  * @return int|NULL
438:  * 
439:  * @throws cDbException
440:  */
441: function conGetCategoryArticleId($idcat, $idart) {
442:     global $cfg, $db;
443: 
444:     // Get idcatart, we need this to retrieve the template configuration
445:     $sql = 'SELECT idcatart FROM `%s` WHERE idcat = %d AND idart = %d';
446:     $sql = $db->prepare($sql, $cfg['tab']['cat_art'], $idcat, $idart);
447:     $db->query($sql);
448: 
449:     return ($db->nextRecord()) ? $db->f('idcatart') : NULL;
450: }
451: 
452: /**
453:  * Returns template configuration id for a configured article.
454:  *
455:  * @param int $idart
456:  * @param int $idcat
457:  *         NOT used
458:  * @param int $lang
459:  * @param int $client
460:  *
461:  * @return int|NULL
462:  * 
463:  * @throws cDbException
464:  */
465: function conGetTemplateConfigurationIdForArticle($idart, $idcat, $lang, $client) {
466:     global $cfg, $db;
467: 
468:     // Retrieve template configuration id
469:     $sql = "SELECT a.idtplcfg AS idtplcfg FROM `%s` AS a, `%s` AS b WHERE a.idart = %d "
470:          . "AND a.idlang = %d AND b.idart = a.idart AND b.idclient = %d";
471:     $sql = $db->prepare($sql, $cfg['tab']['art_lang'], $cfg['tab']['art'], $idart, $lang, $client);
472:     $db->query($sql);
473: 
474:     return ($db->nextRecord()) ? $db->f('idtplcfg') : NULL;
475: }
476: 
477: /**
478:  * Returns template configuration id for a configured category
479:  *
480:  * @param int $idcat
481:  * @param int $lang
482:  * @param int $client
483:  *
484:  * @return int|NULL
485:  * 
486:  * @throws cDbException
487:  */
488: function conGetTemplateConfigurationIdForCategory($idcat, $lang, $client) {
489:     global $cfg, $db;
490: 
491:     // Retrieve template configuration id
492:     $sql = "SELECT a.idtplcfg AS idtplcfg FROM `%s` AS a, `%s` AS b WHERE a.idcat = %d AND "
493:          . "a.idlang = %d AND b.idcat = a.idcat AND b.idclient = %d";
494:     $sql = $db->prepare($sql, $cfg['tab']['cat_lang'], $cfg['tab']['cat'], $idcat, $lang, $client);
495:     $db->query($sql);
496: 
497:     return ($db->nextRecord()) ? $db->f('idtplcfg') : NULL;
498: }
499: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0