aboutsummaryrefslogtreecommitdiffstats
path: root/mod/settings.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-16 05:23:26 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-16 05:23:26 -0700
commit30e3a65c0f15f2cbcc538b35c18b1f60490fda9b (patch)
tree5f702db316822d065442ba0e3983272deab861ac /mod/settings.php
parent4bcf38029656fa3ad2e1914f531491ef90320c23 (diff)
downloadvolse-hubzilla-30e3a65c0f15f2cbcc538b35c18b1f60490fda9b.tar.gz
volse-hubzilla-30e3a65c0f15f2cbcc538b35c18b1f60490fda9b.tar.bz2
volse-hubzilla-30e3a65c0f15f2cbcc538b35c18b1f60490fda9b.zip
full theming support
Diffstat (limited to 'mod/settings.php')
-rw-r--r--mod/settings.php33
1 files changed, 21 insertions, 12 deletions
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;