Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 354 lines (306 sloc) 14.309 kB
4775e82 # more line-ending properties
ts77 authored
1 <?php
2 ////////////////////////////////////////////////////////////////////////////////
3 // //
30964b6 # It's a dirty job, but someone got to do it (-: copyright upgraded t…
mmakaay authored
4 // Copyright (C) 2008 Phorum Development Team //
4775e82 # more line-ending properties
ts77 authored
5 // http://www.phorum.org //
6 // //
7 // This program is free software. You can redistribute it and/or modify //
8 // it under the terms of either the current Phorum License (viewable at //
9 // phorum.org) or the Phorum License that was distributed with this file //
10 // //
11 // This program is distributed in the hope that it will be useful, //
12 // but WITHOUT ANY WARRANTY, without even the implied warranty of //
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
14 // //
15 // You should have received a copy of the Phorum License //
16 // along with this program. //
30964b6 # It's a dirty job, but someone got to do it (-: copyright upgraded t…
mmakaay authored
17 // //
4775e82 # more line-ending properties
ts77 authored
18 ////////////////////////////////////////////////////////////////////////////////
19
30964b6 # It's a dirty job, but someone got to do it (-: copyright upgraded t…
mmakaay authored
20 define('phorum_page','control');
d8069c2 # Use require_once() for all includes. I prefer require based includes,
mmakaay authored
21 require_once("./common.php");
4775e82 # more line-ending properties
ts77 authored
22
23 phorum_require_login();
24
d8069c2 # Use require_once() for all includes. I prefer require based includes,
mmakaay authored
25 require_once("./include/email_functions.php");
26 require_once("./include/format_functions.php");
18b5987 # New user API code + core changes to work with the user API.
mmakaay authored
27
4775e82 # more line-ending properties
ts77 authored
28 define("PHORUM_CONTROL_CENTER", 1);
29
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
30 // A user has to be logged in to use his control-center.
4775e82 # more line-ending properties
ts77 authored
31 if (!$PHORUM["DATA"]["LOGGEDIN"]) {
32 phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
33 exit();
34 }
35
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
36 // If the user is not fully logged in, send him to the login page.
ba5300d New security feature! Users must confirm their login before posting …
brian authored
37 if(!$PHORUM["DATA"]["FULLY_LOGGEDIN"]){
38 phorum_redirect_by_url(phorum_get_url(PHORUM_LOGIN_URL, "redir=".PHORUM_CONTROLCENTER_URL));
39 exit();
40 }
41
4775e82 # more line-ending properties
ts77 authored
42 $error_msg = false;
b0b0faa MFB: Fixed possible XSS issues, exploitable with register_globals = o…
ts77 authored
43 $error = "";
44 $okmsg = "";
da9b6ea MFB: initializing and checking template-var
mmakaay authored
45 $template = "";
4775e82 # more line-ending properties
ts77 authored
46
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
47 // Generating the panel id of the page to use.
65a9dd1 # change urls in template to new standard. fixed pm read style. othe…
brian authored
48 if(isset($PHORUM['args']['panel'])){
49 $panel = $PHORUM['args']['panel'];
4775e82 # more line-ending properties
ts77 authored
50
65a9dd1 # change urls in template to new standard. fixed pm read style. othe…
brian authored
51 } elseif(isset($_POST["panel"])){
52 $panel = $_POST["panel"];
53
54 } else {
55 $panel = PHORUM_CC_SUMMARY;
4775e82 # more line-ending properties
ts77 authored
56 }
57
65a9dd1 # change urls in template to new standard. fixed pm read style. othe…
brian authored
58
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
59 // Set all our URLs.
4775e82 # more line-ending properties
ts77 authored
60 phorum_build_common_urls();
61
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
62 // Generate the control panel URLs.
4775e82 # more line-ending properties
ts77 authored
63 $PHORUM['DATA']['URL']['CC0'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUMMARY);
64 $PHORUM['DATA']['URL']['CC1'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUBSCRIPTION_THREADS);
65 $PHORUM['DATA']['URL']['CC2'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SUBSCRIPTION_FORUMS);
66 $PHORUM['DATA']['URL']['CC3'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_USERINFO);
67 $PHORUM['DATA']['URL']['CC4'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_SIGNATURE);
68 $PHORUM['DATA']['URL']['CC5'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_MAIL);
69 $PHORUM['DATA']['URL']['CC6'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_BOARD);
70 $PHORUM['DATA']['URL']['CC7'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_PASSWORD);
71 $PHORUM['DATA']['URL']['CC8'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_UNAPPROVED);
72 $PHORUM['DATA']['URL']['CC9'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_FILES);
73 $PHORUM['DATA']['URL']['CC10'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_USERS);
74 $PHORUM['DATA']['URL']['CC14'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_PRIVACY);
75 $PHORUM['DATA']['URL']['CC15'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MODERATION);
76 $PHORUM['DATA']['URL']['CC16'] = phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MEMBERSHIP);
77
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
78 // Determine if the user files functionality is available.
79 $PHORUM["DATA"]["MYFILES"] = ($PHORUM["file_uploads"] || $PHORUM["user"]["admin"]);
4775e82 # more line-ending properties
ts77 authored
80
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
81 // Determine if the user is a moderator.
a9bcad7 # Phased out phorum_user_allow_moderate_group() in favor of the new
mmakaay authored
82 $PHORUM["DATA"]["MESSAGE_MODERATOR"] = phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES, PHORUM_ACCESS_ANY);
83 $PHORUM["DATA"]["USER_MODERATOR"] = phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_USERS, PHORUM_ACCESS_ANY);
6d21c13 # Implemented phorum_api_user_check_group_access(), which replaces
mmakaay authored
84 $PHORUM["DATA"]["GROUP_MODERATOR"] = phorum_api_user_check_group_access(PHORUM_USER_GROUP_MODERATOR, PHORUM_ACCESS_ANY);
4775e82 # more line-ending properties
ts77 authored
85 $PHORUM["DATA"]["MODERATOR"] = ($PHORUM["DATA"]["USER_MODERATOR"] + $PHORUM["DATA"]["MESSAGE_MODERATOR"] + $PHORUM["DATA"]["GROUP_MODERATOR"]) > 0;
86
6889943 # Implemented option "allow_pm_email_notify" and added in-program
mmakaay authored
87 // If global email hiding is not enabled, then give the user a chance
88 // to choose for hiding himself.
89 $PHORUM['DATA']['SHOW_EMAIL_HIDE'] = empty($PHORUM['hide_email_addr']) ? 1 : 0;
90
91 // If pm email notifications are enabled, then give the user a chance
92 // to disable it.
93 $PHORUM['DATA']['SHOW_PM_EMAIL_NOTIFY'] = !empty($PHORUM["allow_pm_email_notify"]);
c2a9997 added global option to hide email-addresses (#559)
ts77 authored
94
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
95 // The form action for the common form.
96 $PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url(PHORUM_CONTROLCENTER_ACTION_URL);
4775e82 # more line-ending properties
ts77 authored
97
31fde34 MFB: breadcrumbs in template are now generated from the forum-path st…
ts77 authored
98 // fill the breadcrumbs-info
417d8dc # Some additions to the breadcrumb generation code and the root node
mmakaay authored
99 $PHORUM['DATA']['BREADCRUMBS'][]=array(
100 'URL'=>$PHORUM['DATA']['URL']['REGISTERPROFILE'],
101 'TEXT'=>$PHORUM['DATA']['LANG']['MyProfile'],
102 'TYPE'=>'control'
103 );
31fde34 MFB: breadcrumbs in template are now generated from the forum-path st…
ts77 authored
104
4775e82 # more line-ending properties
ts77 authored
105 $user = $PHORUM['user'];
106
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
107 // Security messures.
4775e82 # more line-ending properties
ts77 authored
108 unset($user["password"]);
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
109 unset($user["password_temp"]);
4775e82 # more line-ending properties
ts77 authored
110 unset($user["permissions"]);
111
8a68ecc made two different variables for signature in control panel. one for …
ts77 authored
112 // Fake a message here so we can run the sig through format_message.
113 $fake_messages = array(array("author"=>"", "email"=>"", "subject"=>"", "body"=>$user["signature"]));
114 $fake_messages = phorum_format_messages( $fake_messages );
115 $user["signature_formatted"] = $fake_messages[0]["body"];
6e867ab MFB: User's signatures were not being escaped.
brian authored
116
67fbecc # Prevent duplicate escaping of the signature in the control panel.
mmakaay authored
117 // Format the user signature using standard message body formatting
118 // or HTML escape it
119 $user["signature"] = htmlspecialchars($user["signature"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
120
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
121 // Initialize any custom profile fields that are not present.
14506cf added more general custom field api (just a port from custom profile …
ts77 authored
122 if (!empty($PHORUM["PROFILE_FIELDS"][PHORUM_CUSTOM_FIELD_USER])) {
123 foreach($PHORUM["PROFILE_FIELDS"][PHORUM_CUSTOM_FIELD_USER] as $id => $field) {
a84aba9 # Updates for handling custom profile fields that are flagged "deleted".
mmakaay authored
124 if ($id === 'num_fields' || !empty($field['deleted'])) continue;
4775e82 # more line-ending properties
ts77 authored
125 if (!isset($user[$field['name']])) $user[$field['name']] = "";
126 }
127 }
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
128
129 // Setup template data.
4775e82 # more line-ending properties
ts77 authored
130 $PHORUM["DATA"]["PROFILE"] = $user;
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
131 $PHORUM["DATA"]["PROFILE"]["forum_id"] = isset($PHORUM["forum_id"]) ? $PHORUM['forum_id'] : 0;
132 $PHORUM["DATA"]["PROFILE"]["PANEL"] = $panel;
25d2b98 # moved a couple of hidden-fields from templates into php (#557)
ts77 authored
133 // used in nearly all or all cc-panels
134 $PHORUM['DATA']['POST_VARS'].="<input type=\"hidden\" name=\"panel\" value=\"{$panel}\" />\n";
4775e82 # more line-ending properties
ts77 authored
135
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
136 // Set the back-URL and -message.
137 if ($PHORUM['forum_id'] > 0 && $PHORUM['folder_flag'] == 0) {
4775e82 # more line-ending properties
ts77 authored
138 $PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_LIST_URL);
139 $PHORUM['DATA']['URL']['BACKTITLE'] = $PHORUM['DATA']['LANG']['BacktoForum'];
140 } else {
141 if(isset($PHORUM['forum_id'])) {
142 $PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_INDEX_URL,$PHORUM['forum_id']);
143 } else {
144 $PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_INDEX_URL);
145 }
146 $PHORUM['DATA']['URL']['BACKTITLE'] = $PHORUM['DATA']['LANG']['BackToForumList'];
147 }
148
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
149 // Load the code for the current panel.
4775e82 # more line-ending properties
ts77 authored
150 $panel = basename($panel);
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
151 /**
152 * [hook]
153 * cc_panel
154 *
155 * [description]
156 * This hook can be used to implement an extra control center panel
157 * or to override an existing panel if you like.
158 *
159 * [category]
160 * Control center
161 *
162 * [when]
163 * Right before loading a standard panel's include file.
164 *
165 * [input]
166 * An array containing the following fields:
167 * <ul>
168 * <li>panel:
169 * the name of the panel that has to be loaded. The module will
170 * have to check this field to see if it should handle the
1d36fea # Documentation updates.
mmakaay authored
171 * panel or not.</li>
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
172 * <li>template:
173 * the name of the template that has to be loaded. This field should
1d36fea # Documentation updates.
mmakaay authored
174 * be filled by the module if it wants to load a specific
175 * template.</li>
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
176 * <li>handled:
177 * if a module does handle the panel, then it can set this field
178 * to a true value, to prevent Phorum from running the standard
1d36fea # Documentation updates.
mmakaay authored
179 * panel code.</li>
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
180 * <li>error:
1d36fea # Documentation updates.
mmakaay authored
181 * modules can fill this field with an error message to show.</li>
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
182 * <li>okmsg:
1d36fea # Documentation updates.
mmakaay authored
183 * modules can fill this field with an ok message to show.</li>
13c8647 Implemented a new hook "cc_panel", which can be used to build extra c…
mmakaay authored
184 * </ul>
185 *
186 * [output]
187 * The same array as the one that was used for the hook call
188 * argument, possibly with the "template", "handled", "error" and
189 * "okmsg" fields updated in it.
190 */
191 $hook_info = array(
192 'panel' => $panel,
193 'template' => NULL,
194 'handled' => FALSE,
195 'error' => NULL,
196 'okmsg' => NULL
197 );
198 if (isset($PHORUM['hooks']['cc_panel'])) {
199 $hook_info = phorum_hook('cc_panel', $hook_info);
200 }
201
202 // Retrieve template, error and okmsg info from the module info.
203 if ($hook_info['template'] !== NULL) { $template = $hook_info['template']; }
204 if ($hook_info['okmsg'] !== NULL) { $okmsg = $hook_info['okmsg']; }
205 if ($hook_info['error'] !== NULL) { $error = $hook_info['error']; }
206
207 // If no module did handle the control center panel, then try to load
208 // a standard control center panel file.
209 if (!$hook_info['handled']) {
210 if (file_exists("./include/controlcenter/$panel.php")) {
211 include "./include/controlcenter/$panel.php";
212 } else {
213 include "./include/controlcenter/summary.php";
214 }
4775e82 # more line-ending properties
ts77 authored
215 }
216
449a669 new templates working on CC now
brian authored
217 if(empty($PHORUM["DATA"]["HEADING"])){
bc1da40 # Fixed default HEADING for control.php.
mmakaay authored
218 $PHORUM["DATA"]["HEADING"] = $PHORUM["DATA"]["LANG"]["MyProfile"];
449a669 new templates working on CC now
brian authored
219 }
220
221 // unset default description
bcd2e35 Fixed #692: the control center and private message pages no longer sh…
mmakaay authored
222 $PHORUM['DATA']['DESCRIPTION'] = '';
223 $PHORUM['DATA']['HTML_DESCRIPTION'] = '';
449a669 new templates working on CC now
brian authored
224
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
225 // The include file can set the template we have to use for
226 // displaying the main part of the control panel screen
227 // in the $template variable.
da9b6ea MFB: initializing and checking template-var
mmakaay authored
228 if (isset($template) && !empty($template)) {
4775e82 # more line-ending properties
ts77 authored
229 $PHORUM['DATA']['content_template'] = $template;
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
230 }
4775e82 # more line-ending properties
ts77 authored
231
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
232 // The include file can also set an error message to show
233 // in the $error variable and a success message in $okmsg.
234 if (isset($error) && !empty($error)) $PHORUM['DATA']['ERROR'] = $error;
235 if (isset($okmsg) && !empty($okmsg)) $PHORUM['DATA']['OKMSG'] = $okmsg;
4775e82 # more line-ending properties
ts77 authored
236
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
237 if ($error_msg) { // Possibly set from the panel include file.
293da1e Moved all template output to common function for control. Added new …
brian authored
238 $template = "message";
4775e82 # more line-ending properties
ts77 authored
239 } else {
293da1e Moved all template output to common function for control. Added new …
brian authored
240 $template = "cc_index";
4775e82 # more line-ending properties
ts77 authored
241 }
293da1e Moved all template output to common function for control. Added new …
brian authored
242
243 // Display the control panel page.
244 phorum_output($template);
4775e82 # more line-ending properties
ts77 authored
245
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
246 // ============================================================================
4775e82 # more line-ending properties
ts77 authored
247
248 /**
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
249 * A common function which is used to save the userdata from the post-data.
250 * @param panel - The panel for which to save data.
251 * @return array - An array containing $error and $okmsg.
4775e82 # more line-ending properties
ts77 authored
252 */
253 function phorum_controlcenter_user_save($panel)
254 {
255 $PHORUM = $GLOBALS['PHORUM'];
256 $error = "";
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
257 $okmsg = "";
258
e8dc690 Moved real_name from a custom profile field to a real user table field.
mmakaay authored
259 // Setup the default userdata fields that can be changed
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
260 // from the control panel interface.
261 $userdata = array(
262 'signature' => NULL,
263 'hide_email' => NULL,
264 'hide_activity' => NULL,
265 'password' => NULL,
46e5de6 Fixed password changing issue reported in chat
brian authored
266 'password_temp' => NULL,
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
267 'tz_offset' => NULL,
268 'is_dst' => NULL,
269 'user_language' => NULL,
270 'threaded_list' => NULL,
271 'threaded_read' => NULL,
272 'email_notify' => NULL,
273 'show_signature' => NULL,
274 'pm_email_notify' => NULL,
275 'email' => NULL,
276 'email_temp' => NULL,
e8d7541 MFB: # user_template could not be changed from the control center panels
mmakaay authored
277 'user_template' => NULL,
c403121 added options for moderators to avoid getting moderation-emails, impl…
ts77 authored
278 'moderation_email'=> NULL,
e8dc690 Moved real_name from a custom profile field to a real user table field.
mmakaay authored
279 'real_name' => NULL,
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
280 );
281 // Add custom profile fields as acceptable fields.
14506cf added more general custom field api (just a port from custom profile …
ts77 authored
282 foreach ($PHORUM["PROFILE_FIELDS"][PHORUM_CUSTOM_FIELD_USER] as $id => $field) {
a84aba9 # Updates for handling custom profile fields that are flagged "deleted".
mmakaay authored
283 if ($id === "num_fields" || !empty($field['deleted'])) continue;
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
284 $userdata[$field["name"]] = NULL;
285 }
286 // Update userdata with $_POST information.
287 foreach ($_POST as $key => $val) {
288 if (array_key_exists($key, $userdata)) {
289 $userdata[$key] = $val;
290 }
291 }
292 // Remove unused profile fields.
293 foreach ($userdata as $key => $val) {
294 if (is_null($val)) {
295 unset($userdata[$key]);
296 }
297 }
4775e82 # more line-ending properties
ts77 authored
298
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
299 // Set static userdata.
4775e82 # more line-ending properties
ts77 authored
300 $userdata["user_id"] = $PHORUM["user"]["user_id"];
301
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
302 // Run a hook, so module writers can update and check the userdata.
5ad1de1 Made the phorum_hook calls conditional, which should speed up execution
mmakaay authored
303 if (isset($PHORUM["hooks"]["cc_save_user"]))
304 $userdata = phorum_hook("cc_save_user", $userdata);
4775e82 # more line-ending properties
ts77 authored
305
a2e0aab Improved switching between user selected templates. The new template …
mmakaay authored
306 // Set $error, in case the cc_save_user hook did set an error.
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
307 if (isset($userdata['error'])) {
6e867ab MFB: User's signatures were not being escaped.
brian authored
308 $error=$userdata['error'];
309 unset($userdata['error']);
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
310 // Try to update the userdata in the database.
c9b26ea # Fully replaced phorum_user_save/phorum_user_add with the new
mmakaay authored
311 } elseif (!phorum_api_user_save($userdata)) {
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
312 // Updating the user failed.
6e867ab MFB: User's signatures were not being escaped.
brian authored
313 $error = $PHORUM["DATA"]["LANG"]["ErrUserAddUpdate"];
4775e82 # more line-ending properties
ts77 authored
314 } else {
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
315 // Updating the user was successful.
316 $okmsg = $PHORUM["DATA"]["LANG"]["ProfileUpdatedOk"];
317
318 // Let the userdata be reloaded.
18b5987 # New user API code + core changes to work with the user API.
mmakaay authored
319 phorum_api_user_set_active_user(PHORUM_FORUM_SESSION, $userdata["user_id"]);
6e867ab MFB: User's signatures were not being escaped.
brian authored
320
18b5987 # New user API code + core changes to work with the user API.
mmakaay authored
321 // If a new password was set, then reset all session id(s), so
d30c7bb # Fixing some typo errors. What a looser^H^H^H^Hser ;-)
mmakaay authored
322 // other computers or browser will lose any active session that
18b5987 # New user API code + core changes to work with the user API.
mmakaay authored
323 // they are running.
c9b26ea # Fully replaced phorum_user_save/phorum_user_add with the new
mmakaay authored
324 if (isset($userdata["password"]) && $userdata["password"] != '') {
18b5987 # New user API code + core changes to work with the user API.
mmakaay authored
325 phorum_api_user_session_create(
326 PHORUM_FORUM_SESSION,
327 PHORUM_SESSID_RESET_ALL
328 );
c403121 added options for moderators to avoid getting moderation-emails, impl…
ts77 authored
329 }
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
330
2d2c1b8 Fixed #717: User data doesn't get reloaded after profile edit.
mmakaay authored
331 // Copy data from the updated user back into the user template data.
332 $formatted = phorum_api_user_format(array($GLOBALS['PHORUM']['user']));
333 foreach ($formatted[0] as $key => $val) {
334 $GLOBALS['PHORUM']['DATA']['USER'][$key] = $val;
335 }
336
337 // Copy data from the updated user back into the profile template data.
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
338 // Leave PANEL and forum_id alone (these are injected into the
339 // userdata in the template from this script).
340 foreach ($GLOBALS["PHORUM"]["DATA"]["PROFILE"] as $key => $val) {
341 if ($key == "PANEL" || $key == "forum_id") continue;
342 if (isset($GLOBALS["PHORUM"]["user"][$key])) {
343 $GLOBALS["PHORUM"]["DATA"]["PROFILE"][$key] = $GLOBALS["PHORUM"]["user"][$key];
344 } else {
345 $GLOBALS["PHORUM"]["DATA"]["PROFILE"][$key] = "";
6e867ab MFB: User's signatures were not being escaped.
brian authored
346 }
347 }
4775e82 # more line-ending properties
ts77 authored
348 }
349
b54edef MFB: # Reformatted and cleaned up CC code and added green okay-msg
mmakaay authored
350 return array($error, $okmsg);
4775e82 # more line-ending properties
ts77 authored
351 }
352
353 ?>
Something went wrong with that request. Please try again.