+}
+
+/**
+ * Change paths containing SM_PATH to admin-friendly paths
+ * relative to the config dir, i.e.:
+ * '' --> <empty string>
+ * SM_PATH . 'images/logo.gif' --> ../images/logo.gif
+ * '/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("../config/","", $new_path);
+ $new_path = str_replace("'","", $new_path);
+ return $new_path;
+}
+
+/**
+ * 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("/^(\/|http)/", $old_path) ) {
+ return "'" . $old_path . "'";
+ } elseif ( preg_match("/^(\$|SM_PATH)/", $old_path) ) {
+ return $old_path;
+ }