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
  • SimpleXMLExtended
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _getCurrentTypes
  • _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
  • 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
  • endsWith
  • 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
  • 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
  • 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:  * This file contains the CONTENIDO module functions.
  4:  *
  5:  * @package Core
  6:  * @subpackage Backend
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Jan Lengowski
 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: 
 21: // @fixme: Document me!
 22: function modEditModule($idmod, $name, $description, $input, $output, $template, $type = '') {
 23:     global $db, $client, $cfgClient, $auth, $cfg, $sess, $area, $area_tree, $perm, $frame;
 24:     $description = stripslashes($description);
 25: 
 26:     $date = date('Y-m-d H:i:s');
 27:     $author = $auth->auth['uname'];
 28:     $contenidoModuleHandler = '';
 29:     $messageIfError = '';
 30: 
 31:     // Alias for modul name for the file system
 32:     $alias = strtolower(cModuleHandler::getCleanName($name));
 33: 
 34:     // Track version
 35:     $oVersion = new cVersionModule($idmod, $cfg, $cfgClient, $db, $client, $area, $frame);
 36:     $oVersion->createNewVersion();
 37: 
 38:     if (!$idmod) {
 39:         $cApiModuleCollection = new cApiModuleCollection();
 40:         $cApiModule = $cApiModuleCollection->create($name);
 41: 
 42:         $idmod = $cApiModule->get('idmod');
 43: 
 44:         cInclude('includes', 'functions.rights.php');
 45:         createRightsForElement('mod', $idmod);
 46:     } else {
 47:         $cApiModule = new cApiModule($idmod);
 48:     }
 49: 
 50:     $contenidoModuleHandler = new cModuleHandler($idmod);
 51: 
 52:     // Save contents of input or output
 53:     $retInput = $contenidoModuleHandler->saveInput(stripslashes($input));
 54:     $retOutput = $contenidoModuleHandler->saveOutput(stripslashes($output));
 55: 
 56:     // clear the client cache if the module code has changed
 57:     if ($retInput || $retOutput) {
 58:         $purge = new cSystemPurge();
 59:         $purge->clearClientCache($client);
 60:     }
 61: 
 62:     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)) {
 63: 
 64:         // Rename the module if the name changed
 65:         $change = false;
 66:         $oldName = $cApiModule->get('alias');
 67: 
 68:         if ($cApiModule->get('alias') != $alias) {
 69:             $change = true;
 70:             // if modul exist show message
 71:             if ($contenidoModuleHandler->modulePathExistsInDirectory($alias)) {
 72:                 cRegistry::addErrorMessage(i18n('Module name exist in module directory, please choose another name.'));
 73:                 $page = new cGuiPage('generic_page');
 74:                 $page->abortRendering();
 75:                 $page->render();
 76:                 die();
 77:             }
 78:         }
 79: 
 80:         // Name of modul changed
 81:         if ($change == true) {
 82:             cRegistry::addInfoMessage(i18n('Renamed module successfully!'));
 83:             $cApiModule->set('name', $name);
 84:             $cApiModule->set('template', $template);
 85:             $cApiModule->set('description', $description);
 86:             $cApiModule->set('type', $type);
 87:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
 88: 
 89:             // False: The new name of modul dont exist im modul dir
 90:             if ($contenidoModuleHandler->renameModul($oldName, $alias) == false) {
 91:                 cRegistry::addWarningMessage(i18n("Can't rename module, is a module file open?! Saving only database changes!"));
 92:             } else {
 93:                 $cApiModule->set('alias', $alias);
 94:             }
 95: 
 96:             $cApiModule->store();
 97: 
 98:             // Set the new module name
 99:             $contenidoModuleHandler->changeModuleName($alias);
100:             // Ssave input and output in file
101:             if ($contenidoModuleHandler->saveInput(stripslashes($input)) == false) {
102:                 $messageIfError .= '<br>' . i18n("Can't save input !");
103:             }
104: 
105:             if ($contenidoModuleHandler->saveOutput(stripslashes($output)) == false) {
106:                 $messageIfError .= '<br>' . i18n("Can't save output !");
107:             }
108: 
109:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
110:                 $messageIfError .= '<br>' . i18n("Can't save xml module info file!");
111:             }
112: 
113:             // Display error
114:             if ($messageIfError != '') {
115:                 cRegistry::addErrorMessage($messageIfError);
116:                 // Set the old name because module could not rename
117:                 $cApiModule->set('name', $oldName);
118:                 $cApiModule->store();
119:             }
120:         } else {
121:             $cApiModule->set('name', $name);
122:             $cApiModule->set('template', $template);
123:             $cApiModule->set('description', $description);
124:             $cApiModule->set('type', $type);
125:             $cApiModule->set('lastmodified', date('Y-m-d H:i:s'));
126:             $cApiModule->set('alias', $alias);
127:             $cApiModule->store();
128: 
129:             if ($contenidoModuleHandler->saveInfoXML($name, $description, $type, $alias) == false) {
130:                 cRegistry::addErrorMessage(i18n("Can't save xml module info file!"));
131:             }
132: 
133:             if ($retInput == true && $retOutput == true) {
134:                 cRegistry::addInfoMessage(i18n('Saved module successfully!'));
135:             } else {
136:                 $messageIfError = '<br>' . i18n("Can't save input !");
137:                 $messageIfError .= '<br>' . i18n("Can't save output !");
138:                 cRegistry::addErrorMessage($messageIfError);
139:             }
140:         }
141:     } else {
142:         // No changes for save
143:         if ($retInput == true && $retOutput == true) {
144:             cRegistry::addInfoMessage(i18n('Saved module successfully!'));
145:         } else {
146:             $messageIfError = i18n("Can't save input !");
147:             $messageIfError .= ' ' . i18n("Can't save output !");
148:             cRegistry::addErrorMessage($messageIfError);
149:         }
150:     }
151: 
152:     return $idmod;
153: }
154: 
155: // @fixme: Document me!
156: function modDeleteModule($idmod) {
157:     global $db, $sess, $client, $cfg, $area_tree, $perm;
158: 
159:     $sql = 'DELETE FROM ' . $cfg['tab']['mod'] . ' WHERE idmod = ' . (int) $idmod . ' AND idclient = ' . (int) $client;
160:     $db->query($sql);
161: 
162:     // Delete rights for element
163:     cInclude('includes', 'functions.rights.php');
164:     deleteRightsForElement('mod', $idmod);
165: }
166: 
167: /**
168:  * @deprecated [2013-10-02]  This function is not longer supported and will always return false.
169:  */
170: function modTestModule($code, $id, $output = false) {
171:     cDeprecated("This function is not longer supported and will always return false. Use cModuleHandler::testInput() and cModuleHandler::testOutput() instead.");
172:     return false;
173: }
CMS CONTENIDO 4.9.4 API documentation generated by ApiGen 2.8.0