diff --git a/common.php b/common.php index 69a839427..dcd58135f 100644 --- a/common.php +++ b/common.php @@ -38,7 +38,7 @@ function g5_path() $server_script_filename = preg_replace('/\/+/', '/', str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME'])); $tilde_remove = preg_replace('/^\/\~[^\/]+(.*)$/', '$1', $server_script_name); $document_root = str_replace($tilde_remove, '', $server_script_filename); - $pattern = '/' . preg_quote($document_root, '/') . '/i'; + $pattern = '/.*?' . preg_quote($document_root, '/') . '/i'; $root = preg_replace($pattern, '', $result['path']); $port = ($_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT']; $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://'; diff --git a/lib/get_data.lib.php b/lib/get_data.lib.php index 56e74a84f..321119471 100644 --- a/lib/get_data.lib.php +++ b/lib/get_data.lib.php @@ -112,6 +112,9 @@ function get_menu_db($use_mobile=0, $is_cache=false){ $result = sql_query($sql, false); for ($i=0; $row=sql_fetch_array($result); $i++) { + + $row['ori_me_link'] = $row['me_link']; + $row['me_link'] = short_url_clean($row['me_link']); $cache[$key][$i] = $row; $sql2 = " select * @@ -122,6 +125,8 @@ function get_menu_db($use_mobile=0, $is_cache=false){ order by me_order, me_id "; $result2 = sql_query($sql2); for ($k=0; $row2=sql_fetch_array($result2); $k++) { + $row2['ori_me_link'] = $row2['me_link']; + $row2['me_link'] = short_url_clean($row2['me_link']); $cache[$key][$i]['sub'][$k] = $row2; } }