Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinymce4Configuration
  • cTinyMCE4Editor
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TODOBackendList
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • addArtspec
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageCheckImageEditingPossibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUniqueArticleUrlname
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsArticleUrlnameUnique
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeInlineScript
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSetStartArticle
  • consoleLog
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParentAreaId
  • getRightsList
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckAlias
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains 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:     static $oMetaTagColl = NULL;
133:     static $metaTagVersionColl = NULL;
134:     $oMetaTag = 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: 
145:         $oMetaTag = $oMetaTagColl->fetchByArtLangAndMetaType($idartlang, $idmetatype);
146:     } else if (is_numeric($version)) {
147:         if (!isset($metaTagVersionColl)) {
148:             $metaTagVersionColl = new cApiMetaTagVersionCollection();
149:         }
150: 
151:         $oMetaTag = $metaTagVersionColl->fetchByArtLangMetaTypeAndVersion($idartlang, $idmetatype, $version);
152:     }
153: 
154:     if (is_object($oMetaTag)) {
155:         return stripslashes($oMetaTag->get('metavalue'));
156:     } else {
157:         return '';
158:     }
159: }
160: 
161: /**
162:  * Set the meta tag value or its version for a specific article.
163:  *
164:  * @param int    $idartlang
165:  *         ID of the article
166:  * @param int    $idmetatype
167:  *         Metatype-ID
168:  * @param string $value
169:  *         Value of the meta tag
170:  * @param int    $version
171:  *         version number
172:  *
173:  * @return bool
174:  *         whether the meta value has been saved successfully
175:  *
176:  * @throws cDbException
177:  * @throws cException
178:  * @throws cInvalidArgumentException
179:  */
180: function conSetMetaValue($idartlang, $idmetatype, $value, $version = NULL) {
181:     static $metaTagColl = NULL;
182:     //$ids[] = array ();
183:     $versioning = new cContentVersioning();
184: 
185:     if (!isset($metaTagColl)) {
186:         $metaTagColl = new cApiMetaTagCollection();
187:     }
188:     //echo "version0:";var_export($version);
189:     $metaTag = $metaTagColl->fetchByArtLangAndMetaType($idartlang, $idmetatype);
190: 
191:     // check if the original version already has been saved
192:     //$where = 'idartlang = ' . $idartlang . ' AND idmetatype = ' . $idmetatype . '';
193:     //$metaTagVersionColl = new cApiMetaTagVersionCollection();
194:     //$ids = $metaTagVersionColl->getIdsByWhereClause($where);
195: 
196:     switch ($versioning->getState()) {
197:         case 'simple':
198:             // if its only a robot-update, only update and don't create a version
199:             if ($version == NULL) {
200:                 if (is_object($metaTag)) {
201:                     $return = $metaTag->updateMetaValue($value);
202:                     return $return;
203:                 } else {
204:                     $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
205:                     return true;
206:                 }
207:             }
208: 
209:             // get metatagid
210:             if (is_object($metaTag)) {
211:                 $idmetatag = $metaTag->get('idmetatag');
212:                 //$valueTemp = $metaTag->getField('value');
213:             }
214: 
215:             // safe original version if nothing has been versioned yet
216:             // foreach ($ids AS $key => $id) {
217:             //     $metaTagTemp = new cApiMetaTagVersion();
218:             //     if ($metaTagTemp->getField('idmetatype') == 7) {
219:             //         unset($ids[$key]);
220:             //     }
221:             // }
222:             //
223:             // if (empty($ids)) {
224:             //         $metaTagVersionParameters = array(
225:             //             'idmetatag' => $idmetatag,
226:             //             'idartlang' => $idartlang,
227:             //             'idmetatype' => $idmetatype,
228:             //             'value' => $valueTemp,
229:             //             'version' => $version
230:             //         );
231:             //         $versioning->createMetaTagVersion($metaTagVersionParameters);
232:             //
233:             //         // create new article version for the change
234:             //         $artLang = new cApiArticleLanguage(cSecurity::toInteger($idartlang));
235:             //         $artLangVersion = $versioning->createArticleLanguageVersion($artLang->toArray());
236:             //         $version = $artLangVersion->getField('version');
237:             // }
238:             // echo "version1:";var_export($version);
239: 
240:             // update article
241:             $artLang = new cApiArticleLanguage($idartlang);
242:             $artLang->set('lastmodified', date('Y-m-d H:i:s'));
243:             $artLang->store();
244:             // update or create meta tag
245:             if (is_object($metaTag)) {
246:                 $return = $metaTag->updateMetaValue($value);
247: 
248:             } else {
249:                 $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
250:             }
251: 
252:             // create meta tag version
253:             $metaTagVersionParameters = array(
254:                 'idmetatag' => $idmetatag,
255:                 'idartlang' => $idartlang,
256:                 'idmetatype' => $idmetatype,
257:                 'value' => $value,
258:                 'version' => $version
259:             );
260:             $versioning->createMetaTagVersion($metaTagVersionParameters);
261:             //echo "version2:";var_export($version);echo "<hr>";
262:             break;
263:         case 'disabled':
264:             // update article
265:             $artLang = new cApiArticleLanguage($idartlang);
266:             $artLang->set('lastmodified', date('Y-m-d H:i:s'));
267:             $artLang->store();
268:             //update meta tag
269:             if (is_object($metaTag)) {
270:                 $return = $metaTag->updateMetaValue($value);
271:                 return $return;
272: 
273:             } else {
274:                 $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
275:                 return true;
276: 
277:             }
278: 
279:             break;
280:         case 'advanced':
281:             if ($version == NULL) {
282:                 if (is_object($metaTag)) {
283:                     $return = $metaTag->updateMetaValue($value);
284:                 } else {
285:                     $metaTag = $metaTagColl->create($idartlang, $idmetatype, $value);
286:                 }
287:                 $version = 1;
288:             }
289: 
290:             if (is_object($metaTag)) {
291:                 $idmetatag = $metaTag->get('idmetatag');
292:             }
293:             $metaTagVersionParameters = array(
294:                 'idmetatag' => $idmetatag,
295:                 'idartlang' => $idartlang,
296:                 'idmetatype' => $idmetatype,
297:                 'value' => $value,
298:                 'version' => $version
299:             );
300:             $versioning->createMetaTagVersion($metaTagVersionParameters);
301: 
302:             break;
303:         default:
304:             break;
305: 
306:     }
307: 
308: }
309: 
310: /**
311:  * (Re-)generate keywords for all articles of a given client (with specified language)
312:  *
313:  * @param int $client
314:  *         Client
315:  * @param int $lang
316:  *         Language of a client
317:  *
318:  * @throws cDbException
319:  * @throws cInvalidArgumentException
320:  *
321:  * @deprecated [2014-07-24]
322:  *         Not used anymore
323:  */
324: function conGenerateKeywords($client, $lang) {
325:     $cfg = cRegistry::getConfig();
326: 
327:     static $oDB = NULL;
328:     if (!isset($oDB)) {
329:         $oDB = cRegistry::getDb();
330:     }
331: 
332:     // cms types to be excluded from indexing
333:     $options = $cfg['search_index']['excluded_content_types'];
334: 
335:     $sql = 'SELECT a.idart, b.idartlang FROM ' . $cfg['tab']['art'] . ' AS a, ' . $cfg['tab']['art_lang'] . ' AS b
336:             WHERE a.idart=b.idart AND a.idclient=' . (int) $client . ' AND b.idlang=' . (int) $lang;
337: 
338:     $oDB->query($sql);
339: 
340:     $aArticles = array();
341:     while ($oDB->nextRecord()) {
342:         $aArticles[$oDB->f('idart')] = $oDB->f('idartlang');
343:     }
344: 
345:     foreach ($aArticles as $artid => $artlangid) {
346:         $aContent = conGetContentFromArticle($artlangid);
347:         if (count($aContent) > 0) {
348:             $oIndex = new cSearchIndex($oDB);
349:             $oIndex->start($artid, $aContent, 'auto', $options);
350:         }
351:     }
352: }
353: 
354: /**
355:  * Get content from article by article language.
356:  *
357:  * @param int $iIdArtLang
358:  *         ArticleLanguageId of an article (idartlang)
359:  *
360:  * @return array
361:  *         Array with content of an article indexed by content-types as follows:
362:  *         - $arr[type][typeid] = value;
363:  *
364:  * @throws cDbException
365:  */
366: function conGetContentFromArticle($iIdArtLang) {
367:     global $cfg;
368: 
369:     static $oDB = NULL;
370:     if (!isset($oDB)) {
371:         $oDB = cRegistry::getDb();
372:     }
373: 
374:     $aContent = array();
375: 
376:     $sql = 'SELECT * FROM ' . $cfg['tab']['content'] . ' AS A, ' . $cfg['tab']['art_lang'] . ' AS B, ' . $cfg['tab']['type'] . ' AS C
377:             WHERE A.idtype=C.idtype AND A.idartlang=B.idartlang AND A.idartlang=' . (int) $iIdArtLang;
378:     $oDB->query($sql);
379:     while ($oDB->nextRecord()) {
380:         $aContent[$oDB->f('type')][$oDB->f('typeid')] = $oDB->f('value');
381:     }
382: 
383:     return $aContent;
384: }
385: 
386: /**
387:  * Returns list of all container with configured modules by template id
388:  *
389:  * @param int $idtpl
390:  *         Template id
391:  *
392:  * @return array
393:  *         Assoziative array where the key is the number and value the module id
394:  *
395:  * @throws cDbException
396:  * @throws cException
397:  */
398: function conGetUsedModules($idtpl) {
399:     $modules = array();
400: 
401:     $oContainerColl = new cApiContainerCollection();
402:     $oContainerColl->select('idtpl = ' . (int) $idtpl, '', 'number ASC');
403:     while (($oContainer = $oContainerColl->next()) !== false) {
404:         $modules[(int) $oContainer->get('number')] = (int) $oContainer->get('idmod');
405:     }
406: 
407:     return $modules;
408: }
409: 
410: /**
411:  * Returns list of all configured container configurations by template configuration id
412:  *
413:  * @param int $idtplcfg
414:  *         Template configuration id
415:  *
416:  * @return array
417:  *         Assoziative array where the key is the number
418:  *         and value the container configuration.
419:  *
420:  * @throws cDbException
421:  * @throws cException
422:  */
423: function conGetContainerConfiguration($idtplcfg) {
424:     $containerConfColl = new cApiContainerConfigurationCollection();
425:     return $containerConfColl->getByTemplateConfiguration($idtplcfg);
426: }
427: 
428: /**
429:  * Returns category article id
430:  *
431:  * @param int $idcat
432:  * @param int $idart
433:  *
434:  * @return int|NULL
435:  *
436:  * @throws cDbException
437:  */
438: function conGetCategoryArticleId($idcat, $idart) {
439:     global $cfg, $db;
440: 
441:     // Get idcatart, we need this to retrieve the template configuration
442:     $sql = 'SELECT idcatart FROM `%s` WHERE idcat = %d AND idart = %d';
443:     $sql = $db->prepare($sql, $cfg['tab']['cat_art'], $idcat, $idart);
444:     $db->query($sql);
445: 
446:     return ($db->nextRecord()) ? $db->f('idcatart') : NULL;
447: }
448: 
449: /**
450:  * Returns template configuration id for a configured article.
451:  *
452:  * @param int $idart
453:  * @param int $idcat
454:  *         NOT used
455:  * @param int $lang
456:  * @param int $client
457:  *
458:  * @return int|NULL
459:  *
460:  * @throws cDbException
461:  */
462: function conGetTemplateConfigurationIdForArticle($idart, $idcat, $lang, $client) {
463:     global $cfg, $db;
464: 
465:     // Retrieve template configuration id
466:     $sql = "SELECT a.idtplcfg AS idtplcfg FROM `%s` AS a, `%s` AS b WHERE a.idart = %d "
467:          . "AND a.idlang = %d AND b.idart = a.idart AND b.idclient = %d";
468:     $sql = $db->prepare($sql, $cfg['tab']['art_lang'], $cfg['tab']['art'], $idart, $lang, $client);
469:     $db->query($sql);
470: 
471:     return ($db->nextRecord()) ? $db->f('idtplcfg') : NULL;
472: }
473: 
474: /**
475:  * Returns template configuration id for a configured category
476:  *
477:  * @param int $idcat
478:  * @param int $lang
479:  * @param int $client
480:  *
481:  * @return int|NULL
482:  *
483:  * @throws cDbException
484:  */
485: function conGetTemplateConfigurationIdForCategory($idcat, $lang, $client) {
486:     global $cfg, $db;
487: 
488:     // Retrieve template configuration id
489:     $sql = "SELECT a.idtplcfg AS idtplcfg FROM `%s` AS a, `%s` AS b WHERE a.idcat = %d AND "
490:          . "a.idlang = %d AND b.idcat = a.idcat AND b.idclient = %d";
491:     $sql = $db->prepare($sql, $cfg['tab']['cat_lang'], $cfg['tab']['cat'], $idcat, $lang, $client);
492:     $db->query($sql);
493: 
494:     return ($db->nextRecord()) ? $db->f('idtplcfg') : NULL;
495: }
496: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0