X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile_tag.php;h=39095aeddedeb07f47bbac8c419e0599e625fdb6;hb=fcf47f315bd7df92c0befb7a0caa26e107ceac29;hp=0d90d4da1415dc6c2b30fdc7dac752642fd5c2be;hpb=707f90d0127e2c994f38d0708e7c829f9b26c2d0;p=quix0rs-gnu-social.git diff --git a/classes/Profile_tag.php b/classes/Profile_tag.php index 0d90d4da14..39095aedde 100644 --- a/classes/Profile_tag.php +++ b/classes/Profile_tag.php @@ -15,10 +15,6 @@ class Profile_tag extends Managed_DataObject public $tag; // varchar(64) primary_key not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP - /* Static get */ - function staticGet($k,$v=null) - { return Memcached_DataObject::staticGet('Profile_tag',$k,$v); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -46,10 +42,6 @@ class Profile_tag extends Managed_DataObject ); } - function pkeyGet($kv) { - return Memcached_DataObject::pkeyGet('Profile_tag', $kv); - } - function links() { return array('tagger,tag' => 'profile_list:tagger,tag'); @@ -100,13 +92,13 @@ class Profile_tag extends Managed_DataObject { $ptag = new Profile_tag(); - $qry = sprint('select profile_tag.tag '. - 'from profile_tag join profile_list '. - ' on (profile_tag.tagger = profile_list.tagger ' . - ' and profile_tag.tag = profile_list.tag) ' . - 'where profile_tag.tagger = %d ' . - 'and profile_tag.tagged = %d ', - $tagger, $tagged); + $qry = sprintf('select profile_tag.tag '. + 'from profile_tag join profile_list '. + ' on (profile_tag.tagger = profile_list.tagger ' . + ' and profile_tag.tag = profile_list.tag) ' . + 'where profile_tag.tagger = %d ' . + 'and profile_tag.tagged = %d ', + $tagger, $tagged); if ($auth_user_id != $tagger) { $qry .= 'and profile_list.private = 0'; @@ -114,7 +106,7 @@ class Profile_tag extends Managed_DataObject $tags = array(); - $ptag->query($sql); + $ptag->query($qry); while ($ptag->fetch()) { $tags[] = $ptag->tag; @@ -161,8 +153,8 @@ class Profile_tag extends Managed_DataObject return $ptag; } - $tagger_profile = Profile::staticGet('id', $tagger); - $tagged_profile = Profile::staticGet('id', $tagged); + $tagger_profile = Profile::getKV('id', $tagger); + $tagged_profile = Profile::getKV('id', $tagged); if (Event::handle('StartTagProfile', array($tagger_profile, $tagged_profile, $tag))) { @@ -193,7 +185,7 @@ class Profile_tag extends Managed_DataObject if ($profile_list->taggedCount() >= common_config('peopletag', 'maxpeople')) { // TRANS: Client exception thrown when trying to add more people than allowed to a list. throw new ClientException(sprintf(_('You already have %1$d or more people in list %2$s, ' . - 'which is the maximum allowed number.' . + 'which is the maximum allowed number. ' . 'Try unlisting others first.'), common_config('peopletag', 'maxpeople'), $tag)); return false; @@ -284,8 +276,11 @@ class Profile_tag extends Managed_DataObject 'tag = "%s", tagger = "%s" ' . 'WHERE tag = "%s" ' . 'AND tagger = "%s"'; - $result = $tags->query(sprintf($qry, $new->tag, $new->tagger, - $orig->tag, $orig->tagger)); + $result = $tags->query(sprintf($qry, + $tags->escape($new->tag), + $tags->escape($new->tagger), + $tags->escape($orig->tag), + $tags->escape($orig->tagger))); if (!$result) { common_log_db_error($tags, 'UPDATE', __FILE__); @@ -307,8 +302,8 @@ class Profile_tag extends Managed_DataObject $profile->query('SELECT profile.* ' . 'FROM profile JOIN profile_tag ' . 'ON profile.id = profile_tag.tagged ' . - 'WHERE profile_tag.tagger = ' . $tagger . ' ' . - 'AND profile_tag.tag = "' . $tag . '" '); + 'WHERE profile_tag.tagger = ' . $profile->escape($tagger) . ' ' . + 'AND profile_tag.tag = "' . $profile->escape($tag) . '" '); $tagged = array(); while ($profile->fetch()) { $tagged[] = clone($profile);