[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This is the handler for asynchronous 'AJAX' calls. 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 * 10 * {@internal License choice 11 * - If you have received this file as part of a package, please find the license.txt file in 12 * the same folder or the closest folder above for complete license terms. 13 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 14 * then you must choose one of the following licenses before using the file: 15 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 16 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 17 * }} 18 * 19 * {@internal Open Source relicensing agreement: 20 * }} 21 * 22 * @package evocore 23 * 24 * @version $Id: async.php,v 1.24 2007/06/25 10:58:49 fplanque Exp $ 25 */ 26 27 28 /** 29 * Do the MAIN initializations: 30 */ 31 require_once dirname(__FILE__).'/../conf/_config.php'; 32 33 /** 34 * HEAVY :( 35 * 36 * @todo dh> refactor _main.inc.php to be able to include small parts 37 * (e.g. $current_User, charset init, ...) only.. 38 * It worked already for $DB (_connect_db.inc.php). 39 * fp> I think I'll try _core_main.inc , _evo_main.inc , _blog_main.inc ; this file would only need _core_main.inc 40 */ 41 require_once $inc_path.'_main.inc.php'; 42 43 param( 'action', 'string', '' ); 44 45 // Check global permission: 46 if( empty($current_User) || ! $current_User->check_perm( 'admin', 'any' ) ) 47 { // No permission to access admin... 48 require $adminskins_path.'_access_denied.main.php'; 49 } 50 51 52 53 // fp>SUSPECT: 54 // fp> Does the following have an HTTP fallback when Javascript/AJ is not available? 55 // dh> yes, but not through this file.. 56 // dh> IMHO it does not make sense to let the "normal controller" handle the AJAX call 57 // if there's something lightweight like calling "$UserSettings->param_Request()"! 58 // Hmm.. bad example (but valid). Better example: something like the actions below, which 59 // output only a small part of what the "real controller" does.. 60 switch( $action ) 61 { 62 case 'add_plugin_sett_set': 63 // Add a Plugin(User)Settings set (for "array" type settings): 64 header('Content-type: text/html; charset='.$io_charset); 65 66 param( 'plugin_ID', 'integer', true ); 67 68 $admin_Plugins = & get_Cache('Plugins_admin'); // use Plugins_admin, because a plugin might be disabled 69 $Plugin = & $admin_Plugins->get_by_ID($plugin_ID); 70 if( ! $Plugin ) 71 { 72 bad_request_die('Invalid Plugin.'); 73 } 74 param( 'set_type', 'string', '' ); // "Settings" or "UserSettings" 75 if( $set_type != 'Settings' /* && $set_type != 'UserSettings' */ ) 76 { 77 bad_request_die('Invalid set_type param!'); 78 } 79 param( 'set_path', '/^\w+(?:\[\w+\])+$/', '' ); 80 81 load_funcs('plugins/_plugin.funcs.php'); 82 83 // Init the new setting set: 84 _set_setting_by_path( $Plugin, $set_type, $set_path, array() ); 85 86 $r = get_plugin_settings_node_by_path( $Plugin, $set_type, $set_path, /* create: */ false ); 87 88 $Form = new Form(); // fake Form 89 autoform_display_field( $set_path, $r['set_meta'], $Form, $set_type, $Plugin, NULL, $r['set_node'] ); 90 exit; 91 92 case 'del_plugin_sett_set': 93 // TODO: may use validation here.. 94 echo 'OK'; 95 exit; 96 97 case 'admin_blogperms_set_layout': 98 // Save blog permission tab layout into user settings. This gets called on JS-toggling. 99 $UserSettings->param_Request( 'layout', 'blogperms_layout', 'string', $debug ? 'all' : 'default' ); // table layout mode 100 exit; 101 102 } 103 // SUSPECT<fp 104 105 106 /** 107 * Call the handler/dispatcher (it is a common handler for asynchronous calls -- both AJax calls and HTTP GET fallbacks) 108 */ 109 require_once $inc_path.'_async.inc.php'; 110 111 112 // Debug info: 113 echo '-expand='.$expand; 114 echo '-collapse='.$collapse; 115 116 /* 117 * $Log: async.php,v $ 118 * Revision 1.24 2007/06/25 10:58:49 fplanque 119 * MODULES (refactored MVC) 120 * 121 * Revision 1.23 2007/06/19 20:41:10 fplanque 122 * renamed generic functions to autoform_* 123 * 124 * Revision 1.22 2007/06/19 00:03:27 fplanque 125 * doc / trying to make sense of automatic settings forms generation. 126 * 127 * Revision 1.21 2007/04/26 00:11:14 fplanque 128 * (c) 2007 129 * 130 * Revision 1.20 2006/12/06 23:32:34 fplanque 131 * Rollback to Daniel's most reliable password hashing design. (which is not the last one) 132 * This not only strengthens the login by providing less failure points, it also: 133 * - Fixes the login in IE7 134 * - Removes the double "do you want to memorize this password' in FF. 135 * 136 * Revision 1.19 2006/12/05 01:04:03 blueyed 137 * Fixed add_plugin_sett_set AJAX callback 138 * 139 * Revision 1.18 2006/12/04 00:18:52 fplanque 140 * keeping the login hashing 141 * 142 * Revision 1.15 2006/12/03 18:18:17 blueyed 143 * doc 144 * 145 * Revision 1.14 2006/12/02 22:57:37 fplanque 146 * SUSPECT code. Not releasable. Discussion by email. 147 * 148 * Revision 1.13 2006/11/29 03:25:53 blueyed 149 * Enhanced password hashing during login: get the password salt through async request + cleanup 150 * 151 * Revision 1.12 2006/11/28 01:10:46 blueyed 152 * doc/discussion 153 * 154 * Revision 1.11 2006/11/28 00:47:16 fplanque 155 * doc 156 * 157 * Revision 1.10 2006/11/24 18:27:22 blueyed 158 * Fixed link to b2evo CVS browsing interface in file docblocks 159 * 160 * Revision 1.9 2006/11/18 01:27:39 blueyed 161 * Always include jQuery in backoffice (it gets cached and can now be used anywhere freely); Update $UserSettings from (blogperms_)toggle_layout (this and related JS moved out of _menutop.php) 162 * 163 * Revision 1.8 2006/11/16 23:43:39 blueyed 164 * - "key" entry for array-type Plugin(User)Settings can define an input field for the key of the settings entry 165 * - cleanup 166 * 167 * Revision 1.7 2006/11/15 22:03:17 blueyed 168 * Use Plugins_admin, because a Plugin might be disabled, when editing its settings 169 * 170 * Revision 1.6 2006/11/10 16:37:30 blueyed 171 * Send charset 172 * 173 * Revision 1.5 2006/11/09 23:40:57 blueyed 174 * Fixed Plugin UserSettings array type editing; Added jquery and use it for AJAHifying Plugin (User)Settings editing of array types 175 * 176 * Revision 1.4 2006/11/02 18:14:59 fplanque 177 * normalized 178 * 179 * Revision 1.3 2006/11/02 02:04:08 blueyed 180 * QUESTION 181 * 182 * Revision 1.2 2006/10/14 04:43:55 blueyed 183 * MFB: E_FATAL for anon user 184 * 185 * Revision 1.1 2006/06/01 19:06:27 fplanque 186 * a taste of Ajax in the framework 187 * 188 */ 189 ?>
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 |
![]() |