From: Paul L. <pdo...@us...> - 2006-11-16 12:25:52
|
Update of /cvsroot/squirrelmail/squirrelmail/include In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32011/include Modified Files: init.php Log Message: Adding plugins on/off switch, which disables plugins completely (optionally for only one named user, otherwise for all users). Index: init.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/include/init.php,v retrieving revision 1.35 retrieving revision 1.36 diff -u -w -r1.35 -r1.36 --- init.php 4 Nov 2006 03:50:20 -0000 1.35 +++ init.php 16 Nov 2006 12:25:48 -0000 1.36 @@ -226,10 +226,27 @@ */ $SQM_INTERNAL_VERSION = array(1,5,2); + +/* if plugins are disabled only for one user and + * the current user is NOT that user, turn them + * back on + */ +sqgetGlobalVar('username',$username,SQ_SESSION); +if ($disable_plugins && !empty($disable_plugins_user) + && $username != $disable_plugins_user) { + $disable_plugins = false; +} + +/* remove all plugins if they are disabled */ +if ($disable_plugins) { + $plugins = array(); +} + + /** * Include Compatibility plugin if available. */ -if (file_exists(SM_PATH . 'plugins/compatibility/functions.php')) +if (!$disable_plugins && file_exists(SM_PATH . 'plugins/compatibility/functions.php')) include_once(SM_PATH . 'plugins/compatibility/functions.php'); /** @@ -239,7 +256,7 @@ * and let the hook calls include only the plugins needed. */ $squirrelmail_plugin_hooks = array(); -if (file_exists(SM_PATH . 'config/plugin_hooks.php')) { +if (!$disable_plugins && file_exists(SM_PATH . 'config/plugin_hooks.php')) { require(SM_PATH . 'config/plugin_hooks.php'); } @@ -423,6 +440,7 @@ exit; } +//FIXME: remove next line if the placement of the copy of this line above does not prove to be problematic sqgetGlobalVar('username',$username,SQ_SESSION); sqgetGlobalVar('authz',$authz,SQ_SESSION); |