summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index f32782e..b4d8b17 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -747,11 +747,12 @@ class PHPFSPOT {
public function getPhotoSelection()
{
$matched_photos = Array();
+ $additional_where_cond = "";
if(isset($_SESSION['from_date']) && isset($_SESSION['to_date'])) {
$from_date = $_SESSION['from_date'];
$to_date = $_SESSION['to_date'];
- $additional_where_cond = "
+ $additional_where_cond.= "
p.time>='". $from_date ."'
AND
p.time<='". $to_date ."'
@@ -798,7 +799,7 @@ class PHPFSPOT {
ON pt2.tag_id=t2.id
WHERE t.name LIKE '%". $_SESSION['searchfor_tag'] ."%' ";
- if(isset($additional_where_cond))
+ if(isset($additional_where_cond) && !empty($additional_where_cond))
$query_str.= "AND ". $additional_where_cond ." ";
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
@@ -835,7 +836,7 @@ class PHPFSPOT {
ON pt1.photo_id=p.id
WHERE pt1.tag_id IN (". $selected .")
";
- if(isset($additional_where_cond))
+ if(isset($additional_where_cond) && !empty($additional_where_cond))
$query_str.= "AND ". $additional_where_cond ." ";
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
@@ -891,7 +892,7 @@ class PHPFSPOT {
AND pt". ($i+2) .".tag_id=". $_SESSION['selected_tags'][$i] ."
";
}
- if(isset($additional_where_cond))
+ if(isset($additional_where_cond) && !empty($additional_where_cond))
$query_str.= "AND ". $additional_where_cond;
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
@@ -920,11 +921,11 @@ class PHPFSPOT {
ON pt.tag_id=t.id
";
- if(isset($additional_where_cond))
+ if(isset($additional_where_cond) && !empty($additional_where_cond))
$query_str.= "WHERE ". $additional_where_cond ." ";
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
- if(isset($additional_where_cond))
+ if(isset($additional_where_cond) && !empty($additional_where_cond))
$query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')";
else
$query_str.= "WHERE t.name IN ('".implode("','",$this->cfg->show_tags). "')";
@@ -1469,7 +1470,7 @@ class PHPFSPOT {
* getPhotoSelection() will then only return the matching
* photos.
*/
- public function startSearch($searchfor_tag, $from = 0, $to = 0)
+ public function startSearch()
{
if(isset($_POST['from']) && $this->isValidDate($_POST['from'])) {
$from = $_POST['from'];
@@ -1480,28 +1481,27 @@ class PHPFSPOT {
if(isset($_POST['for_tag']) && is_string($_POST['for_tag'])) {
$searchfor_tag = $_POST['for_tag'];
+ $_SESSION['searchfor_tag'] = $_POST['for_tag'];
}
if(isset($_POST['for_name']) && is_string($_POST['for_name'])) {
$searchfor_name = $_POST['for_name'];
+ $_SESSION['searchfor_name'] = $_POST['for_name'];
}
$this->get_tags();
- $_SESSION['searchfor_tag'] = $searchfor_tag;
- $_SESSION['searchfor_name'] = $searchfor_name;
-
- if($from != 0)
+ if(isset($from) && !empty($from))
$_SESSION['from_date'] = strtotime($from ." 00:00:00");
else
unset($_SESSION['from_date']);
- if($to != 0)
+ if(isset($to) && !empty($to))
$_SESSION['to_date'] = strtotime($to ." 23:59:59");
else
unset($_SESSION['to_date']);
- if($searchfor_tag != "") {
+ if(isset($searchfor_tag) && !empty($searchfor_tag)) {
/* new search, reset the current selected tags */
$_SESSION['selected_tags'] = Array();
foreach($this->avail_tags as $tag) {