X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fadministrator%2Foptions.php;h=3f7ad46ef28696e7e7b48de04a156de9a7e916cd;hp=af2da68200bd5ad207e0e57db69453c747779bab;hb=16dd8736f68b753f06df30ff39892ef18579e2ce;hpb=f8a1ed5aa365d515e4e2ac3602f900bfb9447fce diff --git a/plugins/administrator/options.php b/plugins/administrator/options.php index af2da682..3f7ad46e 100644 --- a/plugins/administrator/options.php +++ b/plugins/administrator/options.php @@ -6,14 +6,16 @@ * This script creates separate page, that allows to review and modify * SquirrelMail configuration file. * - * @version $Id$ * @author Philippe Mingo - * @copyright (c) 1999-2005 The SquirrelMail Project Team + * @copyright 1999-2012 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ * @package plugins * @subpackage administrator */ +define('PAGE_NAME', 'administrator_options'); + /** * parse the config file * @@ -170,6 +172,7 @@ function change_to_rel_path($old_path) { * empty_string --> '' * ../images/logo.gif --> SM_PATH . 'images/logo.gif' * images/logo.gif --> SM_PATH . 'config/images/logo.gif' + * C:/absolute/win/path --> 'C:/absolute/win/path' * /absolute/path/logo.gif --> '/absolute/path/logo.gif' * http://whatever/ --> 'http://whatever' * @@ -180,7 +183,8 @@ function change_to_rel_path($old_path) { function change_to_sm_path($old_path) { if ( $old_path === '' || $old_path == "''" ) { return "''"; - } elseif ( preg_match("/^(\/|http)/", $old_path) ) { + } elseif ( preg_match("/^(\/|http)/", $old_path) || + substr($old_path,1,2) == ':/' ) { return "'" . $old_path . "'"; } elseif ( preg_match("/^(\$|SM_PATH)/", $old_path) ) { return $old_path; @@ -219,15 +223,12 @@ function change_to_sm_path($old_path) { /* ---------------------- main -------------------------- */ - -/** @ignore */ -define('SM_PATH','../../'); - -/* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); -require_once(SM_PATH . 'functions/imap.php'); -require_once(SM_PATH . 'plugins/administrator/defines.php'); -require_once(SM_PATH . 'plugins/administrator/auth.php'); +/** main SquirrelMail include */ +require('../../include/init.php'); +/* configuration definitions */ +include_once(SM_PATH . 'plugins/administrator/defines.php'); +/* additional functions */ +include_once(SM_PATH . 'plugins/administrator/auth.php'); global $data_dir, $username; @@ -236,7 +237,7 @@ if ( !adm_check_user() ) { exit; } -displayPageHeader($color, 'None'); +displayPageHeader($color); $newcfg = array( ); @@ -272,7 +273,7 @@ if ( sqgetGlobalVar('switch', $switch, SQ_GET) ) { } echo '
' . - '
'. + '
'. ''. ''. @@ -320,12 +321,16 @@ foreach ( $newcfg as $k => $v ) { $type = SMOPT_TYPE_PLUGINS; } else if ( substr( $k, 0, 13 ) == '$ldap_server[' ) { $type = SMOPT_TYPE_LDAP; + } else if ( substr( $k, 0, 9 ) == '$fontsets' || + substr( $k, 0, 13 ) == '$aTemplateSet' ) { + $type = SMOPT_TYPE_CUSTOM; } if ( $type == SMOPT_TYPE_TITLE || $colapse[$act_grp] == 'off' ) { switch ( $type ) { case SMOPT_TYPE_LDAP: + case SMOPT_TYPE_CUSTOM: case SMOPT_TYPE_PLUGINS: case SMOPT_TYPE_THEME: case SMOPT_TYPE_HIDDEN: @@ -412,11 +417,13 @@ foreach ( $newcfg as $k => $v ) { case SMOPT_TYPE_TEXTAREA: if ( sqgetGlobalVar($e, $new_v, SQ_POST) ) { - $v = '"' . $new_v . '"'; + $v = '"' . addslashes($new_v) . '"'; $newcfg[$k] = str_replace( "\n", '', $v ); } - echo "'; } else { echo '\n". - '
'. _("Configuration Administrator").'
$name". - ""; + echo "
$name" + .""; if ( isset( $defcfg[$k]['comment'] ) ) { echo '   ' . $defcfg[$k]['comment']; } @@ -424,15 +431,17 @@ foreach ( $newcfg as $k => $v ) { break; case SMOPT_TYPE_STRING: if ( sqgetGlobalVar($e, $new_v, SQ_POST) ) { - $v = '"' . $new_v . '"'; + $v = '"' . addslashes($new_v) . '"'; $newcfg[$k] = $v; } if ( $v == '""' && isset( $defcfg[$k]['default'] ) ) { $v = "'" . $defcfg[$k]['default'] . "'"; $newcfg[$k] = $v; } - echo "
$name". - "'; + echo "
$name" + ."'; if ( isset( $defcfg[$k]['comment'] ) ) { echo '   ' . $defcfg[$k]['comment']; } @@ -577,7 +586,7 @@ if ( $colapse['Group8'] == 'off' ) { $i++; } } - echo '
'; + echo ''; + echo '
'; foreach ( $op_plugin as $plg ) { if ( in_array( $plg, $plugins ) ) { $sw = ' checked="checked"'; @@ -594,7 +603,7 @@ if ( $colapse['Group8'] == 'off' ) { "". "\n"; } - echo '
'. sprintf(_("Plugin directory could not be found: %s"), $plugpath). @@ -605,7 +614,7 @@ echo '

'. ''. _("Test Configuration")."
'; + '
'; /* Write the options to the file. @@ -617,8 +626,7 @@ if ( $fp = @fopen( $cfgfile, 'w' ) ) { " * SquirrelMail Configuration File\n". " * Created using the Administrator Plugin\n". " */\n". - "\n". - "global \$version;\n" ); + "\n" ); foreach ( $newcfg as $k => $v ) { if ( $k{0} == '$' && $v <> '' || is_int($v)) { @@ -631,8 +639,6 @@ if ( $fp = @fopen( $cfgfile, 'w' ) ) { fwrite( $fp, "$k = $v;\n" ); } } - // add local config support - fwrite( $fp, "@include SM_PATH . 'config/config_local.php';\n" ); // close php fwrite( $fp, '?>' ); fclose( $fp ); @@ -641,5 +647,6 @@ if ( $fp = @fopen( $cfgfile, 'w' ) ) { _("Config file can't be opened. Please check config.php."). '

'; } + ?> - \ No newline at end of file +