* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
class AddMirrorAction extends BaseMirrorAction
{
var $feedurl;
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
- $this->feedurl = $this->validateFeedUrl($this->trimmed('feedurl'));
+ $feedurl = $this->getFeedUrl();
+ $this->feedurl = $this->validateFeedUrl($feedurl);
$this->profile = $this->profileForFeed($this->feedurl);
return true;
}
+ function getFeedUrl()
+ {
+ $provider = $this->trimmed('provider');
+ switch ($provider) {
+ case 'feed':
+ return $this->trimmed('feedurl');
+ default:
+ // TRANS: Exception thrown when a feed provider could not be recognised.
+ throw new Exception(_m('Internal form error: Unrecognized feed provider.'));
+ }
+ }
+
function saveMirror()
{
if ($this->oprofile->subscribe()) {
SubMirror::saveMirror($this->user, $this->profile);
} else {
- $this->serverError(_m("Could not subscribe to feed."));
+ // TRANS: Exception thrown when a subscribing to a feed fails.
+ $this->serverError(_m('Could not subscribe to feed.'));
}
}
}