X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fdesignsettings.php;h=eb3a5908e6ff8c05fec602461fff15553c608686;hb=1d29ba83150bdd7a23e497ca9a743ac2b6158b6f;hp=98ef8256cd9859d1af679901b69691ff34889fee;hpb=bee50840728ca8af99e988bcce71876849ba61d3;p=quix0rs-gnu-social.git diff --git a/lib/designsettings.php b/lib/designsettings.php index 98ef8256cd..eb3a5908e6 100644 --- a/lib/designsettings.php +++ b/lib/designsettings.php @@ -32,9 +32,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR . '/lib/accountsettingsaction.php'; -require_once INSTALLDIR . '/lib/webcolor.php'; - /** * Base class for setting a user or group design * @@ -49,9 +46,8 @@ require_once INSTALLDIR . '/lib/webcolor.php'; * @link http://status.net/ */ -class DesignSettingsAction extends AccountSettingsAction +class DesignSettingsAction extends SettingsAction { - var $submitaction = null; /** @@ -59,9 +55,9 @@ class DesignSettingsAction extends AccountSettingsAction * * @return string Title of the page */ - function title() { + // TRANS: Page title for profile design page. return _('Profile design'); } @@ -70,9 +66,9 @@ class DesignSettingsAction extends AccountSettingsAction * * @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.'); } @@ -84,11 +80,11 @@ class DesignSettingsAction extends AccountSettingsAction * * @return nothing */ - function showDesignForm($design) { $form = new DesignForm($this, $design, $this->selfUrl()); $form->show(); + } /** @@ -99,7 +95,6 @@ class DesignSettingsAction extends AccountSettingsAction * * @return void */ - function handlePost() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { @@ -111,8 +106,10 @@ class DesignSettingsAction extends AccountSettingsAction && empty($_POST) && ($_SERVER['CONTENT_LENGTH'] > 0) ) { - $msg = _('The server was unable to handle that much POST ' . - 'data (%s bytes) due to its current configuration.'); + // 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; @@ -132,6 +129,7 @@ class DesignSettingsAction extends AccountSettingsAction } else if ($this->arg('defaults')) { $this->restoreDefaults(); } else { + // TRANS: Unknown form validation error in design settings form. $this->showForm(_('Unexpected form submission.')); } } @@ -141,7 +139,6 @@ class DesignSettingsAction extends AccountSettingsAction * * @return void */ - function showStylesheets() { parent::showStylesheets(); @@ -153,7 +150,6 @@ class DesignSettingsAction extends AccountSettingsAction * * @return void */ - function showScripts() { parent::showScripts(); @@ -171,31 +167,28 @@ class DesignSettingsAction extends AccountSettingsAction * * @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 ($_FILES['design_background-image_file']['error'] == - UPLOAD_ERR_OK) { + 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'); + $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()); + image_type_to_extension($imagefile->type), + common_timestamp()); $filepath = Design::path($filename); @@ -219,6 +212,7 @@ class DesignSettingsAction extends AccountSettingsAction if ($result === false) { common_log_db_error($design, 'UPDATE', __FILE__); + // TRANS: Error message displayed if design settings could not be saved. $this->showForm(_('Couldn\'t update your design.')); return; } @@ -230,7 +224,6 @@ class DesignSettingsAction extends AccountSettingsAction * * @return nothing */ - function restoreDefaults() { $design = $this->getWorkingDesign(); @@ -241,12 +234,13 @@ class DesignSettingsAction extends AccountSettingsAction 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(_('Couldn\'t update your design.')); return; } } + // TRANS: Success message displayed if design settings were saved after clicking "Use defaults". $this->showForm(_('Design defaults restored.'), true); } - }