diff options
author | Evan Prodromou <evan@status.net> | 2009-12-28 15:49:14 -0800 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-28 15:49:14 -0800 |
commit | 98a579fedf36ff795e255a4b345651df0ee230bc (patch) | |
tree | 2eba012e0094cced9580523051b8ed88b6aefd6b /plugins/UserFlag/flagprofile.php | |
parent | 5f6df8c0c4274e7d900335bba87341f9768e7467 (diff) | |
parent | fa3301cf84ee0a78c4e00c7bd309de8a769fd848 (diff) |
Merge branch 'master' into 0.9.x
Diffstat (limited to 'plugins/UserFlag/flagprofile.php')
-rw-r--r-- | plugins/UserFlag/flagprofile.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/plugins/UserFlag/flagprofile.php b/plugins/UserFlag/flagprofile.php index 9bce7865b..2d0f0abb9 100644 --- a/plugins/UserFlag/flagprofile.php +++ b/plugins/UserFlag/flagprofile.php @@ -63,8 +63,7 @@ class FlagprofileAction extends ProfileFormAction assert(!empty($this->profile)); // checked above if (User_flag_profile::exists($this->profile->id, - $user->id)) - { + $user->id)) { $this->clientError(_('Flag already exists.')); return false; } @@ -72,7 +71,6 @@ class FlagprofileAction extends ProfileFormAction return true; } - /** * Handle request * @@ -107,25 +105,23 @@ class FlagprofileAction extends ProfileFormAction assert(!empty($user)); assert(!empty($this->profile)); - $ufp = new User_flag_profile(); - - $ufp->profile_id = $this->profile->id; - $ufp->user_id = $user->id; - $ufp->created = common_sql_now(); + // throws an exception on error - if (!$ufp->insert()) { - throw new ServerException(sprintf(_("Couldn't flag profile '%s' for review."), - $this->profile->nickname)); - } - - $ufp->free(); + User_flag_profile::create($user->id, $this->profile->id); if ($this->boolean('ajax')) { $this->ajaxResults(); } } - function ajaxResults() { + /** + * Return results as AJAX message + * + * @return void + */ + + function ajaxResults() + { header('Content-Type: text/xml;charset=utf-8'); $this->xw->startDocument('1.0', 'UTF-8'); $this->elementStart('html'); |