summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-01-20 15:59:31 +0100
committerAndreas Unterkircher <unki@netshadow.at>2008-01-20 15:59:31 +0100
commit8f46e095700c4c44b0aa3e216ca9b43bcc2fe9e6 (patch)
treed7b2e4ae61cfdde72716e125702c39d2babae8f1
parenta0a0b23b1133d0fc28c44dd68298850c630f7b3d (diff)
code-cleanup to avoid PHP notice messages
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
-rw-r--r--phpfspot.class.php26
-rw-r--r--rpc.php2
2 files changed, 14 insertions, 14 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) {
diff --git a/rpc.php b/rpc.php
index ad80ca5..f850dad 100644
--- a/rpc.php
+++ b/rpc.php
@@ -110,7 +110,7 @@ class PHPFSPOT_RPC {
break;
case 'search':
- print $fspot->startSearch($_GET['for']);
+ print $fspot->startSearch();
break;
case 'update_sort_order':