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