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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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
  • 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
  • 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
  • conMakeInlineScript
  • 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
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • 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
  • 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
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • 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:  * @return mixed
 38:  *         idmod or nothing
 39:  */
 40: function modEditModule($idmod, $name, $description, $input, $output, $template, $type = '') {
 41:     global $db, $client, $cfgClient, $auth, $cfg, $sess, $area, $area_tree, $perm, $frame;
 42:     $description = stripslashes($description);
 43: 
 44:     $date = date('Y-m-d H:i:s');
 45:     $author = $auth->auth['uname'];
 46:     $contenidoModuleHandler = '';
 47:     $messageIfError = '';
 48: 
 49:     // Alias for modul name for the file system
 50:     $alias = strtolower(cModuleHandler::getCleanName($name));
 51: 
 52:     // Track version
 53:     $oVersion = new cVersionModule($idmod, $cfg, $cfgClient, $db, $client, $area, $frame);
 54:     $oVersion->createNewVersion();
 55: 
 56:     if (!$idmod) {
 57:         $cApiModuleCollection = new cApiModuleCollection();
 58:         $cApiModule = $cApiModuleCollection->create($name);
 59: 
 60:         $idmod = $cApiModule->get('idmod');
 61: 
 62:         cInclude('includes', 'functions.rights.php');
 63:         createRightsForElement('mod', $idmod);
 64:     } else {
 65:         $cApiModule = new cApiModule($idmod);
 66:     }
 67: 
 68:     $contenidoModuleHandler = new cModuleHandler($idmod);
 69: 
 70:     // Save contents of input or output
 71:     $retInput = $contenidoModuleHandler->saveInput(stripslashes($input));
 72:     $retOutput = $contenidoModuleHandler->saveOutput(stripslashes($output));
 73: 
 74:     // clear the client cache if the module code was written successfully
 75:     if ($retInput || $retOutput) {
 76:         $purge = new cSystemPurge();
 77:         $purge->clearClientCache($client);
 78:     }
 79: 
 80:     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)) {
 81: 
 82:         // Rename the module if the name changed
 83:         $change = false;
 84:         $oldName = $cApiModule->get('alias');
 85: 
 86:         if ($cApiModule->get('alias') != $alias) {
 87:             $change = true;
 88:             // if modul exist show message
 89:             if ($contenidoModuleHandler->modulePathExistsInDirectory($alias)) {
 90:                 cRegistry::addErrorMessage(i18n('Module name exist in module directory, please choose another name.'));
 91:                 $page = new cGuiPage('generic_page');
 92:                 $page->abortRendering();
 93:                 $page->render();
 94:                 die();
 95:             }
 96:         }
 97: 
 98:         // Name of module changed
 99:         if ($change == true) {
100:             cRegistry::addOkMessage(i18n('Renamed module successfully!'));
101:             $cApiModule->set('name', $name);
102:             $cApiModule->set('template', $template);
103:             $cApiModule->set('description', $description);
104:             $cApiModule->set('type', $type);
105:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
106: 
107:             // False: The new name of modul dont exist im modul dir
108:             if ($contenidoModuleHandler->renameModul($oldName, $alias) == false) {
109:                 cRegistry::addWarningMessage(i18n("Can't rename module, is a module file open?! Saving only database changes!"));
110:             } else {
111:                 $cApiModule->set('alias', $alias);
112:             }
113: 
114:             $cApiModule->store();
115: 
116:             // Set the new module name
117:             $contenidoModuleHandler->changeModuleName($alias);
118:             // Save input and output in file
119:             if ($contenidoModuleHandler->saveInput(stripslashes($input)) == false) {
120:                 $messageIfError .= '<br>' . i18n("Can't save input !");
121:             }
122: 
123:             if ($contenidoModuleHandler->saveOutput(stripslashes($output)) == false) {
124:                 $messageIfError .= '<br>' . i18n("Can't save output !");
125:             }
126: 
127:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
128:                 $messageIfError .= '<br>' . i18n("Can't save xml module info file!");
129:             }
130: 
131:             // Display error
132:             if ($messageIfError !== '') {
133:                 cRegistry::addErrorMessage($messageIfError);
134:                 // Set the old name because module could not be renamed
135:                 $cApiModule->set('name', $oldName);
136:                 $cApiModule->store();
137:             }
138:         } else {
139:             $cApiModule->set('name', $name);
140:             $cApiModule->set('template', $template);
141:             $cApiModule->set('description', $description);
142:             $cApiModule->set('type', $type);
143:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
144:             $cApiModule->set('alias', $alias);
145:             $cApiModule->store();
146: 
147:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
148:                 cRegistry::addErrorMessage(i18n("Can't save xml module info file!"));
149:             }
150: 
151:             if ($retInput === true && $retOutput === true) {
152:                 cRegistry::addOkMessage(i18n('Saved module successfully!'));
153:             } else {
154:                 $messageIfError = '<br>' . i18n("Can't save input !");
155:                 $messageIfError .= '<br>' . i18n("Can't save output !");
156:                 cRegistry::addErrorMessage($messageIfError);
157:             }
158:         }
159:     } else {
160:         // No changes for save
161:         if ($retInput == true && $retOutput == true) {
162:             // regenerate code cache because module input and output got saved
163:             $cApiModule->store();
164:             cRegistry::addOkMessage(i18n('Saved module successfully!'));
165:         } else {
166:             $messageIfError = i18n("Can't save input !");
167:             $messageIfError .= ' ' . i18n("Can't save output !");
168:             cRegistry::addErrorMessage($messageIfError);
169:         }
170:     }
171: 
172:     return $idmod;
173: }
174: 
175: /**
176:  * Deletes the module of the given ID for the current client.
177:  * Furthermore the rights for this module are deleted.
178:  *
179:  * @todo some global vars seem to be overfluous
180:  * @param int $idmod
181:  */
182: function modDeleteModule($idmod) {
183:     global $db, $client, $cfg;
184:     global $sess, $area_tree, $perm;
185: 
186:     $sql = 'DELETE FROM ' . $cfg['tab']['mod'] . ' WHERE idmod = ' . (int) $idmod . ' AND idclient = ' . (int) $client;
187:     $db->query($sql);
188: 
189:     // Delete rights for element
190:     cInclude('includes', 'functions.rights.php');
191:     deleteRightsForElement('mod', $idmod);
192: }
193: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0