Overview

Packages

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

Classes

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

Functions

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