Permalink
Browse files

MDL-27341, fixed flickr public plugin should check

search text, tag and nsid before searching photos
  • Loading branch information...
1 parent cc50a2f commit 466b23caf7c6e038a1ee7f79a23f4e3c5589d092 @dcai dcai committed May 2, 2011
Showing with 13 additions and 13 deletions.
  1. +13 −13 repository/flickr_public/lib.php
View
26 repository/flickr_public/lib.php
@@ -280,19 +280,19 @@ public function search($search_text, $page = 1) {
$licenses = implode(',', $licenses);
- if (!empty($SESSION->{$this->sess_tag}) // use tag to search
- or !empty($SESSION->{$this->sess_text}) // use keyword to search
- or !empty($this->nsid)/*use pre-defined accound*/) {
- $photos = $this->flickr->photos_search(array(
- 'tags'=>$SESSION->{$this->sess_tag},
- 'page'=>$page,
- 'per_page'=>24,
- 'user_id'=>$this->nsid,
- 'license'=>$licenses,
- 'text'=>$SESSION->{$this->sess_text}
- )
- );
- }
+ $tag = !empty($SESSION->{$this->sess_tag}) ? $SESSION->{$this->sess_tag} : null;
+ $text = !empty($SESSION->{$this->sess_text}) ? $SESSION->{$this->sess_text} : null;
+ $nsid = !empty($this->nsid) ? $this->nsid : null;
+
+ $photos = $this->flickr->photos_search(array(
+ 'tags'=>$tag,
+ 'page'=>$page,
+ 'per_page'=>24,
+ 'user_id'=>$nsid,
+ 'license'=>$licenses,
+ 'text'=>$text
+ )
+ );
$ret['total'] = $photos['total'];
$ret['perpage'] = $photos['perpage'];
if (empty($photos)) {

0 comments on commit 466b23c

Please sign in to comment.