]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
show dropdown of tags only when tags are available and add tags function to profile
authorEvan Prodromou <evan@prodromou.name>
Mon, 24 Nov 2008 01:58:02 +0000 (20:58 -0500)
committerEvan Prodromou <evan@prodromou.name>
Mon, 24 Nov 2008 01:58:02 +0000 (20:58 -0500)
darcs-hash:20081124015802-84dde-d72651ff0c466d15835fe263e96bdd9b34162849.gz

classes/Profile.php
lib/gallery.php

index 794dc1de93c8857e2f23c92f30930342fb7890c2..2d6b48217cb3924a385ae87a7c4c03a90ed50aac 100644 (file)
@@ -145,4 +145,17 @@ class Profile extends Memcached_DataObject
                }
                return NULL;
        }
+       
+       # Get list of tags we tagged other users with
+       
+       function getAllTags() {
+               $profile_tag = new Notice_tag();
+               $profile_tag->query('SELECT DISTINCT(tag) FROM profile_tag WHERE tagger = ' . $this->id);
+               $tags = array();
+               while ($profile_tag->fetch()) {
+                       $tags[] = $profile_tag->tag;
+               }
+               $profile_tag->free();
+               return $tags;
+       }
 }
index ca89e1029f668d52b6ffd5d08941c54a4406cdef..8410768197c6f345a33449a97018f035a262cbbd 100644 (file)
@@ -86,14 +86,16 @@ class GalleryAction extends Action {
                foreach ($tags as $t) {
                        $content[common_local_url($this->trimmed('action'), array('tag' => $t))] = $t;
                }
-               common_element('a', array('href' => common_local_url($this->trimmed('action'),
-                                                                                                                        array('nickname' => $profile->nickname))),
-                                          _('All'));
-               common_element_start('form', array('name' => 'bytag', 'id' => 'bytag'));
-               common_dropdown('tag', _('Tag'), $content,
-                                               _('Choose a tag to narrow list'), FALSE, $tag);
-               common_submit('go', _('Go'));
-               common_element_end('form');
+               if ($tags) {
+                       common_element('a', array('href' => common_local_url($this->trimmed('action'),
+                                                                                                                                array('nickname' => $profile->nickname))),
+                                                  _('All'));
+                       common_element_start('form', array('name' => 'bytag', 'id' => 'bytag'));
+                       common_dropdown('tag', _('Tag'), $content,
+                                                       _('Choose a tag to narrow list'), FALSE, $tag);
+                       common_submit('go', _('Go'));
+                       common_element_end('form');
+               }
        }
        
        function show_top($profile) {
@@ -119,7 +121,7 @@ class GalleryAction extends Action {
                }
 
                # XXX: memcached results
-               # XXX: SQL injection on $tag
+               # FIXME: SQL injection on $tag
                
                $other->query('SELECT profile.* ' .
                                          'FROM profile JOIN subscription ' .