| [ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 <?php 2 /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 3 /* 4 # ***** BEGIN LICENSE BLOCK ***** 5 # This file is part of Plume CMS, a website management application. 6 # Copyright (C) 2001-2005 Loic d'Anterroches and contributors. 7 # 8 # Plume CMS is free software; you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation; either version 2 of the License, or 11 # (at your option) any later version. 12 # 13 # Plume CMS is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this program; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 # 22 # ***** END LICENSE BLOCK ***** */ 23 24 $m->l10n->loadPlugin($m->user->lang, 'plumeconf'); 25 26 $is_user_root = auth::asLevel(PX_AUTH_ROOT); 27 if (!$is_user_root): 28 $m->setError( __('You do not have the rights to access this plugin.')); 29 else: 30 /*============================================================================== 31 Process block 32 ==============================================================================*/ 33 $px_lang = $_PX_config['lang']; 34 $px_format = $_PX_config['content_format']; 35 $px_max_size = (int) $_PX_config['max_upload_size']/1024; 36 $px_url_format = $_PX_config['url_format']; 37 $px_debug = $_PX_config['debug']; 38 $px_log404errors = $_PX_config['log404errors']; 39 40 // get the available languages 41 $localedir = dirname(__FILE__).'/../../locale/'; 42 $arry_lang = array(); 43 $arry_codes = $m->l10n->getIsoCodes(); 44 $D = dir($localedir); 45 while(false !== ($entry = $D->read())) { 46 if (is_dir($localedir.$entry) && preg_match('/^[a-z]{2}$/', $entry)) { 47 $label = $arry_codes[$entry]; 48 $arry_lang[$label] = $entry; 49 } 50 } 51 $D->close(); 52 $arry_lang['English'] = 'en'; 53 54 if (!empty($_POST['save'])) { 55 // get the values from the form 56 $px_lang = (string) $_POST['c_lang']; 57 $px_format = (string) $_POST['c_format']; 58 $px_max_size = (int) $_POST['c_max_size']; 59 $px_url_format = (string) $_POST['c_url_format']; 60 $px_debug = (bool) $_POST['c_debug']; 61 $px_log404errors = (bool) $_POST['c_log404errors']; 62 $px_comment_stat = (int) $_POST['c_comment_stat']; 63 64 // check that they are ok 65 $px_debug = ($px_debug) ? true : false; 66 $px_log404errors = ($px_log404errors) ? true : false; 67 if (empty($px_lang)) { 68 $m->setError( __('Error: You must provide a default language.'), 400); 69 } 70 if (empty($px_max_size) or !preg_match('/^[0-9]+$/',$px_max_size)) { 71 $m->setError( __('Error: The maximum size must be an integer.'), 400); 72 } else { 73 $px_max_size_save = $px_max_size * 1024; //conversion in bytes 74 } 75 if (empty($px_url_format)) { 76 $m->setError( __('Error: You must provide an URL format.'), 400); 77 } 78 if (empty($px_format)) { 79 $m->setError( __('Error: You must provide a default content format.'), 400); 80 } 81 if ( !file_exists(dirname(__FILE__).'/../../conf/config.php') 82 || !is_writable(dirname(__FILE__).'/../../conf/config.php')) { 83 $m->setError(sprintf( __('Error: The file <strong>%s</strong> is not available for writing.'), 84 files::realpath(dirname(__FILE__).'/../../conf/').'/config.php'), 500); 85 } 86 87 if (false === $m->error()) { 88 // open file for edition of the data 89 include_once dirname(__FILE__).'/../../extinc/class.configfile.php'; 90 $cfg = new configfile(dirname(__FILE__).'/../../conf/config.php'); 91 $cfg->prefix = '_PX_config'; 92 $cfg->editVar('lang', (string) $px_lang); 93 $cfg->editVar('content_format', (string) $px_format); 94 $cfg->editVar('max_upload_size', (int) $px_max_size_save); 95 $cfg->editVar('url_format', (string) $px_url_format); 96 $cfg->editVar('debug', (bool) $px_debug); 97 $cfg->editVar('log404errors', (bool) $px_log404errors); 98 99 if (!$cfg->saveFile()) { 100 $m->setError( __('Error: Error while saving the config file, check the permissions of the file.') , 500); 101 } else { 102 $msg = __('The configuration was successfully updated.'); 103 header('Location: tools.php?p=plumeconf&msg='.urlencode($msg)); 104 exit; 105 } 106 } 107 108 109 } 110 111 /*============================================================================== 112 Display block 113 ==============================================================================*/ 114 115 ?> 116 117 <h1><?php echo __('PLUME CMS Configuration'); ?></h1> 118 119 <p><?php echo __('You can modify here the default configuration of PLUME CMS. This will affect all the websites that are managed with PLUME CMS. Please note that some of the information can be overwritten on a site by site, or user by user basis.'); ?></p> 120 121 <form action="tools.php" method="post" id="formPost"> 122 <p class="field"><label class="float" for="c_lang" style="display:inline"><strong><?php echo __('Default language:'); ?></strong></label> 123 <?php echo form::combobox('c_lang', $arry_lang, $px_lang); ?></p> 124 <p><?php echo __('You can chose only from the installed languages.'); ?> 125 </p> 126 127 <p class="field"><label class="float" for="c_format" style="display:inline"><strong><?php echo __('Default content format:'); ?></strong></label> 128 <?php echo form::combobox('c_format', array('HTML'=>'html','Wiki'=>'wiki'), $px_format); ?> 129 </p> 130 131 <p class="field"><label class="float" for="c_max_size" style="display:inline"><strong><?php echo __('Maximum size of the files and images in KB:'); ?></strong></label> 132 <?php echo form::textField('c_max_size', 10, 55, $px_max_size, '', ''); ?></p> 133 <p><?php echo sprintf( __('You cannot give a maximum size greater than <strong>%s</strong> as it is the maximum size allowed by your system.'), ini_get('upload_max_filesize')); ?> 134 </p> 135 136 <p class="field"><label class="float" for="c_url_format" style="display:inline"><strong><?php echo __('Format of the URL:'); ?></strong></label> 137 <?php echo form::combobox('c_url_format', array( __('Simple (default)')=> 'simple', __('Nice URL') => 'mod_rewrite'), $px_url_format); ?></p> 138 <p><?php echo __('To enable the <em>Nice URL</em> you need a webserver with the support of rewriting rules, like <em>mod_rewrite</em> with Apache. Check the online documentation to see how to enable this on your server.'); ?> 139 </p> 140 141 <p class="field"><label class="float" for="c_debug" style="display:inline"><strong><?php echo __('Display debug information:'); ?></strong></label> 142 <?php echo form::combobox('c_debug', array( __('Yes') => true, __('No') => false), $px_debug); ?></p> 143 <p><?php echo __('When you have the debug information enabled, you can see them when looking at the end of the public page source.'); ?> 144 </p> 145 146 <p class="field"><label class="float" for="c_log404errors" style="display:inline"><strong><?php echo __('Log the pages not found:'); ?></strong></label> 147 <?php echo form::combobox('c_log404errors', array( __('Yes') => true, __('No') => false), $px_log404errors); ?></p> 148 <p><?php echo __('The log of the page not found can be managed from the Smart 404 Errors plugin. Be carefull that you need to purge this log from times to times if you enable the logging.'); ?> 149 </p> 150 151 <p> 152 <?php echo form::hidden('p','plumeconf'); ?> 153 <input name="save" type="submit" class="submit" value="<?php echo __('Save [s]'); ?>" accesskey="s" /> 154 </p> 155 </form> 156 157 158 159 <?php 160 endif; // end of the 'is root' check 161 ?> 162 163
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
|