[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the GeneralSettings class, which handles Name/Value pairs. 4 * 5 * This file is part of the evoCore framework - {@link http://evocore.net/} 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 9 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}. 10 * 11 * {@internal License choice 12 * - If you have received this file as part of a package, please find the license.txt file in 13 * the same folder or the closest folder above for complete license terms. 14 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 15 * then you must choose one of the following licenses before using the file: 16 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 17 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 18 * }} 19 * 20 * {@internal Open Source relicensing agreement: 21 * Daniel HAHLER grants Francois PLANQUE the right to license 22 * Daniel HAHLER's contributions to this file and the b2evolution project 23 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 24 * }} 25 * 26 * @package evocore 27 * 28 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 29 * @author fplanque: Francois PLANQUE 30 * @author blueyed: Daniel HAHLER 31 * 32 * @version $Id: _generalsettings.class.php,v 1.5 2007/11/03 04:57:51 fplanque Exp $ 33 */ 34 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 35 36 load_class('settings/model/_abstractsettings.class.php'); 37 38 /** 39 * Class to handle the global settings. 40 * 41 * @package evocore 42 */ 43 class GeneralSettings extends AbstractSettings 44 { 45 /** 46 * The default settings to use, when a setting is not given 47 * in the database. 48 * 49 * @todo Allow overriding from /conf/_config_TEST.php? 50 * @access protected 51 * @var array 52 */ 53 var $_defaults = array( 54 'admin_skin' => 'chicago', 55 56 'antispam_last_update' => '2000-01-01 00:00:00', 57 'antispam_threshold_publish' => '-90', 58 'antispam_threshold_delete' => '100', // do not delete by default! 59 'antispam_block_spam_referers' => '0', // By default, let spam referers go in silently (just don't log them). This is in case the blacklist is too paranoid (social media, etc.) 60 61 'AutoBR' => '0', // Used for email blogging. fp> TODO: should be replaced by "email renderers/decoders/cleaners"... 62 63 'log_public_hits' => '1', 64 'log_admin_hits' => '0', 65 'auto_prune_stats_mode' => 'page', // 'page' is the safest mode for average installs (may be "off", "page" or "cron") 66 'auto_prune_stats' => '15', // days (T_hitlog and T_sessions) 67 68 'outbound_notifications_mode' => 'immediate', // 'immediate' is the safest mode for average installs (may be "off", "immediate" or "cron") 69 70 'fm_enabled' => '1', 71 'fm_enable_create_dir' => '1', 72 'fm_enable_create_file' => '1', 73 'fm_enable_roots_blog' => '1', 74 // 'fm_enable_roots_group' => '0', // TO DO 75 'fm_enable_roots_user' => '1', 76 'fm_enable_roots_skins' => '1', 77 78 'fm_showtypes' => '0', 79 'fm_showfsperms' => '0', 80 81 'fm_default_chmod_file' => '664', 82 'fm_default_chmod_dir' => '775', 83 84 'newusers_canregister' => '0', 85 'newusers_mustvalidate' => '1', 86 'newusers_revalidate_emailchg' => '0', 87 'newusers_level' => '1', 88 89 'regexp_filename' => '^[a-zA-Z0-9\-_. ]+$', // TODO: accept (spaces and) special chars / do full testing on this 90 'regexp_dirname' => '^[a-zA-Z0-9\-_]+$', // TODO: accept spaces and special chars / do full testing on this 91 'reloadpage_timeout' => '300', 92 'time_difference' => '0', 93 'timeout_sessions' => '604800', // seconds (604800 == 7 days) 94 'upload_enabled' => '1', 95 'upload_maxkb' => '2048', 96 97 'user_minpwdlen' => '5', 98 'js_passwd_hashing' => '1', // Use JS password hashing by default 99 100 'webhelp_enabled' => '1', 101 102 'allow_moving_chapters' => '0', // Do not allow moving chapters by default 103 ); 104 105 106 /** 107 * Constructor. 108 * 109 * This loads the general settings and checks db_version. 110 * 111 * It will also turn off error-reporting/halting of the {@link $DB DB object} 112 * temporarily to present a more decent error message if tables do not exist yet. 113 * 114 * Because the {@link $DB DB object} itself creates a connection when it gets 115 * created "Error selecting database" occurs before we can check for it here. 116 */ 117 function GeneralSettings() 118 { 119 global $new_db_version, $DB; 120 121 $save_DB_show_errors = $DB->show_errors; 122 $save_DB_halt_on_error = $DB->halt_on_error; 123 $DB->halt_on_error = false; 124 $DB->show_errors = false; 125 126 // Init through the abstract constructor. This should be the first DB connection. 127 parent::AbstractSettings( 'T_settings', array( 'set_name' ), 'set_value' ); 128 129 130 // check DB version: 131 if( $this->get( 'db_version' ) != $new_db_version ) 132 { // Database is not up to date: 133 if( $DB->last_error ) 134 { 135 $error_message = '<p>MySQL error:</p>'.$DB->last_error; 136 } 137 else 138 { 139 $error_message = '<p>Database schema is not up to date!</p>' 140 .'<p>You have schema version «'.(integer)$this->get( 'db_version' ).'», ' 141 .'but we would need «'.(integer)$new_db_version.'».</p>'; 142 } 143 global $adminskins_path; 144 require $adminskins_path.'conf_error.main.php'; // error & exit 145 } 146 147 $DB->halt_on_error = $save_DB_halt_on_error; 148 $DB->show_errors = $save_DB_show_errors; 149 } 150 151 } 152 153 154 155 /* 156 * $Log: _generalsettings.class.php,v $ 157 * Revision 1.5 2007/11/03 04:57:51 fplanque 158 * no message 159 * 160 * Revision 1.4 2007/11/01 19:50:39 fplanque 161 * minor 162 * 163 * Revision 1.3 2007/09/03 16:44:28 fplanque 164 * chicago admin skin 165 * 166 * Revision 1.2 2007/07/01 18:47:11 fplanque 167 * fixes 168 * 169 * Revision 1.1 2007/06/25 11:01:21 fplanque 170 * MODULES (refactored MVC) 171 * 172 * Revision 1.33 2007/05/26 21:30:54 blueyed 173 * Allow spaces in filenames by default 174 * 175 * Revision 1.32 2007/04/26 00:11:02 fplanque 176 * (c) 2007 177 * 178 * Revision 1.31 2007/04/10 17:55:09 fplanque 179 * minor 180 * 181 * Revision 1.30 2007/03/25 13:20:52 fplanque 182 * cleaned up blog base urls 183 * needs extensive testing... 184 * 185 * Revision 1.29 2007/03/24 20:41:16 fplanque 186 * Refactored a lot of the link junk. 187 * Made options blog specific. 188 * Some junk still needs to be cleaned out. Will do asap. 189 * 190 * Revision 1.28 2006/12/15 22:54:14 fplanque 191 * allow disabling of password hashing 192 * 193 * Revision 1.27 2006/12/11 00:32:26 fplanque 194 * allow_moving_chapters stting moved to UI 195 * chapters are now called categories in the UI 196 * 197 * Revision 1.26 2006/12/07 15:23:42 fplanque 198 * filemanager enhanced, refactored, extended to skins directory 199 * 200 * Revision 1.25 2006/12/07 00:55:52 fplanque 201 * reorganized some settings 202 * 203 * Revision 1.24 2006/12/04 19:41:11 fplanque 204 * Each blog can now have its own "archive mode" settings 205 * 206 * Revision 1.23 2006/12/04 18:16:50 fplanque 207 * Each blog can now have its own "number of page/days to display" settings 208 * 209 * Revision 1.22 2006/11/24 18:27:25 blueyed 210 * Fixed link to b2evo CVS browsing interface in file docblocks 211 * 212 * Revision 1.21 2006/11/09 23:11:44 blueyed 213 * Made chmod settings editable 214 * 215 * Revision 1.20 2006/10/06 21:03:06 blueyed 216 * Removed deprecated/unused "upload_allowedext" Setting, which restricted file extensions during upload though! 217 */ 218 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |