X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=e6c4aff91e8b4f548ede61302c491cca57fa2be3;hp=d2bb907009a9a29d98809247f7699b1aecb65425;hb=aab7d4d07c16dc78a6d2a41223d469a1a60e5022;hpb=f3f12303def5f19118f086ca465d67032dc57706 diff --git a/phpfspot.class.php b/phpfspot.class.php index d2bb907..e6c4aff 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -157,6 +157,7 @@ class PHPFSPOT { "); } + /* get F-Spot database version */ $this->dbver = $this->getFspotDBVersion(); if(!is_writeable($this->cfg->base_path ."/templates_c")) { @@ -203,6 +204,14 @@ class PHPFSPOT { $this->tmpl->assign('web_path', $this->cfg->web_path); + /* Starting with F-Spot 0.4.2, the rating-feature was available */ + if($this->dbver > 10) { + $this->sort_orders = array_merge($this->sort_orders, array( + 'rate_asc' => 'Rate ↑', + 'rate_desc' => 'Rate ↓', + )); + } + /* check if all necessary indices exist */ $this->checkDbIndices(); @@ -425,10 +434,19 @@ class PHPFSPOT { "; } else { - $query_str = " - SELECT p.id, p.uri, p.time, p.description - FROM photos p - "; + /* till F-Spot version 0.4.1 */ + if($this->dbver < 11) { + $query_str = " + SELECT p.id, p.uri, p.time, p.description + FROM photos p + "; + } + else { + $query_str = " + SELECT p.id, p.uri, p.time, p.description, p.rating + FROM photos p + "; + } } /* if show_tags is set, only return details for photos which @@ -649,12 +667,12 @@ class PHPFSPOT { $this->tmpl->assign('current_img', $photo); if($previous_img) { - $this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");"); + $this->tmpl->assign('previous_url', "javascript:showPhoto(". $previous_img .");"); $this->tmpl->assign('prev_img', $previous_img); } if($next_img) { - $this->tmpl->assign('next_url', "javascript:showImage(". $next_img .");"); + $this->tmpl->assign('next_url', "javascript:showPhoto(". $next_img .");"); $this->tmpl->assign('next_img', $next_img); } $this->tmpl->assign('mini_width', $this->cfg->mini_width); @@ -778,17 +796,10 @@ class PHPFSPOT { break; case 'img': $output.= " -
-
- tags[$tag] ."\"> - cfg->web_path ."/phpfspot_img.php?tagidx=". $tag ."\" /> - -
-
- tags[$tag] ."\"> - cfg->web_path ."/resources/underbar.png\" /> - -
+
+ tags[$tag] ."\"> + cfg->web_path ."/phpfspot_img.php?tagidx=". $tag ."\" /> +
"; break; @@ -2545,6 +2556,12 @@ class PHPFSPOT { case 'tags_desc': return " ORDER BY t.name DESC ,p.time ASC"; break; + case 'rate_asc': + return " ORDER BY t.name ASC, p.rating ASC"; + break; + case 'rate_desc': + return " ORDER BY t.name DESC, p.rating DESC"; + break; } } // get_sort_order() @@ -3119,14 +3136,14 @@ class PHPFSPOT { { if(preg_match('/\/photoview\/|\/photo\/|\/tag\//', $request_uri)) { - unset($_SESSION['start_action']); - unset($_SESSION['selected_tags']); - $options = explode('/', $request_uri); switch($options[1]) { case 'photoview': if(is_numeric($options[2])) { + $this->session_cleanup(); + //unset($_SESSION['start_action']); + //unset($_SESSION['selected_tags']); $_GET['mode'] = 'showp'; return $this->showPhoto($options[2]); } @@ -3186,6 +3203,7 @@ class PHPFSPOT { $this->resetTagSearch(); $this->resetNameSearch(); $this->resetDateSearch(); + $this->resetTags(); } // session_cleanup()