]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/deleteapplication.php
Improved type-hint for following methods:
[quix0rs-gnu-social.git] / actions / deleteapplication.php
index 806de0be6eccbee182f8dfe45184bb7f68f7c179..1d9e6d1bb5bf84c6ebc715c882782d1522541772 100644 (file)
@@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  * @link     http://status.net/
  */
-
 class DeleteapplicationAction extends Action
 {
     var $app = null;
@@ -52,31 +51,30 @@ class DeleteapplicationAction extends Action
      *
      * @return boolean success flag
      */
-
-    function prepare($args)
+    function prepare(array $args=array())
     {
         if (!parent::prepare($args)) {
             return false;
         }
 
         if (!common_logged_in()) {
+            // TRANS: Client error displayed trying to delete an application while not logged in.
             $this->clientError(_('You must be logged in to delete an application.'));
-            return false;
         }
 
         $id        = (int)$this->arg('id');
-        $this->app = Oauth_application::staticGet('id', $id);
+        $this->app = Oauth_application::getKV('id', $id);
 
         if (empty($this->app)) {
+            // TRANS: Client error displayed trying to delete an application that does not exist.
             $this->clientError(_('Application not found.'));
-            return false;
         }
 
         $cur = common_current_user();
 
         if ($cur->id != $this->app->owner) {
+            // TRANS: Client error displayed trying to delete an application the current user does not own.
             $this->clientError(_('You are not the owner of this application.'), 401);
-            return false;
         }
 
         return true;
@@ -91,16 +89,15 @@ class DeleteapplicationAction extends Action
      *
      * @return void
      */
-
-    function handle($args)
+    function handle(array $args=array())
     {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 
             // CSRF protection
             $token = $this->trimmed('token');
             if (!$token || $token != common_session_token()) {
+                // TRANS: Client error displayed when the session token does not match or is not given.
                 $this->clientError(_('There was a problem with your session token.'));
-                return;
             }
 
             if ($this->arg('no')) {
@@ -120,6 +117,7 @@ class DeleteapplicationAction extends Action
     }
 
     function title() {
+        // TRANS: Title for delete application page.
         return _('Delete application');
     }
 
@@ -144,8 +142,10 @@ class DeleteapplicationAction extends Action
                                                                        array('id' => $this->app->id))));
         $this->elementStart('fieldset');
         $this->hidden('token', common_session_token());
+        // TRANS: Fieldset legend on delete application page.
         $this->element('legend', _('Delete application'));
         $this->element('p', null,
+                       // TRANS: Confirmation text on delete application page.
                        _('Are you sure you want to delete this application? '.
                          'This will clear all data about the application from the '.
                          'database, including all existing user connections.'));
@@ -155,13 +155,13 @@ class DeleteapplicationAction extends Action
                       'submit form_action-primary',
                       'no',
                       // TRANS: Submit button title for 'No' when deleting an application.
-                      _('Do not delete this application'));
+                      _('Do not delete this application.'));
         $this->submit('form_action-yes',
                       // TRANS: Button label on the delete application form.
                       _m('BUTTON','Yes'),
                       'submit form_action-secondary',
                       // TRANS: Submit button title for 'Yes' when deleting an application.
-                      'yes', _('Delete this application'));
+                      'yes', _('Delete this application.'));
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
     }
@@ -171,10 +171,8 @@ class DeleteapplicationAction extends Action
      *
      * @return void
      */
-
     function handlePost()
     {
         $this->app->delete();
     }
 }
-