Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _processCmsTags
  • addArtspec
  • addslashes_deep
  • 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
  • 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
  • endsWith
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAktuellType
  • 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
  • modTestModule
  • 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
  • setHelpContext
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • stripslashes_deep
  • 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
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • xmlFileToArray
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains CONTENIDO content functions.
  4:  *
  5:  * Please add only stuff which is relevant for the frontend
  6:  * AND the backend. This file should NOT contain any backend editing
  7:  * functions to improve frontend performance:
  8:  *
  9:  * @package          Core
 10:  * @subpackage       Backend
 11:  * @version          SVN Revision $Rev:$
 12:  *
 13:  * @author           Willi Man, 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 Id of category
 26:  * @param int $idart Id of article
 27:  * @param int $lang Id of language
 28:  * @param int $client Id of client
 29:  * @param int $layout Layout-ID of alternate Layout (if false, use associated layout)
 30:  * @param bool $save  Flag to persist generated code in database
 31:  * @return string The generated code or "0601" if neither article nor category configuration
 32:  *                was found
 33:  */
 34: function conGenerateCode($idcat, $idart, $lang, $client, $layout = false, $save = true, $contype = true) {
 35:     global $cfg, $frontend_debug;
 36: 
 37:     // @todo make generator configurable
 38:     $codeGen = cCodeGeneratorFactory::getInstance($cfg['code_generator']['name']);
 39:     if (isset($frontend_debug) && is_array($frontend_debug)) {
 40:         $codeGen->setFrontendDebugOptions($frontend_debug);
 41:     }
 42: 
 43:     $code = $codeGen->generate($idcat, $idart, $lang, $client, $layout, $save, $contype);
 44: 
 45:     // execute CEC hook
 46:     $code = cApiCecHook::executeAndReturn('Contenido.Content.conGenerateCode', $code);
 47: 
 48:     return $code;
 49: }
 50: 
 51: /**
 52:  * Returns the idartlang for a given article and language
 53:  *
 54:  * @param  int  $idart ID of the article
 55:  * @param  int  $idlang ID of the language
 56:  * @return mixed idartlang of the article or false if nothing was found
 57:  */
 58: function getArtLang($idart, $idlang) {
 59:     $oArtLangColl = new cApiArticleLanguageCollection();
 60:     $idartlang = $oArtLangColl->getIdByArticleIdAndLanguageId($idart, $idlang);
 61:     return ($idartlang) ? $idartlang : false;
 62: }
 63: 
 64: /**
 65:  * Returns all available meta tag types
 66:  *
 67:  * @return  array  Assoziative meta tags list
 68:  */
 69: function conGetAvailableMetaTagTypes() {
 70:     $oMetaTypeColl = new cApiMetaTypeCollection();
 71:     $oMetaTypeColl->select();
 72:     $aMetaTypes = array();
 73: 
 74:     while (($oMetaType = $oMetaTypeColl->next()) !== false) {
 75:         $rs = $oMetaType->toArray();
 76:         $aMetaTypes[$rs['idmetatype']] = array(
 77:             'metatype' => $rs['metatype'],
 78:             'fieldtype' => $rs['fieldtype'],
 79:             'maxlength' => $rs['maxlength'],
 80:             'fieldname' => $rs['fieldname'],
 81:             'idmetatype' => $rs["idmetatype"]
 82:         );
 83:     }
 84: 
 85:     return $aMetaTypes;
 86: }
 87: 
 88: /**
 89:  * Get the meta tag value for a specific article
 90:  *
 91:  * @param int $idartlang ID of the article
 92:  * @param int $idmetatype Metatype-ID
 93:  * @return  string
 94:  */
 95: function conGetMetaValue($idartlang, $idmetatype) {
 96:     static $oMetaTagColl = NULL;
 97:     if (!isset($oMetaTagColl)) {
 98:         $oMetaTagColl = new cApiMetaTagCollection();
 99:     }
100: 
101:     if ((int) $idartlang <= 0) {
102:         return '';
103:     }
104: 
105:     $oMetaTag = $oMetaTagColl->fetchByArtLangAndMetaType($idartlang, $idmetatype);
106:     if (is_object($oMetaTag)) {
107:         return stripslashes($oMetaTag->get('metavalue'));
108:     } else {
109:         return '';
110:     }
111: }
112: 
113: /**
114:  * Set the meta tag value for a specific article.
115:  *
116:  * @param  int  $idartlang ID of the article
117:  * @param  int  $idmetatype Metatype-ID
118:  * @param  string  $value Value of the meta tag
119:  * @return bool whether the meta value has been saved successfully
120:  */
121: function conSetMetaValue($idartlang, $idmetatype, $value) {
122:     static $metaTagColl = NULL;
123:     if (!isset($metaTagColl)) {
124:         $metaTagColl = new cApiMetaTagCollection();
125:     }
126: 
127:     $metaTag = $metaTagColl->fetchByArtLangAndMetaType($idartlang, $idmetatype);
128:     $artLang = new cApiArticleLanguage($idartlang);
129:     $artLang->set('lastmodified', date('Y-m-d H:i:s'));
130:     $artLang->store();
131:     if (is_object($metaTag)) {
132:         return $metaTag->updateMetaValue($value);
133:     } else {
134:         $metaTagColl->create($idartlang, $idmetatype, $value);
135:         return true;
136:     }
137: }
138: 
139: /**
140:  * (re)generate keywords for all articles of a given client (with specified language)
141:  * @param int $client Client
142:  * @param int $lang Language of a client
143:  */
144: function conGenerateKeywords($client, $lang) {
145:     global $cfg;
146: 
147:     static $oDB = NULL;
148:     if (!isset($oDB)) {
149:         $oDB = cRegistry::getDb();
150:     }
151: 
152:     $options = array('img', 'link', 'linktarget', 'swf'); // cms types to be excluded from indexing
153: 
154:     $sql = 'SELECT a.idart, b.idartlang FROM ' . $cfg['tab']['art'] . ' AS a, ' . $cfg['tab']['art_lang'] . ' AS b
155:             WHERE a.idart=b.idart AND a.idclient=' . (int) $client . ' AND b.idlang=' . (int) $lang;
156: 
157:     $oDB->query($sql);
158: 
159:     $aArticles = array();
160:     while ($oDB->nextRecord()) {
161:         $aArticles[$oDB->f('idart')] = $oDB->f('idartlang');
162:     }
163: 
164:     foreach ($aArticles as $artid => $artlangid) {
165:         $aContent = conGetContentFromArticle($artlangid);
166:         if (count($aContent) > 0) {
167:             $oIndex = new cSearchIndex($oDB);
168:             $oIndex->start($artid, $aContent, 'auto', $options);
169:         }
170:     }
171: }
172: 
173: /**
174:  * Get content from article by article language.
175:  * @param int $iIdArtLang ArticleLanguageId of an article (idartlang)
176:  * @return array Array with content of an article indexed by content-types as follows:
177:  *               - $arr[type][typeid] = value;
178:  */
179: function conGetContentFromArticle($iIdArtLang) {
180:     global $cfg;
181: 
182:     static $oDB = NULL;
183:     if (!isset($oDB)) {
184:         $oDB = cRegistry::getDb();
185:     }
186: 
187:     $aContent = array();
188: 
189:     $sql = 'SELECT * FROM ' . $cfg['tab']['content'] . ' AS A, ' . $cfg['tab']['art_lang'] . ' AS B, ' . $cfg['tab']['type'] . ' AS C
190:             WHERE A.idtype=C.idtype AND A.idartlang=B.idartlang AND A.idartlang=' . (int) $iIdArtLang;
191:     $oDB->query($sql);
192:     while ($oDB->nextRecord()) {
193:         $aContent[$oDB->f('type')][$oDB->f('typeid')] = $oDB->f('value');
194:     }
195: 
196:     return $aContent;
197: }
198: 
199: /**
200:  * Returns list of all used modules by template id
201:  *
202:  * @param  int $idtpl  Template id
203:  * @return  array  Assoziative array where the key is the number and value the module id
204:  */
205: function conGetUsedModules($idtpl) {
206:     $modules = array();
207: 
208:     $oContainerColl = new cApiContainerCollection();
209:     $oContainerColl->select('idtpl = ' . (int) $idtpl, '', 'number ASC');
210:     while (($oContainer = $oContainerColl->next()) !== false) {
211:         $modules[(int) $oContainer->get('number')] = (int) $oContainer->get('idmod');
212:     }
213: 
214:     return $modules;
215: }
216: 
217: /**
218:  * Returns list of all configured container by template configuration id
219:  *
220:  * @param  int  $idtplcfg  Template configuration id
221:  * @return  array  Assoziative array where the key is the number and value the container
222:  *                 configuration
223:  */
224: function conGetContainerConfiguration($idtplcfg) {
225:     $configuration = array();
226: 
227:     $oContainerConfColl = new cApiContainerConfigurationCollection();
228:     $oContainerConfColl->select('idtplcfg = ' . (int) $idtplcfg, '', 'number ASC');
229:     while (($oContainerConf = $oContainerConfColl->next()) !== false) {
230:         $configuration[(int) $oContainerConf->get('number')] = $oContainerConf->get('container');
231:     }
232: 
233:     return $configuration;
234: }
235: 
236: /**
237:  * Returns category article id
238:  *
239:  * @param  int  $idcat
240:  * @param  int  $idart
241:  * @return  int|NULL
242:  */
243: function conGetCategoryArticleId($idcat, $idart) {
244:     global $cfg, $db;
245: 
246:     // Get idcatart, we need this to retrieve the template configuration
247:     $sql = 'SELECT idcatart FROM `%s` WHERE idcat = %d AND idart = %d';
248:     $sql = $db->prepare($sql, $cfg['tab']['cat_art'], $idcat, $idart);
249:     $db->query($sql);
250: 
251:     return ($db->nextRecord()) ? $db->f('idcatart') : NULL;
252: }
253: 
254: /**
255:  * Returns template configuration id for a configured article.
256:  *
257:  * @param  int  $idart
258:  * @param  int  $idcat  NOT used
259:  * @param  int  $lang
260:  * @param  int  $client
261:  * @return  int|NULL
262:  */
263: function conGetTemplateConfigurationIdForArticle($idart, $idcat, $lang, $client) {
264:     global $cfg, $db;
265: 
266:     // Retrieve template configuration id
267:     $sql = "SELECT a.idtplcfg AS idtplcfg FROM `%s` AS a, `%s` AS b WHERE a.idart = %d "
268:          . "AND a.idlang = %d AND b.idart = a.idart AND b.idclient = %d";
269:     $sql = $db->prepare($sql, $cfg['tab']['art_lang'], $cfg['tab']['art'], $idart, $lang, $client);
270:     $db->query($sql);
271: 
272:     return ($db->nextRecord()) ? $db->f('idtplcfg') : NULL;
273: }
274: 
275: /**
276:  * Returns template configuration id for a configured category
277:  *
278:  * @param  int  $idcat
279:  * @param  int  $lang
280:  * @param  int  $client
281:  * @return  int|NULL
282:  */
283: function conGetTemplateConfigurationIdForCategory($idcat, $lang, $client) {
284:     global $cfg, $db;
285: 
286:     // Retrieve template configuration id
287:     $sql = "SELECT a.idtplcfg AS idtplcfg FROM `%s` AS a, `%s` AS b WHERE a.idcat = %d AND "
288:          . "a.idlang = %d AND b.idcat = a.idcat AND b.idclient = %d";
289:     $sql = $db->prepare($sql, $cfg['tab']['cat_lang'], $cfg['tab']['cat'], $idcat, $lang, $client);
290:     $db->query($sql);
291: 
292:     return ($db->nextRecord()) ? $db->f('idtplcfg') : NULL;
293: }
294: 
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0