. * * @category Action * @package StatusNet * @author Evan Prodromou * @author Sarven Capadisli * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } class ManagedAction extends Action { protected function prepare(array $args=array()) { if (!parent::prepare($args)) { return false; } $this->doPreparation(); return true; } protected function doPreparation() { // pass by default } /** * Handler method */ protected function handle() { parent::handle(); if ($this->canPost && $this->isPost()) { try { $this->msg = $this->handlePost(); } catch (Exception $e) { $this->error = $e->getMessage(); } } $this->showPage(); } protected function handlePost() { // This will only be run if the Action has the property canPost==true assert($this->canPost); } }