]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/UserFlag/flagprofile.php
Updated geolocation sharing in notice form for Realtime pop
[quix0rs-gnu-social.git] / plugins / UserFlag / flagprofile.php
index 9bce7865b8c973114d42b12dacb804473183c25f..2d0f0abb90f80ced2063b2a461e46c6022fdda27 100644 (file)
@@ -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');