Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 185 lines (147 sloc) 9.843 kB
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
1 <?php
2
3 /*
f362a03 @dietrichm copyright update
dietrichm authored
4 Copyright (C) 2003-2005 UseBB Team
98e8605 @dietrichm Changed project web site URL to http://www.usebb.net.
dietrichm authored
5 http://www.usebb.net
3f54de4 @dietrichm Added Header keyword to php files.
dietrichm authored
6
7 $Header$
7e4335d @dietrichm Cosmetic changes with spaces and tabs in header of PHP files.
dietrichm authored
8
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
9 This file is part of UseBB.
7e4335d @dietrichm Cosmetic changes with spaces and tabs in header of PHP files.
dietrichm authored
10
11 UseBB is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 UseBB is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with UseBB; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
24 */
25
75d17d7 @dietrichm Added DocBlocks for phpDocumentator.
dietrichm authored
26 /**
27 * Panel options
28 *
29 * Gives an interface to change account settings.
30 *
31 * @author UseBB Team
32 * @link http://www.usebb.net
33 * @license GPL-2
34 * @version $Revision$
35 * @copyright Copyright (C) 2003-2005 UseBB Team
36 * @package UseBB
37 * @subpackage Panel
38 */
39
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
40 //
41 // Die when called directly in browser
42 //
43 if ( !defined('INCLUDED') )
44 exit();
45
6804369 @dietrichm tpl updates
dietrichm authored
46 if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
47
48 //
49 // Update the user's preferences
50 //
aa5d418 @dietrichm Some fixes in functions.php and language settings implemented in panel.
dietrichm authored
51
dcb3735 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
52 $_POST['language'] = ( !empty($_POST['language']) && in_array($_POST['language'], $functions->get_language_packs()) ) ? $_POST['language'] : $functions->get_config('language');
53 $_POST['template'] = ( !empty($_POST['template']) && in_array($_POST['template'], $functions->get_template_sets()) ) ? $_POST['template'] : $functions->get_config('template');
757f8d5 @dietrichm Fixes bug when submitting form when template dropdown is disabled + s…
dietrichm authored
54 $_POST['email_show'] = ( !empty($_POST['email_show']) ) ? 1 : 0;
55 $_POST['last_login_show'] = ( !empty($_POST['last_login_show']) ) ? 1 : 0;
e7e613b @dietrichm Added feature 1055687: Hide from online users list.
dietrichm authored
56 $_POST['hide_from_online_list'] = ( !empty($_POST['hide_from_online_list']) ) ? 1 : 0;
757f8d5 @dietrichm Fixes bug when submitting form when template dropdown is disabled + s…
dietrichm authored
57 $_POST['date_format'] = ( !empty($_POST['date_format']) ) ? $_POST['date_format'] : $functions->get_config('date_format');
2fd9938 @dietrichm better integer detection
dietrichm authored
58 $_POST['timezone'] = ( valid_int($_POST['timezone']) && $functions->timezone_handler('check_existance', $_POST['timezone']) ) ? $_POST['timezone'] : $functions->get_config('timezone');
ea42fc9 @dietrichm Implemented timezone and DST handling.
dietrichm authored
59 $_POST['dst'] = ( !empty($_POST['dst']) ) ? 1 : 0;
b723e1c @dietrichm This is UseBB 0.2. Official release will follow very soon! :D
dietrichm authored
60 $_POST['quickreply'] = ( !empty($_POST['quickreply']) ) ? 1 : 0;
61 $_POST['return_to_topic'] = ( !empty($_POST['return_to_topic']) ) ? 1 : 0;
488f1d8 @dietrichm Added 'Open external links in new windows' feature.
dietrichm authored
62 $_POST['target_blank'] = ( !empty($_POST['target_blank']) ) ? 1 : 0;
7ceccd6 @dietrichm Added feature 1055684: Hide avatars/signatures setting.
dietrichm authored
63 $_POST['hide_avatars'] = ( !empty($_POST['hide_avatars']) ) ? 1 : 0;
4591049 @dietrichm Added feature 1061847: Hide user information in posts.
dietrichm authored
64 $_POST['hide_userinfo'] = ( !empty($_POST['hide_userinfo']) ) ? 1 : 0;
7ceccd6 @dietrichm Added feature 1055684: Hide avatars/signatures setting.
dietrichm authored
65 $_POST['hide_signatures'] = ( !empty($_POST['hide_signatures']) ) ? 1 : 0;
dd63bfe @dietrichm Added auto subscribe feature.
dietrichm authored
66 $_POST['auto_subscribe_topic'] = ( !empty($_POST['auto_subscribe_topic']) ) ? 1 : 0;
67 $_POST['auto_subscribe_reply'] = ( !empty($_POST['auto_subscribe_reply']) ) ? 1 : 0;
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
68
2c89453 @dietrichm Better SQL error catching.
dietrichm authored
69 $result = $db->query("UPDATE ".TABLE_PREFIX."members SET
dd63bfe @dietrichm Added auto subscribe feature.
dietrichm authored
70 language = '".$_POST['language']."',
71 template = '".$_POST['template']."',
72 email_show = ".$_POST['email_show'].",
757f8d5 @dietrichm Fixes bug when submitting form when template dropdown is disabled + s…
dietrichm authored
73 last_login_show = ".$_POST['last_login_show'].",
e7e613b @dietrichm Added feature 1055687: Hide from online users list.
dietrichm authored
74 hide_from_online_list = ".$_POST['hide_from_online_list'].",
dd63bfe @dietrichm Added auto subscribe feature.
dietrichm authored
75 date_format = '".$_POST['date_format']."',
76 timezone = '".$_POST['timezone']."',
77 dst = ".$_POST['dst'].",
78 enable_quickreply = ".$_POST['quickreply'].",
79 return_to_topic_after_posting = ".$_POST['return_to_topic'].",
80 target_blank = ".$_POST['target_blank'].",
81 hide_avatars = ".$_POST['hide_avatars'].",
82 hide_userinfo = ".$_POST['hide_userinfo'].",
83 hide_signatures = ".$_POST['hide_signatures'].",
84 auto_subscribe_topic = ".$_POST['auto_subscribe_topic'].",
85 auto_subscribe_reply = ".$_POST['auto_subscribe_reply']."
2c89453 @dietrichm Better SQL error catching.
dietrichm authored
86 WHERE id = ".$session->sess_info['user_info']['id']);
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
87
c9b5378 @dietrichm OMG HUGE update. Check Changelog.txt. ;)
dietrichm authored
88 $template->parse('msgbox', 'global', array(
1681db7 @dietrichm Endless updates and addons for many files. See Changelog.txt.
dietrichm authored
89 'box_title' => $lang['Note'],
90 'content' => $lang['OptionsEdited']
91 ));
92
93 } else {
94
9683011 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
95 $available_languages = $functions->get_language_packs();
96 if ( count($available_languages) < 2 ) {
aa5d418 @dietrichm Some fixes in functions.php and language settings implemented in panel.
dietrichm authored
97
9683011 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
98 $single_language = $available_languages;
aa5d418 @dietrichm Some fixes in functions.php and language settings implemented in panel.
dietrichm authored
99 $language_input = $single_language[0];
100
101 } else {
102
103 $language_input = '<select name="language">';
9683011 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
104 foreach ( $available_languages as $single_language ) {
aa5d418 @dietrichm Some fixes in functions.php and language settings implemented in panel.
dietrichm authored
105
106 $selected = ( $functions->get_config('language') == $single_language ) ? ' selected="selected"' : '';
107 $language_input .= '<option value="'.$single_language.'"'.$selected.'>'.$single_language.'</option>';
108
109 }
110 $language_input .= '</select>';
111
112 }
e3af72b @dietrichm Template controls on Your Panel + various small bugfixes.
dietrichm authored
113
9683011 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
114 $available_templates = $functions->get_template_sets();
115 if ( count($available_templates) < 2 ) {
e3af72b @dietrichm Template controls on Your Panel + various small bugfixes.
dietrichm authored
116
9683011 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
117 $single_template = $available_templates;
fb512fc @dietrichm Fixed array to string conversion error.
dietrichm authored
118 $template_input = $single_template[0];
31d3788 @dietrichm No template dropdown when only one enabled template is available.
dietrichm authored
119
120 } else {
121
aa5d418 @dietrichm Some fixes in functions.php and language settings implemented in panel.
dietrichm authored
122 $template_input = '<select name="template">';
9683011 @dietrichm Removed available_* settings, now dynamically detected.
dietrichm authored
123 foreach ( $available_templates as $single_template ) {
31d3788 @dietrichm No template dropdown when only one enabled template is available.
dietrichm authored
124
dae1aea @dietrichm Adjusted options panel to fit with new template and language system.
dietrichm authored
125 $selected = ( $functions->get_config('template') == $single_template ) ? ' selected="selected"' : '';
126 $template_input .= '<option value="'.$single_template.'"'.$selected.'>'.$single_template.'</option>';
31d3788 @dietrichm No template dropdown when only one enabled template is available.
dietrichm authored
127
128 }
129 $template_input .= '</select>';
e3af72b @dietrichm Template controls on Your Panel + various small bugfixes.
dietrichm authored
130
131 }
132
dded95e @dietrichm Endless updates in core, functions moved to functions class, arrays r…
dietrichm authored
133 $email_show_checked = ( $session->sess_info['user_info']['email_show'] ) ? ' checked="checked"' : '';
134 $last_login_show_checked = ( $session->sess_info['user_info']['last_login_show'] ) ? ' checked="checked"' : '';
e7e613b @dietrichm Added feature 1055687: Hide from online users list.
dietrichm authored
135 $hide_from_online_list_checked = ( $session->sess_info['user_info']['hide_from_online_list'] ) ? ' checked="checked"' : '';
ea42fc9 @dietrichm Implemented timezone and DST handling.
dietrichm authored
136
5d12514 @dietrichm another huge update
dietrichm authored
137 $timezone_input = 'UTC/GMT <select name="timezone">';
ea42fc9 @dietrichm Implemented timezone and DST handling.
dietrichm authored
138 foreach ( $functions->timezone_handler('get_zones') as $key => $val ) {
139
140 $selected = ( $functions->get_config('timezone') == $key ) ? ' selected="selected"' : '';
141 $timezone_input .= '<option value="'.$key.'"'.$selected.'>'.$val.'</option>';
142
143 }
144 $timezone_input .= '</select>';
145
146 $dst_checked = ( $functions->get_config('dst') ) ? ' checked="checked"' : '';
b723e1c @dietrichm This is UseBB 0.2. Official release will follow very soon! :D
dietrichm authored
147 $quickreply_checked = ( $session->sess_info['user_info']['enable_quickreply'] ) ? ' checked="checked"' : '';
148 $return_to_topic_checked = ( $session->sess_info['user_info']['return_to_topic_after_posting'] ) ? ' checked="checked"' : '';
488f1d8 @dietrichm Added 'Open external links in new windows' feature.
dietrichm authored
149 $target_blank_checked = ( $session->sess_info['user_info']['target_blank'] ) ? ' checked="checked"' : '';
7ceccd6 @dietrichm Added feature 1055684: Hide avatars/signatures setting.
dietrichm authored
150 $hide_avatars_checked = ( $session->sess_info['user_info']['hide_avatars'] ) ? ' checked="checked"' : '';
4591049 @dietrichm Added feature 1061847: Hide user information in posts.
dietrichm authored
151 $hide_userinfo_checked = ( $session->sess_info['user_info']['hide_userinfo'] ) ? ' checked="checked"' : '';
7ceccd6 @dietrichm Added feature 1055684: Hide avatars/signatures setting.
dietrichm authored
152 $hide_signatures_checked = ( $session->sess_info['user_info']['hide_signatures'] ) ? ' checked="checked"' : '';
dd63bfe @dietrichm Added auto subscribe feature.
dietrichm authored
153 $auto_subscribe_topic_checked = ( $session->sess_info['user_info']['auto_subscribe_topic'] ) ? ' checked="checked"' : '';
154 $auto_subscribe_reply_checked = ( $session->sess_info['user_info']['auto_subscribe_reply'] ) ? ' checked="checked"' : '';
1681db7 @dietrichm Endless updates and addons for many files. See Changelog.txt.
dietrichm authored
155
5d12514 @dietrichm another huge update
dietrichm authored
156 $target_blank = ( $functions->get_config('target_blank') ) ? ' target="_blank"' : '';
157
24901b4 @dietrichm Language variables in templates are not defined in PHP code anymore b…
dietrichm authored
158 $template->parse('edit_options', 'panel', array(
e3af72b @dietrichm Template controls on Your Panel + various small bugfixes.
dietrichm authored
159 'form_begin' => '<form action="'.$functions->make_url('panel.php', array('act' => 'editoptions')).'" method="post">',
160 'language_input' => $language_input,
161 'template_input' => $template_input,
ea42fc9 @dietrichm Implemented timezone and DST handling.
dietrichm authored
162 'email_show_input' => '<input type="checkbox" name="email_show" id="email_show" value="1"'.$email_show_checked.' /><label for="email_show"> '.$lang['Yes'].'</label>',
163 'last_login_show_input' => '<input type="checkbox" name="last_login_show" id="last_login_show" value="1"'.$last_login_show_checked.' /><label for="last_login_show"> '.$lang['Yes'].'</label>',
e7e613b @dietrichm Added feature 1055687: Hide from online users list.
dietrichm authored
164 'hide_from_online_list_input' => '<input type="checkbox" name="hide_from_online_list" id="hide_from_online_list" value="1"'.$hide_from_online_list_checked.' /><label for="hide_from_online_list"> '.$lang['Yes'].'</label>',
a280c59 @dietrichm Config array replaced by new function in functions class.
dietrichm authored
165 'date_format_input' => '<input type="text" name="date_format" size="25" maxlength="255" value="'.$functions->get_config('date_format').'" />',
5d12514 @dietrichm another huge update
dietrichm authored
166 'date_format_help' => sprintf($lang['DateFormatHelp'], '<a href="http://www.php.net/date"'.$target_blank.'>date()</a>'),
167 'timezone_input' => $timezone_input,
488f1d8 @dietrichm Added 'Open external links in new windows' feature.
dietrichm authored
168 'dst_input' => '<input type="checkbox" name="dst" id="dst" value="1"'.$dst_checked.' /><label for="dst"> '.$lang['Enabled'].'</label>',
b723e1c @dietrichm This is UseBB 0.2. Official release will follow very soon! :D
dietrichm authored
169 'quickreply_input' => '<input type="checkbox" name="quickreply" id="quickreply" value="1"'.$quickreply_checked.' /><label for="quickreply"> '.$lang['Enabled'].'</label>',
488f1d8 @dietrichm Added 'Open external links in new windows' feature.
dietrichm authored
170 'return_to_topic_input' => '<input type="checkbox" name="return_to_topic" id="return_to_topic" value="1"'.$return_to_topic_checked.' /><label for="return_to_topic"> '.$lang['Yes'].'</label>',
171 'target_blank_input' => '<input type="checkbox" name="target_blank" id="target_blank" value="1"'.$target_blank_checked.' /><label for="target_blank"> '.$lang['Yes'].'</label>',
7ceccd6 @dietrichm Added feature 1055684: Hide avatars/signatures setting.
dietrichm authored
172 'hide_avatars_input' => '<input type="checkbox" name="hide_avatars" id="hide_avatars" value="1"'.$hide_avatars_checked.' /><label for="hide_avatars"> '.$lang['Yes'].'</label>',
4591049 @dietrichm Added feature 1061847: Hide user information in posts.
dietrichm authored
173 'hide_userinfo_input' => '<input type="checkbox" name="hide_userinfo" id="hide_userinfo" value="1"'.$hide_userinfo_checked.' /><label for="hide_userinfo"> '.$lang['Yes'].'</label>',
7ceccd6 @dietrichm Added feature 1055684: Hide avatars/signatures setting.
dietrichm authored
174 'hide_signatures_input' => '<input type="checkbox" name="hide_signatures" id="hide_signatures" value="1"'.$hide_signatures_checked.' /><label for="hide_signatures"> '.$lang['Yes'].'</label>',
dd63bfe @dietrichm Added auto subscribe feature.
dietrichm authored
175 'auto_subscribe_topic_input' => '<input type="checkbox" name="auto_subscribe_topic" id="auto_subscribe_topic" value="1"'.$auto_subscribe_topic_checked.' /><label for="auto_subscribe_topic"> '.$lang['OnPostingNewTopics'].'</label>',
176 'auto_subscribe_reply_input' => '<input type="checkbox" name="auto_subscribe_reply" id="auto_subscribe_reply" value="1"'.$auto_subscribe_reply_checked.' /><label for="auto_subscribe_reply"> '.$lang['OnPostingNewReplies'].'</label>',
47e170f @dietrichm use more "OK"
dietrichm authored
177 'submit_button' => '<input type="submit" name="submit" value="'.$lang['OK'].'" />',
e3af72b @dietrichm Template controls on Your Panel + various small bugfixes.
dietrichm authored
178 'reset_button' => '<input type="reset" value="'.$lang['Reset'].'" />',
6804369 @dietrichm tpl updates
dietrichm authored
179 'form_end' => '</form>'
1681db7 @dietrichm Endless updates and addons for many files. See Changelog.txt.
dietrichm authored
180 ));
bfc4c5f @dietrichm Initial Commit.
dietrichm authored
181
182 }
183
ea42fc9 @dietrichm Implemented timezone and DST handling.
dietrichm authored
184 ?>
Something went wrong with that request. Please try again.