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
    • SIWECOS
    • 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
  • cRights
  • 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:         cRights::createRightsForElement('mod', $idmod);
 68:     } else {
 69:         $cApiModule = new cApiModule($idmod);
 70:     }
 71: 
 72:     $contenidoModuleHandler = new cModuleHandler($idmod);
 73: 
 74:     // Save contents of input or output
 75:     $retInput = $contenidoModuleHandler->saveInput(stripslashes($input));
 76:     $retOutput = $contenidoModuleHandler->saveOutput(stripslashes($output));
 77: 
 78:     // clear the client cache if the module code was written successfully
 79:     if ($retInput || $retOutput) {
 80:         $purge = new cSystemPurge();
 81:         $purge->clearClientCache($client);
 82:     }
 83: 
 84:     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)) {
 85: 
 86:         // Rename the module if the name changed
 87:         $change = false;
 88:         $oldName = $cApiModule->get('alias');
 89: 
 90:         if ($cApiModule->get('alias') != $alias) {
 91:             $change = true;
 92:             // if modul exist show message
 93:             if ($contenidoModuleHandler->modulePathExistsInDirectory($alias)) {
 94:                 cRegistry::addErrorMessage(i18n('Module name exist in module directory, please choose another name.'));
 95:                 $page = new cGuiPage('generic_page');
 96:                 $page->abortRendering();
 97:                 $page->render();
 98:                 die();
 99:             }
100:         }
101: 
102:         // Name of module changed
103:         if ($change == true) {
104:             cRegistry::addOkMessage(i18n('Renamed module successfully!'));
105:             $cApiModule->set('name', $name);
106:             $cApiModule->set('template', $template);
107:             $cApiModule->set('description', $description);
108:             $cApiModule->set('type', $type);
109:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
110: 
111:             // False: The new name of modul dont exist im modul dir
112:             if ($contenidoModuleHandler->renameModul($oldName, $alias) == false) {
113:                 cRegistry::addWarningMessage(i18n("Can't rename module, is a module file open?! Saving only database changes!"));
114:             } else {
115:                 $cApiModule->set('alias', $alias);
116:             }
117: 
118:             $cApiModule->store();
119: 
120:             // Set the new module name
121:             $contenidoModuleHandler->changeModuleName($alias);
122:             // Save input and output in file
123:             if ($contenidoModuleHandler->saveInput(stripslashes($input)) == false) {
124:                 $messageIfError .= '<br>' . i18n("Can't save input !");
125:             }
126: 
127:             if ($contenidoModuleHandler->saveOutput(stripslashes($output)) == false) {
128:                 $messageIfError .= '<br>' . i18n("Can't save output !");
129:             }
130: 
131:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
132:                 $messageIfError .= '<br>' . i18n("Can't save xml module info file!");
133:             }
134: 
135:             // Display error
136:             if ($messageIfError !== '') {
137:                 cRegistry::addErrorMessage($messageIfError);
138:                 // Set the old name because module could not be renamed
139:                 $cApiModule->set('name', $oldName);
140:                 $cApiModule->store();
141:             }
142:         } else {
143:             $cApiModule->set('name', $name);
144:             $cApiModule->set('template', $template);
145:             $cApiModule->set('description', $description);
146:             $cApiModule->set('type', $type);
147:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
148:             $cApiModule->set('alias', $alias);
149:             $cApiModule->store();
150: 
151:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
152:                 cRegistry::addErrorMessage(i18n("Can't save xml module info file!"));
153:             }
154: 
155:             if ($retInput === true && $retOutput === true) {
156:                 cRegistry::addOkMessage(i18n('Saved module successfully!'));
157:             } else {
158:                 $messageIfError = '<br>' . i18n("Can't save input !");
159:                 $messageIfError .= '<br>' . i18n("Can't save output !");
160:                 cRegistry::addErrorMessage($messageIfError);
161:             }
162:         }
163:     } else {
164:         // No changes for save
165:         if ($retInput == true && $retOutput == true) {
166:             // regenerate code cache because module input and output got saved
167:             $cApiModule->store();
168:             cRegistry::addOkMessage(i18n('Saved module successfully!'));
169:         } else {
170:             $messageIfError = i18n("Can't save input !");
171:             $messageIfError .= ' ' . i18n("Can't save output !");
172:             cRegistry::addErrorMessage($messageIfError);
173:         }
174:     }
175: 
176:     return $idmod;
177: }
178: 
179: /**
180:  * Deletes the module of the given ID for the current client.
181:  * Furthermore the rights for this module are deleted.
182:  *
183:  * @todo some global vars seem to be overfluous
184:  *
185:  * @param int $idmod
186:  *
187:  * @throws cDbException
188:  * @throws cInvalidArgumentException
189:  */
190: function modDeleteModule($idmod) {
191:     global $db, $client, $cfg;
192:     global $sess, $area_tree, $perm;
193: 
194:     $sql = 'DELETE FROM ' . $cfg['tab']['mod'] . ' WHERE idmod = ' . (int) $idmod . ' AND idclient = ' . (int) $client;
195:     $db->query($sql);
196: 
197:     // Delete rights for element
198:     cRights::deleteRightsForElement('mod', $idmod);
199: }
200: 
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0