]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/unblock.php
move opening brace of class declaration to next line
[quix0rs-gnu-social.git] / actions / unblock.php
index 192beaab5b61eeade016745ca5b89a5457e65ac1..112304f71b41331d4aba4b6fb56f4b99b776a306 100644 (file)
 
 if (!defined('LACONICA')) { exit(1); }
 
-class UnblockAction extends Action {
+class UnblockAction extends Action
+{
 
-    var $profile = NULL;
+    var $profile = null;
 
-    function prepare($args) {
+    function prepare($args)
+    {
 
         parent::prepare($args);
 
@@ -32,12 +34,12 @@ class UnblockAction extends Action {
             return false;
         }
 
-               $token = $this->trimmed('token');
+        $token = $this->trimmed('token');
 
-               if (!$token || $token != common_session_token()) {
-                       $this->client_error(_('There was a problem with your session token. Try again, please.'));
-                       return;
-               }
+        if (!$token || $token != common_session_token()) {
+            $this->client_error(_('There was a problem with your session token. Try again, please.'));
+            return;
+        }
 
         $id = $this->trimmed('unblockto');
 
@@ -56,31 +58,23 @@ class UnblockAction extends Action {
         return true;
     }
 
-    function handle($args) {
+    function handle($args)
+    {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->unblock_profile();
         }
     }
 
-    function unblock_profile() {
+    function unblock_profile()
+    {
 
         $cur = common_current_user();
 
-        # Get the block record
-
-        $block = Profile_block::get($cur->id, $this->profile->id);
-
-        if (!$block) {
-            $this->client_error(_('That user is not blocked!'));
-            return;
-        }
-
-        $result = $block->delete();
+        $result = $cur->unblock($this->profile);
 
         if (!$result) {
-            common_log_db_error($block, 'DELETE', __FILE__);
-            $this->server_error(_('Could not delete block record.'));
+            $this->server_error(_('Error removing the block.'));
             return;
         }