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