From c83b38c10e110d6567f77ebbd34d6165b6dfdc80 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Thu, 31 Jan 2002 10:15:55 +0000 Subject: [PATCH] Plugins administration completed. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2308 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/administrator/options.php | 74 +++++++++++++++++++------------ 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/plugins/administrator/options.php b/plugins/administrator/options.php index 031ca437..55e5da07 100644 --- a/plugins/administrator/options.php +++ b/plugins/administrator/options.php @@ -179,13 +179,13 @@ if ( isset( $switch ) ) { setPref($data_dir, $username, "adm_$switch", $colapse[$switch] ); } -echo "
" . +echo "" . "
". "" , ""; $act_grp = 'Titles'; /* Active group */ - + foreach ( $newcfg as $k => $v ) { $l = strtolower( $v ); $type = SMOPT_TYPE_UNDEFINED; @@ -300,7 +300,7 @@ foreach ( $newcfg as $k => $v ) { } echo "\n"; break; - + case SMOPT_TYPE_TEXTAREA: if ( isset( $HTTP_POST_VARS[$e] ) ) { $v = '"' . $HTTP_POST_VARS[$e] . '"'; @@ -389,7 +389,7 @@ if ( !($colapse['Group7']) ) { "". "\n"; $i++; - + } } @@ -400,50 +400,66 @@ if ( $colapse['Group8'] ) { $sw = '(-)'; } echo "'; if( !$colapse['Group8'] ) { $fd = opendir( '../plugins/' ); $op_plugin = array(); + $p_count = 0; while (false!==($file = readdir($fd))) { if ($file != '.' && $file != '..' && $file != 'CVS' ) { if ( filetype( $file ) == 'dir' ) { $op_plugin[] = $file; + $p_count++; } } } closedir($fd); asort( $op_plugin ); - - $i = 0; - while ( isset( $newcfg["\$plugins[$i]"] ) ) { - $k = "\$plugins[$i]"; - $e = "plugin_$i"; - if ( isset( $HTTP_POST_VARS[$e] ) ) { - $v = '"' . $HTTP_POST_VARS[$e] . '"'; - $newcfg[$k] = $v; - } else { + + /* Lets get the plugins that are active */ + $plugins = array(); + if ( isset( $HTTP_POST_VARS['plg'] ) ) { + foreach ( $op_plugin as $plg ) { + if ( $HTTP_POST_VARS["plgs_$plg"] == 'on' ) { + $plugins[] = $plg; + } + } + $i = 0; + foreach ( $plugins as $plg ) { + $k = "\$plugins[$i]"; + $newcfg[$k] = "'$plg'"; + $i++; + } + while ( isset( $newcfg["\$plugins[$i]"] ) ) { + $k = "\$plugins[$i]"; + $newcfg[$k] = ''; + $i++; + } + } else { + $i = 0; + while ( isset( $newcfg["\$plugins[$i]"] ) ) { + $k = "\$plugins[$i]"; $v = $newcfg[$k]; + $plugins[] = substr( $v, 1, strlen( $v ) - 2 ); + $i++; } - $name = substr( $v, 1, strlen( $v ) - 2 ); - echo ''. - "". - "" , @@ -484,7 +500,7 @@ foreach ( $newcfg as $k => $v ) { fwrite( $fp, ";\n" ); */ foreach ( $newcfg as $k => $v ) { - if ( $k{0} == '$' ) { + if ( $k{0} == '$' && $v <> '' ) { if ( substr( $k, 1, 11 ) == 'ldap_server' ) { $v = substr( $v, 0, strlen( $v ) - 1 ) . "\n)"; $v = str_replace( 'array(', "array(\n\t", $v ); -- 2.25.1
" . _("Configuration Administrator") . "
" . - "$sw " . + "$sw " . _("Plugins") . '
$i.
". + echo '' . + "". ''; - $i++; - } + echo '
"; + foreach ( $op_plugin as $plg ) { + if ( in_array( $plg, $plugins ) ) { + $sw = ' checked'; + } else { + $sw = ''; } - echo "
$plg
'; + } echo "