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 the CONTENIDO layout functions.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       Backend
  8:  * @author           Jan Lengowski
  9:  * @author           Olaf Niemann
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: cInclude('includes', 'functions.tpl.php');
 19: cInclude('includes', 'functions.con.php');
 20: cInclude('classes', 'class.layout.handler.php');
 21: 
 22: /**
 23:  * Edit or Create a new layout
 24:  *
 25:  * @param int    $idlay
 26:  *         Id of the Layout
 27:  * @param string $name
 28:  *         Name of the Layout
 29:  * @param string $description
 30:  *         Description of the Layout
 31:  * @param string $code
 32:  *         Layout HTML Code
 33:  *
 34:  * @return int
 35:  *         Id of the new or edited layout
 36:  *
 37:  * @throws cDbException
 38:  * @throws cException
 39:  * @throws cInvalidArgumentException
 40:  */
 41: function layEditLayout($idlay, $name, $description, $code) {
 42:     global $client, $auth, $cfg, $sess, $lang, $area_tree, $perm, $area, $frame, $cfgClient;
 43: 
 44:     $db2 = cRegistry::getDb();
 45:     $db = cRegistry::getDb();
 46: 
 47:     $date = date('Y-m-d H:i:s');
 48:     $author = (string) $auth->auth['uname'];
 49:     if (true === cRegistry::getConfigValue('simulate_magic_quotes')) {
 50:         $name = stripslashes($name);
 51:         $description = stripslashes($description);
 52:         $code = stripslashes($code);
 53:     }
 54: 
 55:     if (cString::getStringLength(trim($name)) == 0) {
 56:         $name = i18n('-- Unnamed layout --');
 57:     }
 58: 
 59:     // Replace all not allowed characters..
 60:     $layoutAlias = cModuleHandler::getCleanName(cString::toLowerCase($name));
 61: 
 62:     // Constructor for the layout in filesystem
 63:     $layoutInFile = new cLayoutHandler($idlay, $code, $cfg, $lang);
 64: 
 65:     // Track version
 66:     $oVersion = new cVersionLayout($idlay, $cfg, $cfgClient, $db, $client, $area, $frame);
 67:     // Save layout from file and not from db
 68:     $oVersion->setCode($layoutInFile->getLayoutCode());
 69:     // Create new Layout Version in cms/version/layout/
 70:     $oVersion->createNewVersion();
 71: 
 72:     if (!$idlay) {
 73:         $layoutCollection = new cApiLayoutCollection();
 74:         $layout = $layoutCollection->create($name, $client, $layoutAlias, $description, '1', $author);
 75:         $idlay = $layout->get('idlay');
 76: 
 77:         if ($layoutInFile->saveLayout($code) == false) {
 78:             cRegistry::addErrorMessage(i18n("Can't save layout in file"));
 79:         } else {
 80:             cRegistry::addOkMessage(i18n("Saved layout successfully!"));
 81:         }
 82: 
 83:         // Set correct rights for element
 84:         cInclude('includes', 'functions.rights.php');
 85:         createRightsForElement('lay', $idlay);
 86: 
 87:         return $idlay;
 88:     } else {
 89:         // Save the layout in file system
 90:         $layoutInFile = new cLayoutHandler($idlay, $code, $cfg, $lang);
 91:         // Name changed
 92:         if ($layoutAlias != $layoutInFile->getLayoutName()) {
 93:             // Exist layout in directory
 94:             if (cLayoutHandler::existLayout($layoutAlias, $cfgClient, $client) == true) {
 95:                 // Save in old directory
 96:                 if ($layoutInFile->saveLayout($code) == false) {
 97:                     cRegistry::addErrorMessage(i18n("Can't save layout in file!"));
 98:                 }
 99: 
100:                 // Display error
101:                 cRegistry::addErrorMessage(i18n("Can't rename the layout!"));
102:                 die();
103:             }
104: 
105:             // Rename the directory
106:             if ($layoutInFile->rename($layoutInFile->getLayoutName(), $layoutAlias)) {
107:                 if ($layoutInFile->saveLayout($code) == false) {
108:                     cRegistry::addWarningMessage(sprintf(i18n("The file %s has no write permissions. Saving only database changes!"), $layoutInFile->_getFileName()));
109:                 } else {
110:                     cRegistry::addOkMessage(i18n("Renamed layout succsessfully!"));
111:                 }
112:                 $layout = new cApiLayout(cSecurity::toInteger($idlay));
113:                 $layout->set('name', $name);
114:                 $layout->set('alias', $layoutAlias);
115:                 $layout->set('description', $description);
116:                 $layout->set('author', $author);
117:                 $layout->set('lastmodified', $date);
118:                 $layout->store();
119:             } else {
120:                 // Rename not successfully
121:                 // Save layout
122:                 if ($layoutInFile->saveLayout($code) == false) {
123:                     cRegistry::addErrorMessage(i18n("Can't save layout file!"));
124:                 }
125:             }
126:         } else {
127:             // Name dont changed
128:             if ($layoutInFile->saveLayout($code) == false) {
129:                 cRegistry::addWarningMessage(sprintf(i18n("The file %s has no write permissions. Saving only database changes!"), $layoutInFile->_getFileName()));
130:             } else {
131:                 cRegistry::addOkMessage(i18n("Saved layout successfully!"));
132:             }
133:             $layout = new cApiLayout(cSecurity::toInteger($idlay));
134:             $layout->set('name', $name);
135:             $layout->set('alias', $layoutAlias);
136:             $layout->set('description', $description);
137:             $layout->set('author', $author);
138:             $layout->set('lastmodified', $date);
139:             $layout->store();
140:         }
141: 
142:         // Update CODE table
143:         conGenerateCodeForAllartsUsingLayout($idlay);
144: 
145:         return $idlay;
146:     }
147: }
148: 
149: /**
150:  * Deletes the layout with the given ID from the database and the file system.
151:  *
152:  * @param int $idlay
153:  *         the ID of the layout
154:  *
155:  * @return string
156:  *         an error code if the layout is still in use
157:  *
158:  * @throws cDbException
159:  * @throws cException
160:  * @throws cInvalidArgumentException
161:  */
162: function layDeleteLayout($idlay) {
163:     global $client, $cfg, $area_tree, $perm, $cfgClient;
164: 
165:     $tplColl = new cApiTemplateCollection();
166:     $tplColl->select('`idlay`=' . $idlay);
167:     if ($tplColl->next()) {
168:         // layout is still in use, you cannot delete it
169:         return '0301';
170:     } else {
171: 
172:         // delete the layout in file system
173:         $layoutInFile = new cLayoutHandler($idlay, '', $cfg, 1);
174:         if ($layoutInFile->eraseLayout()) {
175:             if (cFileHandler::exists($cfgClient[$client]['version']['path'] . "layout" . DIRECTORY_SEPARATOR . $idlay)) {
176:                 cDirHandler::recursiveRmdir($cfgClient[$client]['version']['path'] . "layout" . DIRECTORY_SEPARATOR . $idlay);
177:             }
178: 
179:             // delete layout in database
180:             $layoutCollection = new cApiLayoutCollection();
181:             $layoutCollection->delete($idlay);
182:         } else {
183:             cRegistry::addErrorMessage(i18n("Can't delete layout!"));
184:         }
185:     }
186: 
187:     // Delete rights for element
188:     cInclude('includes', 'functions.rights.php');
189:     deleteRightsForElement('lay', $idlay);
190: }
191: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0