[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI controller for file settings management. 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 * Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}. 11 * 12 * {@internal License choice 13 * - If you have received this file as part of a package, please find the license.txt file in 14 * the same folder or the closest folder above for complete license terms. 15 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 16 * then you must choose one of the following licenses before using the file: 17 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 18 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 19 * }} 20 * 21 * {@internal Open Source relicensing agreement: 22 * Daniel HAHLER grants Francois PLANQUE the right to license 23 * Daniel HAHLER's contributions to this file and the b2evolution project 24 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 25 * 26 * PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license 27 * PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project 28 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 29 * }} 30 * 31 * @package admin 32 * 33 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 34 * @author fplanque: Francois PLANQUE. 35 * @author blueyed: Daniel HAHLER. 36 * @author mbruneau: Marc BRUNEAU / PROGIDISTRI 37 * 38 * @version $Id: file_settings.ctrl.php,v 1.1 2007/06/25 10:59:51 fplanque Exp $ 39 */ 40 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 41 42 43 // Check minimum permission: 44 $current_User->check_perm( 'options', 'view', true ); 45 46 47 $AdminUI->set_path( 'options', 'files' ); 48 49 param( 'action', 'string' ); 50 51 switch( $action ) 52 { 53 case 'update': 54 // Check permission: 55 $current_User->check_perm( 'options', 'edit', true ); 56 57 param( 'submit', 'array', array() ); 58 if( isset($submit['restore_defaults']) ) 59 { 60 $Settings->delete_array( array( 61 'fm_enabled', 62 'fm_enable_roots_blog', 63 // 'fm_enable_roots_group', 64 'fm_enable_roots_user', 65 'fm_enable_roots_skins', 66 'fm_enable_create_dir', 67 'fm_default_chmod_dir', 68 'fm_enable_create_file', 69 'fm_default_chmod_file', 70 'upload_enabled', 71 'upload_maxkb', 72 'regexp_filename' ) ); 73 if( $Settings->dbupdate() ) 74 { 75 $Messages->add( T_('Restored default values.'), 'success' ); 76 } 77 else 78 { 79 $Messages->add( T_('Settings have not changed.'), 'note' ); 80 } 81 } 82 else 83 { 84 // Filemanager 85 param( 'fm_enabled', 'integer', 0 ); 86 $Settings->set( 'fm_enabled', $fm_enabled ); 87 88 param( 'fm_enable_roots_blog', 'integer', 0 ); 89 $Settings->set( 'fm_enable_roots_blog', $fm_enable_roots_blog ); 90 91 // param( 'fm_enable_roots_group', 'fm_enable_roots_group', 'integer', 0 ); 92 93 param( 'fm_enable_roots_user', 'integer', 0 ); 94 $Settings->set( 'fm_enable_roots_user', $fm_enable_roots_user ); 95 96 param( 'fm_enable_roots_skins', 'integer', 0 ); 97 $Settings->set( 'fm_enable_roots_skins', $fm_enable_roots_skins ); 98 99 param( 'fm_enable_create_dir', 'integer', 0 ); 100 $Settings->set( 'fm_enable_create_dir', $fm_enable_create_dir ); 101 102 // Default dir CHMOD: 103 if( param( 'fm_default_chmod_dir', 'string', NULL ) !== NULL ) 104 { 105 if( ! preg_match('~^[0-7]{3}$~', $fm_default_chmod_dir) ) 106 { 107 param_error('fm_default_chmod_dir', T_('Invalid CHMOD value. Use 3 digits.')); 108 } 109 110 $Settings->set( 'fm_default_chmod_dir', $fm_default_chmod_dir ); 111 } 112 113 param( 'fm_enable_create_file', 'integer', 0 ); 114 $Settings->set( 'fm_enable_create_file', $fm_enable_create_file ); 115 116 // Default files CHMOD: 117 if( param( 'fm_default_chmod_file', 'string', NULL ) !== NULL ) 118 { 119 if( ! preg_match('~^[0-7]{3}$~', $fm_default_chmod_file) ) 120 { 121 param_error('fm_default_chmod_file', T_('Invalid CHMOD value. Use 3 digits.')); 122 } 123 124 $Settings->set( 'fm_default_chmod_file', $fm_default_chmod_file ); 125 } 126 127 // Upload 128 param( 'upload_enabled', 'integer', 0 ); 129 $Settings->set( 'upload_enabled', $upload_enabled ); 130 131 param_integer_range( 'upload_maxkb', 1, $upload_maxmaxkb, T_('Maximum allowed filesize must be between %d and %d KB.') ); 132 $Settings->set( 'upload_maxkb', $upload_maxkb ); 133 134 // Advanced settings 135 param( 'regexp_filename', 'string', '' ); 136 if( param_check_isregexp( 'regexp_filename', T_('Valid filename pattern is not a regular expression!') ) ) 137 { 138 $Settings->set( 'regexp_filename', $regexp_filename ); 139 } 140 param( 'regexp_dirname', 'string', '' ); 141 if( param_check_isregexp( 'regexp_dirname', T_('Valid dirname pattern is not a regular expression!') ) ) 142 { 143 $Settings->set( 'regexp_dirname', $regexp_dirname ); 144 } 145 146 if( ! $Messages->count('error') ) 147 { 148 if( $Settings->dbupdate() ) 149 { 150 $Messages->add( T_('File settings updated.'), 'success' ); 151 } 152 else 153 { 154 $Messages->add( T_('Settings have not changed.'), 'note' ); 155 } 156 } 157 } 158 159 break; 160 } 161 162 // Display <html><head>...</head> section! (Note: should be done early if actions do not redirect) 163 $AdminUI->disp_html_head(); 164 165 // Display title, menu, messages, etc. (Note: messages MUST be displayed AFTER the actions) 166 $AdminUI->disp_body_top(); 167 168 // Begin payload block: 169 $AdminUI->disp_payload_begin(); 170 171 // Display VIEW: 172 $AdminUI->disp_view( 'files/views/_file_settings.form.php' ); 173 174 // End payload block: 175 $AdminUI->disp_payload_end(); 176 177 // Display body bottom, debug info and close </html>: 178 $AdminUI->disp_global_footer(); 179 180 /* 181 * $Log: file_settings.ctrl.php,v $ 182 * Revision 1.1 2007/06/25 10:59:51 fplanque 183 * MODULES (refactored MVC) 184 * 185 */ 186 ?>
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 |
![]() |