diff options
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r-- | phpfspot.class.php | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index 094746c..badc728 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -244,6 +244,11 @@ class PHPFSPOT { $this->tmpl->assign('current_condition', $_SESSION['tag_condition']); $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name); + /* parse URL */ + if(isset($this->cfg->user_friendly_url) && $this->cfg->user_friendly_url) { + $content = $this->parse_user_friendly_url($_SERVER['REQUEST_URI']); + } + if(isset($_GET['mode'])) { $_SESSION['start_action'] = $_GET['mode']; @@ -306,7 +311,12 @@ class PHPFSPOT { $this->tmpl->register_function("sort_select_list", array(&$this, "smarty_sort_select_list"), false); $this->tmpl->assign('from_date', $this->get_calendar('from')); $this->tmpl->assign('to_date', $this->get_calendar('to')); - $this->tmpl->assign('content_page', 'welcome.tpl'); + + if(!isset($content)) + $this->tmpl->assign('content_page', $this->tmpl->fetch('welcome.tpl')); + else + $this->tmpl->assign('content_page', $content); + $this->tmpl->show("index.tpl"); } // show() @@ -609,7 +619,11 @@ class PHPFSPOT { $this->tmpl->assign('ExifOrigResolution', $meta_res); $this->tmpl->assign('ExifFileSize', $meta_size); - $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width); + if(!isset($this->cfg->user_friendly_url) || !$this->cfg->user_friendly_url) + $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width); + else + $this->tmpl->assign('image_url', '/photo/'. $photo ."/". $this->cfg->photo_width); + $this->tmpl->assign('image_url_full', 'phpfspot_img.php?idx='. $photo); $this->tmpl->assign('image_filename', $this->parse_uri($details['uri'], 'filename')); @@ -631,7 +645,7 @@ class PHPFSPOT { $this->tmpl->assign('photo_number', $i); $this->tmpl->assign('photo_count', count($all_photos)); - $this->tmpl->show("single_photo.tpl"); + return $this->tmpl->fetch("single_photo.tpl"); } // showPhoto() @@ -3045,6 +3059,36 @@ class PHPFSPOT { } // get_tag_name() + + private function parse_user_friendly_url($request_uri) + { + if(preg_match('/\/photoview\/|\/photo\//', $request_uri)) { + + $options = explode('/', $request_uri); + + switch($options[1]) { + case 'photoview': + if(is_numeric($options[2])) { + return $this->showPhoto($options[2]); + } + break; + case 'photo': + if(is_numeric($options[2])) { + require_once "phpfspot_img.php"; + $img = new PHPFSPOT_IMG; + if(isset($options[3]) && is_numeric($options[3])) + $img->showImg($options[2], $options[3]); + else + $img->showImg($options[2]); + } + exit; + break; + } + } + + } // parse_user_friendly_url() + + } // class PHPFSPOT ?> |