* 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
* @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');
}
/**
*
* @return boolean true
*/
-
function prepare($argarray)
{
parent::prepare($argarray);
$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);
}
*
* @return void
*/
-
function handle($argarray=null)
{
parent::handle($argarray);
/**
* Send a feed of the user's activities to the browser
- *
+ *
* Uses the UserActivityStream class; may take a long time!
*
* @return void
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());
}
*
* @return void
*/
-
+
function showContent()
{
$form = new BackupAccountForm($this);
$form->show();
}
-
+
/**
* Return true if read only.
*
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
- return false;
+ return true;
}
/**
*
* @return string last modified http header
*/
-
function lastModified()
{
// For comparison with If-Last-Modified
*
* @return string etag http header
*/
-
function etag()
{
return null;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class BackupAccountForm extends Form
{
/**
*
* @return string the form's class
*/
-
function formClass()
{
return 'form_profile_backup';
*
* @return string the form's action URL
*/
-
function action()
{
return common_local_url('backupaccount');
/**
* 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 '.
/**
* 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.'));
}
}