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 module functions.
  5:  *
  6:  * @package Core
  7:  * @subpackage Backend
  8:  * @author Jan Lengowski
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: cInclude('includes', 'functions.tpl.php');
 18: cInclude('includes', 'functions.con.php');
 19: 
 20: /**
 21:  * Saves changes of modules and regenerates code cache if required
 22:  *
 23:  * @param int    $idmod
 24:  *         module id
 25:  * @param string $name
 26:  *         name of the module
 27:  * @param string $description
 28:  *         module description text
 29:  * @param string $input
 30:  *         module input content
 31:  * @param string $output
 32:  *         module output content
 33:  * @param string $template
 34:  *         template field in module's database entry (seems deprecated)
 35:  * @param string $type
 36:  *         module type (common values are '', 'content', 'head', 'layout', 'navigation' and 'script')
 37:  *
 38:  * @return mixed
 39:  *         idmod or nothing
 40:  *
 41:  * @throws cDbException
 42:  * @throws cException
 43:  * @throws cInvalidArgumentException
 44:  */
 45: function modEditModule($idmod, $name, $description, $input, $output, $template, $type = '') {
 46:     global $db, $client, $cfgClient, $auth, $cfg, $sess, $area, $area_tree, $perm, $frame;
 47:     $description = stripslashes($description);
 48: 
 49:     $date = date('Y-m-d H:i:s');
 50:     $author = $auth->auth['uname'];
 51:     $contenidoModuleHandler = '';
 52:     $messageIfError = '';
 53: 
 54:     // Alias for modul name for the file system
 55:     $alias = cString::toLowerCase(cModuleHandler::getCleanName($name));
 56: 
 57:     // Track version
 58:     $oVersion = new cVersionModule($idmod, $cfg, $cfgClient, $db, $client, $area, $frame);
 59:     $oVersion->createNewVersion();
 60: 
 61:     if (!$idmod) {
 62:         $cApiModuleCollection = new cApiModuleCollection();
 63:         $cApiModule = $cApiModuleCollection->create($name);
 64: 
 65:         $idmod = $cApiModule->get('idmod');
 66: 
 67:         cInclude('includes', 'functions.rights.php');
 68:         createRightsForElement('mod', $idmod);
 69:     } else {
 70:         $cApiModule = new cApiModule($idmod);
 71:     }
 72: 
 73:     $contenidoModuleHandler = new cModuleHandler($idmod);
 74: 
 75:     // Save contents of input or output
 76:     $retInput = $contenidoModuleHandler->saveInput(stripslashes($input));
 77:     $retOutput = $contenidoModuleHandler->saveOutput(stripslashes($output));
 78: 
 79:     // clear the client cache if the module code was written successfully
 80:     if ($retInput || $retOutput) {
 81:         $purge = new cSystemPurge();
 82:         $purge->clearClientCache($client);
 83:     }
 84: 
 85:     if ($cApiModule->get('name') != stripslashes($name) || $cApiModule->get('alias') != stripslashes($alias) || $cApiModule->get('template') != stripslashes($template) || $cApiModule->get('description') != stripslashes($description) || $cApiModule->get('type') != stripslashes($type)) {
 86: 
 87:         // Rename the module if the name changed
 88:         $change = false;
 89:         $oldName = $cApiModule->get('alias');
 90: 
 91:         if ($cApiModule->get('alias') != $alias) {
 92:             $change = true;
 93:             // if modul exist show message
 94:             if ($contenidoModuleHandler->modulePathExistsInDirectory($alias)) {
 95:                 cRegistry::addErrorMessage(i18n('Module name exist in module directory, please choose another name.'));
 96:                 $page = new cGuiPage('generic_page');
 97:                 $page->abortRendering();
 98:                 $page->render();
 99:                 die();
100:             }
101:         }
102: 
103:         // Name of module changed
104:         if ($change == true) {
105:             cRegistry::addOkMessage(i18n('Renamed module successfully!'));
106:             $cApiModule->set('name', $name);
107:             $cApiModule->set('template', $template);
108:             $cApiModule->set('description', $description);
109:             $cApiModule->set('type', $type);
110:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
111: 
112:             // False: The new name of modul dont exist im modul dir
113:             if ($contenidoModuleHandler->renameModul($oldName, $alias) == false) {
114:                 cRegistry::addWarningMessage(i18n("Can't rename module, is a module file open?! Saving only database changes!"));
115:             } else {
116:                 $cApiModule->set('alias', $alias);
117:             }
118: 
119:             $cApiModule->store();
120: 
121:             // Set the new module name
122:             $contenidoModuleHandler->changeModuleName($alias);
123:             // Save input and output in file
124:             if ($contenidoModuleHandler->saveInput(stripslashes($input)) == false) {
125:                 $messageIfError .= '<br>' . i18n("Can't save input !");
126:             }
127: 
128:             if ($contenidoModuleHandler->saveOutput(stripslashes($output)) == false) {
129:                 $messageIfError .= '<br>' . i18n("Can't save output !");
130:             }
131: 
132:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
133:                 $messageIfError .= '<br>' . i18n("Can't save xml module info file!");
134:             }
135: 
136:             // Display error
137:             if ($messageIfError !== '') {
138:                 cRegistry::addErrorMessage($messageIfError);
139:                 // Set the old name because module could not be renamed
140:                 $cApiModule->set('name', $oldName);
141:                 $cApiModule->store();
142:             }
143:         } else {
144:             $cApiModule->set('name', $name);
145:             $cApiModule->set('template', $template);
146:             $cApiModule->set('description', $description);
147:             $cApiModule->set('type', $type);
148:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
149:             $cApiModule->set('alias', $alias);
150:             $cApiModule->store();
151: 
152:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
153:                 cRegistry::addErrorMessage(i18n("Can't save xml module info file!"));
154:             }
155: 
156:             if ($retInput === true && $retOutput === true) {
157:                 cRegistry::addOkMessage(i18n('Saved module successfully!'));
158:             } else {
159:                 $messageIfError = '<br>' . i18n("Can't save input !");
160:                 $messageIfError .= '<br>' . i18n("Can't save output !");
161:                 cRegistry::addErrorMessage($messageIfError);
162:             }
163:         }
164:     } else {
165:         // No changes for save
166:         if ($retInput == true && $retOutput == true) {
167:             // regenerate code cache because module input and output got saved
168:             $cApiModule->store();
169:             cRegistry::addOkMessage(i18n('Saved module successfully!'));
170:         } else {
171:             $messageIfError = i18n("Can't save input !");
172:             $messageIfError .= ' ' . i18n("Can't save output !");
173:             cRegistry::addErrorMessage($messageIfError);
174:         }
175:     }
176: 
177:     return $idmod;
178: }
179: 
180: /**
181:  * Deletes the module of the given ID for the current client.
182:  * Furthermore the rights for this module are deleted.
183:  *
184:  * @todo some global vars seem to be overfluous
185:  *
186:  * @param int $idmod
187:  *
188:  * @throws cDbException
189:  * @throws cInvalidArgumentException
190:  */
191: function modDeleteModule($idmod) {
192:     global $db, $client, $cfg;
193:     global $sess, $area_tree, $perm;
194: 
195:     $sql = 'DELETE FROM ' . $cfg['tab']['mod'] . ' WHERE idmod = ' . (int) $idmod . ' AND idclient = ' . (int) $client;
196:     $db->query($sql);
197: 
198:     // Delete rights for element
199:     cInclude('includes', 'functions.rights.php');
200:     deleteRightsForElement('mod', $idmod);
201: }
202: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0