Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
This commit is contained in:
commit
c227045975
@ -1,215 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Update the authenticating user's profile background image
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 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('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
|
||||
/**
|
||||
* Update the authenticating user's profile background image
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
|
||||
{
|
||||
var $tile = false;
|
||||
|
||||
/**
|
||||
* Take arguments for running
|
||||
*
|
||||
* @param array $args $_REQUEST args
|
||||
*
|
||||
* @return boolean success flag
|
||||
*
|
||||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->user = $this->auth_user;
|
||||
$this->tile = $this->arg('tile');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the request
|
||||
*
|
||||
* Check whether the credentials are valid and output the result
|
||||
*
|
||||
* @param array $args $_REQUEST data (unused)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
$this->clientError(
|
||||
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||
_('This method requires a POST.'),
|
||||
400, $this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array($this->format, array('xml', 'json'))) {
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed when coming across a non-supported API method.
|
||||
_('API method not found.'),
|
||||
404,
|
||||
$this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for PHP returning empty $_POST and $_FILES when POST
|
||||
// length > post_max_size in php.ini
|
||||
|
||||
if (empty($_FILES)
|
||||
&& empty($_POST)
|
||||
&& ($_SERVER['CONTENT_LENGTH'] > 0)
|
||||
) {
|
||||
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
|
||||
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
|
||||
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
|
||||
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
|
||||
intval($_SERVER['CONTENT_LENGTH']));
|
||||
|
||||
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client error when user not found updating a profile background image.
|
||||
$this->clientError(_('No such user.'), 404, $this->format);
|
||||
return;
|
||||
}
|
||||
|
||||
$design = $this->user->getDesign();
|
||||
|
||||
// XXX: This is kinda gross, but before we can add a background
|
||||
// img we have to make sure there's a Design because design ID
|
||||
// is part of the img filename.
|
||||
|
||||
if (empty($design)) {
|
||||
$this->user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Client error displayed when saving design settings fails because of an empty id.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($this->user);
|
||||
$this->user->design_id = $id;
|
||||
$result = $this->user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Client error displayed when saving design settings fails because of an empty result.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
$this->user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->user->query('COMMIT');
|
||||
}
|
||||
|
||||
// Okay, now get the image and add it to the design
|
||||
|
||||
try {
|
||||
$imagefile = ImageFile::fromUpload('image');
|
||||
} catch (Exception $e) {
|
||||
$this->clientError($e->getMessage(), 400, $this->format);
|
||||
return;
|
||||
}
|
||||
|
||||
$filename = Design::filename(
|
||||
$design->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
common_timestamp()
|
||||
);
|
||||
|
||||
$filepath = Design::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
|
||||
// delete any old backround img laying around
|
||||
|
||||
if (isset($design->backgroundimage)) {
|
||||
@unlink(Design::path($design->backgroundimage));
|
||||
}
|
||||
|
||||
$original = clone($design);
|
||||
$design->backgroundimage = $filename;
|
||||
$design->setDisposition(true, false, ($this->tile == 'true'));
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Error displayed when updating design settings fails.
|
||||
$this->showForm(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
if (empty($profile)) {
|
||||
// TRANS: Error message displayed when referring to a user without a profile.
|
||||
$this->clientError(_('User has no profile.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$twitter_user = $this->twitterUserArray($profile, true);
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
$this->showJsonObjects($twitter_user);
|
||||
$this->endDocument('json');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,242 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Update a user's design colors
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @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://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
|
||||
/**
|
||||
* Sets one or more hex values that control the color scheme of the
|
||||
* authenticating user's design
|
||||
*
|
||||
* @category API
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||
{
|
||||
var $profile_background_color = null;
|
||||
var $profile_text_color = null;
|
||||
var $profile_link_color = null;
|
||||
var $profile_sidebar_fill_color = null;
|
||||
var $profile_sidebar_border_color = null;
|
||||
|
||||
/**
|
||||
* Take arguments for running
|
||||
*
|
||||
* @param array $args $_REQUEST args
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->user = $this->auth_user;
|
||||
|
||||
$this->profile_background_color
|
||||
= $this->trimmed('profile_background_color');
|
||||
$this->profile_text_color
|
||||
= $this->trimmed('profile_text_color');
|
||||
$this->profile_link_color
|
||||
= $this->trimmed('profile_link_color');
|
||||
$this->profile_sidebar_fill_color
|
||||
= $this->trimmed('profile_sidebar_fill_color');
|
||||
|
||||
// XXX: we don't support changing the sidebar border color
|
||||
// in our designs.
|
||||
|
||||
$this->profile_sidebar_border_color
|
||||
= $this->trimmed('profile_sidebar_border_color');
|
||||
|
||||
// XXX: Unlike Twitter, we do allow people to change the 'content color'
|
||||
|
||||
$this->profile_content_color = $this->trimmed('profile_content_color');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the request
|
||||
*
|
||||
* Try to save the user's colors in her design. Create a new design
|
||||
* if the user doesn't already have one.
|
||||
*
|
||||
* @param array $args $_REQUEST data (unused)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
$this->clientError(
|
||||
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||
_('This method requires a POST.'),
|
||||
400, $this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array($this->format, array('xml', 'json'))) {
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed when coming across a non-supported API method.
|
||||
_('API method not found.'),
|
||||
404,
|
||||
$this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$design = $this->user->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
$original = clone($design);
|
||||
|
||||
try {
|
||||
$this->setColors($design);
|
||||
} catch (WebColorException $e) {
|
||||
$this->clientError($e->getMessage(), 400, $this->format);
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Client error displayed when a database error occurs updating profile colours.
|
||||
$this->clientError(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$this->user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
|
||||
try {
|
||||
$this->setColors($design);
|
||||
} catch (WebColorException $e) {
|
||||
$this->clientError($e->getMessage(), 400, $this->format);
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Client error displayed when a database error occurs inserting profile colours.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($this->user);
|
||||
$this->user->design_id = $id;
|
||||
$result = $this->user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Client error displayed when a database error occurs updating profile colours.
|
||||
$this->clientError(_('Unable to save your design settings.'));
|
||||
$this->user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->user->query('COMMIT');
|
||||
}
|
||||
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
if (empty($profile)) {
|
||||
// TRANS: Error message displayed when referring to a user without a profile.
|
||||
$this->clientError(_('User has no profile.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$twitter_user = $this->twitterUserArray($profile, true);
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
$this->showJsonObjects($twitter_user);
|
||||
$this->endDocument('json');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user's design colors based on the request parameters
|
||||
*
|
||||
* @param Design $design the user's Design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setColors($design)
|
||||
{
|
||||
$bgcolor = empty($this->profile_background_color) ?
|
||||
null : new WebColor($this->profile_background_color);
|
||||
$tcolor = empty($this->profile_text_color) ?
|
||||
null : new WebColor($this->profile_text_color);
|
||||
$sbcolor = empty($this->profile_sidebar_fill_color) ?
|
||||
null : new WebColor($this->profile_sidebar_fill_color);
|
||||
$lcolor = empty($this->profile_link_color) ?
|
||||
null : new WebColor($this->profile_link_color);
|
||||
$ccolor = empty($this->profile_content_color) ?
|
||||
null : new WebColor($this->profile_content_color);
|
||||
|
||||
if (!empty($bgcolor)) {
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($ccolor)) {
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($sbcolor)) {
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($tcolor)) {
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
}
|
||||
|
||||
if (!empty($lcolor)) {
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class BlockedfromgroupAction extends GroupDesignAction
|
||||
class BlockedfromgroupAction extends GroupAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -1,738 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Design administration panel
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @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://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Administer design settings
|
||||
*
|
||||
* @category Admin
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class DesignadminpanelAction extends AdminPanelAction
|
||||
{
|
||||
/* The default site design */
|
||||
var $design = null;
|
||||
|
||||
/**
|
||||
* Returns the page title
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Message used as title for design settings for the site.
|
||||
return _('Design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for using this form.
|
||||
*
|
||||
* @return string instructions
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for design adminsitration panel.
|
||||
return _('Design settings for this StatusNet site');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default design and show the design admin panel form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showForm()
|
||||
{
|
||||
$this->design = Design::siteDesign();
|
||||
$form = new DesignAdminPanelForm($this);
|
||||
$form->show();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings from the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveSettings()
|
||||
{
|
||||
if ($this->arg('save')) {
|
||||
$this->saveDesignSettings();
|
||||
} else if ($this->arg('defaults')) {
|
||||
$this->restoreDefaults();
|
||||
} else {
|
||||
// TRANS: Client error displayed when the submitted form contains unexpected data.
|
||||
$this->clientError(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the new design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveDesignSettings()
|
||||
{
|
||||
// Workaround for PHP returning empty $_POST and $_FILES when POST
|
||||
// length > post_max_size in php.ini
|
||||
|
||||
if (empty($_FILES)
|
||||
&& empty($_POST)
|
||||
&& ($_SERVER['CONTENT_LENGTH'] > 0)
|
||||
) {
|
||||
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
|
||||
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
|
||||
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
|
||||
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
|
||||
intval($_SERVER['CONTENT_LENGTH']));
|
||||
$this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
|
||||
return;
|
||||
}
|
||||
|
||||
// check for file uploads
|
||||
|
||||
$bgimage = $this->saveBackgroundImage();
|
||||
$customTheme = $this->saveCustomTheme();
|
||||
|
||||
$oldtheme = common_config('site', 'theme');
|
||||
if ($customTheme) {
|
||||
// This feels pretty hacky :D
|
||||
$this->args['theme'] = $customTheme;
|
||||
$themeChanged = true;
|
||||
} else {
|
||||
$themeChanged = ($this->trimmed('theme') != $oldtheme);
|
||||
}
|
||||
|
||||
static $settings = array('theme', 'logo', 'ssllogo');
|
||||
|
||||
$values = array();
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
$values[$setting] = $this->trimmed($setting);
|
||||
}
|
||||
|
||||
$this->validate($values);
|
||||
|
||||
$config = new Config();
|
||||
|
||||
$config->query('BEGIN');
|
||||
|
||||
if ($themeChanged) {
|
||||
// If the theme has changed, reset custom colors and let them pick
|
||||
// up the new theme's defaults.
|
||||
$colors = array('background', 'content', 'sidebar', 'text', 'link');
|
||||
foreach ($colors as $colorKey) {
|
||||
// Clear from global config so we see defaults on this page...
|
||||
$GLOBALS['config']['design'][$colorKey . 'color'] = false;
|
||||
|
||||
// And remove old settings from DB...
|
||||
$this->deleteSetting('design', $colorKey . 'color');
|
||||
}
|
||||
} else {
|
||||
// Only save colors from the form if the theme has not changed.
|
||||
//
|
||||
// @fixme a future more ajaxy form should allow theme switch
|
||||
// and color customization in one step.
|
||||
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
|
||||
Config::save('design', 'backgroundcolor', $bgcolor->intValue());
|
||||
Config::save('design', 'contentcolor', $ccolor->intValue());
|
||||
Config::save('design', 'sidebarcolor', $sbcolor->intValue());
|
||||
Config::save('design', 'textcolor', $tcolor->intValue());
|
||||
Config::save('design', 'linkcolor', $lcolor->intValue());
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$tile = $this->boolean('design_background-image_repeat');
|
||||
|
||||
// Hack to use Design's bit setter
|
||||
$scratch = new Design();
|
||||
$scratch->setDisposition($on, $off, $tile);
|
||||
|
||||
Config::save('design', 'disposition', $scratch->disposition);
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
Config::save('site', $setting, $values[$setting]);
|
||||
}
|
||||
|
||||
if (isset($bgimage)) {
|
||||
Config::save('design', 'backgroundimage', $bgimage);
|
||||
}
|
||||
|
||||
if (common_config('custom_css', 'enabled')) {
|
||||
$css = $this->arg('css');
|
||||
if ($css != common_config('custom_css', 'css')) {
|
||||
Config::save('custom_css', 'css', $css);
|
||||
}
|
||||
}
|
||||
|
||||
$config->query('COMMIT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the default design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function restoreDefaults()
|
||||
{
|
||||
$this->deleteSetting('site', 'logo');
|
||||
$this->deleteSetting('site', 'ssllogo');
|
||||
$this->deleteSetting('site', 'theme');
|
||||
|
||||
$settings = array(
|
||||
'theme', 'backgroundimage', 'backgroundcolor', 'contentcolor',
|
||||
'sidebarcolor', 'textcolor', 'linkcolor', 'disposition'
|
||||
);
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
$this->deleteSetting('design', $setting);
|
||||
}
|
||||
|
||||
// XXX: Should we restore the default dir settings, etc.? --Z
|
||||
|
||||
// XXX: I can't get it to show the new settings without forcing
|
||||
// this terrible reload -- FIX ME!
|
||||
common_redirect(common_local_url('designadminpanel'), 303);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the background image if the user uploaded one
|
||||
*
|
||||
* @return string $filename the filename of the image
|
||||
*/
|
||||
function saveBackgroundImage()
|
||||
{
|
||||
$filename = null;
|
||||
if (isset($_FILES['design_background-image_file']['error']) &&
|
||||
$_FILES['design_background-image_file']['error'] ==
|
||||
UPLOAD_ERR_OK) {
|
||||
|
||||
$filepath = null;
|
||||
|
||||
try {
|
||||
$imagefile =
|
||||
ImageFile::fromUpload('design_background-image_file');
|
||||
} catch (Exception $e) {
|
||||
$this->clientError('Unable to save background image.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: site design background image has a special filename
|
||||
|
||||
$filename = Design::filename('site-design-background',
|
||||
image_type_to_extension($imagefile->type),
|
||||
common_timestamp());
|
||||
|
||||
$filepath = Design::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
|
||||
// delete any old backround img laying around
|
||||
|
||||
if (isset($this->design->backgroundimage)) {
|
||||
@unlink(Design::path($design->backgroundimage));
|
||||
}
|
||||
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the custom theme if the user uploaded one.
|
||||
*
|
||||
* @return mixed custom theme name, if succesful, or null if no theme upload.
|
||||
* @throws ClientException for invalid theme archives
|
||||
* @throws ServerException if trouble saving the theme files
|
||||
*/
|
||||
function saveCustomTheme()
|
||||
{
|
||||
if (common_config('theme_upload', 'enabled') &&
|
||||
$_FILES['design_upload_theme']['error'] == UPLOAD_ERR_OK) {
|
||||
|
||||
$upload = ThemeUploader::fromUpload('design_upload_theme');
|
||||
$basedir = common_config('local', 'dir');
|
||||
if (empty($basedir)) {
|
||||
$basedir = INSTALLDIR . '/local';
|
||||
}
|
||||
$name = 'custom'; // @todo allow multiples, custom naming?
|
||||
$outdir = $basedir . '/theme/' . $name;
|
||||
$upload->extract($outdir);
|
||||
return $name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to validate setting values
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function validate(&$values)
|
||||
{
|
||||
if (!empty($values['logo']) &&
|
||||
!Validate::uri($values['logo'], array('allowed_schemes' => array('http', 'https')))) {
|
||||
// TRANS: Client error displayed when a logo URL does is not valid.
|
||||
$this->clientError(_('Invalid logo URL.'));
|
||||
}
|
||||
|
||||
if (!empty($values['ssllogo']) &&
|
||||
!Validate::uri($values['ssllogo'], array('allowed_schemes' => array('https')))) {
|
||||
// TRANS: Client error displayed when an SSL logo URL is invalid.
|
||||
$this->clientError(_('Invalid SSL logo URL.'));
|
||||
}
|
||||
|
||||
if (!in_array($values['theme'], Theme::listAvailable())) {
|
||||
// TRANS: Client error displayed when a theme is submitted through the form that is not in the theme list.
|
||||
// TRANS: %s is the chosen unavailable theme.
|
||||
$this->clientError(sprintf(_('Theme not available: %s.'), $values['theme']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Farbtastic stylesheet
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showStylesheets()
|
||||
{
|
||||
parent::showStylesheets();
|
||||
$this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Farbtastic scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
|
||||
$this->script('farbtastic/farbtastic.js');
|
||||
$this->script('userdesign.go.js');
|
||||
|
||||
$this->autofocus('design_background-image_file');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DesignAdminPanelForm extends AdminForm
|
||||
{
|
||||
|
||||
/**
|
||||
* ID of the form
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
function id()
|
||||
{
|
||||
return 'form_design_admin_panel';
|
||||
}
|
||||
|
||||
/**
|
||||
* class of the form
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
function formClass()
|
||||
{
|
||||
return 'form_settings';
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP method used to submit the form
|
||||
*
|
||||
* For image data we need to send multipart/form-data
|
||||
* so we set that here too
|
||||
*
|
||||
* @return string the method to use for submitting
|
||||
*/
|
||||
function method()
|
||||
{
|
||||
$this->enctype = 'multipart/form-data';
|
||||
|
||||
return 'post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Action of the form
|
||||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
function action()
|
||||
{
|
||||
return common_local_url('designadminpanel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Data elements of the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formData()
|
||||
{
|
||||
$this->showLogo();
|
||||
$this->showTheme();
|
||||
$this->showBackground();
|
||||
$this->showColors();
|
||||
$this->showAdvanced();
|
||||
}
|
||||
|
||||
function showLogo()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_logo'));
|
||||
// TRANS: Fieldset legend for form to change logo.
|
||||
$this->out->element('legend', null, _('Change logo'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('logo',
|
||||
// TRANS: Field label for StatusNet site logo.
|
||||
_('Site logo'),
|
||||
// TRANS: Title for field label for StatusNet site logo.
|
||||
'Logo for the site (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('ssllogo',
|
||||
// TRANS: Field label for SSL StatusNet site logo.
|
||||
_('SSL logo'),
|
||||
// TRANS: Title for field label for SSL StatusNet site logo.
|
||||
'Logo to show on SSL pages.');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
}
|
||||
|
||||
function showTheme()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_theme'));
|
||||
// TRANS: Fieldset legend for form change StatusNet site's theme.
|
||||
$this->out->element('legend', null, _('Change theme'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$themes = Theme::listAvailable();
|
||||
|
||||
// XXX: listAvailable() can return an empty list if you
|
||||
// screw up your settings, so just in case:
|
||||
|
||||
if (empty($themes)) {
|
||||
$themes = array('default', 'default');
|
||||
}
|
||||
|
||||
asort($themes);
|
||||
$themes = array_combine($themes, $themes);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for dropdown to choose site theme.
|
||||
$this->out->dropdown('theme', _('Site theme'),
|
||||
// TRANS: Title for field label for dropdown to choose site theme.
|
||||
$themes, _('Theme for the site.'),
|
||||
false, $this->value('theme'));
|
||||
$this->unli();
|
||||
|
||||
if (common_config('theme_upload', 'enabled')) {
|
||||
$this->li();
|
||||
// TRANS: Field label for uploading a cutom theme.
|
||||
$this->out->element('label', array('for' => 'design_upload_theme'), _('Custom theme'));
|
||||
$this->out->element('input', array('id' => 'design_upload_theme',
|
||||
'name' => 'design_upload_theme',
|
||||
'type' => 'file'));
|
||||
// TRANS: Form instructions for uploading a cutom StatusNet theme.
|
||||
$this->out->element('p', 'form_guide', _('You can upload a custom StatusNet theme as a .ZIP archive.'));
|
||||
$this->unli();
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
function showBackground()
|
||||
{
|
||||
$design = $this->out->design;
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_background-image'));
|
||||
// TRANS: Fieldset legend for theme background image.
|
||||
$this->out->element('legend', null, _('Change background image'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->out->element('label', array('for' => 'design_background-image_file'),
|
||||
// TRANS: Field label for background image on theme designer page.
|
||||
_('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background-image_file',
|
||||
'type' => 'file',
|
||||
'id' => 'design_background-image_file'));
|
||||
$this->out->element('p', 'form_guide',
|
||||
// TRANS: Form guide for background image upload form on theme designer page.
|
||||
sprintf(_('You can upload a background image for the site. ' .
|
||||
'The maximum file size is %1$s.'), ImageFile::maxFileSize()));
|
||||
$this->unli();
|
||||
|
||||
if (!empty($design->backgroundimage)) {
|
||||
|
||||
$this->out->elementStart('li', array('id' =>
|
||||
'design_background-image_onoff'));
|
||||
|
||||
$this->out->element('img', array('src' =>
|
||||
Design::url($design->backgroundimage)));
|
||||
|
||||
$attrs = array('name' => 'design_background-image_onoff',
|
||||
'type' => 'radio',
|
||||
'id' => 'design_background-image_on',
|
||||
'class' => 'radio',
|
||||
'value' => 'on');
|
||||
|
||||
if ($design->disposition & BACKGROUND_ON) {
|
||||
$attrs['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$this->out->element('input', $attrs);
|
||||
|
||||
$this->out->element('label', array('for' => 'design_background-image_on',
|
||||
'class' => 'radio'),
|
||||
// TRANS: Used as radio button label to add a background image.
|
||||
_('On'));
|
||||
|
||||
$attrs = array('name' => 'design_background-image_onoff',
|
||||
'type' => 'radio',
|
||||
'id' => 'design_background-image_off',
|
||||
'class' => 'radio',
|
||||
'value' => 'off');
|
||||
|
||||
if ($design->disposition & BACKGROUND_OFF) {
|
||||
$attrs['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$this->out->element('input', $attrs);
|
||||
|
||||
$this->out->element('label', array('for' => 'design_background-image_off',
|
||||
'class' => 'radio'),
|
||||
// TRANS: Used as radio button label to not add a background image.
|
||||
_('Off'));
|
||||
// TRANS: Form guide for turning background image on or off on theme designer page.
|
||||
$this->out->element('p', 'form_guide', _('Turn background image on or off.'));
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->out->checkbox('design_background-image_repeat',
|
||||
// TRANS: Checkbox label to title background image on theme designer page.
|
||||
_('Tile background image'),
|
||||
($design->disposition & BACKGROUND_TILE) ? true : false);
|
||||
$this->unli();
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
function showColors()
|
||||
{
|
||||
$design = $this->out->design;
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
|
||||
// TRANS: Fieldset legend for theme colors.
|
||||
$this->out->element('legend', null, _('Change colors'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
try {
|
||||
// @fixme avoid loop unrolling in non-performance-critical contexts like this
|
||||
|
||||
$bgcolor = new WebColor($design->backgroundcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for background color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-1'), _('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-1',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$ccolor = new WebColor($design->contentcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for content color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-2'), _('Content'));
|
||||
$this->out->element('input', array('name' => 'design_content',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-2',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$sbcolor = new WebColor($design->sidebarcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for sidebar color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
|
||||
$this->out->element('input', array('name' => 'design_sidebar',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-3',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$tcolor = new WebColor($design->textcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for text color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-4'), _('Text'));
|
||||
$this->out->element('input', array('name' => 'design_text',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-4',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
$lcolor = new WebColor($design->linkcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for link color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-5'), _('Links'));
|
||||
$this->out->element('input', array('name' => 'design_links',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-5',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->unli();
|
||||
|
||||
} catch (WebColorException $e) {
|
||||
// @fixme normalize them individually!
|
||||
common_log(LOG_ERR, 'Bad color values in site design: ' .
|
||||
$e->getMessage());
|
||||
}
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
|
||||
function showAdvanced()
|
||||
{
|
||||
if (common_config('custom_css', 'enabled')) {
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_advanced'));
|
||||
// TRANS: Fieldset legend for advanced theme design settings.
|
||||
$this->out->element('legend', null, _('Advanced'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for custom CSS.
|
||||
$this->out->element('label', array('for' => 'css'), _('Custom CSS'));
|
||||
$this->out->element('textarea', array('name' => 'css',
|
||||
'id' => 'css',
|
||||
'cols' => '50',
|
||||
'rows' => '10'),
|
||||
strval(common_config('custom_css', 'css')));
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action elements
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
// TRANS: Button text for resetting theme settings.
|
||||
$this->out->submit('defaults', _m('BUTTON','Use defaults'), 'submit form_action-default',
|
||||
// TRANS: Title for button for resetting theme settings.
|
||||
'defaults', _('Restore default designs.'));
|
||||
|
||||
$this->out->element('input', array('id' => 'settings_design_reset',
|
||||
'type' => 'reset',
|
||||
// TRANS: Button text for resetting theme settings.
|
||||
'value' => 'Reset',
|
||||
'class' => 'submit form_action-primary',
|
||||
// TRANS: Title for button for resetting theme settings.
|
||||
'title' => _('Reset back to default.')));
|
||||
|
||||
$this->out->submit('save',
|
||||
// TRANS: Button text for saving theme settings.
|
||||
_m('BUTTON','Save'),
|
||||
'submit form_action-secondary',
|
||||
'save',
|
||||
// TRANS: Title for button for saving theme settings.
|
||||
_('Save design.'));
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
* @category Applications
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class EditApplicationAction extends OwnerDesignAction
|
||||
class EditApplicationAction extends Action
|
||||
{
|
||||
var $msg = null;
|
||||
var $owner = null;
|
||||
|
@ -24,7 +24,7 @@
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -45,7 +45,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class EditgroupAction extends GroupDesignAction
|
||||
class EditgroupAction extends GroupAction
|
||||
{
|
||||
var $msg;
|
||||
|
||||
|
@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class EditpeopletagAction extends OwnerDesignAction
|
||||
class EditpeopletagAction extends Action
|
||||
{
|
||||
var $msg, $confirm, $confirm_args=array();
|
||||
|
||||
|
@ -1,319 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Saves a design for a given group.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @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://status.net/
|
||||
*/
|
||||
|
||||
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 <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* 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_logged_in()) {
|
||||
// TRANS: Client error displayed trying to change group design settings while not 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);
|
||||
|
||||
// Permanent redirect on non-canonical nickname
|
||||
|
||||
if ($nickname_arg != $nickname) {
|
||||
$args = array('nickname' => $nickname);
|
||||
common_redirect(common_local_url('groupdesignsettings', $args), 301);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed trying to change group design settings without providing a group nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$groupid = $this->trimmed('groupid');
|
||||
|
||||
if ($groupid) {
|
||||
$this->group = User_group::staticGet('id', $groupid);
|
||||
} else {
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
if ($local) {
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!$cur->isAdmin($this->group)) {
|
||||
// TRANS: Client error displayed trying to change group design settings without being a (group) admin.
|
||||
$this->clientError(_('You must be an admin to edit the group.'), 403);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->submitaction = common_local_url('groupdesignsettings',
|
||||
array('nickname' => $this->group->nickname));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A design for this action
|
||||
*
|
||||
* if the group attribute has been set, returns that group's
|
||||
* design.
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
function getDesign()
|
||||
{
|
||||
|
||||
if (empty($this->group)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->group->getDesign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title group design settings page.
|
||||
return _('Group design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for use
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for group design settings page.
|
||||
return _('Customize the way your group looks ' .
|
||||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to show group nav stuff
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to show default nav stuff
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function showLocalNav()
|
||||
{
|
||||
Action::showLocalNav();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the design we want to edit
|
||||
*
|
||||
* @return Design
|
||||
*/
|
||||
function getWorkingDesign()
|
||||
{
|
||||
$design = null;
|
||||
|
||||
if (isset($this->group)) {
|
||||
$design = $this->group->getDesign();
|
||||
}
|
||||
|
||||
return $design;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area of the page
|
||||
*
|
||||
* Shows a form for changing the design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showContent()
|
||||
{
|
||||
$design = $this->getWorkingDesign();
|
||||
|
||||
if (empty($design)) {
|
||||
$design = Design::siteDesign();
|
||||
}
|
||||
|
||||
$this->showDesignForm($design);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update the group's design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveDesign()
|
||||
{
|
||||
try {
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
} catch (WebColorException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
$tile = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$repeat = $this->boolean('design_background-image_repeat');
|
||||
|
||||
if ($repeat) {
|
||||
$tile = true;
|
||||
}
|
||||
|
||||
$design = $this->group->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
// update design
|
||||
|
||||
$original = clone($design);
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be updated because of an application issue.
|
||||
$this->showForm(_('Unable to update your design settings.'));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$this->group->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($this->group);
|
||||
$this->group->design_id = $id;
|
||||
$result = $this->group->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$this->group->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->group->query('COMMIT');
|
||||
}
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Form text to confirm saved group design settings.
|
||||
$this->showForm(_('Design preferences saved.'), true);
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -49,7 +49,7 @@ define('MAX_ORIGINAL', 480);
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GrouplogoAction extends GroupDesignAction
|
||||
class GrouplogoAction extends GroupAction
|
||||
{
|
||||
var $mode = null;
|
||||
var $imagefile = null;
|
||||
|
@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GroupmembersAction extends GroupDesignAction
|
||||
class GroupmembersAction extends GroupAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GroupqueueAction extends GroupDesignAction
|
||||
class GroupqueueAction extends GroupAction
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
// @todo XXX: Add documentation.
|
||||
class InviteAction extends CurrentUserDesignAction
|
||||
class InviteAction extends Action
|
||||
{
|
||||
var $mode = null;
|
||||
var $error = null;
|
||||
|
@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class NewApplicationAction extends OwnerDesignAction
|
||||
class NewApplicationAction extends Action
|
||||
{
|
||||
var $msg;
|
||||
|
||||
|
@ -364,61 +364,7 @@ class PathsAdminPanelForm extends AdminForm
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_background-paths'));
|
||||
// TRANS: Fieldset legend in Paths admin panel.
|
||||
$this->out->element('legend', null, _('Backgrounds'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('server',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Server'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Server for backgrounds.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('path',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Path'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Web path to backgrounds.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('sslserver',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('SSL server'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Server for backgrounds on SSL pages.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('sslpath',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('SSL path'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Web path to backgrounds on SSL pages.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('dir',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Directory'),
|
||||
// TRANS: Tooltip for field label in Paths admin panel.
|
||||
_('Directory where backgrounds are located.'),
|
||||
'background');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_attachments-paths'));
|
||||
'settings_attachments-paths'));
|
||||
|
||||
// TRANS: Fieldset legens in Paths admin panel.
|
||||
$this->out->element('legend', null, _('Attachments'));
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Group
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -42,7 +42,7 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class PeopletaggedAction extends OwnerDesignAction
|
||||
class PeopletaggedAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $peopletag = null;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
|
||||
require_once INSTALLDIR.'/lib/peopletaglist.php';
|
||||
|
||||
class PeopletagsbyuserAction extends OwnerDesignAction
|
||||
class PeopletagsbyuserAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $tagger = null;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
|
||||
require_once INSTALLDIR.'/lib/peopletaglist.php';
|
||||
|
||||
class PeopletagsforuserAction extends OwnerDesignAction
|
||||
class PeopletagsforuserAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $tagged = null;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Group
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -42,7 +42,7 @@ require_once(INSTALLDIR.'/lib/profilelist.php');
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class PeopletagsubscribersAction extends OwnerDesignAction
|
||||
class PeopletagsubscribersAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $peopletag = null;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Shashi Gowda <connect2shashi@gmail.com>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -33,7 +33,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
|
||||
require_once INSTALLDIR.'/lib/peopletaglist.php';
|
||||
|
||||
class PeopletagsubscriptionsAction extends OwnerDesignAction
|
||||
class PeopletagsubscriptionsAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $profile = null;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class RepliesAction extends OwnerDesignAction
|
||||
class RepliesAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $notice;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Application
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -40,7 +40,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShowApplicationAction extends OwnerDesignAction
|
||||
class ShowApplicationAction extends Action
|
||||
{
|
||||
/**
|
||||
* Application to show
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShowfavoritesAction extends OwnerDesignAction
|
||||
class ShowfavoritesAction extends Action
|
||||
{
|
||||
/** User we're getting the faves of */
|
||||
var $user = null;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -46,7 +46,7 @@ define('MEMBERS_PER_SECTION', 27);
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShowgroupAction extends GroupDesignAction
|
||||
class ShowgroupAction extends Action
|
||||
{
|
||||
/** page we're viewing. */
|
||||
var $page = null;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Personal
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/feedlist.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ShownoticeAction extends OwnerDesignAction
|
||||
class ShownoticeAction extends Action
|
||||
{
|
||||
/**
|
||||
* Notice object to show
|
||||
|
@ -24,7 +24,7 @@
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2010 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -88,9 +88,19 @@ class SiteadminpanelAction extends AdminPanelAction
|
||||
function saveSettings()
|
||||
{
|
||||
static $settings = array(
|
||||
'site' => array('name', 'broughtby', 'broughtbyurl',
|
||||
'email', 'timezone', 'language',
|
||||
'site', 'textlimit', 'dupelimit'),
|
||||
'site' => array(
|
||||
'name',
|
||||
'broughtby',
|
||||
'broughtbyurl',
|
||||
'email',
|
||||
'timezone',
|
||||
'language',
|
||||
'site',
|
||||
'textlimit',
|
||||
'dupelimit',
|
||||
'logo',
|
||||
'ssllogo'
|
||||
)
|
||||
);
|
||||
|
||||
$values = array();
|
||||
@ -144,6 +154,19 @@ class SiteadminpanelAction extends AdminPanelAction
|
||||
$this->clientError(_('Not a valid email address.'));
|
||||
}
|
||||
|
||||
// Validate logos
|
||||
if (!empty($values['site']['logo']) &&
|
||||
!Validate::uri($values['site']['logo'], array('allowed_schemes' => array('http', 'https')))) {
|
||||
// TRANS: Client error displayed when a logo URL does is not valid.
|
||||
$this->clientError(_('Invalid logo URL.'));
|
||||
}
|
||||
|
||||
if (!empty($values['site']['ssllogo']) &&
|
||||
!Validate::uri($values['site']['ssllogo'], array('allowed_schemes' => array('https')))) {
|
||||
// TRANS: Client error displayed when an SSL logo URL is invalid.
|
||||
$this->clientError(_('Invalid SSL logo URL.'));
|
||||
}
|
||||
|
||||
// Validate timezone
|
||||
|
||||
if (is_null($values['site']['timezone']) ||
|
||||
@ -251,6 +274,8 @@ class SiteAdminPanelForm extends AdminForm
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->showLogo();
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_local'));
|
||||
// TRANS: Fieldset legend on site settings panel.
|
||||
$this->out->element('legend', null, _m('LEGEND','Local'));
|
||||
@ -307,6 +332,35 @@ class SiteAdminPanelForm extends AdminForm
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
function showLogo()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_site_logo'));
|
||||
// TRANS: Fieldset legend for form to change logo.
|
||||
$this->out->element('legend', null, _('Logo'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('logo',
|
||||
// TRANS: Field label for StatusNet site logo.
|
||||
_('Site logo'),
|
||||
// TRANS: Title for field label for StatusNet site logo.
|
||||
'Logo for the site (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('ssllogo',
|
||||
// TRANS: Field label for SSL StatusNet site logo.
|
||||
_('SSL logo'),
|
||||
// TRANS: Title for field label for SSL StatusNet site logo.
|
||||
'Logo to show on SSL pages (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
||||
/**
|
||||
* Action elements
|
||||
*
|
||||
|
@ -1,365 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Change user password
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @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://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/designsettings.php';
|
||||
|
||||
/**
|
||||
* Set a user's design
|
||||
*
|
||||
* Saves a design for a given user
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class UserDesignSettingsAction extends DesignSettingsAction
|
||||
{
|
||||
/**
|
||||
* 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);
|
||||
$this->submitaction = common_local_url('userdesignsettings');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for profile design page.
|
||||
return _('Profile design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for use
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for Profile design page.
|
||||
return _('Customize the way your profile looks ' .
|
||||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the design we want to edit
|
||||
*
|
||||
* @return Design
|
||||
*/
|
||||
function getWorkingDesign()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$design = $user->getDesign();
|
||||
return $design;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area of the page
|
||||
*
|
||||
* Shows a form for changing the design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showContent()
|
||||
{
|
||||
$design = $this->getWorkingDesign();
|
||||
|
||||
if (empty($design)) {
|
||||
$design = Design::siteDesign();
|
||||
}
|
||||
|
||||
$this->showDesignForm($design);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the design settings form
|
||||
*
|
||||
* @param Design $design a working design to show
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
|
||||
function showDesignForm($design)
|
||||
{
|
||||
$form = new UserDesignForm($this, $design, $this->submitaction);
|
||||
$form->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update the user's design settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function saveDesign()
|
||||
{
|
||||
$this->saveDesignPreferences();
|
||||
|
||||
foreach ($this->args as $key => $val) {
|
||||
if (preg_match('/(#ho|ho)Td.*g/i', $val)) {
|
||||
$this->sethd();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
} catch (WebColorException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
$onoff = $this->arg('design_background-image_onoff');
|
||||
|
||||
$on = false;
|
||||
$off = false;
|
||||
$tile = false;
|
||||
|
||||
if ($onoff == 'on') {
|
||||
$on = true;
|
||||
} else {
|
||||
$off = true;
|
||||
}
|
||||
|
||||
$repeat = $this->boolean('design_background-image_repeat');
|
||||
|
||||
if ($repeat) {
|
||||
$tile = true;
|
||||
}
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$design = $user->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
$original = clone($design);
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when updating design settings has failed.
|
||||
$this->showForm(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
// update design
|
||||
} else {
|
||||
$user->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = $bgcolor->intValue();
|
||||
$design->contentcolor = $ccolor->intValue();
|
||||
$design->sidebarcolor = $sbcolor->intValue();
|
||||
$design->textcolor = $tcolor->intValue();
|
||||
$design->linkcolor = $lcolor->intValue();
|
||||
|
||||
$design->setDisposition($on, $off, $tile);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when saving design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($user);
|
||||
$user->design_id = $id;
|
||||
$result = $user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when saving design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$user->query('COMMIT');
|
||||
|
||||
}
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Confirmation message on Profile design page when saving design settings has succeeded.
|
||||
$this->showForm(_('Design preferences saved.'), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternate default colors
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function sethd()
|
||||
{
|
||||
$user = common_current_user();
|
||||
$design = $user->getDesign();
|
||||
|
||||
$user->query('BEGIN');
|
||||
|
||||
// alternate colors
|
||||
$design = new Design();
|
||||
|
||||
$design->backgroundcolor = 16184329;
|
||||
$design->contentcolor = 16059904;
|
||||
$design->sidebarcolor = 16059904;
|
||||
$design->textcolor = 0;
|
||||
$design->linkcolor = 16777215;
|
||||
|
||||
$design->setDisposition(false, true, false);
|
||||
|
||||
$id = $design->insert();
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when saving design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$original = clone($user);
|
||||
$user->design_id = $id;
|
||||
$result = $user->update($original);
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error on Profile design page when updating design settings has failed.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$user->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$user->query('COMMIT');
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Succes message on Profile design page when finding an easter egg.
|
||||
$this->showForm(_('Enjoy your hotdog!'), true);
|
||||
}
|
||||
|
||||
function saveDesignPreferences()
|
||||
{
|
||||
$viewdesigns = $this->boolean('viewdesigns');
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
$original = clone($user);
|
||||
|
||||
$user->viewdesigns = $viewdesigns;
|
||||
|
||||
$result = $user->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server exception thrown on Profile design page when updating design settings fails.
|
||||
throw new ServerException(_('Could not update user.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UserDesignForm extends DesignForm
|
||||
{
|
||||
function __construct($out, $design, $actionurl)
|
||||
{
|
||||
parent::__construct($out, $design, $actionurl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legend of the Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formLegend()
|
||||
{
|
||||
// TRANS: Form legend on Profile design page.
|
||||
$this->out->element('legend', null, _('Design settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data elements of the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Checkbox label on Profile design page.
|
||||
$this->out->checkbox('viewdesigns', _('View profile designs'),
|
||||
// TRANS: Title for checkbox on Profile design page.
|
||||
- $user->viewdesigns, _('Show or hide profile designs.'));
|
||||
$this->out->elementEnd('li');
|
||||
$this->out->elementEnd('ul');
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset');
|
||||
// TRANS: Form legend on Profile design page for form to choose a background image.
|
||||
$this->out->element('legend', null, _('Background file'));
|
||||
|
||||
parent::formData();
|
||||
}
|
||||
}
|
@ -1,243 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009-2011, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
define('BACKGROUND_ON', 1);
|
||||
define('BACKGROUND_OFF', 2);
|
||||
define('BACKGROUND_TILE', 4);
|
||||
|
||||
/**
|
||||
* Table Definition for design
|
||||
*/
|
||||
|
||||
require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
|
||||
require_once INSTALLDIR . '/lib/webcolor.php';
|
||||
|
||||
class Design extends Memcached_DataObject
|
||||
{
|
||||
###START_AUTOCODE
|
||||
/* the code below is auto generated do not remove the above tag */
|
||||
|
||||
public $__table = 'design'; // table name
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $backgroundcolor; // int(4)
|
||||
public $contentcolor; // int(4)
|
||||
public $sidebarcolor; // int(4)
|
||||
public $textcolor; // int(4)
|
||||
public $linkcolor; // int(4)
|
||||
public $backgroundimage; // varchar(255)
|
||||
public $disposition; // tinyint(1) default_1
|
||||
|
||||
/* Static get */
|
||||
function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); }
|
||||
|
||||
/* the code above is auto generated do not remove the tag below */
|
||||
###END_AUTOCODE
|
||||
|
||||
function showCSS($out)
|
||||
{
|
||||
$css = '';
|
||||
|
||||
$bgcolor = Design::toWebColor($this->backgroundcolor);
|
||||
|
||||
if (!empty($bgcolor)) {
|
||||
$css .= 'body { background-color: #' . $bgcolor->hexValue() . ' }' . "\n";
|
||||
}
|
||||
|
||||
$ccolor = Design::toWebColor($this->contentcolor);
|
||||
|
||||
if (!empty($ccolor)) {
|
||||
$css .= '#content { background-color: #';
|
||||
$css .= $ccolor->hexValue() . '} '."\n";
|
||||
}
|
||||
|
||||
$sbcolor = Design::toWebColor($this->sidebarcolor);
|
||||
|
||||
if (!empty($sbcolor)) {
|
||||
$css .= '#aside_primary_wrapper, #site_nav_local_views_wrapper { background-color: #'. $sbcolor->hexValue() . ' }' . "\n";
|
||||
}
|
||||
|
||||
$tcolor = Design::toWebColor($this->textcolor);
|
||||
|
||||
if (!empty($tcolor)) {
|
||||
$css .= 'html body { color: #'. $tcolor->hexValue() . ' }'. "\n";
|
||||
}
|
||||
|
||||
$lcolor = Design::toWebColor($this->linkcolor);
|
||||
|
||||
if (!empty($lcolor)) {
|
||||
$css .= 'a { color: #' . $lcolor->hexValue() . ' }' . "\n";
|
||||
}
|
||||
|
||||
if (!empty($this->backgroundimage) &&
|
||||
$this->disposition & BACKGROUND_ON) {
|
||||
|
||||
$repeat = ($this->disposition & BACKGROUND_TILE) ?
|
||||
'background-repeat:repeat;' :
|
||||
'background-repeat:no-repeat;';
|
||||
|
||||
$css .= 'body { background-image:url(' .
|
||||
Design::url($this->backgroundimage) .
|
||||
'); ' . $repeat . ' background-attachment:fixed; }' . "\n";
|
||||
}
|
||||
|
||||
if (0 != mb_strlen($css)) {
|
||||
$out->style($css);
|
||||
}
|
||||
}
|
||||
|
||||
static function toWebColor($color)
|
||||
{
|
||||
if ($color === null || $color === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new WebColor($color);
|
||||
} catch (WebColorException $e) {
|
||||
// This shouldn't happen
|
||||
common_log(LOG_ERR, "Unable to create web color for $color",
|
||||
__FILE__);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static function filename($id, $extension, $extra=null)
|
||||
{
|
||||
return $id . (($extra) ? ('-' . $extra) : '') . $extension;
|
||||
}
|
||||
|
||||
static function path($filename)
|
||||
{
|
||||
$dir = common_config('background', 'dir');
|
||||
|
||||
if ($dir[strlen($dir)-1] != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
|
||||
return $dir . $filename;
|
||||
}
|
||||
|
||||
static function url($filename)
|
||||
{
|
||||
if (StatusNet::isHTTPS()) {
|
||||
|
||||
$sslserver = common_config('background', 'sslserver');
|
||||
|
||||
if (empty($sslserver)) {
|
||||
// XXX: this assumes that background dir == site dir + /background/
|
||||
// not true if there's another server
|
||||
if (is_string(common_config('site', 'sslserver')) &&
|
||||
mb_strlen(common_config('site', 'sslserver')) > 0) {
|
||||
$server = common_config('site', 'sslserver');
|
||||
} else if (common_config('site', 'server')) {
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
$path = common_config('site', 'path') . '/background/';
|
||||
} else {
|
||||
$server = $sslserver;
|
||||
$path = common_config('background', 'sslpath');
|
||||
if (empty($path)) {
|
||||
$path = common_config('background', 'path');
|
||||
}
|
||||
}
|
||||
|
||||
$protocol = 'https';
|
||||
|
||||
} else {
|
||||
|
||||
$path = common_config('background', 'path');
|
||||
|
||||
$server = common_config('background', 'server');
|
||||
|
||||
if (empty($server)) {
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
|
||||
$protocol = 'http';
|
||||
}
|
||||
|
||||
if ($path[strlen($path)-1] != '/') {
|
||||
$path .= '/';
|
||||
}
|
||||
|
||||
if ($path[0] != '/') {
|
||||
$path = '/'.$path;
|
||||
}
|
||||
|
||||
return $protocol.'://'.$server.$path.$filename;
|
||||
}
|
||||
|
||||
function setDisposition($on, $off, $tile)
|
||||
{
|
||||
if ($on) {
|
||||
$this->disposition |= BACKGROUND_ON;
|
||||
} else {
|
||||
$this->disposition &= ~BACKGROUND_ON;
|
||||
}
|
||||
|
||||
if ($off) {
|
||||
$this->disposition |= BACKGROUND_OFF;
|
||||
} else {
|
||||
$this->disposition &= ~BACKGROUND_OFF;
|
||||
}
|
||||
|
||||
if ($tile) {
|
||||
$this->disposition |= BACKGROUND_TILE;
|
||||
} else {
|
||||
$this->disposition &= ~BACKGROUND_TILE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a design object based on the configured site design.
|
||||
*
|
||||
* @return Design a singleton design object for the site.
|
||||
*/
|
||||
|
||||
static function siteDesign()
|
||||
{
|
||||
static $siteDesign = null;
|
||||
|
||||
if (empty($siteDesign)) {
|
||||
|
||||
$siteDesign = new Design();
|
||||
|
||||
$attrs = array('backgroundcolor',
|
||||
'contentcolor',
|
||||
'sidebarcolor',
|
||||
'textcolor',
|
||||
'linkcolor',
|
||||
'backgroundimage',
|
||||
'disposition');
|
||||
|
||||
foreach ($attrs as $attr) {
|
||||
$val = common_config('design', $attr);
|
||||
if ($val !== false) {
|
||||
$siteDesign->$attr = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $siteDesign;
|
||||
}
|
||||
}
|
@ -61,8 +61,6 @@ class User extends Memcached_DataObject
|
||||
public $subscribe_policy; // tinyint(1)
|
||||
public $urlshorteningservice; // varchar(50) default_ur1.ca
|
||||
public $inboxed; // tinyint(1)
|
||||
public $design_id; // int(4)
|
||||
public $viewdesigns; // tinyint(1) default_1
|
||||
public $private_stream; // tinyint(1) default_0
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
@ -293,7 +291,6 @@ class User extends Memcached_DataObject
|
||||
$user->emailmicroid = 1;
|
||||
$user->emailpost = 1;
|
||||
$user->jabbermicroid = 1;
|
||||
$user->viewdesigns = 1;
|
||||
|
||||
$user->created = common_sql_now();
|
||||
|
||||
@ -714,11 +711,6 @@ class User extends Memcached_DataObject
|
||||
return $profile;
|
||||
}
|
||||
|
||||
function getDesign()
|
||||
{
|
||||
return Design::staticGet('id', $this->design_id);
|
||||
}
|
||||
|
||||
function hasRight($right)
|
||||
{
|
||||
$profile = $this->getProfile();
|
||||
|
@ -22,7 +22,6 @@ class User_group extends Memcached_DataObject
|
||||
public $homepage_logo; // varchar(255)
|
||||
public $stream_logo; // varchar(255)
|
||||
public $mini_logo; // varchar(255)
|
||||
public $design_id; // int(4)
|
||||
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
|
||||
public $uri; // varchar(255) unique_key
|
||||
@ -339,11 +338,6 @@ class User_group extends Memcached_DataObject
|
||||
return null;
|
||||
}
|
||||
|
||||
function getDesign()
|
||||
{
|
||||
return Design::staticGet('id', $this->design_id);
|
||||
}
|
||||
|
||||
function getUserMembers()
|
||||
{
|
||||
// XXX: cache this
|
||||
|
21
db/core.php
21
db/core.php
@ -121,8 +121,6 @@ $schema['user'] = array(
|
||||
'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'),
|
||||
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
|
||||
'inboxed' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'has an inbox been created for this user?'),
|
||||
'design_id' => array('type' => 'int', 'description' => 'id of a design'),
|
||||
'viewdesigns' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'whether to view user-provided designs'),
|
||||
'private_stream' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to limit all notices to followers only'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
@ -139,7 +137,6 @@ $schema['user'] = array(
|
||||
'foreign keys' => array(
|
||||
'user_id_fkey' => array('profile', array('id' => 'id')),
|
||||
'user_carrier_fkey' => array('sms_carrier', array('carrier' => 'id')),
|
||||
'user_design_id_fkey' => array('design', array('design_id' => 'id')),
|
||||
),
|
||||
'indexes' => array(
|
||||
'user_smsemail_idx' => array('smsemail'),
|
||||
@ -721,7 +718,6 @@ $schema['user_group'] = array(
|
||||
'homepage_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'homepage (profile) size logo'),
|
||||
'stream_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'stream-sized logo'),
|
||||
'mini_logo' => array('type' => 'varchar', 'length' => 255, 'description' => 'mini logo'),
|
||||
'design_id' => array('type' => 'int', 'description' => 'id of a design'),
|
||||
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
@ -735,9 +731,6 @@ $schema['user_group'] = array(
|
||||
'unique keys' => array(
|
||||
'user_group_uri_key' => array('uri'),
|
||||
),
|
||||
'foreign keys' => array(
|
||||
'user_group_design_id_fkey' => array('design', array('design_id' => 'id')),
|
||||
),
|
||||
'indexes' => array(
|
||||
'user_group_nickname_idx' => array('nickname'),
|
||||
),
|
||||
@ -886,20 +879,6 @@ $schema['file_to_post'] = array(
|
||||
),
|
||||
);
|
||||
|
||||
$schema['design'] = array(
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'design ID'),
|
||||
'backgroundcolor' => array('type' => 'int', 'description' => 'main background color'),
|
||||
'contentcolor' => array('type' => 'int', 'description' => 'content area background color'),
|
||||
'sidebarcolor' => array('type' => 'int', 'description' => 'sidebar background color'),
|
||||
'textcolor' => array('type' => 'int', 'description' => 'text color'),
|
||||
'linkcolor' => array('type' => 'int', 'description' => 'link color'),
|
||||
'backgroundimage' => array('type' => 'varchar', 'length' => 255, 'description' => 'background image, if any'),
|
||||
'disposition' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'),
|
||||
),
|
||||
'primary key' => array('id'),
|
||||
);
|
||||
|
||||
$schema['group_block'] = array(
|
||||
'fields' => array(
|
||||
'group_id' => array('type' => 'int', 'not null' => true, 'description' => 'group profile is blocked from'),
|
||||
|
@ -246,20 +246,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||
Event::handle('EndShowUAStyles', array($this));
|
||||
}
|
||||
|
||||
if (Event::handle('StartShowDesign', array($this))) {
|
||||
|
||||
$user = common_current_user();
|
||||
|
||||
if (empty($user) || $user->viewdesigns) {
|
||||
$design = $this->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
$design->showCSS($this);
|
||||
}
|
||||
}
|
||||
|
||||
Event::handle('EndShowDesign', array($this));
|
||||
}
|
||||
Event::handle('EndShowStyles', array($this));
|
||||
|
||||
if (common_config('custom_css', 'enabled')) {
|
||||
@ -1366,13 +1352,16 @@ class Action extends HTMLOutputter // lawsuit
|
||||
// Added @id to li for some control.
|
||||
// XXX: We might want to move this to htmloutputter.php
|
||||
$lattrs = array();
|
||||
$classes = array();
|
||||
if ($class !== null) {
|
||||
$lattrs['class'] = $class;
|
||||
$classes[] = trim($class);
|
||||
}
|
||||
if ($is_selected) {
|
||||
$lattrs['class'] = trim('current ' . $lattrs['class']);
|
||||
}
|
||||
$classes[] = 'current';
|
||||
}
|
||||
|
||||
$lattrs['class'] = implode(' ', $classes);
|
||||
|
||||
(is_null($id)) ? $lattrs : $lattrs['id'] = $id;
|
||||
|
||||
$this->elementStart('li', $lattrs);
|
||||
@ -1442,16 +1431,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A design for this action
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
function getDesign()
|
||||
{
|
||||
return Design::siteDesign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the session token.
|
||||
*
|
||||
|
@ -251,35 +251,6 @@ class AdminPanelAction extends Action
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a design setting
|
||||
*
|
||||
* // XXX: Maybe this should go in Design? --Z
|
||||
*
|
||||
* @return mixed $result false if something didn't work
|
||||
*/
|
||||
function deleteSetting($section, $setting)
|
||||
{
|
||||
$config = new Config();
|
||||
|
||||
$config->section = $section;
|
||||
$config->setting = $setting;
|
||||
|
||||
if ($config->find(true)) {
|
||||
$result = $config->delete();
|
||||
if (!$result) {
|
||||
common_log_db_error($config, 'DELETE', __FILE__);
|
||||
// TRANS: Client error message thrown if design settings could not be deleted in
|
||||
// TRANS: the admin panel Design.
|
||||
$this->clientError(_("Unable to delete design setting."));
|
||||
return null;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function canAdmin($name)
|
||||
{
|
||||
$isOK = false;
|
||||
|
@ -94,14 +94,6 @@ class AdminPanelNav extends Menu
|
||||
$menu_title, $action_name == 'siteadminpanel', 'nav_site_admin_panel');
|
||||
}
|
||||
|
||||
if (AdminPanelAction::canAdmin('design')) {
|
||||
// TRANS: Menu item title in administrator navigation panel.
|
||||
$menu_title = _('Design configuration');
|
||||
// TRANS: Menu item in administrator navigation panel.
|
||||
$this->out->menuItem(common_local_url('designadminpanel'), _m('MENU', 'Design'),
|
||||
$menu_title, $action_name == 'designadminpanel', 'nav_design_admin_panel');
|
||||
}
|
||||
|
||||
if (AdminPanelAction::canAdmin('user')) {
|
||||
// TRANS: Menu item title in administrator navigation panel.
|
||||
$menu_title = _('User configuration');
|
||||
@ -163,7 +155,7 @@ class AdminPanelNav extends Menu
|
||||
$menu_title = _('Plugins configuration');
|
||||
// TRANS: Menu item in administrator navigation panel.
|
||||
$this->out->menuItem(common_local_url('pluginsadminpanel'), _m('MENU','Plugins'),
|
||||
$menu_title, $action_name == 'pluginsadminpanel', 'nav_design_admin_panel');
|
||||
$menu_title, $action_name == 'pluginsadminpanel', 'nav_plugin_admin_panel');
|
||||
}
|
||||
|
||||
Event::handle('EndAdminPanelNav', array($this));
|
||||
|
@ -218,30 +218,8 @@ class ApiAction extends Action
|
||||
$twitter_user['protected'] = ($user->private_stream) ? true : false;
|
||||
$twitter_user['followers_count'] = $profile->subscriberCount();
|
||||
|
||||
$design = null;
|
||||
|
||||
// Note: some profiles don't have an associated user
|
||||
|
||||
$defaultDesign = Design::siteDesign();
|
||||
|
||||
if (!empty($user)) {
|
||||
$design = $user->getDesign();
|
||||
}
|
||||
|
||||
if (empty($design)) {
|
||||
$design = $defaultDesign;
|
||||
}
|
||||
|
||||
$color = Design::toWebColor(empty($design->backgroundcolor) ? $defaultDesign->backgroundcolor : $design->backgroundcolor);
|
||||
$twitter_user['profile_background_color'] = ($color == null) ? '' : '#'.$color->hexValue();
|
||||
$color = Design::toWebColor(empty($design->textcolor) ? $defaultDesign->textcolor : $design->textcolor);
|
||||
$twitter_user['profile_text_color'] = ($color == null) ? '' : '#'.$color->hexValue();
|
||||
$color = Design::toWebColor(empty($design->linkcolor) ? $defaultDesign->linkcolor : $design->linkcolor);
|
||||
$twitter_user['profile_link_color'] = ($color == null) ? '' : '#'.$color->hexValue();
|
||||
$color = Design::toWebColor(empty($design->sidebarcolor) ? $defaultDesign->sidebarcolor : $design->sidebarcolor);
|
||||
$twitter_user['profile_sidebar_fill_color'] = ($color == null) ? '' : '#'.$color->hexValue();
|
||||
$twitter_user['profile_sidebar_border_color'] = '';
|
||||
|
||||
$twitter_user['friends_count'] = $profile->subscriptionCount();
|
||||
|
||||
$twitter_user['created_at'] = $this->dateTwitter($profile->created);
|
||||
@ -259,15 +237,6 @@ class ApiAction extends Action
|
||||
|
||||
$twitter_user['utc_offset'] = $t->format('Z');
|
||||
$twitter_user['time_zone'] = $timezone;
|
||||
|
||||
$twitter_user['profile_background_image_url']
|
||||
= empty($design->backgroundimage)
|
||||
? '' : ($design->disposition & BACKGROUND_ON)
|
||||
? Design::url($design->backgroundimage) : '';
|
||||
|
||||
$twitter_user['profile_background_tile']
|
||||
= (bool)($design->disposition & BACKGROUND_TILE);
|
||||
|
||||
$twitter_user['statuses_count'] = $profile->noticeCount();
|
||||
|
||||
// Is the requesting user following this user?
|
||||
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Base class for actions that use the current user's design
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @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://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for actions that use the current user's design
|
||||
*
|
||||
* Some pages (settings in particular) use the current user's chosen
|
||||
* design. This superclass returns that design.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*
|
||||
*/
|
||||
class CurrentUserDesignAction extends Action
|
||||
{
|
||||
|
||||
protected $cur = null; // The current user
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
$this->cur = common_current_user();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A design for this action
|
||||
*
|
||||
* Returns the design preferences for the current user.
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
function getDesign()
|
||||
{
|
||||
if (!empty($this->cur)) {
|
||||
|
||||
$design = $this->cur->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
return $design;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getDesign();
|
||||
}
|
||||
|
||||
function getCurrentUser()
|
||||
{
|
||||
return $this->cur;
|
||||
}
|
||||
}
|
||||
|
@ -286,17 +286,6 @@ $default =
|
||||
array('handle' => false, // whether to handle sessions ourselves
|
||||
'debug' => false, // debugging output for sessions
|
||||
'gc_limit' => 1000), // max sessions to expire at a time
|
||||
'design' =>
|
||||
array('backgroundcolor' => null, // null -> 'use theme default'
|
||||
'contentcolor' => null,
|
||||
'sidebarcolor' => null,
|
||||
'textcolor' => null,
|
||||
'linkcolor' => null,
|
||||
'backgroundimage' => null,
|
||||
'disposition' => null),
|
||||
'custom_css' =>
|
||||
array('enabled' => true,
|
||||
'css' => ''),
|
||||
'notice' =>
|
||||
array('contentlimit' => null,
|
||||
'defaultscope' => 0), // set to 0 for default open
|
||||
@ -330,7 +319,7 @@ $default =
|
||||
),
|
||||
'pluginlist' => array(),
|
||||
'admin' =>
|
||||
array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license', 'plugins')),
|
||||
array('panels' => array('site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license', 'plugins')),
|
||||
'singleuser' =>
|
||||
array('enabled' => false,
|
||||
'nickname' => null),
|
||||
|
@ -1,319 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Form for choosing a design
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Form
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2009 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('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Form for choosing a design
|
||||
*
|
||||
* Used for choosing a site design, user design, or group design.
|
||||
*
|
||||
* @category Form
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*
|
||||
*/
|
||||
class DesignForm extends Form
|
||||
{
|
||||
/**
|
||||
* Return-to args
|
||||
*/
|
||||
|
||||
var $design = null;
|
||||
var $actionurl = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param HTMLOutputter $out output channel
|
||||
* @param Design $design initial design
|
||||
* @param Design $actionurl url of action (for form posting)
|
||||
*/
|
||||
function __construct($out, $design, $actionurl)
|
||||
{
|
||||
parent::__construct($out);
|
||||
|
||||
$this->design = $design;
|
||||
$this->actionurl = $actionurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the form
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
function id()
|
||||
{
|
||||
return 'design';
|
||||
}
|
||||
|
||||
/**
|
||||
* class of the form
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
function formClass()
|
||||
{
|
||||
return 'form_design';
|
||||
}
|
||||
|
||||
/**
|
||||
* Action of the form
|
||||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
function action()
|
||||
{
|
||||
return $this->actionurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legend of the Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formLegend()
|
||||
{
|
||||
// TRANS: Form legend of form for changing the page design.
|
||||
$this->out->element('legend', null, _('Change design'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data elements of the form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formData()
|
||||
{
|
||||
$this->backgroundData();
|
||||
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
|
||||
// TRANS: Fieldset legend on profile design page to change profile page colours.
|
||||
$this->out->element('legend', null, _('Change colours'));
|
||||
$this->colourData();
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset');
|
||||
|
||||
// TRANS: Button text on profile design page to immediately reset all colour settings to default.
|
||||
$this->out->submit('defaults', _('Use defaults'), 'submit form_action-default',
|
||||
// TRANS: Title for button on profile design page to reset all colour settings to default.
|
||||
'defaults', _('Restore default designs.'));
|
||||
|
||||
$this->out->element('input', array('id' => 'settings_design_reset',
|
||||
'type' => 'reset',
|
||||
// TRANS: Button text on profile design page to reset all colour settings to default without saving.
|
||||
'value' => _m('BUTTON', 'Reset'),
|
||||
'class' => 'submit form_action-primary',
|
||||
// TRANS: Title for button on profile design page to reset all colour settings to default without saving.
|
||||
'title' => _('Reset back to default.')));
|
||||
}
|
||||
|
||||
function backgroundData()
|
||||
{
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
$this->out->elementStart('li');
|
||||
$this->out->element('label', array('for' => 'design_background-image_file'),
|
||||
// TRANS: Label in form on profile design page.
|
||||
// TRANS: Field contains file name on user's computer that could be that user's custom profile background image.
|
||||
_('Upload file'));
|
||||
$this->out->element('input', array('name' => 'design_background-image_file',
|
||||
'type' => 'file',
|
||||
'id' => 'design_background-image_file'));
|
||||
// TRANS: Instructions for form on profile design page.
|
||||
$this->out->element('p', 'form_guide', _('You can upload your personal ' .
|
||||
'background image. The maximum file size is 2MB.'));
|
||||
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
if (!empty($this->design->backgroundimage)) {
|
||||
|
||||
$this->out->elementStart('li', array('id' =>
|
||||
'design_background-image_onoff'));
|
||||
|
||||
$this->out->element('img', array('src' =>
|
||||
Design::url($this->design->backgroundimage)));
|
||||
|
||||
$attrs = array('name' => 'design_background-image_onoff',
|
||||
'type' => 'radio',
|
||||
'id' => 'design_background-image_on',
|
||||
'class' => 'radio',
|
||||
'value' => 'on');
|
||||
|
||||
if ($this->design->disposition & BACKGROUND_ON) {
|
||||
$attrs['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$this->out->element('input', $attrs);
|
||||
|
||||
$this->out->element('label', array('for' => 'design_background-image_on',
|
||||
'class' => 'radio'),
|
||||
// TRANS: Radio button on profile design page that will enable use of the uploaded profile image.
|
||||
_m('RADIO', 'On'));
|
||||
|
||||
$attrs = array('name' => 'design_background-image_onoff',
|
||||
'type' => 'radio',
|
||||
'id' => 'design_background-image_off',
|
||||
'class' => 'radio',
|
||||
'value' => 'off');
|
||||
|
||||
if ($this->design->disposition & BACKGROUND_OFF) {
|
||||
$attrs['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$this->out->element('input', $attrs);
|
||||
|
||||
$this->out->element('label', array('for' => 'design_background-image_off',
|
||||
'class' => 'radio'),
|
||||
// TRANS: Radio button on profile design page that will disable use of the uploaded profile image.
|
||||
_m('RADIO', 'Off'));
|
||||
// TRANS: Form guide for a set of radio buttons on the profile design page that will enable or disable
|
||||
// TRANS: use of the uploaded profile image.
|
||||
$this->out->element('p', 'form_guide', _('Turn background image on or off.'));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
$this->out->elementStart('li');
|
||||
$this->out->checkbox('design_background-image_repeat',
|
||||
// TRANS: Checkbox label on profile design page that will cause the profile image to be tiled.
|
||||
_('Tile background image'),
|
||||
($this->design->disposition & BACKGROUND_TILE) ? true : false);
|
||||
$this->out->elementEnd('li');
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
|
||||
function colourData()
|
||||
{
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
try {
|
||||
|
||||
$bgcolor = new WebColor($this->design->backgroundcolor);
|
||||
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Label on profile design page for setting a profile page background colour.
|
||||
$this->out->element('label', array('for' => 'swatch-1'), _('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-1',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
$ccolor = new WebColor($this->design->contentcolor);
|
||||
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Label on profile design page for setting a profile page content colour.
|
||||
$this->out->element('label', array('for' => 'swatch-2'), _('Content'));
|
||||
$this->out->element('input', array('name' => 'design_content',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-2',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
$sbcolor = new WebColor($this->design->sidebarcolor);
|
||||
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Label on profile design page for setting a profile page sidebar colour.
|
||||
$this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
|
||||
$this->out->element('input', array('name' => 'design_sidebar',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-3',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
$tcolor = new WebColor($this->design->textcolor);
|
||||
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Label on profile design page for setting a profile page text colour.
|
||||
$this->out->element('label', array('for' => 'swatch-4'), _('Text'));
|
||||
$this->out->element('input', array('name' => 'design_text',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-4',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
$lcolor = new WebColor($this->design->linkcolor);
|
||||
|
||||
$this->out->elementStart('li');
|
||||
// TRANS: Label on profile design page for setting a profile page links colour.
|
||||
$this->out->element('label', array('for' => 'swatch-5'), _('Links'));
|
||||
$this->out->element('input', array('name' => 'design_links',
|
||||
'type' => 'text',
|
||||
'id' => 'swatch-5',
|
||||
'class' => 'swatch',
|
||||
'maxlength' => '7',
|
||||
'size' => '7',
|
||||
'value' => ''));
|
||||
$this->out->elementEnd('li');
|
||||
|
||||
} catch (WebColorException $e) {
|
||||
common_log(LOG_ERR, 'Bad color values in design ID: ' .$this->design->id);
|
||||
}
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
}
|
||||
|
||||
/**
|
||||
* Action elements
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
// TRANS: Button text on profile design page to save settings.
|
||||
$this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
|
||||
// TRANS: Title for button on profile design page to save settings.
|
||||
'save', _('Save design.'));
|
||||
}
|
||||
}
|
@ -1,247 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Change user password
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @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://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for setting a user or group design
|
||||
*
|
||||
* Shows the design setting form and also handles some things like saving
|
||||
* background images, and fetching a default design
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class DesignSettingsAction extends SettingsAction
|
||||
{
|
||||
var $submitaction = null;
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for profile design page.
|
||||
return _('Profile design');
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions for use
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for profile design page.
|
||||
return _('Customize the way your profile looks ' .
|
||||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the design settings form
|
||||
*
|
||||
* @param Design $design a working design to show
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function showDesignForm($design)
|
||||
{
|
||||
$form = new DesignForm($this, $design, $this->selfUrl());
|
||||
$form->show();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a post
|
||||
*
|
||||
* Validate input and save changes. Reload the form with a success
|
||||
* or error message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handlePost()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
// Workaround for PHP returning empty $_POST and $_FILES when POST
|
||||
// length > post_max_size in php.ini
|
||||
|
||||
if (empty($_FILES)
|
||||
&& empty($_POST)
|
||||
&& ($_SERVER['CONTENT_LENGTH'] > 0)
|
||||
) {
|
||||
// TRANS: Form validation error in design settings form. POST should remain untranslated.
|
||||
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
|
||||
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
|
||||
intval($_SERVER['CONTENT_LENGTH']));
|
||||
|
||||
$this->showForm(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// CSRF protection
|
||||
$token = $this->trimmed('token');
|
||||
if (!$token || $token != common_session_token()) {
|
||||
// TRANS: Client error displayed when the session token does not match or is not given.
|
||||
$this->showForm(_('There was a problem with your session token. '.
|
||||
'Try again, please.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->arg('save')) {
|
||||
$this->saveDesign();
|
||||
} else if ($this->arg('defaults')) {
|
||||
$this->restoreDefaults();
|
||||
} else {
|
||||
// TRANS: Unknown form validation error in design settings form.
|
||||
$this->showForm(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Farbtastic stylesheet
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showStylesheets()
|
||||
{
|
||||
parent::showStylesheets();
|
||||
$this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Farbtastic scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
|
||||
$this->script('farbtastic/farbtastic.js');
|
||||
$this->script('userdesign.go.js');
|
||||
|
||||
$this->autofocus('design_background-image_file');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the background image, if any, and set its disposition
|
||||
*
|
||||
* @param Design $design a working design to attach the img to
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function saveBackgroundImage($design)
|
||||
{
|
||||
// Now that we have a Design ID we can add a file to the design.
|
||||
// XXX: This is an additional DB hit, but figured having the image
|
||||
// associated with the Design rather than the User was worth
|
||||
// it. -- Zach
|
||||
|
||||
if (array_key_exists('design_background-image_file', $_FILES) &&
|
||||
$_FILES['design_background-image_file']['error'] == UPLOAD_ERR_OK) {
|
||||
|
||||
$filepath = null;
|
||||
|
||||
try {
|
||||
$imagefile = ImageFile::fromUpload('design_background-image_file');
|
||||
} catch (Exception $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
$filename = Design::filename($design->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
common_timestamp());
|
||||
|
||||
$filepath = Design::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
|
||||
// delete any old backround img laying around
|
||||
|
||||
if (isset($design->backgroundimage)) {
|
||||
@unlink(Design::path($design->backgroundimage));
|
||||
}
|
||||
|
||||
$original = clone($design);
|
||||
|
||||
$design->backgroundimage = $filename;
|
||||
|
||||
// default to on, no tile
|
||||
|
||||
$design->setDisposition(true, false, false);
|
||||
|
||||
$result = $design->update($original);
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
// TRANS: Error message displayed if design settings could not be saved.
|
||||
$this->showForm(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the user or group design to system defaults
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function restoreDefaults()
|
||||
{
|
||||
$design = $this->getWorkingDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
|
||||
$result = $design->delete();
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'DELETE', __FILE__);
|
||||
// TRANS: Error message displayed if design settings could not be saved after clicking "Use defaults".
|
||||
$this->showForm(_('Could not update your design.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TRANS: Success message displayed if design settings were saved after clicking "Use defaults".
|
||||
$this->showForm(_('Design defaults restored.'), true);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Base class for actions that use the current user's design
|
||||
* Base class for group actions
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
@ -22,7 +22,7 @@
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009-2011 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/
|
||||
*/
|
||||
@ -32,10 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for actions that use a group's design
|
||||
*
|
||||
* Pages related to groups can be themed with a design.
|
||||
* This superclass returns that design.
|
||||
* Base class for group actions, similar to ProfileAction
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
@ -44,30 +41,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @link http://status.net/
|
||||
*
|
||||
*/
|
||||
class GroupDesignAction extends Action {
|
||||
|
||||
/** The group in question */
|
||||
var $group = null;
|
||||
|
||||
/**
|
||||
* A design for this action
|
||||
*
|
||||
* if the group attribute has been set, returns that group's
|
||||
* design.
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
|
||||
function getDesign()
|
||||
{
|
||||
if (!empty($this->group)) {
|
||||
$design = $this->group->getDesign();
|
||||
if (!empty($design)) {
|
||||
return $design;
|
||||
}
|
||||
}
|
||||
return parent::getDesign();
|
||||
}
|
||||
class GroupAction extends Action {
|
||||
|
||||
function showProfileBlock()
|
||||
{
|
@ -137,15 +137,6 @@ class GroupNav extends Menu
|
||||
sprintf(_m('TOOLTIP','Add or edit %s logo'), $nickname),
|
||||
$action_name == 'grouplogo',
|
||||
'nav_group_logo');
|
||||
$this->out->menuItem(common_local_url('groupdesignsettings', array('nickname' =>
|
||||
$nickname)),
|
||||
// TRANS: Menu item in the group navigation page. Only shown for group administrators.
|
||||
_m('MENU','Design'),
|
||||
// TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators.
|
||||
// TRANS: %s is the nickname of the group.
|
||||
sprintf(_m('TOOLTIP','Add or edit %s design'), $nickname),
|
||||
$action_name == 'groupdesignsettings',
|
||||
'nav_group_design');
|
||||
}
|
||||
Event::handle('EndGroupGroupNav', array($this));
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class GroupsByMembersSection extends GroupSection
|
||||
$qry = 'SELECT user_group.*, count(*) as value ' .
|
||||
'FROM user_group JOIN group_member '.
|
||||
'ON user_group.id = group_member.group_id ' .
|
||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
|
||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
|
||||
'ORDER BY value DESC ';
|
||||
|
||||
$limit = GROUPS_PER_SECTION;
|
||||
|
@ -47,7 +47,7 @@ class GroupsByPostsSection extends GroupSection
|
||||
$qry = 'SELECT user_group.*, count(*) as value ' .
|
||||
'FROM user_group JOIN group_inbox '.
|
||||
'ON user_group.id = group_inbox.group_id ' .
|
||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
|
||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
|
||||
'ORDER BY value DESC ';
|
||||
|
||||
$limit = GROUPS_PER_SECTION;
|
||||
|
@ -42,7 +42,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @see InboxAction
|
||||
* @see OutboxAction
|
||||
*/
|
||||
class MailboxAction extends CurrentUserDesignAction
|
||||
class MailboxAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Base class for actions that use the page owner's design
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 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('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for actions that use the page owner's design
|
||||
*
|
||||
* Some pages have a clear "owner" -- like the profile page, subscriptions
|
||||
* pages, etc. This superclass uses that owner's chosen design for the page
|
||||
* design.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*
|
||||
*/
|
||||
|
||||
class OwnerDesignAction extends Action {
|
||||
|
||||
/** The user for this page. */
|
||||
|
||||
var $user = null;
|
||||
|
||||
/**
|
||||
* A design for this action
|
||||
*
|
||||
* if the user attribute has been set, returns that user's
|
||||
* design.
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
|
||||
function getDesign()
|
||||
{
|
||||
if (!empty($this->user)) {
|
||||
|
||||
$design = $this->user->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
return $design;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getDesign();
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 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/
|
||||
*/
|
||||
@ -46,7 +46,7 @@ require_once INSTALLDIR.'/lib/groupminilist.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class ProfileAction extends OwnerDesignAction
|
||||
class ProfileAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
var $profile = null;
|
||||
|
@ -269,7 +269,7 @@ class Router
|
||||
// settings
|
||||
|
||||
foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
|
||||
'oauthapps', 'email', 'sms', 'userdesign', 'url') as $s) {
|
||||
'oauthapps', 'email', 'sms', 'url') as $s) {
|
||||
$m->connect('settings/'.$s, array('action' => $s.'settings'));
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ class Router
|
||||
array('id' => '[0-9]+'));
|
||||
}
|
||||
|
||||
foreach (array('members', 'logo', 'rss', 'designsettings') as $n) {
|
||||
foreach (array('members', 'logo', 'rss') as $n) {
|
||||
$m->connect('group/:nickname/'.$n,
|
||||
array('action' => 'group'.$n),
|
||||
array('nickname' => Nickname::DISPLAY_FMT));
|
||||
@ -626,12 +626,6 @@ class Router
|
||||
$m->connect('api/account/update_profile_image.:format',
|
||||
array('action' => 'ApiAccountUpdateProfileImage'));
|
||||
|
||||
$m->connect('api/account/update_profile_background_image.:format',
|
||||
array('action' => 'ApiAccountUpdateProfileBackgroundImage'));
|
||||
|
||||
$m->connect('api/account/update_profile_colors.:format',
|
||||
array('action' => 'ApiAccountUpdateProfileColors'));
|
||||
|
||||
$m->connect('api/account/update_delivery_device.:format',
|
||||
array('action' => 'ApiAccountUpdateDeliveryDevice'));
|
||||
|
||||
@ -875,7 +869,6 @@ class Router
|
||||
// Admin
|
||||
|
||||
$m->connect('panel/site', array('action' => 'siteadminpanel'));
|
||||
$m->connect('panel/design', array('action' => 'designadminpanel'));
|
||||
$m->connect('panel/user', array('action' => 'useradminpanel'));
|
||||
$m->connect('panel/access', array('action' => 'accessadminpanel'));
|
||||
$m->connect('panel/paths', array('action' => 'pathsadminpanel'));
|
||||
|
@ -43,7 +43,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @see Widget
|
||||
*/
|
||||
|
||||
class SettingsAction extends CurrentUserDesignAction
|
||||
class SettingsAction extends Action
|
||||
{
|
||||
/**
|
||||
* A message for the user.
|
||||
|
@ -112,13 +112,6 @@ class SettingsNav extends Menu
|
||||
_('Change email handling'),
|
||||
$actionName == 'emailsettings');
|
||||
|
||||
$this->action->menuItem(common_local_url('userdesignsettings'),
|
||||
// TRANS: Menu item in settings navigation panel.
|
||||
_m('MENU','Design'),
|
||||
// TRANS: Menu item title in settings navigation panel.
|
||||
_('Design your profile'),
|
||||
$actionName == 'userdesignsettings');
|
||||
|
||||
$this->action->menuItem(common_local_url('urlsettings'),
|
||||
// TRANS: Menu item in settings navigation panel.
|
||||
_m('MENU','URL'),
|
||||
|
@ -296,10 +296,6 @@ class StatusNet
|
||||
|
||||
$config['db'] = $default['db'];
|
||||
|
||||
// Backward compatibility
|
||||
|
||||
$config['site']['design'] =& $config['design'];
|
||||
|
||||
if (function_exists('date_default_timezone_set')) {
|
||||
/* Work internally in UTC */
|
||||
date_default_timezone_set('UTC');
|
||||
|
@ -277,8 +277,7 @@ class FacebookBridgePlugin extends Plugin
|
||||
if ($this->hasApplication()) {
|
||||
$action_name = $action->trimmed('action');
|
||||
|
||||
// CurrentUserDesignAction stores the current user in $cur
|
||||
$user = $action->getCurrentUser();
|
||||
$user = common_current_user();
|
||||
|
||||
$flink = null;
|
||||
|
||||
|
@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class GroupinboxAction extends GroupDesignAction
|
||||
class GroupinboxAction extends GroupAction
|
||||
{
|
||||
var $gm;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Mapstraction
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @copyright 2009-2011 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/
|
||||
*/
|
||||
@ -42,7 +42,7 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class MapAction extends OwnerDesignAction
|
||||
class MapAction extends Action
|
||||
{
|
||||
var $profile = null;
|
||||
var $page = null;
|
||||
|
@ -8,7 +8,7 @@ class RemoteProfileAction extends ShowstreamAction
|
||||
{
|
||||
function prepare($args)
|
||||
{
|
||||
OwnerDesignAction::prepare($args); // skip the ProfileAction code and replace it...
|
||||
Action::prepare($args); // skip the ProfileAction code and replace it...
|
||||
|
||||
$id = $this->arg('id');
|
||||
$this->user = false;
|
||||
|
@ -57,7 +57,7 @@ class QnashowanswerAction extends ShownoticeAction
|
||||
*/
|
||||
function prepare($argarray)
|
||||
{
|
||||
OwnerDesignAction::prepare($argarray);
|
||||
Action::prepare($argarray);
|
||||
|
||||
$this->id = $this->trimmed('id');
|
||||
|
||||
|
@ -57,7 +57,7 @@ class QnashowquestionAction extends ShownoticeAction
|
||||
*/
|
||||
function prepare($argarray)
|
||||
{
|
||||
OwnerDesignAction::prepare($argarray);
|
||||
Action::prepare($argarray);
|
||||
|
||||
$this->id = $this->trimmed('id');
|
||||
|
||||
|
@ -1903,4 +1903,35 @@ li.notice-answer + li.notice {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
/* SNOD CompanyLogo styling */
|
||||
|
||||
#site_nav_local_views a.company_logo {
|
||||
width: 138px;
|
||||
padding: 0px;
|
||||
font-weight: bold;
|
||||
text-transform: none;
|
||||
line-height: 1em;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
#site_nav_local_views a.company_logo:hover {
|
||||
background: none;
|
||||
color: blue;
|
||||
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.company_logo img {
|
||||
max-width: 96px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.company_logo span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
a.company_logo:hover span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
}/*end of @media screen, projection, tv*/
|
||||
|
Loading…
Reference in New Issue
Block a user