summaryrefslogtreecommitdiff
path: root/actions/designsettings.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/designsettings.php')
-rw-r--r--actions/designsettings.php91
1 files changed, 13 insertions, 78 deletions
diff --git a/actions/designsettings.php b/actions/designsettings.php
index 5774b8537..66476e677 100644
--- a/actions/designsettings.php
+++ b/actions/designsettings.php
@@ -33,8 +33,6 @@ if (!defined('LACONICA')) {
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
-
-
class DesignsettingsAction extends AccountSettingsAction
{
/**
@@ -100,28 +98,18 @@ class DesignsettingsAction extends AccountSettingsAction
$this->element('legend', null, _('Change colours'));
$this->elementStart('ul', 'form_data');
- //This is a JSON object in the DB field. Here for testing. Remove later.
- $userSwatch = '{"body":{"background-color":"#F0F2F5"},
- "#content":{"background-color":"#FFFFFF"},
- "#aside_primary":{"background-color":"#CEE1E9"},
- "html body":{"color":"#000000"},
- "a":{"color":"#002E6E"}}';
+ $design = $user->getDesign();
- //Default theme swatch -- Where should this be stored?
- $defaultSwatch = array('body' => array('background-color' => '#F0F2F5'),
- '#content' => array('background-color' => '#FFFFFF'),
- '#aside_primary' => array('background-color' => '#CEE1E9'),
- 'html body' => array('color' => '#000000'),
- 'a' => array('color' => '#002E6E'));
-
- $userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
+ if (empty($design)) {
+ $design = $this->defaultDesign();
+ }
- $s = 0;
$labelSwatch = array('Background',
'Content',
'Sidebar',
'Text',
'Links');
+
foreach($userSwatch as $propertyvalue => $value) {
$foo = array_values($value);
$this->elementStart('li');
@@ -147,14 +135,14 @@ class DesignsettingsAction extends AccountSettingsAction
'title' => _('Reset back to default')));
$this->submit('save', _('Save'), 'submit form_action-secondary', 'save', _('Save design'));
-/*TODO: Check submitted form values:
-json_encode(form values)
-if submitted Swatch == DefaultSwatch, don't store in DB.
-else store in BD
-*/
+ /*TODO: Check submitted form values:
+ json_encode(form values)
+ if submitted Swatch == DefaultSwatch, don't store in DB.
+ else store in BD
+ */
+
$this->elementEnd('fieldset');
$this->elementEnd('form');
-
}
/**
@@ -168,63 +156,10 @@ else store in BD
function handlePost()
{
- /*
- // CSRF protection
-
- $token = $this->trimmed('token');
- if (!$token || $token != common_session_token()) {
- $this->showForm(_('There was a problem with your session token. '.
- 'Try again, please.'));
- return;
- }
-
- $user = common_current_user();
- assert(!is_null($user)); // should already be checked
-
- // FIXME: scrub input
-
- $newpassword = $this->arg('newpassword');
- $confirm = $this->arg('confirm');
-
- # Some validation
-
- if (strlen($newpassword) < 6) {
- $this->showForm(_('Password must be 6 or more characters.'));
- return;
- } else if (0 != strcmp($newpassword, $confirm)) {
- $this->showForm(_('Passwords don\'t match.'));
- return;
- }
-
- if ($user->password) {
- $oldpassword = $this->arg('oldpassword');
-
- if (!common_check_user($user->nickname, $oldpassword)) {
- $this->showForm(_('Incorrect old password'));
- return;
- }
- }
-
- $original = clone($user);
-
- $user->password = common_munge_password($newpassword, $user->id);
-
- $val = $user->validate();
- if ($val !== true) {
- $this->showForm(_('Error saving user; invalid.'));
- return;
- }
-
- if (!$user->update($original)) {
- $this->serverError(_('Can\'t save new password.'));
- return;
- }
-
- $this->showForm(_('Password saved.'), true);
- */
+ // TODO: implement this
+ return;
}
-
/**
* Add the Farbtastic stylesheet
*