X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=d2bb907009a9a29d98809247f7699b1aecb65425;hp=55bd713abedcc4f1818a3eb1a020e991ca90e480;hb=597c52097954f47e89451fea0086cf9c606be7d2;hpb=ca733ba231fa3da5dc9c6eb0d80eca175c7afe5e diff --git a/phpfspot.class.php b/phpfspot.class.php index 55bd713..d2bb907 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,16 +316,20 @@ 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()); if(!isset($content)) { - $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags()); - $this->tmpl->assign('preset_available_tags', $this->getAvailableTags()); - $this->tmpl->assign('content_page', $this->tmpl->fetch('welcome.tpl')); + if(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags'])) + $this->tmpl->assign('initial_content', $this->showPhotoIndex()); + else + $this->tmpl->assign('initial_content', $this->tmpl->fetch('welcome.tpl')); } else - $this->tmpl->assign('content_page', $content); + $this->tmpl->assign('initial_content', $content); $this->tmpl->show("index.tpl"); @@ -730,9 +739,11 @@ class PHPFSPOT { $b = '88'; if(isset($this->tags[$key])) { - $output.= "". $this->tags[$key] .", "; + if($this->is_user_friendly_url()) + $output.= "cfg->web_path ."/tag/". $key ."\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] .", "; + else + $output.= "cfg->web_path ."/index.php?mode=showpi\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] .", "; } - } $output = substr($output, 0, strlen($output)-2); @@ -770,12 +781,12 @@ class PHPFSPOT {
tags[$tag] ."\"> - + cfg->web_path ."/phpfspot_img.php?tagidx=". $tag ."\" />
tags[$tag] ."\"> - + cfg->web_path ."/resources/underbar.png\" />
@@ -861,7 +872,7 @@ class PHPFSPOT { } // resetTags() /** - * returns the value for the autocomplet tag-search + * returns the value for the autocomplete tag-search * @return string */ public function get_xml_tag_list() @@ -1176,6 +1187,7 @@ class PHPFSPOT { * * this function provides all the necessary information * for the photo index template. + * @return string */ public function showPhotoIndex() { @@ -1287,7 +1299,16 @@ class PHPFSPOT { else $style = ""; - $select = "is_user_friendly_url()) { + $select = "cfg->web_path ."/tag/205/". $start_with ."\""; + } + else { + $select = "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 ." "; @@ -1325,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"; @@ -2704,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() /** @@ -3122,9 +3144,11 @@ class PHPFSPOT { break; case 'tag': if(is_numeric($options[2])) { - $_GET['mode'] = 'showpi'; - $_SESSION['selected_tags'] = Array($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; @@ -3149,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