X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fadministrator%2Foptions.php;h=c7af2d8bbf067243a2c67f979ec1c710f1caa0da;hb=ab3fe5771fc506f98f5120990cea01bc2b879302;hp=08aad32bec9156c4bf37278ce8d0bcfae477909f;hpb=fd521778267760f193931cebe0c70f7cf7b3d858;p=squirrelmail.git diff --git a/plugins/administrator/options.php b/plugins/administrator/options.php index 08aad32b..c7af2d8b 100644 --- a/plugins/administrator/options.php +++ b/plugins/administrator/options.php @@ -45,7 +45,7 @@ function parseConfig( $cfg_file ) { break; case 'K': // Key detect - if( $line{$j} == ' ' ) { + if ( $line{$j} == ' ' ) { $mode = '='; } else { $key .= $line{$j}; @@ -172,43 +172,43 @@ function change_to_rel_path($old_path) { * @access private */ function change_to_sm_path($old_path) { - if ( $old_path === '' || $old_path == "''" ) { - return "''"; - } elseif ( preg_match("/^(\/|http)/", $old_path) ) { - return "'" . $old_path . "'"; - } elseif ( preg_match("/^(\$|SM_PATH)/", $old_path) ) { - return $old_path; - } + if ( $old_path === '' || $old_path == "''" ) { + return "''"; + } elseif ( preg_match("/^(\/|http)/", $old_path) ) { + return "'" . $old_path . "'"; + } elseif ( preg_match("/^(\$|SM_PATH)/", $old_path) ) { + return $old_path; + } - $new_path = ''; - $rel_path = explode("../", $old_path); - if ( count($rel_path) > 2 ) { - // Since we're relative to the config dir, - // more than 1 ../ puts us OUTSIDE the SM tree. - // get full path to config.php, then pop the filename - $abs_path = explode('/', realpath (SM_PATH . 'config/config.php')); - array_pop ($abs_path); - foreach ( $rel_path as $subdir ) { - if ( $subdir === '' ) { - array_pop ($abs_path); - } else { - array_push($abs_path, $subdir); - } - } - foreach ($abs_path as $subdir) { - $new_path .= $subdir . '/'; - } - $new_path = "'$new_path'"; - } elseif ( count($rel_path) > 1 ) { - // we're within the SM tree, prepend SM_PATH - $new_path = str_replace('../',"SM_PATH . '", $old_path . "'"); - } else { - // Last, if it's a relative path without a .. prefix, - // we're somewhere within the config dir, so prepend - // SM_PATH . 'config/ - $new_path = "SM_PATH . 'config/" . $old_path . "'"; - } - return $new_path; + $new_path = ''; + $rel_path = explode("../", $old_path); + if ( count($rel_path) > 2 ) { + // Since we're relative to the config dir, + // more than 1 ../ puts us OUTSIDE the SM tree. + // get full path to config.php, then pop the filename + $abs_path = explode('/', realpath (SM_PATH . 'config/config.php')); + array_pop ($abs_path); + foreach ( $rel_path as $subdir ) { + if ( $subdir === '' ) { + array_pop ($abs_path); + } else { + array_push($abs_path, $subdir); + } + } + foreach ($abs_path as $subdir) { + $new_path .= $subdir . '/'; + } + $new_path = "'$new_path'"; + } elseif ( count($rel_path) > 1 ) { + // we're within the SM tree, prepend SM_PATH + $new_path = str_replace('../',"SM_PATH . '", $old_path . "'"); + } else { + // Last, if it's a relative path without a .. prefix, + // we're somewhere within the config dir, so prepend + // SM_PATH . 'config/ + $new_path = "SM_PATH . 'config/" . $old_path . "'"; + } + return $new_path; } @@ -259,24 +259,23 @@ $colapse = array( 'Titles' => 'off', /* look in $_GET array for 'switch' */ if ( sqgetGlobalVar('switch', $switch, SQ_GET) ) { if ( $colapse[$switch] == 'on' ) { - $colapse[$switch] = 'off'; + $colapse[$switch] = 'off'; } else { - $colapse[$switch] = 'on'; + $colapse[$switch] = 'on'; } setPref($data_dir, $username, "adm_$switch", $colapse[$switch] ); } echo '