diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2008-05-13 19:33:09 +0200 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2008-05-13 19:33:09 +0200 |
commit | 112916d4ffcc59590b3fd8753ea832c171167751 (patch) | |
tree | 2bbafb1206e7bfb8ccda8e59a90e833b67fa74f8 /phpfspot.class.php | |
parent | e3ff519ba724a0c3e3e682140e77b1fdb1100805 (diff) | |
parent | 8e14a6b9e1c7d2dfc25e786c425d76acc115f393 (diff) |
Merge branch 'friendlyurl'
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r-- | phpfspot.class.php | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index 49d0c7d..f938dbc 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -223,6 +223,11 @@ class PHPFSPOT { if(isset($_SESSION['begin_with']) && $this->cfg->thumbs_per_page == 0) unset($_SESSION['begin_with']); + // if user-friendly-url's are enabled, set also a flag for the template handler + if($this->is_user_friendly_url()) { + $this->tmpl->assign('user_friendly_url', 'true'); + } + } // __construct() public function __destruct() @@ -311,8 +316,8 @@ class PHPFSPOT { $this->tmpl->assign('date_search_enabled', true); $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('search_from_date', $this->get_calendar('from')); + $this->tmpl->assign('search_to_date', $this->get_calendar('to')); $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags()); $this->tmpl->assign('preset_available_tags', $this->getAvailableTags()); @@ -776,12 +781,12 @@ class PHPFSPOT { <div style=\"display: table-cell;\"> <div style=\"display: table-row; text-align: center;\"> <a href=\"javascript:Tags('del', ". $tag .");\" title=\"". $this->tags[$tag] ."\"> - <img src=\"phpfspot_img.php?tagidx=". $tag ."\" /> + <img src=\"". $this->cfg->web_path ."/phpfspot_img.php?tagidx=". $tag ."\" /> </a> </div> <div style=\"display: table-row; text-align: center;\"> <a href=\"javascript:Tags('del', ". $tag .");\" title=\"". $this->tags[$tag] ."\"> - <img src=\"resources/underbar.png\" /> + <img src=\"". $this->cfg->web_path ."/resources/underbar.png\" /> </a> </div> </div> @@ -1294,7 +1299,16 @@ class PHPFSPOT { else $style = ""; - $select = "<a href=\"javascript:showPhotoIndex(". (($i*$photo_per_page)-$photo_per_page) .");\""; + $start_with = ($i*$photo_per_page)-$photo_per_page; + + if($this->is_user_friendly_url()) { + $select = "<a href=\"". $this->cfg->web_path ."/tag/205/". $start_with ."\""; + } + else { + $select = "<a href=\"". $this->cfg->web_path ."/index.php?mode=showpi tags=". $current_tags ." begin_with=". $begin_with ."\""; + } + $select.= " onclick=\"showPhotoIndex(". $start_with ."); return false;\""; + if($style != "") $select.= $style; $select.= ">". $i ."</a> "; @@ -1332,7 +1346,6 @@ class PHPFSPOT { if($last_page > 1) $this->tmpl->assign('page_selector', $page_select); } - $current_tags = $this->getCurrentTags(); $extern_link = "index.php?mode=showpi"; @@ -2711,7 +2724,9 @@ class PHPFSPOT { */ private function ts2str($timestamp) { - return strftime("%Y-%m-%d", $timestamp); + if(!empty($timestamp) && is_numeric($timestamp)) + return strftime("%Y-%m-%d", $timestamp); + } // ts2str() /** @@ -3129,8 +3144,11 @@ class PHPFSPOT { break; case 'tag': if(is_numeric($options[2])) { + $this->session_cleanup(); $_GET['tags'] = $options[2]; $_SESSION['selected_tags'] = Array($options[2]); + if(isset($options[3]) && is_numeric($options[3])) + $_SESSION['begin_with'] = $options[3]; return $this->showPhotoIndex(); } break; @@ -3155,6 +3173,21 @@ class PHPFSPOT { } // is_user_friendly_url() + /** + * session cleanup + * + * this function will cleanup user's session information + */ + private function session_cleanup() + { + unset($_SESSION['begin_with']); + $this->resetDateSearch(); + $this->resetPhotoView(); + $this->resetTagSearch(); + $this->resetNameSearch(); + $this->resetDateSearch(); + + } // session_cleanup() } // class PHPFSPOT |