X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fcurrentuserdesignaction.php;h=7cd892022dfd8e0e77996ff83408d3f6747ec11f;hb=0b573e0d2b5c15e296d2520ba87cbb6a80f3837d;hp=4c7e15a8b7a4dd6c8f17d418847944508c0b4046;hpb=dd705ddaf751ee8132cdd52e47aeef259477912c;p=quix0rs-gnu-social.git diff --git a/lib/currentuserdesignaction.php b/lib/currentuserdesignaction.php index 4c7e15a8b7..7cd892022d 100644 --- a/lib/currentuserdesignaction.php +++ b/lib/currentuserdesignaction.php @@ -1,6 +1,6 @@ . * * @category Action - * @package Laconica - * @author Evan Prodromou - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009-2010 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); } @@ -38,55 +38,52 @@ if (!defined('LACONICA')) { * design. This superclass returns that design. * * @category Action - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou + * @author Zach Copley * @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/ * */ - class CurrentUserDesignAction extends Action { - /** - * Show the user's design stylesheet - * - * @return nothing - */ - - function showStylesheets() - { - parent::showStylesheets(); + protected $cur = null; // The current user - $user = common_current_user(); - - if (empty($user) || $user->viewdesigns) { - $design = $this->getDesign(); + /** + * For initializing members of the class. Set a the + * current user here. + * + * @param array $argarray misc. arguments + * + * @return boolean true + */ + function prepare($argarray) + { + parent::prepare($argarray); - if (!empty($design)) { - $design->showCSS($this); - } - } - } + $this->cur = common_current_user(); + } /** * A design for this action * - * if the user attribute has been set, returns that user's - * design. + * Returns the design preferences for the current user. * * @return Design a design object to use */ - function getDesign() { - $cur = common_current_user(); + if (!empty($this->cur)) { + + $design = $cur->getDesign(); - if (empty($cur)) { - return null; + if (!empty($design)) { + return $design; + } } - return $cur->getDesign(); + return parent::getDesign(); } }