issue46, added a javascript-based slider to modify slide-interval
[phpfspot.git] / phpfspot.class.php
index ffb511d97361df9c475132a27bb0c9e4cc6d7f99..2a2813545045235f2503eeeb7455efe4a14bdf91 100644 (file)
@@ -58,8 +58,13 @@ class PHPFSPOT {
       }
          
       $this->cfg_db = new PHPFSPOT_DB(&$this, $this->cfg->phpfspot_db);
+      if(!is_writeable($this->cfg->phpfspot_db)) {
+         print $this->cfg->phpfspot_db ." is not writeable for user ". $this->getuid() ."\n";
+         exit(1);
+      }
       $this->check_config_table();
 
+
       $this->tmpl = new PHPFSPOT_TMPL($this);
 
       $this->get_tags();
@@ -100,6 +105,7 @@ class PHPFSPOT {
       $this->tmpl->assign('searchfor', $_SESSION['searchfor']);
       $this->tmpl->assign('page_title', $this->cfg->page_title);
       $this->tmpl->assign('current_condition', $_SESSION['tag_condition']);
+      $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name);
 
       $_SESSION['start_action'] = $_GET['mode'];
 
@@ -1660,6 +1666,12 @@ class PHPFSPOT {
 
    } // get_sort_order()
 
+   /***
+     * return the next to be shown slide show image
+     *
+     * this function returns the URL of the next image
+     * in the slideshow sequence.
+     */
    public function getNextSlideShowImage()
    {
       $all_photos = $this->getPhotoSelection();
@@ -1677,6 +1689,29 @@ class PHPFSPOT {
 
    } // getNextSlideShowImage()
 
+   /***
+     * return the previous to be shown slide show image
+     *
+     * this function returns the URL of the previous image
+     * in the slideshow sequence.
+     */
+   public function getPrevSlideShowImage()
+   {
+      $all_photos = $this->getPhotoSelection();
+
+      if(!isset($_SESSION['slideshow_img']) || $_SESSION['slideshow_img'] == 0)
+         $_SESSION['slideshow_img'] = 0;
+      else
+         $_SESSION['slideshow_img']--;
+
+      $server_name = $_SERVER['SERVER_NAME'];
+      if(!isset($_SERVER['HTTPS'])) $protocol = "http";
+      else $protocol = "https";
+
+      return $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $all_photos[$_SESSION['slideshow_img']] ."&width=". $this->cfg->photo_width;
+
+   } // getPrevSlideShowImage()
+
    public function resetSlideShow()
    {
       if(isset($_SESSION['slideshow_img']))