author | Dan |
Fri, 28 Dec 2007 16:52:03 -0500 | |
changeset 342 | ac34de920762 |
parent 334 | c72b545f1304 |
child 343 | eefe9ab7fe7c |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/* |
|
3 |
Plugin Name: User control panel |
|
36
425261984266
Added "page hint" on search page; deprecated "www." on EnanoCMS.org links
Dan
parents:
32
diff
changeset
|
4 |
Plugin URI: http://enanocms.org/ |
0 | 5 |
Description: Provides the page Special:Preferences. |
6 |
Author: Dan Fuhry |
|
317 | 7 |
Version: 1.0.3 |
36
425261984266
Added "page hint" on search page; deprecated "www." on EnanoCMS.org links
Dan
parents:
32
diff
changeset
|
8 |
Author URI: http://enanocms.org/ |
0 | 9 |
*/ |
10 |
||
11 |
/* |
|
12 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
|
317 | 13 |
* Version 1.0.3 |
0 | 14 |
* Copyright (C) 2006-2007 Dan Fuhry |
15 |
* |
|
16 |
* This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
20 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
|
21 |
*/ |
|
22 |
||
23 |
$userprefs_menu = Array(); |
|
24 |
$userprefs_menu_links = Array(); |
|
25 |
function userprefs_menu_add($section, $text, $link) |
|
26 |
{ |
|
27 |
global $userprefs_menu; |
|
286
b2f985e4cef3
Fixed a number of issues with SQL query readability and some undefined index-ish errors; consequently the SQL report feature was added
Dan
parents:
224
diff
changeset
|
28 |
if ( isset($userprefs_menu[$section]) && is_array($userprefs_menu[$section]) ) |
0 | 29 |
{ |
30 |
$userprefs_menu[$section][] = Array( |
|
31 |
'text' => $text, |
|
32 |
'link' => $link |
|
33 |
); |
|
34 |
} |
|
35 |
else |
|
36 |
{ |
|
37 |
$userprefs_menu[$section] = Array(Array( |
|
38 |
'text' => $text, |
|
39 |
'link' => $link |
|
40 |
)); |
|
41 |
} |
|
42 |
} |
|
43 |
||
103
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
44 |
$plugins->attachHook('compile_template', 'userprefs_jbox_setup($button, $tb, $menubtn);'); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
45 |
|
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
46 |
function userprefs_jbox_setup(&$button, &$tb, &$menubtn) |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
47 |
{ |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
48 |
global $db, $session, $paths, $template, $plugins; // Common objects |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
49 |
|
322
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
50 |
if ( $paths->namespace != 'Special' || $paths->page_id != 'Preferences' ) |
103
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
51 |
return false; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
52 |
|
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
53 |
$tb .= "<ul>$template->toolbar_menu</ul>"; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
54 |
$template->toolbar_menu = ''; |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
55 |
|
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
56 |
$button->assign_vars(array( |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
57 |
'TEXT' => 'list of registered members', |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
58 |
'FLAGS' => '', |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
59 |
'PARENTFLAGS' => '', |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
60 |
'HREF' => makeUrlNS('Special', 'Memberlist') |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
61 |
)); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
62 |
|
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
63 |
$tb .= $button->run(); |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
64 |
} |
a8891e108c95
Several major improvements: Memberlist page added (planned since about beta 2), page group support added for non-JS ACL editor (oops!), and attempting to view a page for which you lack read permissions will get you logged.
Dan
parents:
85
diff
changeset
|
65 |
|
0 | 66 |
function userprefs_menu_html() |
67 |
{ |
|
68 |
global $userprefs_menu; |
|
69 |
global $userprefs_menu_links; |
|
70 |
||
71 |
$html = ''; |
|
72 |
$quot = '"'; |
|
73 |
||
74 |
foreach ( $userprefs_menu as $section => $buttons ) |
|
75 |
{ |
|
76 |
$html .= ( isset($userprefs_menu_links[$section]) ) ? "<a href={$quot}{$userprefs_menu_links[$section]}{$quot}>{$section}</a>\n " : "<a>{$section}</a>\n "; |
|
77 |
$html .= "<ul>\n "; |
|
78 |
foreach ( $buttons as $button ) |
|
79 |
{ |
|
80 |
$html .= " <li><a href={$quot}{$button['link']}{$quot}>{$button['text']}</a></li>\n "; |
|
81 |
} |
|
82 |
$html .= "</ul>\n "; |
|
83 |
} |
|
84 |
||
85 |
return $html; |
|
86 |
} |
|
87 |
||
88 |
function userprefs_show_menu() |
|
89 |
{ |
|
90 |
echo '<div class="menu_nojs"> |
|
91 |
' . userprefs_menu_html() . ' |
|
92 |
<span class="menuclear"></span> |
|
93 |
</div> |
|
94 |
<br /> |
|
95 |
'; |
|
96 |
} |
|
97 |
||
98 |
function userprefs_menu_init() |
|
99 |
{ |
|
100 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
101 |
global $userprefs_menu_links; |
|
102 |
||
175
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
140
diff
changeset
|
103 |
userprefs_menu_add('Profile/membership', 'Edit e-mail address and password', makeUrlNS('Special', 'Preferences/EmailPassword') . '" onclick="ajaxLoginNavTo(\'Special\', \'Preferences/EmailPassword\', '.USER_LEVEL_CHPREF.'); return false;'); |
0 | 104 |
userprefs_menu_add('Profile/membership', 'Edit signature', makeUrlNS('Special', 'Preferences/Signature')); |
105 |
userprefs_menu_add('Profile/membership', 'Edit public profile', makeUrlNS('Special', 'Preferences/Profile')); |
|
334
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
106 |
userprefs_menu_add('Profile/membership', 'Group memberships', makeUrlNS('Special', 'Usergroups')); |
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
107 |
if ( getConfig('avatar_enable') == '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
108 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
109 |
userprefs_menu_add('Profile/membership', 'Avatar settings', makeUrlNS('Special', 'Preferences/Avatar')); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
110 |
} |
0 | 111 |
userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special', 'PrivateMessages/Folder/Inbox')); |
112 |
userprefs_menu_add('Private messages', 'Outbox', makeUrlNS('Special', 'PrivateMessages/Folder/Outbox')); |
|
113 |
userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'PrivateMessages/Folder/Sent')); |
|
114 |
userprefs_menu_add('Private messages', 'Drafts', makeUrlNS('Special', 'PrivateMessages/Folder/Drafts')); |
|
115 |
userprefs_menu_add('Private messages', 'Archive', makeUrlNS('Special', 'PrivateMessages/Folder/Archive')); |
|
334
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
116 |
/* |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
117 |
userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special', 'Private_Messages#folder:inbox')); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
118 |
userprefs_menu_add('Private messages', 'Starred', makeUrlNS('Special', 'Private_Messages#folder:starred')); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
119 |
userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'Private_Messages#folder:sent')); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
120 |
userprefs_menu_add('Private messages', 'Drafts', makeUrlNS('Special', 'Private_Messages#folder:drafts')); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
121 |
userprefs_menu_add('Private messages', 'Archive', makeUrlNS('Special', 'Private_Messages#folder:archive')); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
122 |
userprefs_menu_add('Private messages', 'Trash', makeUrlNS('Special', 'Private_Messages#folder:trash')); |
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
123 |
*/ |
0 | 124 |
|
125 |
$userprefs_menu_links['Profile/membership'] = makeUrlNS('Special', 'Preferences'); |
|
126 |
$userprefs_menu_links['Private messages'] = makeUrlNS('Special', 'PrivateMessages'); |
|
127 |
||
128 |
$code = $plugins->setHook('userprefs_jbox'); |
|
129 |
foreach ( $code as $cmd ) |
|
130 |
{ |
|
131 |
eval($cmd); |
|
132 |
} |
|
133 |
} |
|
134 |
||
334
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents:
329
diff
changeset
|
135 |
$plugins->attachHook('common_post', 'userprefs_menu_init();'); |
0 | 136 |
|
137 |
function page_Special_Preferences() |
|
138 |
{ |
|
139 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
140 |
global $lang; |
0 | 141 |
|
142 |
// We need a login to continue |
|
143 |
if ( !$session->user_logged_in ) |
|
144 |
redirect(makeUrlNS('Special', 'Login/' . $paths->page), 'Login required', 'You need to be logged in to access this page. Please wait while you are redirected to the login page.'); |
|
145 |
||
146 |
// User ID - later this will be specified on the URL, but hardcoded for now |
|
147 |
$uid = intval($session->user_id); |
|
148 |
||
149 |
// Instanciate the AES encryptor |
|
286
b2f985e4cef3
Fixed a number of issues with SQL query readability and some undefined index-ish errors; consequently the SQL report feature was added
Dan
parents:
224
diff
changeset
|
150 |
$aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); |
0 | 151 |
|
152 |
// Basic user info |
|
153 |
$q = $db->sql_query('SELECT username, password, email, real_name, signature, theme, style FROM '.table_prefix.'users WHERE user_id='.$uid.';'); |
|
154 |
if ( !$q ) |
|
155 |
$db->_die(); |
|
156 |
||
157 |
$row = $db->fetchrow(); |
|
158 |
$db->free_result(); |
|
159 |
||
160 |
$section = $paths->getParam(0); |
|
161 |
if ( !$section ) |
|
162 |
{ |
|
163 |
$section = 'Home'; |
|
164 |
} |
|
165 |
||
166 |
$errors = ''; |
|
167 |
||
168 |
switch ( $section ) |
|
169 |
{ |
|
170 |
case 'EmailPassword': |
|
171 |
// Require elevated privileges (well sortof) |
|
172 |
if ( $session->auth_level < USER_LEVEL_CHPREF ) |
|
173 |
{ |
|
174 |
redirect(makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . USER_LEVEL_CHPREF, true), 'Authentication required', 'You need to re-authenticate to access this page.', 0); |
|
175 |
} |
|
176 |
||
177 |
if ( isset($_POST['submit']) ) |
|
178 |
{ |
|
179 |
$email_changed = false; |
|
180 |
// First do the e-mail address |
|
181 |
if ( strlen($_POST['newemail']) > 0 ) |
|
182 |
{ |
|
183 |
switch('foo') // Same reason as in the password code... |
|
184 |
{ |
|
185 |
case 'foo': |
|
186 |
if ( $_POST['newemail'] != $_POST['newemail_conf'] ) |
|
187 |
{ |
|
188 |
$errors .= '<div class="error-box">The e-mail addresses you entered did not match.</div>'; |
|
189 |
break; |
|
190 |
} |
|
191 |
} |
|
192 |
$q = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE user_id='.$session->user_id.';'); |
|
193 |
if ( !$q ) |
|
194 |
$db->_die(); |
|
195 |
$row = $db->fetchrow(); |
|
196 |
$db->free_result(); |
|
197 |
$old_pass = $aes->decrypt($row['password'], $session->private_key, ENC_HEX); |
|
198 |
||
199 |
$new_email = $_POST['newemail']; |
|
200 |
||
201 |
$result = $session->update_user($session->user_id, false, $old_pass, false, $new_email); |
|
202 |
if ( $result != 'success' ) |
|
203 |
{ |
|
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
204 |
$message = '<p>The following errors were encountered while saving your e-mail address:</p>'; |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
205 |
$message .= '<ul><li>' . implode("</li>\n<li>", $result) . '</li></ul>'; |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
206 |
die_friendly('Error updating e-mail address', $message); |
0 | 207 |
} |
208 |
$email_changed = true; |
|
209 |
} |
|
210 |
// Obtain password |
|
211 |
if ( $_POST['use_crypt'] == 'yes' && !empty($_POST['crypt_data']) ) |
|
212 |
{ |
|
213 |
$key = $session->fetch_public_key($_POST['crypt_key']); |
|
214 |
if ( !$key ) |
|
215 |
die('Can\'t lookup key'); |
|
216 |
$key = hexdecode($key); |
|
217 |
$newpass = $aes->decrypt($_POST['crypt_data'], $key, ENC_HEX); |
|
218 |
// At this point we know if we _want_ to change the password... |
|
219 |
||
220 |
// We can't check the password to see if it matches the confirmation |
|
221 |
// because the confirmation was destroyed during the encryption. I figured |
|
222 |
// this wasn't a big deal because if the encryption worked, then either |
|
223 |
// the Javascript validated it or the user hacked the form. In the latter |
|
224 |
// case, if he's smart enough to hack the encryption code, he's probably |
|
225 |
// smart enough to remember his password. |
|
226 |
||
227 |
if ( strlen($newpass) > 0 ) |
|
228 |
{ |
|
224
6a4573507ff8
Fixed: invalid smartform input to Admin:UserManager when errors present and changing own account; [demo mode] default user can no longer change password
Dan
parents:
192
diff
changeset
|
229 |
if ( defined('ENANO_DEMO_MODE') ) |
6a4573507ff8
Fixed: invalid smartform input to Admin:UserManager when errors present and changing own account; [demo mode] default user can no longer change password
Dan
parents:
192
diff
changeset
|
230 |
$errors .= '<div class="error-box" style="margin: 0 0 10px 0;">You can\'t change your password in demo mode.</div>'; |
0 | 231 |
// Perform checks |
232 |
if ( strlen($newpass) < 6 ) |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
233 |
$errors .= '<div class="error-box" style="margin: 0 0 10px 0;">Password must be at least 6 characters. You hacked my script, darn you!</div>'; |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
234 |
if ( getConfig('pw_strength_enable') == '1' ) |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
235 |
{ |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
236 |
$score_inp = password_score($newpass); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
237 |
$score_min = intval( getConfig('pw_strength_minimum') ); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
238 |
if ( $score_inp < $score_min ) |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
239 |
$errors .= '<div class="error-box" style="margin: 0 0 10px 0;">Your password did not meet the complexity score requirement for this site. Your password scored '. $score_inp .', while a score of at least '. $score_min .' is needed.</div>'; |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
240 |
} |
0 | 241 |
// Encrypt new password |
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
242 |
if ( empty($errors) ) |
0 | 243 |
{ |
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
244 |
$newpass_enc = $aes->encrypt($newpass, $session->private_key, ENC_HEX); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
245 |
// Perform the swap |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
246 |
$q = $db->sql_query('UPDATE '.table_prefix.'users SET password=\'' . $newpass_enc . '\' WHERE user_id=' . $session->user_id . ';'); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
247 |
if ( !$q ) |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
248 |
$db->_die(); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
249 |
// Log out and back in |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
250 |
$username = $session->username; |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
251 |
$session->logout(); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
252 |
if ( $email_changed ) |
0 | 253 |
{ |
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
254 |
if ( getConfig('account_activation') == 'user' ) |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
255 |
{ |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
256 |
redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your password and e-mail address have been changed. Since e-mail activation is required on this site, you will need to re-activate your account to continue. An e-mail has been sent to the new e-mail address with an activation link. You must click that link in order to log in again.', 19); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
257 |
} |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
258 |
else if ( getConfig('account_activation') == 'admin' ) |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
259 |
{ |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
260 |
redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your password and e-mail address have been changed. Since administrative activation is requires on this site, a request has been sent to the administrators to activate your account for you. You will not be able to use your account until it is activated by an administrator.', 19); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
261 |
} |
0 | 262 |
} |
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
263 |
$session->login_without_crypto($session->username, $newpass); |
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
264 |
redirect(makeUrlNS('Special', 'Preferences'), 'Password changed', 'Your password has been changed, and you will now be redirected back to the user control panel.', 4); |
0 | 265 |
} |
266 |
} |
|
267 |
} |
|
268 |
else |
|
269 |
{ |
|
270 |
switch('foo') // allow breaking out of our section...i can't wait until PHP6 (goto support!) |
|
271 |
{ |
|
272 |
case 'foo': |
|
273 |
$pass = $_POST['newpass']; |
|
274 |
if ( $pass != $_POST['newpass_conf'] ) |
|
275 |
{ |
|
276 |
$errors .= '<div class="error-box">The passwords you entered did not match</div>'; |
|
277 |
break; |
|
278 |
} |
|
279 |
||
280 |
if ( $email_changed ) |
|
281 |
{ |
|
282 |
if ( getConfig('account_activation') == 'user' ) |
|
283 |
{ |
|
284 |
redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your e-mail address has been changed. Since e-mail activation is required on this site, you will need to re-activate your account to continue. An e-mail has been sent to the new e-mail address with an activation link. You must click that link in order to log in again.', 19); |
|
285 |
} |
|
286 |
else if ( getConfig('account_activation') == 'admin' ) |
|
287 |
{ |
|
288 |
redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your e-mail address has been changed. Since administrative activation is requires on this site, a request has been sent to the administrators to activate your account for you. You will not be able to use your account until it is activated by an administrator.', 19); |
|
289 |
} |
|
290 |
else |
|
291 |
{ |
|
292 |
redirect(makeUrlNS('Special', 'Preferences'), 'Password changed', 'Your e-mail address has been changed, and you will now be redirected back to the user control panel.', 4); |
|
293 |
} |
|
294 |
} |
|
295 |
||
296 |
return; |
|
297 |
} |
|
298 |
} |
|
299 |
} |
|
300 |
$template->tpl_strings['PAGE_NAME'] = 'Change E-mail Address or Password'; |
|
301 |
break; |
|
302 |
case 'Signature': |
|
303 |
$template->tpl_strings['PAGE_NAME'] = 'Editing signature'; |
|
304 |
break; |
|
305 |
case 'Profile': |
|
306 |
$template->tpl_strings['PAGE_NAME'] = 'Editing public profile'; |
|
307 |
break; |
|
308 |
} |
|
309 |
||
310 |
$template->header(); |
|
311 |
||
312 |
// Output the menu |
|
313 |
// This is not templatized because it conforms to the jBox menu standard. |
|
314 |
||
315 |
userprefs_show_menu(); |
|
316 |
||
317 |
switch ( $section ) |
|
318 |
{ |
|
319 |
case 'Home': |
|
320 |
global $email; |
|
175
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
140
diff
changeset
|
321 |
$userpage_id = $paths->nslist['User'] . sanitize_page_id($session->username); |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
140
diff
changeset
|
322 |
$userpage_exists = ( isPage($userpage_id) ) ? '' : ' class="wikilink-nonexistent"'; |
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
140
diff
changeset
|
323 |
$user_page = '<a href="' . makeUrlNS('User', sanitize_page_id($session->username)) . '"' . $userpage_exists . '>user page</a> <sup>(<a href="' . makeUrlNS('User', str_replace(' ', '_', $session->username)) . '#do:comments">comments</a>)</sup>'; |
0 | 324 |
$site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', 'administrator'); |
175
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
140
diff
changeset
|
325 |
$make_one_now = '<a href="' . makeUrlNS('User', sanitize_page_id($session->username)) . '">make one now</a>'; |
0 | 326 |
echo "<h3 style='margin-top: 0;'>$session->username, welcome to your control panel</h3>"; |
327 |
echo "<p>Here you can make changes to your profile, view statistics on yourself on this site, and set your preferences.</p> |
|
175
1465f48faba0
AJAX login box is now used in userprefs panel; Spry shake effect and general UX on auth fail is smoother now; added ajaxLoginNavTo() JS function
Dan
parents:
140
diff
changeset
|
328 |
<p>Your $user_page is your free writing space. You can use it to tell the other members of this site a little bit about yourself. If you haven't already made a user page, why not $make_one_now?</p> |
0 | 329 |
<p>Use the menu at the top to navigate around. If you have any questions, you may contact the $site_admin."; |
330 |
break; |
|
331 |
case 'EmailPassword': |
|
332 |
||
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
333 |
$errors = trim($errors); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
334 |
if ( !empty($errors) ) |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
335 |
{ |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
336 |
echo $errors; |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
337 |
} |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
338 |
|
0 | 339 |
echo '<form action="' . makeUrlNS('Special', 'Preferences/EmailPassword') . '" method="post" onsubmit="return runEncryption();" name="empwform" >'; |
340 |
||
341 |
// Password change form |
|
342 |
$pubkey = $session->rijndael_genkey(); |
|
343 |
||
344 |
echo '<fieldset> |
|
345 |
<legend>Change password</legend> |
|
346 |
Type a new password:<br /> |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
347 |
<input type="password" name="newpass" size="30" tabindex="1" ' . ( getConfig('pw_strength_enable') == '1' ? 'onkeyup="password_score_field(this);" ' : '' ) . '/>' . ( getConfig('pw_strength_enable') == '1' ? '<span class="password-checker" style="font-weight: bold; color: #aaaaaa;"> Loading...</span>' : '' ) . ' |
0 | 348 |
<br /> |
349 |
<br /> |
|
350 |
Type the password again to confirm:<br /> |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
351 |
<input type="password" name="newpass_conf" size="30" tabindex="2" /> |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
352 |
' . ( getConfig('pw_strength_enable') == '1' ? '<br /><br /><div id="pwmeter"></div> |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
353 |
<small>Your password needs to score at least <b>'.getConfig('pw_strength_minimum').'</b> in order to be accepted.</small>' : '' ) . ' |
0 | 354 |
</fieldset><br /> |
355 |
<fieldset> |
|
356 |
<legend>Change e-mail address</legend> |
|
357 |
New e-mail address:<br /> |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
358 |
<input type="text" value="' . ( isset($_POST['newemail']) ? htmlspecialchars($_POST['newemail']) : '' ) . '" name="newemail" size="30" tabindex="3" /> |
0 | 359 |
<br /> |
360 |
<br /> |
|
361 |
Confirm e-mail address:<br /> |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
362 |
<input type="text" value="' . ( isset($_POST['newemail']) ? htmlspecialchars($_POST['newemail']) : '' ) . '" name="newemail_conf" size="30" tabindex="4" /> |
0 | 363 |
</fieldset> |
364 |
<input type="hidden" name="use_crypt" value="no" /> |
|
365 |
<input type="hidden" name="crypt_key" value="' . $pubkey . '" /> |
|
366 |
<input type="hidden" name="crypt_data" value="" /> |
|
367 |
<br /> |
|
368 |
<div style="text-align: right;"><input type="submit" name="submit" value="Save Changes" tabindex="5" /></div>'; |
|
369 |
||
370 |
echo '</form>'; |
|
371 |
||
372 |
// ENCRYPTION CODE |
|
373 |
?> |
|
374 |
<script type="text/javascript"> |
|
133
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
375 |
<?php if ( getConfig('pw_strength_enable') == '1' ): ?> |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
376 |
password_score_field(document.forms.empwform.newpass); |
af0f6ec48de3
Fully implemented password complexity enforcement; added encryption for passwords on registration form; some baby steps taken towards supporting international usernames - this is not working very well, we might need a hackish fix; TODO: implement password strength meter into installer UI and get international usernames 100% working
Dan
parents:
103
diff
changeset
|
377 |
<?php endif; ?> |
0 | 378 |
disableJSONExts(); |
379 |
str = ''; |
|
380 |
for(i=0;i<keySizeInBits/4;i++) str+='0'; |
|
381 |
var key = hexToByteArray(str); |
|
382 |
var pt = hexToByteArray(str); |
|
383 |
var ct = rijndaelEncrypt(pt, key, "ECB"); |
|
384 |
var ct = byteArrayToHex(ct); |
|
385 |
switch(keySizeInBits) |
|
386 |
{ |
|
387 |
case 128: |
|
388 |
v = '66e94bd4ef8a2c3b884cfa59ca342b2e'; |
|
389 |
break; |
|
390 |
case 192: |
|
391 |
v = 'aae06992acbf52a3e8f4a96ec9300bd7aae06992acbf52a3e8f4a96ec9300bd7'; |
|
392 |
break; |
|
393 |
case 256: |
|
394 |
v = 'dc95c078a2408989ad48a21492842087dc95c078a2408989ad48a21492842087'; |
|
395 |
break; |
|
396 |
} |
|
397 |
var aes_testpassed = ( ct == v && md5_vm_test() ); |
|
398 |
function runEncryption() |
|
399 |
{ |
|
400 |
var frm = document.forms.empwform; |
|
401 |
if ( frm.newpass.value.length < 1 ) |
|
402 |
return true; |
|
403 |
if(aes_testpassed) |
|
404 |
{ |
|
405 |
frm.use_crypt.value = 'yes'; |
|
406 |
var cryptkey = frm.crypt_key.value; |
|
407 |
frm.crypt_key.value = hex_md5(cryptkey); |
|
408 |
cryptkey = hexToByteArray(cryptkey); |
|
409 |
if(!cryptkey || ( ( typeof cryptkey == 'string' || typeof cryptkey == 'object' ) ) && cryptkey.length != keySizeInBits / 8 ) |
|
410 |
{ |
|
411 |
frm.submit.disabled = true; |
|
412 |
len = ( typeof cryptkey == 'string' || typeof cryptkey == 'object' ) ? '\nLen: '+cryptkey.length : ''; |
|
413 |
alert('The key is messed up\nType: '+typeof(cryptkey)+len); |
|
414 |
} |
|
415 |
} |
|
416 |
pass1 = frm.newpass.value; |
|
417 |
pass2 = frm.newpass_conf.value; |
|
418 |
if ( pass1 != pass2 ) |
|
419 |
{ |
|
420 |
alert('The passwords you entered do not match.'); |
|
421 |
return false; |
|
422 |
} |
|
423 |
if ( pass1.length < 6 && pass1.length > 0 ) |
|
424 |
{ |
|
425 |
alert('The new password must be 6 characters or greater in length.'); |
|
426 |
return false; |
|
427 |
} |
|
428 |
if(aes_testpassed) |
|
429 |
{ |
|
430 |
pass = frm.newpass.value; |
|
431 |
pass = stringToByteArray(pass); |
|
432 |
cryptstring = rijndaelEncrypt(pass, cryptkey, 'ECB'); |
|
433 |
if(!cryptstring) |
|
434 |
{ |
|
435 |
return false; |
|
436 |
} |
|
437 |
cryptstring = byteArrayToHex(cryptstring); |
|
438 |
frm.crypt_data.value = cryptstring; |
|
439 |
frm.newpass.value = ""; |
|
440 |
frm.newpass_conf.value = ""; |
|
441 |
} |
|
442 |
return true; |
|
443 |
} |
|
444 |
</script> |
|
445 |
<?php |
|
446 |
||
447 |
break; |
|
448 |
case 'Signature': |
|
449 |
if ( isset($_POST['new_sig']) ) |
|
450 |
{ |
|
451 |
$sig = $_POST['new_sig']; |
|
452 |
$sig = RenderMan::preprocess_text($sig, true, false); |
|
453 |
$sql_sig = $db->escape($sig); |
|
454 |
$q = $db->sql_query('UPDATE '.table_prefix.'users SET signature=\'' . $sql_sig . '\' WHERE user_id=' . $session->user_id . ';'); |
|
455 |
if ( !$q ) |
|
456 |
$db->_die(); |
|
457 |
$session->signature = $sig; |
|
458 |
echo '<div class="info-box" style="margin: 0 0 10px 0;">Your signature has been saved.</div>'; |
|
459 |
} |
|
460 |
echo '<form action="'.makeUrl($paths->fullpage).'" method="post">'; |
|
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
36
diff
changeset
|
461 |
echo $template->tinymce_textarea('new_sig', htmlspecialchars($session->signature)); |
0 | 462 |
echo '<input type="submit" value="Save signature" />'; |
463 |
echo '</form>'; |
|
464 |
break; |
|
465 |
case "Profile": |
|
466 |
if ( isset($_POST['submit']) ) |
|
467 |
{ |
|
468 |
$real_name = htmlspecialchars($_POST['real_name']); |
|
469 |
$real_name = $db->escape($real_name); |
|
31
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
470 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
471 |
$imaddr_aim = htmlspecialchars($_POST['imaddr_aim']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
472 |
$imaddr_aim = $db->escape($imaddr_aim); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
473 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
474 |
$imaddr_msn = htmlspecialchars($_POST['imaddr_msn']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
475 |
$imaddr_msn = $db->escape($imaddr_msn); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
476 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
477 |
$imaddr_yahoo = htmlspecialchars($_POST['imaddr_yahoo']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
478 |
$imaddr_yahoo = $db->escape($imaddr_yahoo); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
479 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
480 |
$imaddr_xmpp = htmlspecialchars($_POST['imaddr_xmpp']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
481 |
$imaddr_xmpp = $db->escape($imaddr_xmpp); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
482 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
483 |
$homepage = htmlspecialchars($_POST['homepage']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
484 |
$homepage = $db->escape($homepage); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
485 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
486 |
$location = htmlspecialchars($_POST['location']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
487 |
$location = $db->escape($location); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
488 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
489 |
$occupation = htmlspecialchars($_POST['occupation']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
490 |
$occupation = $db->escape($occupation); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
491 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
492 |
$hobbies = htmlspecialchars($_POST['hobbies']); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
493 |
$hobbies = $db->escape($hobbies); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
494 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
495 |
$email_public = ( isset($_POST['email_public']) ) ? '1' : '0'; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
496 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
497 |
$session->real_name = $real_name; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
498 |
|
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
31
diff
changeset
|
499 |
if ( !preg_match('/@([a-z0-9-]+)(\.([a-z0-9-\.]+))?/', $imaddr_msn) && !empty($imaddr_msn) ) |
31
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
500 |
{ |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
501 |
$imaddr_msn = "$imaddr_msn@hotmail.com"; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
502 |
} |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
503 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
504 |
if ( substr($homepage, 0, 7) != 'http://' ) |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
505 |
{ |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
506 |
$homepage = "http://$homepage"; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
507 |
} |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
508 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
509 |
if ( !preg_match('/^http:\/\/([a-z0-9-.]+)([A-z0-9@#\$%\&:;<>,\.\?=\+\(\)\[\]_\/\\\\]*?)$/i', $homepage) ) |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
510 |
{ |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
511 |
$homepage = ''; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
512 |
} |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
513 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
514 |
$session->user_extra['user_aim'] = $imaddr_aim; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
515 |
$session->user_extra['user_msn'] = $imaddr_msn; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
516 |
$session->user_extra['user_xmpp'] = $imaddr_xmpp; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
517 |
$session->user_extra['user_yahoo'] = $imaddr_yahoo; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
518 |
$session->user_extra['user_homepage'] = $homepage; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
519 |
$session->user_extra['user_location'] = $location; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
520 |
$session->user_extra['user_job'] = $occupation; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
521 |
$session->user_extra['user_hobbies'] = $hobbies; |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
522 |
$session->user_extra['email_public'] = intval($email_public); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
523 |
|
0 | 524 |
$q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name' WHERE user_id=$session->user_id;"); |
525 |
if ( !$q ) |
|
526 |
$db->_die(); |
|
527 |
||
31
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
528 |
$q = $db->sql_query('UPDATE '.table_prefix."users_extra SET user_aim='$imaddr_aim',user_yahoo='$imaddr_yahoo',user_msn='$imaddr_msn', |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
529 |
user_xmpp='$imaddr_xmpp',user_homepage='$homepage',user_location='$location',user_job='$occupation', |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
530 |
user_hobbies='$hobbies',email_public=$email_public |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
531 |
WHERE user_id=$session->user_id;"); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
532 |
|
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
533 |
if ( !$q ) |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
534 |
$db->_die(); |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
535 |
|
0 | 536 |
echo '<div class="info-box" style="margin: 0 0 10px 0;">Your profile has been updated.</div>'; |
537 |
} |
|
538 |
echo '<form action="'.makeUrl($paths->fullpage).'" method="post">'; |
|
539 |
?> |
|
540 |
<div class="tblholder"> |
|
541 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
542 |
<tr> |
|
543 |
<th colspan="2">Your public profile</th> |
|
544 |
</tr> |
|
545 |
<tr> |
|
546 |
<td colspan="2" class="row3">Please note that all of the information you enter here will be <b>publicly viewable.</b> All of the fields on this page are optional and may be left blank if you so desire.</td> |
|
547 |
</tr> |
|
548 |
<tr> |
|
549 |
<td class="row2" style="width: 50%;">Real name:</td> |
|
550 |
<td class="row1" style="width: 50%;"><input type="text" name="real_name" value="<?php echo $session->real_name; ?>" size="30" /></td> |
|
551 |
</tr> |
|
552 |
<tr> |
|
553 |
<td class="row2">Change theme:</td> |
|
554 |
<td class="row1">If you don't like the look of the site, need a visual break, or are just curious, we might have some different themes for you to try out! <a href="<?php echo makeUrlNS('Special', 'ChangeStyle/' . $paths->page); ?>" onclick="ajaxChangeStyle(); return false;">Change my theme...</a></td> |
|
555 |
</tr> |
|
556 |
<tr> |
|
31
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
557 |
<th class="subhead" colspan="2"> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
558 |
Instant messenger contact information |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
559 |
</th> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
560 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
561 |
<td class="row2" style="width: 50%;">AIM handle:</td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
562 |
<td class="row1" style="width: 50%;"><input type="text" name="imaddr_aim" value="<?php echo $session->user_extra['user_aim']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
563 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
564 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
565 |
<td class="row2" style="width: 50%;"><acronym title="Windows™ Live Messenger">WLM</acronym> handle:<br /><small>If you don't specify the domain (@whatever.com), "@hotmail.com" will be assumed.</small></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
566 |
<td class="row1" style="width: 50%;"><input type="text" name="imaddr_msn" value="<?php echo $session->user_extra['user_msn']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
567 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
568 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
569 |
<td class="row2" style="width: 50%;">Yahoo! IM handle:</td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
570 |
<td class="row1" style="width: 50%;"><input type="text" name="imaddr_yahoo" value="<?php echo $session->user_extra['user_yahoo']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
571 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
572 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
573 |
<td class="row2" style="width: 50%;">Jabber/XMPP handle:</td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
574 |
<td class="row1" style="width: 50%;"><input type="text" name="imaddr_xmpp" value="<?php echo $session->user_extra['user_xmpp']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
575 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
576 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
577 |
<th class="subhead" colspan="2"> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
578 |
Extra contact information |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
579 |
</th> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
580 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
581 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
582 |
<td class="row2" style="width: 50%;">Your homepage:<br /><small>Please remember the http:// prefix.</small></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
583 |
<td class="row1" style="width: 50%;"><input type="text" name="homepage" value="<?php echo $session->user_extra['user_homepage']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
584 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
585 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
586 |
<td class="row2" style="width: 50%;">Your location:</td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
587 |
<td class="row1" style="width: 50%;"><input type="text" name="location" value="<?php echo $session->user_extra['user_location']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
588 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
589 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
590 |
<td class="row2" style="width: 50%;">Your job:</td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
591 |
<td class="row1" style="width: 50%;"><input type="text" name="occupation" value="<?php echo $session->user_extra['user_job']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
592 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
593 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
594 |
<td class="row2" style="width: 50%;">Your hobbies:</td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
595 |
<td class="row1" style="width: 50%;"><input type="text" name="hobbies" value="<?php echo $session->user_extra['user_hobbies']; ?>" size="30" /></td> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
596 |
</tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
597 |
<tr> |
dc8741857bde
Finished Special:Preferences/Profile page! Only the wikitext parser cleanup left, yay!
Dan
parents:
0
diff
changeset
|
598 |
<td class="row2" style="width: 50%;"><label for="chk_email_public">E-mail address is public</label><br /><small>If this is checked, your e-mail address will be displayed on your user page. To protect your address from spambots, your e-mail address will be encrypted.</small></td> |
140
40f7fa5fd061
Revamped the administrator's user CP, big time. The admin module now uses a smart form and enables all profile fields, including users_extra, to be changed. Passwords are encrypted when sent. The whole CP has been split off into a different file to accomodate the large amount of code.
Dan
parents:
133
diff
changeset
|
599 |
<td class="row1" style="width: 50%;"><input type="checkbox" id="chk_email_public" name="email_public" <?php if ($session->user_extra['email_public'] == 1) echo 'checked="checked"'; ?> size="30" /></td> |
0 | 600 |
</tr> |
601 |
<tr> |
|
602 |
<th class="subhead" colspan="2"> |
|
603 |
<input type="submit" name="submit" value="Save profile" /> |
|
604 |
</th> |
|
605 |
</tr> |
|
606 |
</table> |
|
607 |
</div> |
|
608 |
<?php |
|
609 |
echo '</form>'; |
|
610 |
break; |
|
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
611 |
case 'Avatar': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
612 |
if ( getConfig('avatar_enable') != '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
613 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
614 |
echo '<div class="error-box"><b>' . $lang->get('usercp_avatar_err_disabled_title') . '</b><br />' . $lang->get('usercp_avatar_err_disabled_body') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
615 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
616 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
617 |
// Determine current avatar |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
618 |
$q = $db->sql_query('SELECT user_has_avatar, avatar_type FROM ' . table_prefix . 'users WHERE user_id = ' . $session->user_id . ';'); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
619 |
if ( !$q ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
620 |
$db->_die('Avatar CP selecting user\'s avatar data'); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
621 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
622 |
list($has_avi, $avi_type) = $db->fetchrow_num(); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
623 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
624 |
if ( isset($_POST['submit']) ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
625 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
626 |
$action = ( isset($_POST['avatar_action']) ) ? $_POST['avatar_action'] : 'keep'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
627 |
$avi_path = ENANO_ROOT . '/' . getConfig('avatar_directory') . '/' . $session->user_id . '.' . $avi_type; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
628 |
switch($action) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
629 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
630 |
case 'keep': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
631 |
default: |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
632 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
633 |
case 'remove': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
634 |
if ( $has_avi ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
635 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
636 |
// First switch the avatar off |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
637 |
$q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 0 WHERE user_id = ' . $session->user_id . ';'); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
638 |
if ( !$q ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
639 |
$db->_die('Avatar CP switching user avatar off'); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
640 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
641 |
if ( @unlink($avi_path) ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
642 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
643 |
echo '<div class="info-box">' . $lang->get('usercp_avatar_delete_success') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
644 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
645 |
$has_avi = 0; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
646 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
647 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
648 |
case 'set_http': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
649 |
case 'set_file': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
650 |
// Hackish way to preserve the UNIX philosophy of reusing as much code as possible |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
651 |
if ( $action == 'set_http' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
652 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
653 |
// Check if this action is enabled |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
654 |
if ( getConfig('avatar_upload_http') !== '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
655 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
656 |
// non-localized, only appears on hack attempt |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
657 |
echo '<div class="error-box">Uploads over HTTP are disabled.</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
658 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
659 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
660 |
// Download the file |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
661 |
require_once( ENANO_ROOT . '/includes/http.php' ); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
662 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
663 |
if ( !preg_match('/^http:\/\/([a-z0-9-\.]+)(:([0-9]+))?\/(.+)$/', $_POST['avatar_http_url'], $match) ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
664 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
665 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_invalid_url') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
666 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
667 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
668 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
669 |
$hostname = $match[1]; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
670 |
$uri = '/' . $match[4]; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
671 |
$port = ( $match[3] ) ? intval($match[3]) : 80; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
672 |
$max_size = intval(getConfig('avatar_max_size')); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
673 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
674 |
// Get temporary file |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
675 |
$tempfile = tempnam(false, "enanoavatar_{$session->user_id}"); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
676 |
if ( !$tempfile ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
677 |
echo '<div class="error-box">Error getting temp file.</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
678 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
679 |
@unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
680 |
$request = new Request_HTTP($hostname, $uri, 'GET', $port); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
681 |
$result = $request->write_response_to_file($tempfile, 50, $max_size); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
682 |
if ( !$result || $request->response_code != HTTP_OK ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
683 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
684 |
@unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
685 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_bad_write') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
686 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
687 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
688 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
689 |
// Response written. Proceed to validation... |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
690 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
691 |
else |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
692 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
693 |
// Check if this action is enabled |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
694 |
if ( getConfig('avatar_upload_file') !== '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
695 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
696 |
// non-localized, only appears on hack attempt |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
697 |
echo '<div class="error-box">Uploads from the browser are disabled.</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
698 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
699 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
700 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
701 |
$max_size = intval(getConfig('avatar_max_size')); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
702 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
703 |
$file =& $_FILES['avatar_file']; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
704 |
$tempfile =& $file['tmp_name']; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
705 |
if ( filesize($tempfile) > $max_size ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
706 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
707 |
@unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
708 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_file_too_large') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
709 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
710 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
711 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
712 |
$file_type = get_image_filetype($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
713 |
if ( !$file_type ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
714 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
715 |
unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
716 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_bad_filetype') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
717 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
718 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
719 |
|
329
0437a7cf1acc
Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents:
328
diff
changeset
|
720 |
$avi_path_new = ENANO_ROOT . '/' . getConfig('avatar_directory') . '/' . $session->user_id . '.' . $file_type; |
0437a7cf1acc
Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents:
328
diff
changeset
|
721 |
|
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
722 |
// The file type is good - validate dimensions and animation |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
723 |
switch($file_type) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
724 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
725 |
case 'png': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
726 |
$is_animated = is_png_animated($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
727 |
$dimensions = png_get_dimensions($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
728 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
729 |
case 'gif': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
730 |
$is_animated = is_gif_animated($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
731 |
$dimensions = gif_get_dimensions($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
732 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
733 |
case 'jpg': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
734 |
$is_animated = false; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
735 |
$dimensions = jpg_get_dimensions($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
736 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
737 |
default: |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
738 |
echo '<div class="error-box">API mismatch</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
739 |
break 2; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
740 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
741 |
// Did we get invalid size data? If so the image is probably corrupt. |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
742 |
if ( !$dimensions ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
743 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
744 |
@unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
745 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_corrupt_image') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
746 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
747 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
748 |
// Is the image animated? |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
749 |
if ( $is_animated && getConfig('avatar_enable_anim') !== '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
750 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
751 |
@unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
752 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_disallowed_animation') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
753 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
754 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
755 |
// Check image dimensions |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
756 |
list($image_x, $image_y) = $dimensions; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
757 |
$max_x = intval(getConfig('avatar_max_width')); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
758 |
$max_y = intval(getConfig('avatar_max_height')); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
759 |
if ( $image_x > $max_x || $image_y > $max_y ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
760 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
761 |
@unlink($tempfile); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
762 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_too_large') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
763 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
764 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
765 |
// All good! |
329
0437a7cf1acc
Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents:
328
diff
changeset
|
766 |
@unlink($avi_path); |
0437a7cf1acc
Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents:
328
diff
changeset
|
767 |
if ( rename($tempfile, $avi_path_new) ) |
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
768 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
769 |
$q = $db->sql_query('UPDATE ' . table_prefix . "users SET user_has_avatar = 1, avatar_type = '$file_type' WHERE user_id = {$session->user_id};"); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
770 |
if ( !$q ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
771 |
$db->_die('Avatar CP updating users table after successful avatar upload'); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
772 |
$has_avi = 1; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
773 |
$avi_type = $file_type; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
774 |
echo '<div class="info-box">' . $lang->get('usercp_avatar_upload_success') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
775 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
776 |
else |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
777 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
778 |
echo '<div class="error-box">' . $lang->get('usercp_avatar_move_failed') . '</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
779 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
780 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
781 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
782 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
783 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
784 |
?> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
785 |
<script type="text/javascript"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
786 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
787 |
function avatar_select_field(elParent) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
788 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
789 |
switch(elParent.value) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
790 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
791 |
case 'keep': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
792 |
case 'remove': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
793 |
$('avatar_upload_http').object.style.display = 'none'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
794 |
$('avatar_upload_file').object.style.display = 'none'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
795 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
796 |
case 'set_http': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
797 |
$('avatar_upload_http').object.style.display = 'block'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
798 |
$('avatar_upload_file').object.style.display = 'none'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
799 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
800 |
case 'set_file': |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
801 |
$('avatar_upload_http').object.style.display = 'none'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
802 |
$('avatar_upload_file').object.style.display = 'block'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
803 |
break; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
804 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
805 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
806 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
807 |
</script> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
808 |
<?php |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
809 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
810 |
echo '<form action="' . makeUrl($paths->fullpage) . '" method="post" enctype="multipart/form-data">'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
811 |
echo '<div class="tblholder">'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
812 |
echo '<table border="0" cellspacing="1" cellpadding="4">'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
813 |
echo '<tr> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
814 |
<th colspan="2"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
815 |
' . $lang->get('usercp_avatar_table_title') . ' |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
816 |
</th> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
817 |
</tr>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
818 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
819 |
echo '<tr> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
820 |
<td class="row2" style="width: 50%;"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
821 |
' . $lang->get('usercp_avatar_label_current') . ' |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
822 |
</td> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
823 |
<td class="row1" style="text-align: center;">'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
824 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
825 |
if ( $has_avi == 1 ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
826 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
827 |
echo '<img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $session->username)) . '" src="' . make_avatar_url($session->user_id, $avi_type) . '" />'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
828 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
829 |
else |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
830 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
831 |
echo $lang->get('usercp_avatar_image_none'); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
832 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
833 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
834 |
echo ' </td> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
835 |
</tr>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
836 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
837 |
echo ' <tr> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
838 |
<td class="row2"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
839 |
' . $lang->get('usercp_avatar_lbl_change') . ' |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
840 |
</td> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
841 |
<td class="row1"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
842 |
<label><input type="radio" name="avatar_action" value="keep" onclick="avatar_select_field(this);" checked="checked" /> ' . $lang->get('usercp_avatar_lbl_keep') . '</label><br /> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
843 |
<label><input type="radio" name="avatar_action" value="remove" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_remove') . '</label><br />'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
844 |
if ( getConfig('avatar_upload_http') == '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
845 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
846 |
echo ' <label><input type="radio" name="avatar_action" value="set_http" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_http') . '</label><br /> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
847 |
<div id="avatar_upload_http" style="display: none; margin: 10px 0 0 2.2em;"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
848 |
' . $lang->get('usercp_avatar_lbl_url') . ' <input type="text" name="avatar_http_url" size="40" value="http://" /><br /> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
849 |
<small>' . $lang->get('usercp_avatar_lbl_url_desc') . ' ' . $lang->get('usercp_avatar_limits') . '</small> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
850 |
</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
851 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
852 |
else |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
853 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
854 |
echo ' <div id="avatar_upload_http" style="display: none;"></div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
855 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
856 |
if ( getConfig('avatar_upload_file') == '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
857 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
858 |
echo ' <label><input type="radio" name="avatar_action" value="set_file" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_file') . '</label> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
859 |
<div id="avatar_upload_file" style="display: none; margin: 10px 0 0 2.2em;"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
860 |
' . $lang->get('usercp_avatar_lbl_file') . ' <input type="file" name="avatar_file" size="40" /><br /> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
861 |
<small>' . $lang->get('usercp_avatar_lbl_file_desc') . ' ' . $lang->get('usercp_avatar_limits') . '</small> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
862 |
</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
863 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
864 |
else |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
865 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
866 |
echo ' <div id="avatar_upload_file" style="display: none;"></div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
867 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
868 |
echo ' </td> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
869 |
</tr>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
870 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
871 |
echo ' <tr> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
872 |
<th class="subhead" colspan="2"> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
873 |
<input type="submit" name="submit" value="' . $lang->get('etc_save_changes') . '" /> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
874 |
</th> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
875 |
</tr>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
876 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
877 |
echo '</table> |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
878 |
</div>'; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
879 |
|
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
322
diff
changeset
|
880 |
break; |
0 | 881 |
default: |
882 |
$good = false; |
|
883 |
$code = $plugins->setHook('userprefs_body'); |
|
884 |
foreach ( $code as $cmd ) |
|
885 |
{ |
|
315
f49e3c8b638c
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents:
286
diff
changeset
|
886 |
if ( eval($cmd) ) |
0 | 887 |
$good = true; |
888 |
} |
|
889 |
if ( !$good ) |
|
890 |
{ |
|
891 |
echo '<h3>Invalid module</h3> |
|
892 |
<p>Userprefs module "'.$section.'" not found.</p>'; |
|
893 |
} |
|
894 |
break; |
|
895 |
} |
|
896 |
||
897 |
$template->footer(); |
|
898 |
} |
|
899 |
||
900 |
?> |