]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/backupaccount.php
Improved type-hint for following methods:
[quix0rs-gnu-social.git] / actions / backupaccount.php
index 4f6fb936bd23c9b2a86e0944d9a73e849a158583..4d7b6fcfcd653f4ed2b5f0d978b3ed83ffb5e9f4 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2010, StatusNet, Inc.
  *
  * Download a backup of your own account to the browser
- * 
+ *
  * PHP version 5
  *
  * This program is free software: you can redistribute it and/or modify
@@ -48,18 +48,17 @@ if (!defined('STATUSNET')) {
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-
 class BackupaccountAction extends Action
 {
     /**
      * Returns the title of the page
-     * 
+     *
      * @return string page title
      */
-
     function title()
     {
-        return _("Backup account");
+        // TRANS: Title for backup account page.
+        return _('Backup account');
     }
 
     /**
@@ -69,7 +68,6 @@ class BackupaccountAction extends Action
      *
      * @return boolean true
      */
-
     function prepare($argarray)
     {
         parent::prepare($argarray);
@@ -77,10 +75,12 @@ class BackupaccountAction extends Action
         $cur = common_current_user();
 
         if (empty($cur)) {
+            // TRANS: Client exception thrown when trying to backup an account while not logged in.
             throw new ClientException(_('Only logged-in users can backup their account.'), 403);
         }
 
         if (!$cur->hasRight(Right::BACKUPACCOUNT)) {
+            // TRANS: Client exception thrown when trying to backup an account without having backup rights.
             throw new ClientException(_('You may not backup your account.'), 403);
         }
 
@@ -94,7 +94,6 @@ class BackupaccountAction extends Action
      *
      * @return void
      */
-
     function handle($argarray=null)
     {
         parent::handle($argarray);
@@ -109,7 +108,7 @@ class BackupaccountAction extends Action
 
     /**
      * Send a feed of the user's activities to the browser
-     * 
+     *
      * Uses the UserActivityStream class; may take a long time!
      *
      * @return void
@@ -118,12 +117,14 @@ class BackupaccountAction extends Action
     function sendFeed()
     {
         $cur = common_current_user();
-        
-        $stream = new UserActivityStream($cur);
+
+        $stream = new UserActivityStream($cur, true, UserActivityStream::OUTPUT_RAW);
 
         header('Content-Disposition: attachment; filename='.$cur->nickname.'.atom');
         header('Content-Type: application/atom+xml; charset=utf-8');
 
+        // @fixme atom feed logic is in getString...
+        // but we just want it to output to the outputter.
         $this->raw($stream->getString());
     }
 
@@ -132,13 +133,13 @@ class BackupaccountAction extends Action
      *
      * @return void
      */
-    
+
     function showContent()
     {
         $form = new BackupAccountForm($this);
         $form->show();
     }
+
     /**
      * Return true if read only.
      *
@@ -148,10 +149,9 @@ class BackupaccountAction extends Action
      *
      * @return boolean is read only action?
      */
-
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
-        return false;
+        return true;
     }
 
     /**
@@ -161,7 +161,6 @@ class BackupaccountAction extends Action
      *
      * @return string last modified http header
      */
-
     function lastModified()
     {
         // For comparison with If-Last-Modified
@@ -176,7 +175,6 @@ class BackupaccountAction extends Action
      *
      * @return string etag http header
      */
-
     function etag()
     {
         return null;
@@ -193,7 +191,6 @@ class BackupaccountAction extends Action
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-
 class BackupAccountForm extends Form
 {
     /**
@@ -201,7 +198,6 @@ class BackupAccountForm extends Form
      *
      * @return string the form's class
      */
-
     function formClass()
     {
         return 'form_profile_backup';
@@ -212,7 +208,6 @@ class BackupAccountForm extends Form
      *
      * @return string the form's action URL
      */
-
     function action()
     {
         return common_local_url('backupaccount');
@@ -220,18 +215,18 @@ class BackupAccountForm extends Form
 
     /**
      * Output form data
-     * 
+     *
      * Really, just instructions for doing a backup.
      *
      * @return void
      */
-
     function formData()
     {
         $msg =
+            // TRANS: Information displayed on the backup account page.
             _('You can backup your account data in '.
               '<a href="http://activitystrea.ms/">Activity Streams</a> '.
-              'format.  This is an experimental feature and provides an '.
+              'format. This is an experimental feature and provides an '.
               'incomplete backup; private account '.
               'information like email and IM addresses is not backed up. '.
               'Additionally, uploaded files and direct messages are not '.
@@ -243,18 +238,19 @@ class BackupAccountForm extends Form
 
     /**
      * Buttons for the form
-     * 
+     *
      * In this case, a single submit button
      *
      * @return void
      */
-
     function formActions()
     {
         $this->out->submit('submit',
+                           // TRANS: Submit button to backup an account on the backup account page.
                            _m('BUTTON', 'Backup'),
                            'submit',
                            null,
-                           _('Backup your account'));
+                           // TRANS: Title for submit button to backup an account on the backup account page.
+                           _('Backup your account.'));
     }
 }