Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- zach@plantard:/var/www/zach$ diff actions/designsettings.php ../evan/actions/designsettings.php
- 35a36,37
- >
- >
- 101c103,115
- < $design = $user->getDesign();
- ---
- > //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"}}';
- >
- > //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'));
- 103,105c117
- < if (empty($design)) {
- < $design = $this->defaultDesign();
- < }
- ---
- > $userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
- 106a119
- > $s = 0;
- 112d124
- <
- 138,143c150,154
- < /*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
- > */
- 145a157
- >
- 159,160c171,224
- < // TODO: implement this
- < return;
- ---
- > /*
- > // 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);
- > */
- 162a227
- >
Add Comment
Please, Sign In to add comment