From 30e3a65c0f15f2cbcc538b35c18b1f60490fda9b Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 16 Aug 2010 05:23:26 -0700 Subject: full theming support --- mod/settings.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'mod/settings.php') diff --git a/mod/settings.php b/mod/settings.php index 10336e771..0d65bf9ba 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -52,6 +52,7 @@ function settings_post(&$a) { } } + $theme = notags(trim($_POST['theme'])); $username = notags(trim($_POST['username'])); $email = notags(trim($_POST['email'])); $timezone = notags(trim($_POST['timezone'])); @@ -131,9 +132,7 @@ function settings_post(&$a) { $str_contact_deny = implode('',$contact_deny); } - - - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d WHERE `uid` = %d LIMIT 1", + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `theme` = '%s' WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($timezone), @@ -142,24 +141,19 @@ function settings_post(&$a) { dbesc($str_contact_deny), dbesc($str_group_deny), intval($notify), + dbesc($theme), intval($_SESSION['uid']) ); if($r) notice( t('Settings updated.') . EOL); - + $_SESSION['theme'] = $theme; if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) { // FIXME - set to un-verified, blocked and redirect to logout } - - // Refresh the content display with new data - - $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", - intval($_SESSION['uid'])); - if(count($r)) - $a->user = $r[0]; + goaway($a->get_baseurl() . '/settings' ); } @@ -179,6 +173,8 @@ function settings_content(&$a) { $timezone = $a->user['timezone']; $notify = $a->user['notify-flags']; + if(! strlen($a->user['timezone'])) + $timezone = date_default_timezone_get(); $nickname_block = file_get_contents("view/settings_nick_set.tpl"); @@ -193,6 +189,18 @@ function settings_content(&$a) { )); } + $theme_selector = ''; + $nickname_block = replace_macros($nickname_block,array( '$nickname' => $nickname, @@ -217,7 +225,8 @@ function settings_content(&$a) { '$sel_notify2' => (($notify & NOTIFY_CONFIRM) ? ' checked="checked" ' : ''), '$sel_notify3' => (($notify & NOTIFY_WALL) ? ' checked="checked" ' : ''), '$sel_notify4' => (($notify & NOTIFY_COMMENT) ? ' checked="checked" ' : ''), - '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : '') + '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''), + '$theme' => $theme_selector )); return $o; -- cgit v1.2.3