2 /* |
2 /* |
3 Plugin Name: User control panel |
3 Plugin Name: User control panel |
4 Plugin URI: http://enanocms.org/ |
4 Plugin URI: http://enanocms.org/ |
5 Description: Provides the page Special:Preferences. |
5 Description: Provides the page Special:Preferences. |
6 Author: Dan Fuhry |
6 Author: Dan Fuhry |
7 Version: 1.0.1 |
7 Version: 1.0.2 |
8 Author URI: http://enanocms.org/ |
8 Author URI: http://enanocms.org/ |
9 */ |
9 */ |
10 |
10 |
11 /* |
11 /* |
12 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
12 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
13 * Version 1.0 release candidate 2 |
13 * Version 1.0.2 |
14 * Copyright (C) 2006-2007 Dan Fuhry |
14 * Copyright (C) 2006-2007 Dan Fuhry |
15 * |
15 * |
16 * This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License |
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. |
17 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
18 * |
18 * |
98 function userprefs_menu_init() |
98 function userprefs_menu_init() |
99 { |
99 { |
100 global $db, $session, $paths, $template, $plugins; // Common objects |
100 global $db, $session, $paths, $template, $plugins; // Common objects |
101 global $userprefs_menu_links; |
101 global $userprefs_menu_links; |
102 |
102 |
103 userprefs_menu_add('Profile/membership', 'Edit e-mail address and password', makeUrlNS('Special', 'Preferences/EmailPassword')); |
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;'); |
104 userprefs_menu_add('Profile/membership', 'Edit signature', makeUrlNS('Special', 'Preferences/Signature')); |
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')); |
105 userprefs_menu_add('Profile/membership', 'Edit public profile', makeUrlNS('Special', 'Preferences/Profile')); |
106 userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special', 'PrivateMessages/Folder/Inbox')); |
106 userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special', 'PrivateMessages/Folder/Inbox')); |
107 userprefs_menu_add('Private messages', 'Outbox', makeUrlNS('Special', 'PrivateMessages/Folder/Outbox')); |
107 userprefs_menu_add('Private messages', 'Outbox', makeUrlNS('Special', 'PrivateMessages/Folder/Outbox')); |
108 userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'PrivateMessages/Folder/Sent')); |
108 userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'PrivateMessages/Folder/Sent')); |
210 // case, if he's smart enough to hack the encryption code, he's probably |
210 // case, if he's smart enough to hack the encryption code, he's probably |
211 // smart enough to remember his password. |
211 // smart enough to remember his password. |
212 |
212 |
213 if ( strlen($newpass) > 0 ) |
213 if ( strlen($newpass) > 0 ) |
214 { |
214 { |
|
215 if ( defined('ENANO_DEMO_MODE') ) |
|
216 $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">You can\'t change your password in demo mode.</div>'; |
215 // Perform checks |
217 // Perform checks |
216 if ( strlen($newpass) < 6 ) |
218 if ( strlen($newpass) < 6 ) |
217 $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>'; |
219 $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>'; |
218 if ( getConfig('pw_strength_enable') == '1' ) |
220 if ( getConfig('pw_strength_enable') == '1' ) |
219 { |
221 { |
300 |
302 |
301 switch ( $section ) |
303 switch ( $section ) |
302 { |
304 { |
303 case 'Home': |
305 case 'Home': |
304 global $email; |
306 global $email; |
305 $user_page = '<a href="' . makeUrlNS('User', str_replace(' ', '_', $session->username)) . '">user page</a> <sup>(<a href="' . makeUrlNS('User', str_replace(' ', '_', $session->username)) . '#do:comments">comments</a>)</sup>'; |
307 $userpage_id = $paths->nslist['User'] . sanitize_page_id($session->username); |
|
308 $userpage_exists = ( isPage($userpage_id) ) ? '' : ' class="wikilink-nonexistent"'; |
|
309 $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>'; |
306 $site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', 'administrator'); |
310 $site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', 'administrator'); |
|
311 $make_one_now = '<a href="' . makeUrlNS('User', sanitize_page_id($session->username)) . '">make one now</a>'; |
307 echo "<h3 style='margin-top: 0;'>$session->username, welcome to your control panel</h3>"; |
312 echo "<h3 style='margin-top: 0;'>$session->username, welcome to your control panel</h3>"; |
308 echo "<p>Here you can make changes to your profile, view statistics on yourself on this site, and set your preferences.</p> |
313 echo "<p>Here you can make changes to your profile, view statistics on yourself on this site, and set your preferences.</p> |
309 <p>If you have not already done so, you are encouraged to make a $user_page and tell the other members of this site a little about yourself.</p> |
314 <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> |
310 <p>Use the menu at the top to navigate around. If you have any questions, you may contact the $site_admin."; |
315 <p>Use the menu at the top to navigate around. If you have any questions, you may contact the $site_admin."; |
311 break; |
316 break; |
312 case 'EmailPassword': |
317 case 'EmailPassword': |
313 |
318 |
314 $errors = trim($errors); |
319 $errors = trim($errors); |