issue13, added first try of external link to directly jump to a photo
[phpfspot.git] / phpfspot.class.php
index 66dc4b5d97d297ebf8acc4d0f5efff6aec9d3ac5..dd634dbe70a8b8cc5cb974de880482dabf72030d 100644 (file)
@@ -12,7 +12,6 @@ class PHPFSPOT {
    var $tmpl;
    var $tags;
    var $avail_tags;
-   var $current_tags;
 
    public function __construct()
    {
@@ -64,6 +63,14 @@ class PHPFSPOT {
                $_SESSION['selected_tags'] = split(',', $_GET['tags']);
             }
             break;
+         case 'showp':
+            if(isset($_GET['tags'])) {
+               $_SESSION['selected_tags'] = split(',', $_GET['tags']);
+            }
+            if(isset($_GET['id'])) {
+               $_SESSION['current_photo'] = $_GET['id'];
+            }
+            break;
          case 'export':
             $this->tmpl->show("export.tpl");
             return;
@@ -192,6 +199,14 @@ class PHPFSPOT {
       $meta_make = isset($meta['Make']) ? $meta['Make'] ." ". $meta['Model'] : "n/a";
       $meta_size = isset($meta['FileSize']) ? round($meta['FileSize']/1024, 1) ."kbyte" : "n/a";
 
+      $current_tags = $this->getCurrentTags();
+      $extern_link = "index.php?mode=showp&id=". $photo;
+      if($current_tags != "") {
+         $extern_link.= "&tags=". $current_tags;
+      }
+
+      $this->tmpl->assign('extern_link', $extern_link);
+
       if(file_exists($thumb_path)) {
 
          $info = getimagesize($thumb_path);
@@ -328,6 +343,12 @@ class PHPFSPOT {
 
    } // resetTags()
 
+   public function resetPhotoView()
+   {
+      unset($_SESSION['current_photo']);
+
+   } // resetPhotoView();
+
    public function resetTagSearch()
    {
       unset($_SESSION['searchfor']);
@@ -585,13 +606,8 @@ class PHPFSPOT {
             $this->tmpl->assign('page_selector', $page_select);
       }
 
-      $current_tags = "";
-      if($_SESSION['selected_tags'] != "") {
-         foreach($_SESSION['selected_tags'] as $tag)
-            $current_tags.= $tag .",";
-         $current_tags = substr($current_tags, 0, strlen($current_tags)-1);
-      }
-
+      
+      $current_tags = $this->getCurrentTags();
       $extern_link = "index.php?mode=showpi";
       if($current_tags != "") {
          $extern_link.= "&tags=". $current_tags;
@@ -1159,7 +1175,7 @@ class PHPFSPOT {
                
             case 'MoinMoin':
                // [%pictureurl% %thumbnailurl%]
-               print htmlspecialchars("[$orig_url $thumb_url]") ."<br />\n";
+               print htmlspecialchars(" * [".$orig_url." ".$thumb_url."&fake=1.jpg]") ."<br />\n";
                break;
          }
 
@@ -1167,6 +1183,25 @@ class PHPFSPOT {
 
    } // getExport()
 
+   private function getCurrentTags()
+   {
+      $current_tags = "";
+      if($_SESSION['selected_tags'] != "") {
+         foreach($_SESSION['selected_tags'] as $tag)
+            $current_tags.= $tag .",";
+         $current_tags = substr($current_tags, 0, strlen($current_tags)-1);
+      }
+      return $current_tags;
+
+   } // getCurrentTags()
+
+   public function getCurrentPhoto()
+   {
+      if(isset($_SESSION['current_photo'])) {
+         print $_SESSION['current_photo'];
+      }
+   } // getCurrentPhoto()
+
 }
 
 ?>