X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgroupdesignsettings.php;h=1c998efe1e215772beb8e96facbd4084341ab7ff;hb=fe181002814359620e962454444917580ee51970;hp=79c192ac466bceeb9b0988a67ade4a9ae2ab7aad;hpb=612a107e09619b92d4614e2f3076ddca5c65824c;p=quix0rs-gnu-social.git diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php index 79c192ac46..1c998efe1e 100644 --- a/actions/groupdesignsettings.php +++ b/actions/groupdesignsettings.php @@ -1,6 +1,6 @@ . * * @category Settings - * @package Laconica - * @author Sarven Capadisli - * @author Zach Copley - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Sarven Capadisli + * @author Zach Copley + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } require_once INSTALLDIR . '/lib/designsettings.php'; +/** + * Set a group's design + * + * Saves a design for a given group + * + * @category Settings + * @package StatusNet + * @author Zach Copley + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + class GroupDesignSettingsAction extends DesignSettingsAction { var $group = null; /** - * Prepare to run + * Sets the right action for the form, and passes request args into + * the base action + * + * @param array $args misc. arguments + * + * @return boolean true */ function prepare($args) { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to edit a group.')); return false; } $nickname_arg = $this->trimmed('nickname'); - $nickname = common_canonical_nickname($nickname_arg); + $nickname = common_canonical_nickname($nickname_arg); // Permanent redirect on non-canonical nickname @@ -158,18 +171,14 @@ class GroupDesignSettingsAction extends DesignSettingsAction * @return Design */ - function getWorkingDesign() { - + function getWorkingDesign() + { $design = null; if (isset($this->group)) { $design = $this->group->getDesign(); } - if (empty($design)) { - $design = $this->defaultDesign(); - } - return $design; } @@ -183,7 +192,13 @@ class GroupDesignSettingsAction extends DesignSettingsAction function showContent() { - $this->showDesignForm($this->getWorkingDesign()); + $design = $this->getWorkingDesign(); + + if (empty($design)) { + $design = Design::siteDesign(); + } + + $this->showDesignForm($design); } /** @@ -273,9 +288,9 @@ class GroupDesignSettingsAction extends DesignSettingsAction return; } - $original = clone($this->group); + $original = clone($this->group); $this->group->design_id = $id; - $result = $this->group->update($original); + $result = $this->group->update($original); if (empty($result)) { common_log_db_error($original, 'UPDATE', __FILE__); @@ -293,36 +308,4 @@ class GroupDesignSettingsAction extends DesignSettingsAction $this->showForm(_('Design preferences saved.'), true); } - /** - * Handle input and output a page (overrided) - * - * @param array $args $_REQUEST arguments - * - * @return void - */ - - function handle($args) - { - parent::handle($args); - if (!common_logged_in()) { - $this->clientError(_('Not logged in.')); - return; - } else if (!common_is_real_login()) { - // Cookie theft means that automatic logins can't - // change important settings or see private info, and - // _all_ our settings are important - common_set_returnto($this->selfUrl()); - $user = common_current_user(); - if ($user->hasOpenID()) { - common_redirect(common_local_url('openidlogin'), 303); - } else { - common_redirect(common_local_url('login'), 303); - } - } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $this->handlePost(); - } else { - $this->showForm(); - } - } - }