diff options
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r-- | phpfspot.class.php | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index 99b0d7b..8305ba5 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -201,6 +201,8 @@ class PHPFSPOT { require_once "phpfspot_tmpl.php"; $this->tmpl = new PHPFSPOT_TMPL(); + $this->tmpl->assign('web_path', $this->cfg->web_path); + /* check if all necessary indices exist */ $this->checkDbIndices(); @@ -2437,7 +2439,6 @@ class PHPFSPOT { public function whatToDo() { if(isset($_SESSION['current_photo']) && $_SESSION['start_action'] == 'showp') { - return "show_photo"; } elseif(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags'])) { return "showpi_tags"; @@ -2446,8 +2447,6 @@ class PHPFSPOT { return "showpi"; } - return "nothing special"; - } // whatToDo() /** @@ -2771,15 +2770,7 @@ class PHPFSPOT { */ private function get_phpfspot_url() { - if($this->cfg->web_path == "/") - $web_path = ""; - /* remove trailing slash */ - elseif(preg_match('/\/$/', $this->cfg->web_path)) - $web_path = preg_replace('/\/$/', '', $this->cfg->web_path); - else - $web_path = $this->cfg->web_path; - - return $this->get_web_protocol() ."://". $this->get_server_name() . $web_path; + return $this->get_web_protocol() ."://". $this->get_server_name() . $this->cfg->web_path; } // get_phpfspot_url() @@ -2973,9 +2964,11 @@ class PHPFSPOT { } - /* check for pending slash on web_path */ - if(!preg_match("/\/$/", $this->cfg->web_path)) - $this->cfg->web_path.= "/"; + /* remove trailing slash, if set */ + if($this->cfg->web_path == "/") + $this->cfg->web_path = ""; + elseif(preg_match('/\/$/', $this->cfg->web_path)) + $this->cfg->web_path = preg_replace('/\/$/', '', $this->cfg->web_path); return $this->runtime_error; @@ -3092,7 +3085,11 @@ class PHPFSPOT { } // get_tag_name() - + /** + * parse user friendly url which got rewritten by the websever + * @param string $request_uri + * @return string + */ private function parse_user_friendly_url($request_uri) { if(preg_match('/\/photoview\/|\/photo\/|\/tag\//', $request_uri)) { @@ -3105,6 +3102,7 @@ class PHPFSPOT { switch($options[1]) { case 'photoview': if(is_numeric($options[2])) { + $_GET['mode'] = 'showp'; return $this->showPhoto($options[2]); } break; |