aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/profile.php1
-rw-r--r--mod/settings.php33
2 files changed, 22 insertions, 12 deletions
diff --git a/mod/profile.php b/mod/profile.php
index 1b37d31bc..119b523a6 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -34,6 +34,7 @@ function profile_load(&$a, $username, $profile = 0) {
$a->page['template'] = 'profile';
$a->page['title'] = $a->profile['name'];
+ $_SESSION['theme'] = $a->profile['theme'];
return;
}}
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 = '<select name="theme" id="theme-select" >';
+ $files = glob('view/theme/*');
+ if($files) {
+ foreach($files as $file) {
+ $f = basename($file);
+ $selected = (($f == $_SESSION['theme']) || ($f == 'default' && (! x($_SESSION,'theme')))
+ ? ' selected="selected" ' : '' );
+ $theme_selector .= '<option val="' . basename($file) . '"' . $selected . '>' . basename($file) . '</option>';
+ }
+ }
+ $theme_selector .= '</select>';
+
$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;