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 system configuration backend page.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       Backend
  8:  * @author           Timo Trautmann
  9:  * @author           Simon Sprankel
 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: /**
 19:  * Renders a select element with a label.
 20:  *
 21:  * If there are only two possible values which are called true/false,
 22:  * enabled/disabled or 0/1, a checkbox is rendered.
 23:  *
 24:  * Returns an associative array with the label and the input field.
 25:  *
 26:  * @param string $name
 27:  *         the name of the form element
 28:  * @param array $possibleValues
 29:  *         the possible values
 30:  * @param string $value
 31:  *         the value which should be selected
 32:  * @param string $label
 33:  *         the label text which should be rendered
 34:  * @param int $width
 35:  * @return array
 36:  *         associative array with the label and the input field
 37:  */
 38: function renderSelectProperty($name, $possibleValues, $value, $label, $width = 328) {
 39:     global $auth;
 40: 
 41:     $return = array();
 42: 
 43:     if (count($possibleValues) === 2 && (in_array('true', $possibleValues) && in_array('false', $possibleValues) || in_array('enabled', $possibleValues) && in_array('disabled', $possibleValues) || in_array('0', $possibleValues) && in_array('1', $possibleValues))) {
 44:         // render a checkbox if there are only the values true and false
 45:         $checked = $value == 'true' || $value == '1' || $value == 'enabled';
 46:         $html = new cHTMLCheckbox($name, $possibleValues[0], $name, $checked);
 47:         $html->setLabelText($label);
 48:         $return['label'] = '';
 49:     } else {
 50:         // otherwise render a select box with the possible values
 51:         $html = new cHTMLSelectElement($name);
 52:         foreach ($possibleValues as $possibleValue) {
 53:             $element = new cHTMLOptionElement($possibleValue, $possibleValue);
 54:             if ($possibleValue == $value) {
 55:                 $element->setSelected(true);
 56:             }
 57:             $html->appendOptionElement($element);
 58:         }
 59: 
 60:         //if (in_array($value, array('disabled', 'simple', 'advanced'))) {
 61:         if ($name == 'versioning{_}enabled') {
 62:             $html->setStyle('float:left;padding:3px;width:' . $width . 'px;');
 63:             $return['label'] =
 64:                 ' <div>
 65:                     <span style="width: 284px; display: inline-block; padding: 0px 0px 0px 2px; float:left;">
 66:                         <span style="margin: 0px 10px 0px 0px;">' . i18n("Article versioning") . ':' . '</span>
 67:                         <a
 68:                             href="#"
 69:                             id="pluginInfoDetails-link"
 70:                             class="main i-link infoButton"
 71:                             title="">
 72:                         </a>
 73:                     </span>
 74:                     ' . $html->render() . '
 75:                   </div>
 76:                   <div id="pluginInfoDetails" class="nodisplay">'
 77:                   . i18n('<p><strong>Article versioning:</strong></p>'
 78:                       . '<ul style="list-style:none;">'
 79:                         . '<li>'
 80:                             . 'Review and restore older versions (simple) and create drafts (advanced).'
 81:                             . ' Versions are generated automatically by changing an article.'
 82:                         . '</li>'
 83:                     . '</ul>'
 84:                   . '<p><strong>Modes:</strong></p>'
 85:                       . '<ul class="list">'
 86:                           . '<li class="first"><strong>disabled: </strong> The article versioning is disabled.</li>'
 87:                           . '<li><strong>simple: </strong>Older article versions can be reviewed and restored.</li>'
 88:                           . '<li><strong>advanced: </strong>Additional to the simple-mode, unpublished drafts can be created.</li>'
 89:                       . '</ul>'
 90:                   . '<p><strong>Further informations</strong> can be found in related tabs (Content/Articles/Properties|SEO|Raw data|Editor).</p>'
 91:                   . '</div>');
 92:         } else {
 93:             $html->setStyle('padding:3px;display:block;float:left;width:' . $width . 'px;');
 94:             $return['label'] = renderLabel($label, $name, 280, ':', 'left');
 95:         }
 96: 
 97:     }
 98: 
 99:     // disable the HTML element if user is not a sysadmin
100:     if (strpos($auth->auth['perm'], 'sysadmin') === false) {
101:         $html->updateAttribute('disabled', 'true');
102:     }
103: 
104:     //if (!in_array($value, array('disabled', 'simple', 'advanced'))) {
105:     if ($name != 'versioning{_}enabled') {
106:         $return['input'] = $html->render();
107:     }
108: 
109:     return $return;
110: }
111: 
112: /**
113:  * Renders a cHTMLLabel.
114:  *
115:  * @param string $text
116:  *         the label text
117:  * @param string $name
118:  *         the name of the corresponding input element
119:  * @param string $width
120:  *         the width in pixel
121:  * @param string $seperator
122:  *         the seperator which is written at the end of the label
123:  * @param string $float
124:  * @return string
125:  *         the rendered cHTMLLabel element
126:  */
127: function renderLabel($text, $name, $width = 280, $seperator = ':', $float = '') {
128:     $label = new cHTMLLabel($text . $seperator, $name);
129:     $label->setClass("sys_config_txt_lbl");
130:     if ($float != '') {
131:         $label->setStyle('width:' . $width . 'px;' . 'float:' . $float . ';');
132:     } else {
133:         $label->setStyle('width:' . $width . 'px;');
134:     }
135: 
136: 
137: 
138:     return $label->render();
139: }
140: 
141: /**
142:  * Renders a cHTMLTextbox.
143:  *
144:  * Returns an associative array with the label and the input field.
145:  *
146:  * @param string $name
147:  *         the name of the form element
148:  * @param string $value
149:  *         the value of the text field
150:  * @param string $label
151:  *         the label text
152:  * @param bool $password
153:  *         if the input is a password
154:  * @return array
155:  *         associative array with the label and the input field
156:  */
157: function renderTextProperty($name, $value, $label, $password = false) {
158:     global $auth;
159: 
160:     $textbox = new cHTMLTextbox($name, conHtmlSpecialChars($value), '50', '96');
161:     $textbox->updateAttribute('style', 'width:322px');
162:     // disable the textbox if user is not a sysadmin
163:     if (strpos($auth->auth['perm'], 'sysadmin') === false) {
164:         $textbox->updateAttribute('disabled', 'true');
165:     }
166:     if ($password === true) {
167:         $textbox->updateAttribute('type', 'password');
168:     }
169: 
170:     $return = array();
171:     $return['input'] = $textbox->render();
172:     $return['label'] = renderLabel($label, $name);
173: 
174:     return $return;
175: }
176: 
177: $page = new cGuiPage('system_configuration', '', '1');
178: 
179: // read the properties from the XML file
180: $propertyTypes = cXmlReader::xmlStringToArray(cFileHandler::read($cfg['path']['xml'] . 'system.xml'));
181: $propertyTypes = $propertyTypes['properties'];
182: 
183: // get the stored settings
184: $settings = getSystemProperties();
185: 
186: $reloadHeader = false;
187: // store the system properties
188: if (isset($_POST['action']) && $_POST['action'] == 'edit_sysconf' && $perm->have_perm_area_action($area, 'edit_sysconf')) {
189:     if (strpos($auth->auth['perm'], 'sysadmin') === false) {
190:         $page->displayError(i18n('You don\'t have the permission to make changes here.'));
191:     } else {
192:         // @TODO Find a general solution for this!
193:         if (defined('CON_STRIPSLASHES')) {
194:             $post = cString::stripSlashes($_POST);
195:         } else {
196:             $post = $_POST;
197:         }
198:         $stored = false;
199:         foreach ($propertyTypes as $type => $properties) {
200:             foreach ($properties as $name => $infos) {
201:                 // get the posted value
202:                 $fieldName = $type . '{_}' . $name;
203:                 if (isset($post[$fieldName])) {
204:                     $value = $post[$fieldName];
205:                 } else {
206:                     $value = (isset($infos['values'][1])) ? $infos['values'][1] : 'false';
207:                 }
208: 
209:                 $storedValue = $settings[$type][$name];
210:                 if ($storedValue != $value && (is_array($infos['values']) && $value != '' || !is_array($infos['values']))) {
211:                     if ($type == 'update' && $name == 'check_period' && $value < 60) {
212:                         $page->displayError(i18n('Update check period must be at least 60 minutes.'));
213:                         $stored = false;
214:                         // break out of both loops
215:                         break 2;
216:                     } else {
217:                         setSystemProperty($type, $name, $value);
218:                         // also update the settings array because it is used below
219:                         $settings[$type][$name] = $value;
220:                         $stored = true;
221: 
222:                         if (($type == 'debug' && $name == 'debug_to_screen') || ($type == 'system' && $name == 'clickmenu')) {
223:                             $reloadHeader = true;
224:                         }
225:                     }
226:                 }
227:             }
228:         }
229:         if ($stored) {
230:             $page->displayOk(i18n('Changes saved'));
231:         }
232:     }
233: }
234: 
235: // generate the table for changing the system properties
236: $form = new cGuiTableForm('system_configuration');
237: $form->addHeader(i18n('System configuration'));
238: $form->setVar('area', $area);
239: $form->setVar('frame', $frame);
240: $form->setVar('action', 'edit_sysconf');
241: 
242: // show a disabled OK button if user is not a sysadmin
243: if (strpos($auth->auth['perm'], 'sysadmin') === false) {
244:     $form->setActionButton('submit', cRegistry::getBackendUrl() . 'images/but_ok_off.gif', i18n("You are not sysadmin. You can't change these settings."), 's');
245: }
246: 
247: $groups = array();
248: $currentGroup = '';
249: $leftContent = '';
250: // iterate over all property types
251: foreach ($propertyTypes as $type => $properties) {
252:     foreach ($properties as $name => $infos) {
253:         // $infos is an array with the keys 'values', 'label' and 'group'
254:         // extend the groups array if it is a new group
255:         if (!isset($groups[$infos['group']])) {
256:             $groups[$infos['group']] = '';
257:         }
258: 
259:         // get the currently stored value
260:         if (isset($settings[$type][$name])) {
261:             $value = $settings[$type][$name];
262:         } else {
263:             $value = '';
264:         }
265: 
266:         // render the HTML and add it to the groups array
267:         $fieldName = $type . '{_}' . $name;
268:         if (is_array($infos['values'])) {
269:             $htmlElement = renderSelectProperty($fieldName, $infos['values'], $value, i18n($infos['label']));
270:         } else {
271:             if (strlen($name) > 5 && substr($name, -5) === '_pass') {
272:                 $htmlElement = renderTextProperty($fieldName, $value, i18n($infos['label']), true);
273:             } else {
274:                 $htmlElement = renderTextProperty($fieldName, $value, i18n($infos['label']));
275:             }
276:         }
277: 
278:         $groups[$infos['group']] .= new cHTMLDiv($htmlElement['label'] . $htmlElement['input'], 'systemSetting');
279:     }
280: }
281: 
282: // render the group names and the corresponding settings
283: foreach ($groups as $groupName => $groupSettings) {
284:     $groupName = i18n($groupName);
285:     $form->add(renderLabel($groupName, '', 150, ''), $groupSettings);
286: }
287: 
288: // show error if user is not allowed to see the page
289: if ($perm->have_perm_area_action($area, 'edit_sysconf')) {
290:     $page->set('s', 'RELOAD_HEADER', ($reloadHeader) ? 'true' : 'false');
291:     $page->set('s', 'FORM', $form->render());
292: } else {
293:     $page->displayCriticalError(i18n('Access denied'));
294: }
295: 
296: $page->render();
297: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0