avoid error messages if $_SESSION['selected_tags'] is set with an empty value in...
[phpfspot.git] / phpfspot.class.php
index 391589a591d11c2068a34a87d36845b5c12a58d6..13517f2550e14444e209e05a7b795c291cf1731b 100644 (file)
@@ -23,8 +23,7 @@ class PHPFSPOT {
 
       $this->cfg = new PHPFSPOT_CFG;
 
-      $this->db = new PHPFSPOT_DB(&$this, $this->cfg->fspot_db);
-
+      $this->db  = new PHPFSPOT_DB(&$this, $this->cfg->fspot_db);
       $this->cfg_db = new PHPFSPOT_DB(&$this, $this->cfg->phpfspot_db);
       $this->check_config_table();
 
@@ -69,6 +68,7 @@ class PHPFSPOT {
 
    private function get_tags()
    {
+   
       $this->avail_tags = Array();
       $count = 0;
    
@@ -436,9 +436,12 @@ class PHPFSPOT {
       }
 
       $current_tags = "";
-      foreach($_SESSION['selected_tags'] as $tag)
-         $current_tags.= $tag .",";
-      $current_tags = substr($current_tags, 0, strlen($current_tags)-1);
+      if($_SESSION['selected_tags'] != "") {
+         foreach($_SESSION['selected_tags'] as $tag)
+            $current_tags.= $tag .",";
+         $current_tags = substr($current_tags, 0, strlen($current_tags)-1);
+      }
+
       $extern_link = "http://". $_SERVER['SERVER_NAME'] ."/index.php?mode=showpi&tags=". $current_tags;
 
       $this->tmpl->assign('extern_link', $extern_link);
@@ -846,7 +849,7 @@ class PHPFSPOT {
 
       /* Check for HTML_AJAX PEAR package, lent from Horde project */
       ini_set('track_errors', 1);
-      @include 'HTML/AJAX/Server.php';
+      @include_once 'HTML/AJAX/Server.php';
       if(isset($php_errormsg)) {
          print "PEAR HTML_AJAX package is missing<br />\n";
          $missing = true;