. * * PHP version 5 * * @category Action * @package StatusNet * @author Brion Vibber * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } /** * Takes parameters: * * - feed: a profile ID * - token: session token to prevent CSRF attacks * - ajax: boolean; whether to return Ajax or full-browser results * * Only works if the current user is logged in. * * @category Action * @package StatusNet * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ class AddMirrorAction extends BaseMirrorAction { var $feedurl; /** * Check pre-requisites and instantiate attributes * * @param Array $args array of arguments (URL, GET, POST) * * @return boolean success flag */ function prepare($args) { parent::prepare($args); $this->feedurl = $this->validateFeedUrl($this->trimmed('feedurl')); $this->profile = $this->profileForFeed($this->feedurl); return true; } function saveMirror() { if ($this->oprofile->subscribe()) { SubMirror::saveMirror($this->user, $this->profile); } else { $this->serverError(_m("Could not subscribe to feed.")); } } }