*
* @version $Id$
* @author Philippe Mingo
- * @copyright (c) 1999-2004 The SquirrelMail Project Team
+ * @copyright (c) 1999-2005 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @package plugins
* @subpackage administrator
* '/absolute/path/logo.gif' --> /absolute/path/logo.gif
* 'http://whatever/' --> http://whatever
* Note removal of quotes in returned value
- *
+ *
* @param string $old_path path that has to be converted
* @return string new path
* @access private
*/
function change_to_rel_path($old_path) {
- $new_path = str_replace("SM_PATH . '", "../", $old_path);
+ $new_path = str_replace("SM_PATH . '", "../", $old_path);
$new_path = str_replace("../config/","", $new_path);
$new_path = str_replace("'","", $new_path);
return $new_path;
}
/**
- * Change relative path (relative to config dir) to
+ * Change relative path (relative to config dir) to
* internal SM_PATH, i.e.:
* empty_string --> ''
* ../images/logo.gif --> SM_PATH . 'images/logo.gif'
* images/logo.gif --> SM_PATH . 'config/images/logo.gif'
* /absolute/path/logo.gif --> '/absolute/path/logo.gif'
* http://whatever/ --> 'http://whatever'
- *
+ *
* @param string $old_path path that has to be converted
* @return string new path
* @access private
-*/
+*/
function change_to_sm_path($old_path) {
if ( $old_path === '' || $old_path == "''" ) {
return "''";
} 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,
+ // 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);
+ array_pop ($abs_path);
foreach ( $rel_path as $subdir ) {
if ( $subdir === '' ) {
array_pop ($abs_path);
// 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,
+ // Last, if it's a relative path without a .. prefix,
// we're somewhere within the config dir, so prepend
- // SM_PATH . 'config/
+ // SM_PATH . 'config/
$new_path = "SM_PATH . 'config/" . $old_path . "'";
}
return $new_path;