author | Dan |
Sun, 14 Oct 2007 20:51:15 -0400 | |
changeset 187 | 9dbbec5e6096 |
parent 179 | 36b287f1d85c |
parent 183 | 91127e62f38f |
child 193 | ebe99e82a59a |
child 207 | 861807631f70 |
permissions | -rwxr-xr-x |
0 | 1 |
<?php |
2 |
/* |
|
3 |
Plugin Name: Runt - the Enano administration panel |
|
4 |
Plugin URI: http://enanocms.org/ |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
5 |
Description: Provides the page Special:Administration, which is the AJAX frontend to the various Admin pagelets. This plugin cannot be disabled. |
0 | 6 |
Author: Dan Fuhry |
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
72
diff
changeset
|
7 |
Version: 1.0.1 |
0 | 8 |
Author URI: http://enanocms.org/ |
9 |
*/ |
|
10 |
||
11 |
/* |
|
12 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
|
166
d53cc29308f4
Rebrand as 1.1.1; everything should now be bumped to "unstable" status
Dan
parents:
162
diff
changeset
|
13 |
* Version 1.1.1 |
0 | 14 |
* Copyright (C) 2006-2007 Dan Fuhry |
15 |
* |
|
16 |
* This program is Free Software; you can redistribute 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 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
24 |
||
25 |
$plugins->attachHook('base_classes_initted', ' |
|
26 |
global $paths; |
|
27 |
$paths->add_page(Array( |
|
28 |
\'name\'=>\'Administration\', |
|
29 |
\'urlname\'=>\'Administration\', |
|
30 |
\'namespace\'=>\'Special\', |
|
116
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents:
110
diff
changeset
|
31 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
0 | 32 |
)); |
33 |
||
34 |
$paths->add_page(Array( |
|
35 |
\'name\'=>\'Manage the Sidebar\', |
|
36 |
\'urlname\'=>\'EditSidebar\', |
|
37 |
\'namespace\'=>\'Special\', |
|
116
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents:
110
diff
changeset
|
38 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
0 | 39 |
)); |
40 |
'); |
|
41 |
||
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
73
diff
changeset
|
42 |
// Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1 |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
73
diff
changeset
|
43 |
require(ENANO_ROOT . '/plugins/admin/PageGroups.php'); |
109
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
44 |
require(ENANO_ROOT . '/plugins/admin/SecurityLog.php'); |
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
|
45 |
require(ENANO_ROOT . '/plugins/admin/UserManager.php'); |
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
73
diff
changeset
|
46 |
|
0 | 47 |
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
48 |
||
49 |
function page_Admin_Home() { |
|
50 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
51 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
52 |
{ |
|
53 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
54 |
return; |
|
55 |
} |
|
56 |
||
57 |
// Basic information |
|
58 |
echo RenderMan::render( |
|
59 |
'== Welcome to Runt, the Enano administration panel. == |
|
60 |
||
61 |
Thank you for choosing Enano as your CMS. This screen allows you to see some information about your website, plus some details about how your site is doing statistically. |
|
62 |
||
63 |
Using the links on the left you can control every aspect of your website\'s look and feel, plus you can manage users, work with pages, and install plugins to make your Enano installation even better.'); |
|
64 |
||
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
65 |
// Demo mode |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
66 |
if ( defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
67 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
68 |
echo '<h3>Enano is running in demo mode.</h3> |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
69 |
<p>If you borked something up, or if you\'re done testing, you can <a href="' . makeUrlNS('Special', 'DemoReset', false, true) . '">reset this site</a>. The site is reset automatically once every two hours. When a reset is performed, all custom modifications to the site are lost and replaced with default values.</p>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
70 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
71 |
|
0 | 72 |
// Check for the installer scripts |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
73 |
if( ( file_exists(ENANO_ROOT.'/install.php') || file_exists(ENANO_ROOT.'/schema.sql') ) && !defined('ENANO_DEMO_MODE') ) |
0 | 74 |
{ |
75 |
echo '<div class="error-box"><b>NOTE:</b> It appears that your install.php and/or schema.sql files still exist. It is HIGHLY RECOMMENDED that you delete or rename these files, to prevent getting your server hacked.</div>'; |
|
76 |
} |
|
77 |
||
78 |
// Inactive users |
|
79 |
$q = $db->sql_query('SELECT * FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\';'); |
|
80 |
if($q) |
|
81 |
if($db->numrows() > 0) |
|
82 |
{ |
|
83 |
$n = $db->numrows(); |
|
84 |
if($n == 1) $s = $n . ' user is'; |
|
85 |
else $s = $n . ' users are'; |
|
86 |
echo '<div class="warning-box">It appears that '.$s.' awaiting account activation. You can activate those accounts by going to the <a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'UserManager\'); return false;">User Manager</a>.</div>'; |
|
87 |
} |
|
88 |
$db->free_result(); |
|
89 |
// Stats |
|
90 |
if(getConfig('log_hits') == '1') |
|
91 |
{ |
|
92 |
$stats = stats_top_pages(10); |
|
61 | 93 |
//die('<pre>'.print_r($stats,true).'</pre>'); |
0 | 94 |
$c = 0; |
95 |
$cls = 'row2'; |
|
96 |
echo '<h3>Most requested pages</h3><div class="tblholder"><table style="width: 100%;" border="0" cellspacing="1" cellpadding="4"><tr><th>Page</th><th>Hits</th></tr>'; |
|
61 | 97 |
foreach($stats as $data) |
0 | 98 |
{ |
61 | 99 |
echo '<tr>'; |
100 |
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
|
101 |
echo '<td class="'.$cls.'"><a href="'.makeUrl($data['page_urlname']).'">'.$data['page_title'].'</a></td><td style="text-align: center;" class="'.$cls.'">'.$data['num_hits'].'</td>'; |
|
102 |
echo '</tr>'; |
|
0 | 103 |
} |
104 |
echo '</table></div>'; |
|
105 |
} |
|
106 |
||
107 |
// Security log |
|
108 |
echo '<h3>Security log</h3>'; |
|
109
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
109 |
$seclog = get_security_log(5); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
110 |
echo $seclog; |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
111 |
|
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
112 |
echo '<p><a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'SecurityLog\'); return false;">Full security log</a></p>'; |
0 | 113 |
|
114 |
} |
|
115 |
||
116 |
function page_Admin_GeneralConfig() { |
|
117 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
118 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
119 |
{ |
|
120 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
121 |
return; |
|
122 |
} |
|
123 |
||
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
124 |
if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
125 |
{ |
0 | 126 |
|
127 |
// Global site options |
|
128 |
setConfig('site_name', $_POST['site_name']); |
|
129 |
setConfig('site_desc', $_POST['site_desc']); |
|
130 |
setConfig('main_page', str_replace(' ', '_', $_POST['main_page'])); |
|
131 |
setConfig('copyright_notice', $_POST['copyright']); |
|
132 |
setConfig('contact_email', $_POST['contact_email']); |
|
133 |
||
134 |
// Wiki mode |
|
135 |
if(isset($_POST['wikimode'])) setConfig('wiki_mode', '1'); |
|
136 |
else setConfig('wiki_mode', '0'); |
|
137 |
if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1'); |
|
138 |
else setConfig('wiki_mode_require_login', '0'); |
|
139 |
if(isset($_POST['editmsg'])) setConfig('wiki_edit_notice', '1'); |
|
140 |
else setConfig('wiki_edit_notice', '0'); |
|
141 |
setConfig('wiki_edit_notice_text', $_POST['editmsg_text']); |
|
142 |
||
143 |
// Stats |
|
144 |
if(isset($_POST['log_hits'])) setConfig('log_hits', '1'); |
|
145 |
else setConfig('log_hits', '0'); |
|
146 |
||
147 |
// Disablement |
|
148 |
if(isset($_POST['site_disabled'])) { setConfig('site_disabled', '1'); setConfig('site_disabled_notice', $_POST['site_disabled_notice']); } |
|
149 |
else setConfig('site_disabled', '0'); |
|
150 |
||
151 |
// Account activation |
|
152 |
setConfig('account_activation', $_POST['account_activation']); |
|
153 |
||
154 |
// W3C compliance buttons |
|
155 |
if(isset($_POST['w3c-vh32'])) setConfig("w3c_vh32", "1"); |
|
156 |
else setConfig("w3c_vh32", "0"); |
|
157 |
if(isset($_POST['w3c-vh40'])) setConfig("w3c_vh40", "1"); |
|
158 |
else setConfig("w3c_vh40", "0"); |
|
159 |
if(isset($_POST['w3c-vh401'])) setConfig("w3c_vh401", "1"); |
|
160 |
else setConfig("w3c_vh401", "0"); |
|
161 |
if(isset($_POST['w3c-vxhtml10'])) setConfig("w3c_vxhtml10", "1"); |
|
162 |
else setConfig("w3c_vxhtml10", "0"); |
|
163 |
if(isset($_POST['w3c-vxhtml11'])) setConfig("w3c_vxhtml11", "1"); |
|
164 |
else setConfig("w3c_vxhtml11", "0"); |
|
165 |
if(isset($_POST['w3c-vcss'])) setConfig("w3c_vcss", "1"); |
|
166 |
else setConfig("w3c_vcss", "0"); |
|
167 |
||
168 |
// SourceForge.net logo |
|
169 |
if(isset($_POST['showsf'])) setConfig('sflogo_enabled', '1'); |
|
170 |
else setConfig('sflogo_enabled', '0'); |
|
171 |
setConfig('sflogo_groupid', $_POST['sfgroup']); |
|
172 |
setConfig('sflogo_type', $_POST['sflogo']); |
|
173 |
||
174 |
// Comment options |
|
175 |
if(isset($_POST['comment-approval'])) setConfig('approve_comments', '1'); |
|
176 |
else setConfig('approve_comments', '0'); |
|
177 |
if(isset($_POST['enable-comments'])) setConfig('enable_comments', '1'); |
|
178 |
else setConfig('enable_comments', '0'); |
|
179 |
setConfig('comments_need_login', $_POST['comments_need_login']); |
|
180 |
||
181 |
// Powered by link |
|
182 |
if ( isset($_POST['enano_powered_link']) ) setConfig('powered_btn', '1'); |
|
183 |
else setConfig('powered_btn', '0'); |
|
184 |
||
185 |
if(isset($_POST['dbdbutton'])) setConfig('dbd_button', '1'); |
|
186 |
else setConfig('dbd_button', '0'); |
|
187 |
||
188 |
if($_POST['emailmethod'] == 'phpmail') setConfig('smtp_enabled', '0'); |
|
189 |
else setConfig('smtp_enabled', '1'); |
|
190 |
||
191 |
setConfig('smtp_server', $_POST['smtp_host']); |
|
192 |
setConfig('smtp_user', $_POST['smtp_user']); |
|
193 |
if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']); |
|
194 |
||
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:
130
diff
changeset
|
195 |
// Password strength |
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:
130
diff
changeset
|
196 |
if ( isset($_POST['pw_strength_enable']) ) setConfig('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:
130
diff
changeset
|
197 |
else setConfig('pw_strength_enable', '0'); |
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:
130
diff
changeset
|
198 |
|
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:
130
diff
changeset
|
199 |
$strength = intval($_POST['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:
130
diff
changeset
|
200 |
if ( $strength >= -10 && $strength <= 30 ) |
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:
130
diff
changeset
|
201 |
{ |
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:
130
diff
changeset
|
202 |
$strength = strval($strength); |
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:
130
diff
changeset
|
203 |
setConfig('pw_strength_minimum', $strength); |
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:
130
diff
changeset
|
204 |
} |
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:
130
diff
changeset
|
205 |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
206 |
// Account lockout policy |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
207 |
if ( preg_match('/^[0-9]+$/', $_POST['lockout_threshold']) ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
208 |
setConfig('lockout_threshold', $_POST['lockout_threshold']); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
209 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
210 |
if ( preg_match('/^[0-9]+$/', $_POST['lockout_duration']) ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
211 |
setConfig('lockout_duration', $_POST['lockout_duration']); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
212 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
213 |
if ( in_array($_POST['lockout_policy'], array('disable', 'captcha', 'lockout')) ) |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
214 |
setConfig('lockout_policy', $_POST['lockout_policy']); |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
215 |
|
0 | 216 |
echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />'; |
217 |
||
218 |
} |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
219 |
else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
220 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
221 |
echo '<div class="error-box">Saving the general site configuration is blocked in the administration demo.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
222 |
} |
0 | 223 |
echo('<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post" onsubmit="if(!submitAuthorized) return false;">'); |
224 |
?> |
|
225 |
<div class="tblholder"> |
|
226 |
<table border="0" width="100%" cellspacing="1" cellpadding="4"> |
|
227 |
||
228 |
<!-- Global options --> |
|
229 |
||
230 |
<tr><th colspan="2">Global site options</th></tr> |
|
231 |
<tr><th colspan="2" class="subhead">These options control the entire site.</th></tr> |
|
232 |
||
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
233 |
<tr><td class="row1" style="width: 50%;">Site name:</td> <td class="row1" style="width: 50%;"><input type="text" name="site_name" size="30" value="<?php echo htmlspecialchars(getConfig('site_name')); ?>" /></td></tr> |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
234 |
<tr><td class="row2">Site description:</td> <td class="row2"><input type="text" name="site_desc" size="30" value="<?php echo htmlspecialchars(getConfig('site_desc')); ?>" /></td></tr> |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
235 |
<tr><td class="row1">Main page:</td> <td class="row1"><?php echo $template->pagename_field('main_page', htmlspecialchars(str_replace('_', ' ', getConfig('main_page')))); ?></td></tr> |
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
236 |
<tr><td class="row2">Copyright notice shown on pages:</td><td class="row2"><input type="text" name="copyright" size="30" value="<?php echo htmlspecialchars(getConfig('copyright_notice')); ?>" /></td></tr> |
0 | 237 |
<tr><td class="row1" colspan="2">Hint: If you're using Windows, you can make a "©" symbol by holding ALT and pressing 0169 on the numeric keypad.</td></tr> |
238 |
<tr><td class="row2">Contact e-mail<br /><small>All e-mail sent from this site will appear to have come from the address shown here.</small></td><td class="row2"><input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" /></td></tr> |
|
239 |
||
240 |
<!-- Wiki mode --> |
|
241 |
||
242 |
<tr><th colspan="2">Wiki mode</th></tr> |
|
243 |
||
244 |
<tr> |
|
245 |
<td class="row3" rowspan="2"> |
|
246 |
Enano can also act as a wiki, meaning anyone can edit and create pages. To enable Wiki Mode, check the box to the right.<br /><br /> |
|
247 |
In Wiki Mode, certain HTML tags such as <script> and <object> are disabled, and all PHP code is disabled, except if the person editing the page is an administrator.<br /><br /> |
|
248 |
Also, Enano keeps complete page history, which makes restoring vandalized pages easy. You can also protect pages so that they cannot be edited. |
|
249 |
</td> |
|
250 |
<td class="row1"> |
|
251 |
<input type="checkbox" name="wikimode" id="wikimode" <?php if(getConfig('wiki_mode')=='1') echo('CHECKED '); ?> /><label for="wikimode">Enable Wiki Mode</label> |
|
252 |
</td> |
|
253 |
</tr> |
|
254 |
||
255 |
<tr><td class="row2"><label><input type="checkbox" name="wiki_mode_require_login"<?php if(getConfig('wiki_mode_require_login')=='1') echo('CHECKED '); ?>/> Only for logged in users</label></td></tr> |
|
256 |
||
257 |
<tr> |
|
258 |
<td class="row3" rowspan="2"> |
|
259 |
<b>Edit page notice</b><br /> |
|
260 |
When Wiki Mode is enabled, anyone can edit pages. Check the box below and enter a message to display it whenever the page editor is opened. |
|
261 |
</td> |
|
262 |
<td class="row1"> |
|
263 |
<input onclick="if(this.checked) document.getElementById('editmsg_text').style.display='block'; else document.getElementById('editmsg_text').style.display='none';" type="checkbox" name="editmsg" id="editmsg" <?php if(getConfig('wiki_edit_notice')=='1') echo('CHECKED '); ?>/> <label for="editmsg">Show a message whenever pages are edited</label> |
|
264 |
</td> |
|
265 |
</tr> |
|
266 |
||
267 |
<tr> |
|
268 |
<td class="row2"> |
|
269 |
<textarea <?php if(getConfig('wiki_edit_notice')!='1') echo('style="display:none" '); ?>rows="5" cols="30" name="editmsg_text" id="editmsg_text"><?php echo getConfig('wiki_edit_notice_text'); ?></textarea> |
|
270 |
</td> |
|
271 |
</tr> |
|
272 |
||
273 |
<!-- Site statistics --> |
|
274 |
||
275 |
<tr><th colspan="2">Statistics and hit counting</th></tr> |
|
276 |
||
277 |
<tr> |
|
278 |
<td class="row1">Enano has the ability to show statistics for every page on the site. This allows you to keep very close track of who is visiting your site, and from where.<br /><br />Unfortunately, some users don't like being logged. For this reason, you should state clearly what is logged (usually the username or IP address, current time, page name, and referer URL) in your privacy policy. If your site is primarily geared towards children, and you are a United States citizen, you are required to have a privacy policy stating exactly what is being logged under the terms of the Childrens' Online Privacy Protection Act.</td> |
|
279 |
<td class="row1"><label><input type="checkbox" name="log_hits" <?php if(getConfig('log_hits') == '1') echo 'checked="checked" '; ?>/> Log all page hits</label><br /><small>This excludes special and administration pages.</small></td> |
|
280 |
</tr> |
|
281 |
||
282 |
<!-- Comment options --> |
|
283 |
||
284 |
<tr><th colspan="2">Comment system</th></tr> |
|
285 |
<tr><td class="row1"><label for="enable-comments"><b>Enable the comment system</b></label> </td><td class="row1"><input name="enable-comments" id="enable-comments" type="checkbox" <?php if(getConfig('enable_comments')=='1') echo('CHECKED '); ?>/></td></tr> |
|
286 |
<tr><td class="row2"><label for="comment-approval">Require approval before article comments can be shown</label></td><td class="row2"><input name="comment-approval" id="comment-approval" type="checkbox" <?php if(getConfig('approve_comments')=='1') echo('CHECKED '); ?>/></td></tr> |
|
287 |
<tr><td class="row1">Guest comment posting allowed </td><td class="row1"><label><input name="comments_need_login" type="radio" value="0" <?php if(getConfig('comments_need_login')=='0') echo 'CHECKED '; ?>/> Yes</label> |
|
288 |
<label><input name="comments_need_login" type="radio" value="1" <?php if(getConfig('comments_need_login')=='1') echo 'CHECKED '; ?>/> Require visual confirmation</label> |
|
289 |
<!-- Default permissions --> <label><input name="comments_need_login" type="radio" value="2" <?php if(getConfig('comments_need_login')=='2') echo 'CHECKED '; ?>/> No (require login)</label></td></tr> |
|
290 |
||
291 |
<!-- |
|
292 |
||
293 |
READ: Do not try to enable this, backend support for it has been disabled. To edit default |
|
294 |
permissions, select The Entire Website in any permissions editor window. |
|
295 |
||
296 |
<tr><th colspan="2">Default permissions for pages</th></tr> |
|
297 |
||
298 |
<tr> |
|
299 |
<td class="row1">You can edit the default set of permissions used when no other permissions are available. Permissions set here are used when no other permissions are available. As with other ACL rules, you can assign these defaults to every user or one specific user or group.</td> |
|
300 |
<td class="row1"><a href="#" onclick="ajaxOpenACLManager('__DefaultPermissions', 'Special'); return false;">Manage default permissions</a></td> |
|
301 |
</tr> |
|
302 |
||
303 |
--> |
|
304 |
||
305 |
<!-- enanocms.org link --> |
|
306 |
||
307 |
<tr> |
|
308 |
<th colspan="2">Promote Enano</th> |
|
309 |
</tr> |
|
310 |
<tr> |
|
311 |
<td class="row3"> |
|
312 |
If you think Enano is nice, or if you want to show your support for the Enano team, you can do so by placing a link to the Enano |
|
313 |
homepage in your Links sidebar block. You absolutely don't have to do this, and you won't get degraded support if you don't. Because |
|
314 |
Enano is still relatively new in the CMS world, it needs all the attention it can get - and you can easily help to spread the word |
|
315 |
using this link. |
|
316 |
</td> |
|
317 |
<td class="row1"> |
|
318 |
<label> |
|
36
425261984266
Added "page hint" on search page; deprecated "www." on EnanoCMS.org links
Dan
parents:
30
diff
changeset
|
319 |
<input name="enano_powered_link" type="checkbox" <?php if(getConfig('powered_btn') == '1') echo 'checked="checked"'; ?> /> Place a link to enanocms.org on the sidebar |
0 | 320 |
</label> |
321 |
</td> |
|
322 |
</tr> |
|
323 |
||
324 |
<!-- Site disablement --> |
|
325 |
||
326 |
<tr><th colspan="2">Disable all site access</th></tr> |
|
327 |
||
328 |
<tr> |
|
329 |
<td class="row3" rowspan="2">Disabling the site allows you to work on the site without letting non-administrators see or use it.</td> |
|
330 |
<td class="row1"><label><input onclick="if(this.checked) document.getElementById('site_disabled_notice').style.display='block'; else document.getElementById('site_disabled_notice').style.display='none';" type="checkbox" name="site_disabled" <?php if(getConfig('site_disabled') == '1') echo 'checked="checked" '; ?>/> Disable this site</label></td> |
|
331 |
</tr> |
|
332 |
<tr> |
|
333 |
<td class="row2"> |
|
30 | 334 |
<div id="site_disabled_notice"<?php if(getConfig('site_disabled')!='1') echo(' style="display:none"'); ?>> |
0 | 335 |
Message to show to users:<br /> |
336 |
<textarea name="site_disabled_notice" rows="7" cols="30"><?php echo getConfig('site_disabled_notice'); ?></textarea> |
|
337 |
</div> |
|
338 |
</td> |
|
339 |
</tr> |
|
340 |
||
341 |
<!-- Account activation --> |
|
342 |
||
343 |
<tr><th colspan="2">User account activation</th></tr> |
|
344 |
||
345 |
<tr> |
|
346 |
<td class="row3" colspan="2"> |
|
347 |
If you would like to require users to confirm their e-mail addresses by way of account activation, you can enable this behavior here. If this option is set to "None", users will be able to register and use this site without confirming their e-mail addresses. If this option is set to "User", users will automatically be sent e-mails upon registration with a link to activate their accounts. And lastly, if this option is set to "Admin", users' accounts will not be active until an administrator activates the account.<br /><br /> |
|
348 |
You may also disable registration completely if needed.<br /><br /> |
|
349 |
<b>Note: because of abuse by project administrators, sending account activation e-mails will not work on SourceForge.net servers.</b> |
|
350 |
</td> |
|
351 |
</tr> |
|
352 |
||
353 |
<tr> |
|
354 |
<td class="row1">Account activation:</td><td class="row1"> |
|
355 |
<?php |
|
356 |
echo '<label><input'; if(getConfig('account_activation') == 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="disable" /> Disable registration</label><br />'; |
|
357 |
echo '<label><input'; if(getConfig('account_activation') != 'user' && getConfig('account_activation') != 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="none" /> None</label>'; |
|
358 |
echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> User</label>'; |
|
359 |
echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> Admin</label>'; |
|
360 |
?> |
|
361 |
</td> |
|
362 |
</tr> |
|
363 |
||
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
364 |
<!-- Account lockout --> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
365 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
366 |
<tr><th colspan="2">Account lockouts</th></tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
367 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
368 |
<tr><td class="row3" colspan="2">Configure Enano to prevent or restrict logins for a specified period of time if a user enters an incorrect password a specific number of times.</td></tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
369 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
370 |
<tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
371 |
<td class="row2">Lockout threshold:<br /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
372 |
<small>How many times can a user enter wrong credentials before a lockout goes into effect?</small> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
373 |
</td> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
374 |
<td class="row2"> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
375 |
<input type="text" name="lockout_threshold" value="<?php echo ( $_ = getConfig('lockout_threshold') ) ? $_ : '5' ?>" /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
376 |
</td> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
377 |
</tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
378 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
379 |
<tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
380 |
<td class="row1">Lockout duration:<br /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
381 |
<small>This is how long an account lockout should last, in minutes.</small> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
382 |
</td> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
383 |
<td class="row1"> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
384 |
<input type="text" name="lockout_duration" value="<?php echo ( $_ = getConfig('lockout_duration') ) ? $_ : '15' ?>" /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
385 |
</td> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
386 |
</tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
387 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
388 |
<tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
389 |
<td class="row2">Lockout policy:<br /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
390 |
<small>What should be done when a lockout goes into effect?</small> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
391 |
</td> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
392 |
<td class="row2"> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
393 |
<label><input type="radio" name="lockout_policy" value="disable" <?php if ( getConfig('lockout_policy') == 'disable' ) echo 'checked="checked"'; ?> /> Don't do anything</label><br /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
394 |
<label><input type="radio" name="lockout_policy" value="captcha" <?php if ( getConfig('lockout_policy') == 'captcha' ) echo 'checked="checked"'; ?> /> Require visual confirmation</label><br /> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
395 |
<label><input type="radio" name="lockout_policy" value="lockout" <?php if ( getConfig('lockout_policy') == 'lockout' || !getConfig('lockout_policy') ) echo 'checked="checked"'; ?> /> Prevent all login attempts</label> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
396 |
</td> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
397 |
</tr> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
398 |
|
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
399 |
<!-- Password strength --> |
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
400 |
|
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:
130
diff
changeset
|
401 |
<tr><th colspan="2">Password strength</th></tr> |
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:
130
diff
changeset
|
402 |
|
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:
130
diff
changeset
|
403 |
<tr> |
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:
130
diff
changeset
|
404 |
<td class="row2"> |
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:
130
diff
changeset
|
405 |
<b>Enable password strength analysis</b><br /> |
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:
130
diff
changeset
|
406 |
<small>This should be enabled in most cases. When this is enabled, a strength meter and a numerical score will be displayed wherever a password can be changed.</small> |
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:
130
diff
changeset
|
407 |
</td> |
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:
130
diff
changeset
|
408 |
<td class="row2"> |
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:
130
diff
changeset
|
409 |
<label><input type="checkbox" name="pw_strength_enable" <?php if ( getConfig('pw_strength_enable') == '1' ) echo 'checked="checked" '; ?>/> Enabled</label> |
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:
130
diff
changeset
|
410 |
</td> |
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:
130
diff
changeset
|
411 |
</tr> |
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:
130
diff
changeset
|
412 |
|
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:
130
diff
changeset
|
413 |
<tr> |
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:
130
diff
changeset
|
414 |
<td class="row1"> |
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:
130
diff
changeset
|
415 |
<b>Minimum strength score</b><br /> |
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:
130
diff
changeset
|
416 |
<small>This is the lowest score a password will be allowed to have. -10 will allow any password. A score of under -3 is considered weak, under 1 is fair, under 4 is good, under 10 is strong, and 10 and above are very strong. The scale is open-ended. This only has an effect if the meter is enabled above.</small> |
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:
130
diff
changeset
|
417 |
</td> |
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:
130
diff
changeset
|
418 |
<td class="row1"> |
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:
130
diff
changeset
|
419 |
<input type="text" name="pw_strength_minimum" value="<?php echo ( $x = getConfig('pw_strength_minimum') ) ? $x : '-10'; ?>" /> |
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:
130
diff
changeset
|
420 |
</td> |
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:
130
diff
changeset
|
421 |
</tr> |
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:
130
diff
changeset
|
422 |
|
0 | 423 |
<!-- E-mail options --> |
424 |
||
425 |
<tr><th colspan="2">E-mail sent from the site</th></tr> |
|
426 |
<tr><td class="row1">E-mail sending method:<br /><small>Try using the built-in e-mail method first. If that doesn't work, you will need to enter valid SMTP information here.</small></td> |
|
427 |
<td class="row1"><label><input <?php if(getConfig('smtp_enabled') != '1') echo 'checked="checked"'; ?> type="radio" name="emailmethod" value="phpmail" />PHP's built-in mail() function</label><br /> |
|
428 |
<label><input <?php if(getConfig('smtp_enabled') == '1') echo 'checked="checked"'; ?> type="radio" name="emailmethod" value="smtp" />Use an external SMTP server</label></td> |
|
429 |
</tr> |
|
430 |
<tr><td class="row2">SMTP hostname:<br /><small>This option only applies to the external SMTP mode.</small></td> |
|
431 |
<td class="row2"><input value="<?php echo getConfig('smtp_server'); ?>" name="smtp_host" type="text" size="30" /></td> |
|
432 |
</tr> |
|
433 |
<tr><td class="row1">SMTP credentials:<br /><small>This option only applies to the external SMTP mode.</small></td> |
|
434 |
<td class="row1">Username: <input value="<?php echo getConfig('smtp_user'); ?>" name="smtp_user" type="text" size="30" /><br /> |
|
435 |
Password: <input value="<?php if(getConfig('smtp_password') != false) echo 'XXXXXXXXXXXX'; ?>" name="smtp_pass" type="password" size="30" /></td> |
|
436 |
</tr> |
|
437 |
||
438 |
<!-- SourceForge.net logo --> |
|
439 |
||
440 |
<tr><th colspan="2">SourceForge.net logo</th></tr> |
|
441 |
||
442 |
<tr> |
|
443 |
<td colspan="2" class="row3"> |
|
444 |
All projects hosted by SourceForge.net are required to display an official SourceForge.net logo on their pages. If you want |
|
445 |
to display a SourceForge.net logo on the sidebar, check the box below, enter your group ID, and select an image type. |
|
446 |
</td> |
|
447 |
</tr> |
|
448 |
||
449 |
<?php |
|
450 |
if(getConfig("sflogo_enabled")=='1') $c='CHECKED '; |
|
451 |
else $c=''; |
|
452 |
if(getConfig("sflogo_groupid")) $g=getConfig("sflogo_groupid"); |
|
453 |
else $g=''; |
|
454 |
if(getConfig("sflogo_type")) $t=getConfig("sflogo_type"); |
|
455 |
else $t='1'; |
|
456 |
?> |
|
457 |
||
458 |
<tr> |
|
459 |
<td class="row1">Display the SourceForge.net logo on the right sidebar</td> |
|
460 |
<td class="row1"><input type=checkbox name="showsf" id="showsf" <?php echo $c; ?> /></td> |
|
461 |
</tr> |
|
462 |
||
463 |
<tr> |
|
464 |
<td class="row2">Group ID:</td> |
|
465 |
<td class="row2"><input value="<?php echo $g; ?>" type=text size=15 name=sfgroup /></td> |
|
466 |
</tr> |
|
467 |
||
468 |
<tr> |
|
469 |
<td class="row1">Logo style:</td> |
|
470 |
<td class="row1"> |
|
471 |
<select name="sflogo"> |
|
472 |
<option <?php if($t=='1') echo('SELECTED '); ?>value=1>88x31px, white</option> |
|
473 |
<option <?php if($t=='2') echo('SELECTED '); ?>value=2>125x37px, white</option> |
|
474 |
<option <?php if($t=='3') echo('SELECTED '); ?>value=3>125x37px, black</option> |
|
475 |
<option <?php if($t=='4') echo('SELECTED '); ?>value=4>125x37px, blue</option> |
|
476 |
<option <?php if($t=='5') echo('SELECTED '); ?>value=5>210x62px, white</option> |
|
477 |
<option <?php if($t=='6') echo('SELECTED '); ?>value=6>210x62px, black</option> |
|
478 |
<option <?php if($t=='7') echo('SELECTED '); ?>value=7>210x62px, blue</option> |
|
479 |
</select> |
|
480 |
</td> |
|
481 |
</tr> |
|
482 |
||
483 |
<!-- W3C validator buttons --> |
|
484 |
||
485 |
<tr><th colspan="2">W3C compliance logos</th></tr> |
|
486 |
<tr><th colspan="2" class="subhead">Enano generates (by default) Valid XHTML 1.1 code, plus valid CSS. If you want to show this off, check the appropriate boxes below.</th></tr> |
|
487 |
||
488 |
<tr><td class="row1"><label for="w3c-vh32">HTML 3.2</label> </td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vh32')=='1') echo('CHECKED '); ?> id="w3c-vh32" name="w3c-vh32" /></td></tr> |
|
489 |
<tr><td class="row2"><label for="w3c-vh40">HTML 4.0</label> </td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vh40')=='1') echo('CHECKED '); ?> id="w3c-vh40" name="w3c-vh40" /></td></tr> |
|
490 |
<tr><td class="row1"><label for="w3c-vh401">HTML 4.01</label> </td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vh401')=='1') echo('CHECKED '); ?> id="w3c-vh401" name="w3c-vh401" /></td></tr> |
|
491 |
<tr><td class="row2"><label for="w3c-vxhtml10">XHTML 1.0</label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vxhtml10')=='1') echo('CHECKED '); ?> id="w3c-vxhtml10" name="w3c-vxhtml10" /></td></tr> |
|
492 |
<tr><td class="row1"><label for="w3c-vxhtml11">XHTML 1.1</label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vxhtml11')=='1') echo('CHECKED '); ?> id="w3c-vxhtml11" name="w3c-vxhtml11" /></td></tr> |
|
493 |
<tr><td class="row2"><label for="w3c-vcss">CSS</label> </td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vcss')=='1') echo('CHECKED '); ?> id="w3c-vcss" name="w3c-vcss" /></td></tr> |
|
494 |
||
495 |
<!-- DefectiveByDesign.org ad --> |
|
496 |
||
497 |
<tr><th colspan="2">Defective By Design Anti-DRM button</th></tr> |
|
498 |
<tr><td colspan="2" class="row3"><b>The Enano project is strongly against Digital Restrictions Management.</b> DRM removes the freedoms that every consumer should have: to freely copy and use digital media items they legally purchased to their own devices. Showing your opposition to DRM is as easy as checking the box below to place a link to <a href="http://www.defectivebydesign.org">DefectiveByDesign.org</a> on your sidebar.</td></tr> |
|
499 |
<tr><td class="row1"><label for="dbdbutton">Help stop DRM by placing a link to DBD on the sidebar!</label></td><td class="row1"><input type="checkbox" name="dbdbutton" id="dbdbutton" <?php if(getConfig('dbd_button')=='1') echo('checked="checked" '); ?>/></td></tr> |
|
500 |
||
501 |
<!-- Save button --> |
|
502 |
||
503 |
<tr><th style="text-align: right" class="subhead" colspan="2"><input type=submit name=submit value="Save changes" /></th></tr> |
|
504 |
||
505 |
</table> |
|
506 |
</div> |
|
507 |
</form> |
|
508 |
<?php |
|
509 |
} |
|
510 |
||
511 |
function page_Admin_UploadConfig() |
|
512 |
{ |
|
513 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
514 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
515 |
{ |
|
516 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
517 |
return; |
|
518 |
} |
|
519 |
||
520 |
if(isset($_POST['save'])) |
|
521 |
{ |
|
109
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
522 |
if(isset($_POST['enable_uploads']) && getConfig('enable_uploads') != '1') |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
523 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
524 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES("security","upload_enable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
525 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
526 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
527 |
setConfig('enable_uploads', '1'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
528 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
529 |
else if ( !isset($_POST['enable_uploads']) && getConfig('enable_uploads') == '1' ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
530 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
531 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES("security","upload_disable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
532 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
533 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
534 |
setConfig('enable_uploads', '0'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
535 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
536 |
if(isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') != '1') |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
537 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
538 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES("security","magick_enable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
539 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
540 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
541 |
setConfig('enable_imagemagick', '1'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
542 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
543 |
else if ( !isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') == '1' ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
544 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
545 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES("security","magick_disable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
546 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
547 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
548 |
setConfig('enable_imagemagick', '0'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
549 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
550 |
if(isset($_POST['cache_thumbs'])) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
551 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
552 |
setConfig('cache_thumbs', '1'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
553 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
554 |
else |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
555 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
556 |
setConfig('cache_thumbs', '0'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
557 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
558 |
if(isset($_POST['file_history']) && getConfig('file_history') != '1' ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
559 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
560 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES("security","filehist_enable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
561 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
562 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
563 |
setConfig('file_history', '1'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
564 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
565 |
else if ( !isset($_POST['file_history']) && getConfig('file_history') == '1' ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
566 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
567 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author) VALUES("security","filehist_disable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
568 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
569 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
570 |
setConfig('file_history', '0'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
571 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
572 |
if(file_exists($_POST['imagemagick_path']) && $_POST['imagemagick_path'] != getConfig('imagemagick_path')) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
573 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
574 |
$old = getConfig('imagemagick_path'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
575 |
$oldnew = "{$old}||{$_POST['imagemagick_path']}"; |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
576 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","magick_path",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($oldnew) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
577 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
578 |
$db->_die(); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
579 |
setConfig('imagemagick_path', $_POST['imagemagick_path']); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
580 |
} |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
581 |
else if ( $_POST['imagemagick_path'] != getConfig('imagemagick_path') ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
582 |
{ |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
583 |
echo '<span style="color: red"><b>Warning:</b> the file "'.htmlspecialchars($_POST['imagemagick_path']).'" was not found, and the ImageMagick file path was not updated.</span>'; |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
584 |
} |
0 | 585 |
$max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']); |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
586 |
if ( $max_upload > 1048576 && defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
587 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
588 |
echo '<div class="error-box">Wouldn\'t want the server DoS\'ed now. Stick to under a megabyte for the demo, please.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
589 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
590 |
else |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
591 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
592 |
setConfig('max_file_size', $max_upload.''); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
593 |
} |
0 | 594 |
} |
595 |
echo '<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post">'; |
|
596 |
?> |
|
597 |
<h3>File upload configuration</h3> |
|
598 |
<p>Enano supports the ability to upload files to your website and store the files in the database. This enables you to embed images |
|
599 |
and such into pages without manually writing the HTML. However, the upload feature can sometimes pose a risk to your site, as viruses |
|
600 |
and executable files can sometimes be uploaded.</p> |
|
601 |
<p><label><input type="checkbox" name="enable_uploads" <?php if(getConfig('enable_uploads')=='1') echo 'checked="checked"'; ?> /> <b>Enable file uploads</b></label></p> |
|
602 |
<p>Maximum file size: <input name="max_file_size" onkeyup="if(!this.value.match(/^([0-9\.]+)$/ig)) this.value = this.value.substr(0,this.value.length-1);" value="<?php echo getConfig('max_file_size'); ?>" /> <select name="fs_units"><option value="1" selected="selected">bytes</option><option value="1024">KB</option><option value="1048576">MB</option></select></p> |
|
603 |
<p>You can allow Enano to generate thumbnails of images automatically. This feature requires ImageMagick to work properly. If your server |
|
604 |
does not have ImageMagick on it, Enano will simply make your users' browsers scale the images. In most cases this is fine, but if you |
|
605 |
are uploading large (>100KB) images and embedding them inside of pages, you should try to enable ImageMagick because transferring these |
|
606 |
large images many times can cost you quite a lot of bandwidth.</p> |
|
607 |
<p><label><input type="checkbox" name="enable_imagemagick" <?php if(getConfig('enable_imagemagick')=='1') echo 'checked="checked"'; ?> /> Use ImageMagick to scale images</label><br /> |
|
608 |
Path to ImageMagick: <input type="text" name="imagemagick_path" value="<?php if(getConfig('imagemagick_path')) echo getConfig('imagemagick_path'); else echo '/usr/bin/convert'; ?>" /><br /> |
|
609 |
On Linux and Unix servers, the most likely options here are /usr/bin/convert and /usr/local/bin/convert. If you server runs Windows, then |
|
610 |
ImageMagick is most likely to be C:\Windows\Convert.exe or C:\Windows\System32\Convert.exe. |
|
611 |
</p> |
|
612 |
<p>If you use ImageMagick to scale images, your server will be very busy constantly scaling images if your website is busy, and your site |
|
613 |
may experience slowdowns. You can dramatically speed up this scaling process if you use a directory to cache thumbnail images.</p> |
|
614 |
<p><b>Please note:</b> the cache/ directory on your server <u>must</u> be writable by the server. While this is not usually a problem on |
|
615 |
Windows servers, most Linux/Unix servers will require you to CHMOD the cache/ directory to 777. See your FTP client's user guide for |
|
616 |
more information on how to do this.<?php if(!is_writable(ENANO_ROOT.'/cache/')) echo ' <b>At present, it seems that the cache directory |
|
617 |
is not writable. The checkbox below has been disabled to maintain the stability of Enano.</b>'; ?></p> |
|
618 |
<p><label><input type="checkbox" name="cache_thumbs" <?php if(getConfig('cache_thumbs')=='1' && is_writable(ENANO_ROOT.'/cache/')) echo 'checked="checked"'; elseif(!is_writable(ENANO_ROOT.'/cache/')) echo 'readonly="readonly"'; ?> /> Cache thumbnailed images</label></p> |
|
619 |
<p>Lastly, you can choose whether file history will be saved. If this option is turned on, you will be able to roll back any malicious |
|
620 |
changes made to uploaded files, but this requires a significant amount of database storage. You should probably leave this option |
|
621 |
enabled unless you have less than 250MB of MySQL database space.</p> |
|
109
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
622 |
<p><label><input type="checkbox" name="file_history" <?php if(getConfig('file_history')=='1') echo 'checked="checked"'; ?> /> Keep a history of uploaded files</label></p> |
0 | 623 |
<hr style="margin-left: 1em;" /> |
624 |
<p><input type="submit" name="save" value="Save changes" style="font-weight: bold;" /></p> |
|
625 |
<?php |
|
626 |
echo '</form>'; |
|
627 |
} |
|
628 |
||
629 |
function page_Admin_PluginManager() { |
|
630 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
631 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
632 |
{ |
|
633 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
634 |
return; |
|
635 |
} |
|
636 |
||
9
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
637 |
if(isset($_GET['action'])) |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
638 |
{ |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
639 |
switch($_GET['action']) |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
640 |
{ |
0 | 641 |
case "enable": |
109
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
642 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","plugin_enable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_GET['plugin']) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
643 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
644 |
$db->_die(); |
0 | 645 |
setConfig('plugin_'.$_GET['plugin'], '1'); |
646 |
break; |
|
647 |
case "disable": |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
648 |
if ( defined('ENANO_DEMO_MODE') && strstr($_GET['plugin'], 'Demo') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
649 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
650 |
echo('<h3>Error disabling plugin</h3><p>The demo lockdown plugin cannot be disabled in demo mode.</p>'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
651 |
break; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
652 |
} |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
653 |
if ( !in_array($_GET['plugin'], $plugins->system_plugins) ) |
9
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
654 |
{ |
109
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
655 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","plugin_disable",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_GET['plugin']) . '");'); |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
656 |
if ( !$q ) |
93ef7df77847
Added a ton of new log points for administrator actions; restructured security log view and enabled pagination for security logs; string change in ajax.php for RDNS operation failure
Dan
parents:
103
diff
changeset
|
657 |
$db->_die(); |
9
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
658 |
setConfig('plugin_'.$_GET['plugin'], '0'); |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
659 |
} |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
660 |
else |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
661 |
{ |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
662 |
echo('<h3>Error disabling plugin</h3><p>The plugin you selected cannot be disabled because it is a system plugin.</p>'); |
9
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
663 |
} |
0 | 664 |
break; |
665 |
} |
|
666 |
} |
|
667 |
$dir = './plugins/'; |
|
668 |
$plugin_list = Array(); |
|
669 |
$system = Array(); |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
670 |
$show_system = ( isset($_GET['show_system']) && $_GET['show_system'] == 'yes' ); |
9
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
671 |
|
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
672 |
if (is_dir($dir)) |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
673 |
{ |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
674 |
if ($dh = opendir($dir)) |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
675 |
{ |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
676 |
while (($file = readdir($dh)) !== false) |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
677 |
{ |
0 | 678 |
if(preg_match('#^(.*?)\.php$#is', $file) && $file != 'index.php') |
679 |
{ |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
680 |
unset($thelist); |
0 | 681 |
if ( in_array($file, $plugins->system_plugins) ) |
682 |
{ |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
683 |
if ( !$show_system ) |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
684 |
continue; |
0 | 685 |
$thelist =& $system; |
686 |
} |
|
687 |
else |
|
688 |
{ |
|
689 |
$thelist =& $plugin_list; |
|
690 |
} |
|
691 |
$f = file_get_contents($dir . $file); |
|
692 |
$f = explode("\n", $f); |
|
693 |
$f = array_slice($f, 2, 7); |
|
694 |
$f[0] = substr($f[0], 13, strlen($f[0])); |
|
695 |
$f[1] = substr($f[1], 12, strlen($f[1])); |
|
696 |
$f[2] = substr($f[2], 13, strlen($f[2])); |
|
697 |
$f[3] = substr($f[3], 8, strlen($f[3])); |
|
698 |
$f[4] = substr($f[4], 9, strlen($f[4])); |
|
699 |
$f[5] = substr($f[5], 12, strlen($f[5])); |
|
700 |
$thelist[$file] = Array(); |
|
701 |
$thelist[$file]['name'] = $f[0]; |
|
702 |
$thelist[$file]['uri'] = $f[1]; |
|
703 |
$thelist[$file]['desc'] = $f[2]; |
|
704 |
$thelist[$file]['auth'] = $f[3]; |
|
705 |
$thelist[$file]['vers'] = $f[4]; |
|
706 |
$thelist[$file]['aweb'] = $f[5]; |
|
707 |
} |
|
708 |
} |
|
709 |
closedir($dh); |
|
710 |
} |
|
9
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
711 |
else |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
712 |
{ |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
713 |
echo '<div class="error-box">The plugins/ directory could not be opened.</div>'; |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
714 |
return; |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
715 |
} |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
716 |
} |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
717 |
else |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
718 |
{ |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
719 |
echo '<div class="error-box">The plugins/ directory is missing from your Enano installation.</div>'; |
1e61232606d6
Following fixes: admin theme supports <button> tag now, PageProcessor can eval now, and SpecialAdmin.php plugin can no longer be disabled
dan@fuhry
parents:
0
diff
changeset
|
720 |
return; |
0 | 721 |
} |
722 |
echo('<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4"> |
|
723 |
<tr><th>Plugin filename</th><th>Plugin name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr>'); |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
724 |
$plugin_files_1 = array_keys($plugin_list); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
725 |
$plugin_files_2 = array_keys($system); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
726 |
$plugin_files = array_values(array_merge($plugin_files_1, $plugin_files_2)); |
0 | 727 |
$cls = 'row2'; |
728 |
for ( $i = 0; $i < sizeof($plugin_files); $i++ ) |
|
729 |
{ |
|
730 |
$cls = ( $cls == 'row2' ) ? 'row3' : 'row2'; |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
731 |
$this_plugin = ( isset($system[$plugin_files[$i]]) ) ? $system[$plugin_files[$i]] : $plugin_list[$plugin_files[$i]]; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
732 |
$is_system = ( $system[$plugin_files[$i]] ); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
733 |
$bgcolor = ''; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
734 |
if ( $is_system && $cls == 'row2' ) |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
735 |
$bgcolor = ' style="background-color: #FFD8D8;"'; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
736 |
else if ( $is_system && $cls == 'row3' ) |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
737 |
$bgcolor = ' style="background-color: #FFD0D0;"'; |
0 | 738 |
echo '<tr> |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
739 |
<td class="'.$cls.'"'.$bgcolor.'>'.$plugin_files[$i].'</td> |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
740 |
<td class="'.$cls.'"'.$bgcolor.'><a href="'.$this_plugin['uri'].'">'.$this_plugin['name'].'</a></td> |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
741 |
<td class="'.$cls.'"'.$bgcolor.'>'.$this_plugin['desc'].'</td> |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
742 |
<td class="'.$cls.'"'.$bgcolor.'><a href="'.$this_plugin['aweb'].'">'.$this_plugin['auth'].'</a></td> |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
743 |
<td class="'.$cls.'"'.$bgcolor.'>'.$this_plugin['vers'].'</td> |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
744 |
<td class="'.$cls.'"'.$bgcolor.'>'; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
745 |
if ( !in_array($plugin_files[$i], $plugins->system_plugins) ) |
0 | 746 |
{ |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
747 |
if ( getConfig('plugin_'.$plugin_files[$i]) == '1' ) |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
748 |
{ |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
749 |
echo '<a href="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'&show_system=' . ( $show_system ? 'yes' : 'no' ) . '&action=disable&plugin='.$plugin_files[$i].'">Disable</a>'; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
750 |
} |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
751 |
else |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
752 |
{ |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
753 |
echo '<a href="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'&show_system=' . ( $show_system ? 'yes' : 'no' ) . '&action=enable&plugin='.$plugin_files[$i].'">Enable</a>'; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
754 |
} |
0 | 755 |
} |
756 |
else |
|
757 |
{ |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
758 |
echo '[System]'; |
0 | 759 |
} |
760 |
echo '</td></tr>'; |
|
761 |
} |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
762 |
$showhide_link = ( $show_system ) ? |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
763 |
'<a style="color: white;" href="' . makeUrlNS('Special', 'Administration', 'module=' . $paths->cpage['module'] . '&show_system=no', true) . '">Hide system plugins</a>' : |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
764 |
'<a style="color: white;" href="' . makeUrlNS('Special', 'Administration', 'module=' . $paths->cpage['module'] . '&show_system=yes', true) . '">Show system plugins</a>' ; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
80
diff
changeset
|
765 |
echo '<tr><th colspan="6" class="subhead">'.$showhide_link.'</th></tr>'; |
0 | 766 |
echo '</table></div>'; |
767 |
} |
|
768 |
||
769 |
function page_Admin_UploadAllowedMimeTypes() |
|
770 |
{ |
|
771 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
772 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
773 |
{ |
|
774 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
775 |
return; |
|
776 |
} |
|
777 |
||
778 |
global $mime_types, $mimetype_exps, $mimetype_extlist; |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
779 |
if(isset($_POST['save']) && !defined('ENANO_DEMO_MODE')) |
0 | 780 |
{ |
781 |
$bits = ''; |
|
782 |
$keys = array_keys($mime_types); |
|
783 |
foreach($keys as $i => $k) |
|
784 |
{ |
|
785 |
if(isset($_POST['ext_'.$k])) $bits .= '1'; |
|
786 |
else $bits .= '0'; |
|
787 |
} |
|
788 |
$bits = compress_bitfield($bits); |
|
789 |
setConfig('allowed_mime_types', $bits); |
|
790 |
echo '<div class="info-box">Your changes have been saved.</div>'; |
|
791 |
} |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
792 |
else if ( isset($_POST['save']) && defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
793 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
794 |
echo '<div class="error-box">Hmm, enabling executables, are we? Tsk tsk. I\'d love to know what\'s in that EXE file you want to upload. OK, maybe you didn\'t enable EXEs. But nevertheless, changing allowed filetypes is disabled in the demo.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
795 |
} |
0 | 796 |
$allowed = fetch_allowed_extensions(); |
797 |
?> |
|
798 |
<h3>Allowed file types</h3> |
|
799 |
<p>Using the form below, you can decide which file types are allowed to be uploaded to this site.</p> |
|
800 |
<?php |
|
801 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', (( isset($_GET['sqldbg'])) ? 'sqldbg&' : '') .'module='.$paths->cpage['module']).'" method="post">'; |
|
802 |
$c = -1; |
|
803 |
$t = -1; |
|
804 |
$cl = 'row1'; |
|
805 |
echo "\n".' <div class="tblholder">'."\n".' <table cellspacing="1" cellpadding="2" style="margin: 0; padding: 0;" border="0">'."\n".' <tr>'."\n "; |
|
806 |
foreach($mime_types as $e => $m) |
|
807 |
{ |
|
808 |
$c++; |
|
809 |
$t++; |
|
810 |
if($c == 3) |
|
811 |
{ |
|
812 |
$c = 0; |
|
813 |
$cl = ( $cl == 'row1' ) ? 'row2' : 'row1'; |
|
814 |
echo '</tr>'."\n".' <tr>'."\n "; |
|
815 |
} |
|
816 |
$seed = "extchkbx_{$e}_".md5(microtime() . mt_rand()); |
|
817 |
$chk = (!empty($allowed[$e])) ? ' checked="checked"' : ''; |
|
818 |
echo " <td class='$cl'>\n <label><input id='{$seed}' type='checkbox' name='ext_{$e}'{$chk} />.{$e}\n ({$m})</label>\n </td>\n "; |
|
819 |
} |
|
820 |
while($c < 2) |
|
821 |
{ |
|
822 |
$c++; |
|
823 |
echo " <td class='{$cl}'></td>\n "; |
|
824 |
} |
|
825 |
echo '<tr><th class="subhead" colspan="3"><input type="submit" name="save" value="Save changes" /></th></tr>'; |
|
826 |
echo '</tr>'."\n".' </table>'."\n".' </div>'; |
|
827 |
echo '</form>'; |
|
828 |
?> |
|
829 |
<?php |
|
830 |
} |
|
831 |
||
832 |
function page_Admin_Sidebar() |
|
833 |
{ |
|
834 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
835 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
836 |
{ |
|
837 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
838 |
return; |
|
839 |
} |
|
840 |
||
841 |
?> |
|
842 |
<h2>Editing and managing the Enano sidebar</h2> |
|
843 |
<p>The Enano sidebar is a versatile tool when scripted correctly. You don't have to be a programmer to enjoy the features the Sidebar |
|
844 |
provides; however, editing the sidebar requires a small bit of programming knowledge and an understanding of Enano's system message |
|
845 |
markup language. |
|
846 |
</p> |
|
847 |
<p>The Enano system markup language is somewhat similar to HTML, in that it uses tags (<example>like this</example>) for the |
|
848 |
main syntax. However, Enano uses curly brackets ({ and }) as opposed to less-than and greater-than signs (< and >).</p> |
|
849 |
<p>Programming the Enano sidebar requires the use of two tags: {slider} and {if}. The {slider} tag is used to create a new heading |
|
850 |
on the sidebar, and all text enclosed in that tag will be collapsed when the heading is clicked. To specify the text on the heading, |
|
851 |
use an equals sign (=) after the "slider" text. Then insert any links (they should be wiki-formatted) to internal Enano pages and |
|
852 |
external sites.</p> |
|
853 |
<p>So here is what the language for the default sidebar's "Navigation" heading looks like:</p> |
|
854 |
<pre>{slider=Navigation} |
|
855 |
[[Main Page|Home]] |
|
856 |
[[Enano:Sidebar|Edit the sidebar]] |
|
857 |
{/slider}</pre> |
|
858 |
<p>Pretty simple, huh? Good, now we're going to learn another common aspect of Enano programming: conditionals. The {if} tag allows you |
|
859 |
to decide whether a portion of the sidebar will be displayed based on a template variable. Currently the only available conditions are |
|
860 |
"user_logged_in" and "auth_admin", but more will be added soon. To use a conditional, enter {if conditional_name}, and then the |
|
861 |
wiki-formatted text that you want to be under that condition, and then close the tag with {/if}. In the same way, you can reverse the |
|
862 |
effect with {!if}. With {!if}, the closing tag is still {/if}, so keep that in mind. An {else} tag will be supported soon.</p> |
|
863 |
<p>Now it's time for some real fun: variables. All template variables can be accessed from the sidebar. A variable is simply the |
|
864 |
variable name, prefixed by a dollar sign ($). Some of the most common variables are $USERNAME, $SITE_NAME, $SITE_DESC, and $PAGE_NAME. |
|
865 |
The sidebar also has some special variables that it uses for some of its links. The logout link can be added with $LOGOUT_LINK, and |
|
866 |
the "change theme" button can be added with $STYLE_LINK.</p> |
|
867 |
<p>So here is the Enano markup for the portion of the sidebar that contains the user tools:</p> |
|
868 |
<pre>{slider=$USERNAME} |
|
869 |
[[User:$USERNAME|User page]] |
|
870 |
[[Special:Contributions?user=$USERNAME|My Contributions]] |
|
871 |
{if user_logged_in} |
|
872 |
[[Special:Preferences|Preferences]] |
|
873 |
$THEME_LINK |
|
874 |
{/if} |
|
875 |
{if auth_admin} |
|
876 |
[[Special:Administration|Administration]] |
|
877 |
{/if} |
|
878 |
{if user_logged_in} |
|
879 |
$LOGOUT_LINK |
|
880 |
{/if} |
|
881 |
{!if user_logged_in} |
|
882 |
Create an account |
|
883 |
Log in |
|
884 |
{/if} |
|
885 |
{/slider}</pre> |
|
886 |
<?php |
|
887 |
} |
|
888 |
||
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
|
889 |
/* |
0 | 890 |
function page_Admin_UserManager() { |
891 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
892 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
893 |
{ |
|
894 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
895 |
return; |
|
896 |
} |
|
897 |
||
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:
102
diff
changeset
|
898 |
if ( isset($_GET['src']) && $_GET['src'] == 'get' && !empty($_GET['user']) ) |
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:
102
diff
changeset
|
899 |
{ |
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:
102
diff
changeset
|
900 |
$_POST['go'] = true; |
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:
102
diff
changeset
|
901 |
$_POST['username'] = $_GET['user']; |
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:
102
diff
changeset
|
902 |
} |
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:
102
diff
changeset
|
903 |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
904 |
if(isset($_POST['go'])) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
905 |
{ |
0 | 906 |
// We need the user ID before we can do anything |
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
907 |
$q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level,account_active FROM '.table_prefix.'users WHERE username=\'' . $db->escape($_POST['username']) . '\''); |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
908 |
if ( !$q ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
909 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
910 |
die('Error selecting user ID: '.mysql_error()); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
911 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
912 |
if ( $db->numrows() < 1 ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
913 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
914 |
echo('User does not exist, please enter another username.'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
915 |
return; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
916 |
} |
0 | 917 |
$r = $db->fetchrow(); |
918 |
$db->free_result(); |
|
919 |
if(isset($_POST['save'])) |
|
920 |
{ |
|
921 |
$_POST['level'] = intval($_POST['level']); |
|
922 |
||
923 |
$new_level = $_POST['level']; |
|
924 |
$old_level = intval($r['user_level']); |
|
925 |
||
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
926 |
if ( defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
927 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
928 |
echo '<div class="error-box">You cannot delete or modify user accounts in demo mode - they are cleaned up once every two hours.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
929 |
$re = Array('permission denied'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
930 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
931 |
else |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
932 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
933 |
$re = $session->update_user((int)$r['user_id'], $_POST['new_username'], false, $_POST['new_pass'], $_POST['email'], $_POST['real_name'], false, $_POST['level']); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
934 |
} |
0 | 935 |
|
936 |
if($re == 'success') |
|
937 |
{ |
|
938 |
||
939 |
if ( $new_level != $old_level ) |
|
940 |
{ |
|
941 |
$user_id = intval($r['user_id']); |
|
942 |
// We need to update group memberships |
|
943 |
if ( $old_level == USER_LEVEL_ADMIN ) |
|
944 |
{ |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
945 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_from_admin",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
946 |
if ( !$q ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
947 |
$db->_die(); |
0 | 948 |
$session->remove_user_from_group($user_id, GROUP_ID_ADMIN); |
949 |
} |
|
950 |
else if ( $old_level == USER_LEVEL_MOD ) |
|
951 |
{ |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
952 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_from_mod",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
953 |
if ( !$q ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
954 |
$db->_die(); |
0 | 955 |
$session->remove_user_from_group($user_id, GROUP_ID_MOD); |
956 |
} |
|
957 |
||
958 |
if ( $new_level == USER_LEVEL_ADMIN ) |
|
959 |
{ |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
960 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_to_admin",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
961 |
if ( !$q ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
962 |
$db->_die(); |
0 | 963 |
$session->add_user_to_group($user_id, GROUP_ID_ADMIN, false); |
964 |
} |
|
965 |
else if ( $new_level == USER_LEVEL_MOD ) |
|
966 |
{ |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
967 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_to_mod",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
968 |
if ( !$q ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
969 |
$db->_die(); |
0 | 970 |
$session->add_user_to_group($user_id, GROUP_ID_MOD, false); |
971 |
} |
|
972 |
} |
|
973 |
||
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
974 |
// update account activation |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
975 |
if ( isset($_POST['account_active']) ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
976 |
{ |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
977 |
// activate account |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
978 |
$q = $db->sql_query('UPDATE '.table_prefix.'users SET account_active=1 WHERE user_id=' . intval($r['user_id']) . ';'); |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
979 |
if ( !$q ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
980 |
$db->_die(); |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
981 |
} |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
982 |
else |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
983 |
{ |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
984 |
// deactivate account and throw away the old key |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
985 |
$actkey = sha1 ( microtime() . mt_rand() ); |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
986 |
$q = $db->sql_query('UPDATE '.table_prefix.'users SET account_active=0,activation_key=\'' . $actkey . '\' WHERE user_id=' . intval($r['user_id']) . ';'); |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
987 |
if ( !$q ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
988 |
$db->_die(); |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
989 |
} |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
990 |
|
0 | 991 |
echo('<div class="info-box">Your changes have been saved.</div>'); |
992 |
} |
|
993 |
else |
|
994 |
{ |
|
995 |
echo('<div class="error-box">Error saving changes: '.implode('<br />', $re).'</div>'); |
|
996 |
} |
|
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
997 |
$q = $db->sql_query('SELECT user_id,username,email,real_name,style,user_level,account_active FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['username']).'\''); |
0 | 998 |
if ( !$q ) |
999 |
{ |
|
1000 |
die('Error selecting user ID: '.mysql_error()); |
|
1001 |
} |
|
1002 |
if($db->numrows($q) < 1) |
|
1003 |
{ |
|
1004 |
die('User does not exist, please enter another username.'); |
|
1005 |
} |
|
1006 |
$r = mysql_fetch_object($q); |
|
1007 |
$db->free_result(); |
|
1008 |
} |
|
1009 |
elseif(isset($_POST['deleteme']) && isset($_POST['delete_conf'])) |
|
1010 |
{ |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1011 |
if ( defined('ENANO_DEMO_MODE') ) |
0 | 1012 |
{ |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1013 |
echo '<div class="error-box">You cannot delete or modify user accounts in demo mode - they are cleaned up once every two hours.</div>'; |
0 | 1014 |
} |
1015 |
else |
|
1016 |
{ |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1017 |
$q = $db->sql_query('DELETE FROM users WHERE user_id='.$r['user_id'].';'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1018 |
if($q) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1019 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1020 |
echo '<div class="error-box">The user account "'.$r['username'].'" was deleted.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1021 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1022 |
else |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1023 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1024 |
echo '<div class="error-box">The user account "'.$r['username'].'" could not be deleted due to a database error.<br /><br />'.$db->get_error().'</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1025 |
} |
0 | 1026 |
} |
1027 |
} |
|
1028 |
else |
|
1029 |
{ |
|
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1030 |
$disabled = ( $r['user_id'] == $session->user_id ) ? ' disabled="disabled" ' : ''; |
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:
130
diff
changeset
|
1031 |
$evt_get_score = ( getConfig('pw_strength_enable') == '1' ) ? 'onkeyup="password_score_field(this);" style="margin-right: 7px;" ' : ''; |
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:
130
diff
changeset
|
1032 |
$meter = ( getConfig('pw_strength_enable') == '1' ) ? '<tr><td></td><td><div id="pwmeter"></div><p><small>Password complexity requirements are not enforced here.</small></p></td></tr>' : ''; |
0 | 1033 |
echo(' |
1034 |
<h3>Edit User Info</h3> |
|
1035 |
<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post"> |
|
1036 |
<table border="0" style="margin-left: 0.2in;"> |
|
1037 |
<tr><td>Username:</td><td><input type="text" name="new_username" value="'.$r['username'].'" /></td></tr> |
|
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:
130
diff
changeset
|
1038 |
<tr><td>New Password:</td><td><input ' . $disabled . ' type="password" name="new_pass" '.$evt_get_score.'/></td></tr> |
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:
130
diff
changeset
|
1039 |
'.$meter.' |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1040 |
<tr><td>E-mail:</td><td><input ' . $disabled . ' type="text" name="email" value="'.$r['email'].'" /></td></tr> |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1041 |
<tr><td>Real Name:</td><td><input ' . $disabled . ' type="text" name="real_name" value="'.$r['real_name'].'" /></td></tr> |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1042 |
' . ( ( !empty($disabled) ) ? '<tr><td colspan="2"><small>To change your e-mail address, password, or real name, please use the user control panel.</small></td></tr>' : '' ) . ' |
0 | 1043 |
<tr><td>User level:</td><td><select name="level"><option '); if($r['user_level']==USER_LEVEL_CHPREF) echo('SELECTED'); echo(' value="'.USER_LEVEL_CHPREF.'">Regular User</option><option '); if($r['user_level']==USER_LEVEL_MOD) echo('SELECTED'); echo(' value="'.USER_LEVEL_MOD.'">Moderator</option><option '); if($r['user_level']==USER_LEVEL_ADMIN) echo('SELECTED'); echo(' value="'.USER_LEVEL_ADMIN.'">Administrator</option></select></td></tr> |
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
89
diff
changeset
|
1044 |
<tr><td></td><td><label><input type="checkbox" name="account_active"' . ( $r['account_active'] == '1' ? ' checked="checked"' : '' ) . ' /> Account is active</label><br /><small>If this is unchecked, the activation key will be reset, meaning that any activation e-mails sent will be invalidated.</small></td></tr> |
0 | 1045 |
<tr><td>Delete user:</td><td><input type="hidden" name="go" /><input type="hidden" name="username" value="'.$r['username'].'" /><input onclick="return confirm(\'This is your last warning.\n\nAre you sure you want to delete this user account? Even if you delete this user account, the username will be shown in page edit history, comments, and other areas of the site.\n\nDeleting a user account CANNOT BE UNDONE and should only be done in extreme circumstances.\n\nIf the user has violated the site policy, deleting the account will not prevent him from using the site, for that you need to add a new ban rule.\n\nContinue deleting this user account?\')" type="submit" name="deleteme" value="Delete this user" style="color: red;" /> <label><input type="checkbox" name="delete_conf" /> I\'m absolutely sure</label> |
1046 |
<tr><td align="center" colspan="2"> |
|
1047 |
<input type="submit" name="save" value="Save Changes" /></td></tr> |
|
1048 |
</table> |
|
1049 |
</form> |
|
1050 |
'); |
|
1051 |
} |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1052 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1053 |
else if(isset($_POST['clearsessions'])) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1054 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1055 |
if ( defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1056 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1057 |
echo '<div class="error-box">Sorry Charlie, no can do. You might mess up other people logged into the demo site.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1058 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1059 |
else |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1060 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1061 |
// Get the current session information so the user doesn't get logged out |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1062 |
$aes = new AESCrypt(); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1063 |
$sk = md5(strrev($session->sid_super)); |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1064 |
$qb = $db->sql_query('SELECT session_key,salt,auth_level,source_ip,time FROM '.table_prefix.'session_keys WHERE session_key=\''.$sk.'\' AND user_id='.$session->user_id.' AND auth_level='.USER_LEVEL_ADMIN); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1065 |
if ( !$qb ) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1066 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1067 |
die('Error selecting session key info block B: '.$db->get_error()); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1068 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1069 |
if ( $db->numrows($qb) < 1 ) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1070 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1071 |
die('Error: cannot read admin session info block B, aborting table clear process'); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1072 |
} |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1073 |
$qa = $db->sql_query('SELECT session_key,salt,auth_level,source_ip,time FROM '.table_prefix.'session_keys WHERE session_key=\''.md5($session->sid).'\' AND user_id='.$session->user_id.' AND auth_level='.USER_LEVEL_MEMBER); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1074 |
if ( !$qa ) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1075 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1076 |
die('Error selecting session key info block A: '.$db->get_error()); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1077 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1078 |
if ( $db->numrows($qa) < 1 ) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1079 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1080 |
die('Error: cannot read user session info block A, aborting table clear process'); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1081 |
} |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1082 |
$ra = mysql_fetch_object($qa); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1083 |
$rb = mysql_fetch_object($qb); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1084 |
$db->free_result($qa); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1085 |
$db->free_result($qb); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1086 |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1087 |
$db->sql_query('DELETE FROM '.table_prefix.'session_keys;'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1088 |
$db->sql_query('INSERT INTO '.table_prefix.'session_keys( session_key,salt,user_id,auth_level,source_ip,time ) VALUES( \''.$ra->session_key.'\', \''.$ra->salt.'\', \''.$session->user_id.'\', \''.$ra->auth_level.'\', \''.$ra->source_ip.'\', '.$ra->time.' ),( \''.$rb->session_key.'\', \''.$rb->salt.'\', \''.$session->user_id.'\', \''.$rb->auth_level.'\', \''.$rb->source_ip.'\', '.$rb->time.' )'); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1089 |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1090 |
echo(' |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1091 |
<div class="info-box">The session key table has been cleared. Your database should be a little bit smaller now.</div> |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1092 |
'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
1093 |
} |
0 | 1094 |
} |
1095 |
echo(' |
|
1096 |
<h3>User Management</h3> |
|
1097 |
<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;"> |
|
1098 |
<p>Username: '.$template->username_field('username').' <input type="submit" name="go" value="Go" /></p> |
|
1099 |
<h3>Clear session keys table</h3> |
|
1100 |
<p>It\'s a good idea to clean out your session keys table every once in a while, since this helps to reduce database size. During this process you will be logged off and (hopefully) logged back on automatically. The side effects of this include all users except you being logged off.</p> |
|
1101 |
<p><input type="submit" name="clearsessions" value="Clear session keys table" /></p> |
|
1102 |
</form> |
|
1103 |
'); |
|
1104 |
if(isset($_GET['action']) && isset($_GET['user'])) |
|
1105 |
{ |
|
1106 |
switch($_GET['action']) |
|
1107 |
{ |
|
1108 |
case "activate": |
|
1109 |
$e = $db->sql_query('SELECT activation_key FROM '.table_prefix.'users WHERE username=\'' . $db->escape($_GET['user']) . '\''); |
|
1110 |
if($e) |
|
1111 |
{ |
|
1112 |
$row = $db->fetchrow(); |
|
1113 |
$db->free_result(); |
|
1114 |
if($session->activate_account($_GET['user'], $row['activation_key'])) { echo '<div class="info-box">The user account "'.$_GET['user'].'" has been activated.</div>'; $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE time_id=' . $db->escape($_GET['logid'])); } |
|
1115 |
else echo '<div class="warning-box">The user account "'.$_GET['user'].'" has NOT been activated, possibly because the account is already active.</div>'; |
|
1116 |
} else echo '<div class="error-box">Error activating account: '.mysql_error().'</div>'; |
|
1117 |
break; |
|
1118 |
case "sendemail": |
|
1119 |
if($session->send_activation_mail($_GET['user'])) { echo '<div class="info-box">The user "'.$_GET['user'].'" has been sent an e-mail with an activation link.</div>'; $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE time_id=' . $db->escape($_GET['logid'])); } |
|
1120 |
else echo '<div class="error-box">The user account "'.$_GET['user'].'" has not been activated, probably because of a bad SMTP configuration.</div>'; |
|
1121 |
break; |
|
1122 |
case "deny": |
|
1123 |
$e = $db->sql_query('DELETE FROM '.table_prefix.'logs WHERE log_type=\'admin\' AND action=\'activ_req\' AND edit_summary=\'' . $db->escape($_GET['user']) . '\';'); |
|
1124 |
if(!$e) echo '<div class="error-box">Error during row deletion: '.mysql_error().'</div>'; |
|
1125 |
else echo '<div class="info-box">All activation requests for the user "'.$_GET['user'].'" have been deleted.</div>'; |
|
1126 |
break; |
|
1127 |
} |
|
1128 |
} |
|
30 | 1129 |
$q = $db->sql_query('SELECT l.log_type, l.action, l.time_id, l.date_string, l.author, l.edit_summary, u.user_coppa FROM '.table_prefix.'logs AS l |
1130 |
LEFT JOIN '.table_prefix.'users AS u |
|
1131 |
ON ( u.username = l.edit_summary OR u.username IS NULL ) |
|
1132 |
WHERE log_type=\'admin\' AND action=\'activ_req\' ORDER BY time_id DESC;'); |
|
0 | 1133 |
if($q) |
1134 |
{ |
|
1135 |
if($db->numrows() > 0) |
|
1136 |
{ |
|
1137 |
$n = $db->numrows(); |
|
1138 |
if($n == 1) $s = $n . ' user is'; |
|
1139 |
else $s = $n . ' users are'; |
|
1140 |
echo '<h3>'.$s . ' awaiting account activation</h3>'; |
|
1141 |
echo '<div class="tblholder"> |
|
1142 |
<table border="0" cellspacing="1" cellpadding="4" width="100%"> |
|
30 | 1143 |
<tr><th>Date of request</th><th>Requested by</th><th>Requested for</th><th>COPPA user</th><th colspan="3">Actions</th></tr>'; |
0 | 1144 |
$cls = 'row2'; |
1145 |
while($row = $db->fetchrow()) |
|
1146 |
{ |
|
1147 |
if($cls == 'row2') $cls = 'row1'; |
|
1148 |
else $cls = 'row2'; |
|
30 | 1149 |
$coppa = ( $row['user_coppa'] == '1' ) ? '<b>Yes</b>' : 'No'; |
1150 |
echo '<tr><td class="'.$cls.'">'.date('F d, Y h:i a', $row['time_id']).'</td><td class="'.$cls.'">'.$row['author'].'</td><td class="'.$cls.'">'.$row['edit_summary'].'</td><td style="text-align: center;" class="' . $cls . '">' . $coppa . '</td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&action=activate&user='.$row['edit_summary'].'&logid='.$row['time_id']).'">Activate now</a></td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&action=sendemail&user='.$row['edit_summary'].'&logid='.$row['time_id']).'">Send activation e-mail</a></td><td class="'.$cls.'" style="text-align: center;"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'UserManager&action=deny&user='.$row['edit_summary'].'&logid='.$row['time_id']).'">Deny request</a></td></tr>'; |
|
0 | 1151 |
} |
1152 |
echo '</table>'; |
|
1153 |
} |
|
1154 |
$db->free_result(); |
|
1155 |
} |
|
1156 |
} |
|
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
|
1157 |
*/ |
0 | 1158 |
|
1159 |
function page_Admin_GroupManager() |
|
1160 |
{ |
|
1161 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
1162 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
1163 |
{ |
|
1164 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
1165 |
return; |
|
1166 |
} |
|
1167 |
||
1168 |
if(isset($_POST['do_create_stage1'])) |
|
1169 |
{ |
|
1170 |
if(!preg_match('/^([A-z0-9 -]+)$/', $_POST['create_group_name'])) |
|
1171 |
{ |
|
1172 |
echo '<p>The group name you chose is invalid.</p>'; |
|
1173 |
return; |
|
1174 |
} |
|
1175 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1176 |
echo '<div class="tblholder"> |
|
1177 |
<table border="0" style="width:100%;" cellspacing="1" cellpadding="4"> |
|
1178 |
<tr><th colspan="2">Creating group: '.$_POST['create_group_name'].'</th></tr> |
|
1179 |
<tr> |
|
1180 |
<td class="row1">Group moderator</td><td class="row1">' . $template->username_field('group_mod') . '</td> |
|
1181 |
</tr> |
|
1182 |
<tr><td class="row2">Group status</td><td class="row2"> |
|
1183 |
<label><input type="radio" name="group_status" value="'.GROUP_CLOSED.'" checked="checked" /> Closed to new members</label><br /> |
|
1184 |
<label><input type="radio" name="group_status" value="'.GROUP_REQUEST.'" /> Members can ask to be added</label><br /> |
|
1185 |
<label><input type="radio" name="group_status" value="'.GROUP_OPEN.'" /> Members can join freely</label><br /> |
|
1186 |
<label><input type="radio" name="group_status" value="'.GROUP_HIDDEN.'" /> Group is hidden</label> |
|
1187 |
</td></tr> |
|
1188 |
<tr> |
|
1189 |
<th class="subhead" colspan="2"> |
|
1190 |
<input type="hidden" name="create_group_name" value="'.$_POST['create_group_name'].'" /> |
|
1191 |
<input type="submit" name="do_create_stage2" value="Create group" /> |
|
1192 |
</th> |
|
1193 |
</tr> |
|
1194 |
</table> |
|
1195 |
</div>'; |
|
1196 |
echo '</form>'; |
|
1197 |
return; |
|
1198 |
} |
|
1199 |
elseif(isset($_POST['do_create_stage2'])) |
|
1200 |
{ |
|
1201 |
if(!preg_match('/^([A-z0-9 -]+)$/', $_POST['create_group_name'])) |
|
1202 |
{ |
|
1203 |
echo '<p>The group name you chose is invalid.</p>'; |
|
1204 |
return; |
|
1205 |
} |
|
1206 |
if(!in_array(intval($_POST['group_status']), Array(GROUP_CLOSED, GROUP_OPEN, GROUP_HIDDEN, GROUP_REQUEST))) |
|
1207 |
{ |
|
1208 |
echo '<p>Hacking attempt</p>'; |
|
1209 |
return; |
|
1210 |
} |
|
1211 |
$e = $db->sql_query('SELECT group_id FROM '.table_prefix.'groups WHERE group_name=\''.$db->escape($_POST['create_group_name']).'\';'); |
|
1212 |
if(!$e) |
|
1213 |
{ |
|
1214 |
echo $db->get_error(); |
|
1215 |
return; |
|
1216 |
} |
|
1217 |
if($db->numrows() > 0) |
|
1218 |
{ |
|
1219 |
echo '<p>The group name you entered already exists.</p>'; |
|
1220 |
return; |
|
1221 |
} |
|
1222 |
$db->free_result(); |
|
1223 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'groups(group_name,group_type) VALUES( \''.$db->escape($_POST['create_group_name']).'\', ' . intval($_POST['group_status']) . ' )'); |
|
1224 |
if(!$q) |
|
1225 |
{ |
|
1226 |
echo $db->get_error(); |
|
1227 |
return; |
|
1228 |
} |
|
1229 |
$e = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['group_mod']).'\';'); |
|
1230 |
if(!$e) |
|
1231 |
{ |
|
1232 |
echo $db->get_error(); |
|
1233 |
return; |
|
1234 |
} |
|
1235 |
if($db->numrows() < 1) |
|
1236 |
{ |
|
1237 |
echo '<p>The username you entered could not be found.</p>'; |
|
1238 |
return; |
|
1239 |
} |
|
1240 |
$row = $db->fetchrow(); |
|
1241 |
$id = $row['user_id']; |
|
1242 |
$db->free_result(); |
|
1243 |
$e = $db->sql_query('SELECT group_id FROM '.table_prefix.'groups WHERE group_name=\''.$db->escape($_POST['create_group_name']).'\';'); |
|
1244 |
if(!$e) |
|
1245 |
{ |
|
1246 |
echo $db->get_error(); |
|
1247 |
return; |
|
1248 |
} |
|
1249 |
if($db->numrows() < 1) |
|
1250 |
{ |
|
1251 |
echo '<p>The group ID could not be looked up.</p>'; |
|
1252 |
return; |
|
1253 |
} |
|
1254 |
$row = $db->fetchrow(); |
|
1255 |
$gid = $row['group_id']; |
|
1256 |
$db->free_result(); |
|
1257 |
$e = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id,is_mod) VALUES('.$gid.', '.$id.', 1);'); |
|
1258 |
if(!$e) |
|
1259 |
{ |
|
1260 |
echo $db->get_error(); |
|
1261 |
return; |
|
1262 |
} |
|
1263 |
echo "<div class='info-box'> |
|
1264 |
<b>Information</b><br /> |
|
1265 |
The group {$_POST['create_group_name']} has been created successfully. |
|
1266 |
</div>"; |
|
1267 |
} |
|
1268 |
if(isset($_POST['do_edit']) || isset($_POST['edit_do'])) |
|
1269 |
{ |
|
1270 |
// Fetch the group name |
|
1271 |
$q = $db->sql_query('SELECT group_name,system_group FROM '.table_prefix.'groups WHERE group_id='.intval($_POST['group_edit_id']).';'); |
|
1272 |
if(!$q) |
|
1273 |
{ |
|
1274 |
echo $db->get_error(); |
|
1275 |
return; |
|
1276 |
} |
|
1277 |
if($db->numrows() < 1) |
|
1278 |
{ |
|
1279 |
echo '<p>Error: couldn\'t look up group name</p>'; |
|
1280 |
} |
|
1281 |
$row = $db->fetchrow(); |
|
1282 |
$name = $row['group_name']; |
|
1283 |
$db->free_result(); |
|
1284 |
if(isset($_POST['edit_do'])) |
|
1285 |
{ |
|
1286 |
if(isset($_POST['edit_do']['del_group'])) |
|
1287 |
{ |
|
1288 |
if ( $row['system_group'] == 1 ) |
|
1289 |
{ |
|
1290 |
echo '<div class="error-box">The group "' . $name . '" could not be deleted because it is a system group required for site functionality.</div>'; |
|
1291 |
} |
|
1292 |
else |
|
1293 |
{ |
|
1294 |
$q = $db->sql_query('DELETE FROM '.table_prefix.'group_members WHERE group_id='.intval($_POST['group_edit_id']).';'); |
|
1295 |
if(!$q) |
|
1296 |
{ |
|
1297 |
echo $db->get_error(); |
|
1298 |
return; |
|
1299 |
} |
|
1300 |
$q = $db->sql_query('DELETE FROM '.table_prefix.'groups WHERE group_id='.intval($_POST['group_edit_id']).';'); |
|
1301 |
if(!$q) |
|
1302 |
{ |
|
1303 |
echo $db->get_error(); |
|
1304 |
return; |
|
1305 |
} |
|
1306 |
echo '<div class="info-box">The group "'.$name.'" has been deleted. Return to the <a href="javascript:ajaxPage(\'Admin:GroupManager\');">group manager</a>.</div>'; |
|
1307 |
return; |
|
1308 |
} |
|
1309 |
} |
|
1310 |
if(isset($_POST['edit_do']['save_name'])) |
|
1311 |
{ |
|
1312 |
if(!preg_match('/^([A-z0-9 -]+)$/', $_POST['group_name'])) |
|
1313 |
{ |
|
1314 |
echo '<p>The group name you chose is invalid.</p>'; |
|
1315 |
return; |
|
1316 |
} |
|
1317 |
$q = $db->sql_query('UPDATE '.table_prefix.'groups SET group_name=\''.$db->escape($_POST['group_name']).'\' |
|
1318 |
WHERE group_id='.intval($_POST['group_edit_id']).';'); |
|
1319 |
if(!$q) |
|
1320 |
{ |
|
1321 |
echo $db->get_error(); |
|
1322 |
return; |
|
1323 |
} |
|
1324 |
else |
|
1325 |
{ |
|
1326 |
echo '<div class="info-box" style="margin: 0 0 10px 0;""> |
|
1327 |
The group name has been updated. |
|
1328 |
</div>'; |
|
1329 |
} |
|
1330 |
$name = $_POST['group_name']; |
|
1331 |
||
1332 |
} |
|
1333 |
$q = $db->sql_query('SELECT member_id FROM '.table_prefix.'group_members |
|
1334 |
WHERE group_id='.intval($_POST['group_edit_id']).';'); |
|
1335 |
if(!$q) |
|
1336 |
{ |
|
1337 |
echo $db->get_error(); |
|
1338 |
return; |
|
1339 |
} |
|
1340 |
if($db->numrows() > 0) |
|
1341 |
{ |
|
1342 |
while($row = $db->fetchrow($q)) |
|
1343 |
{ |
|
1344 |
if(isset($_POST['edit_do']['del_' . $row['member_id']])) |
|
1345 |
{ |
|
1346 |
$e = $db->sql_query('DELETE FROM '.table_prefix.'group_members WHERE member_id='.$row['member_id']); |
|
1347 |
if(!$e) |
|
1348 |
{ |
|
1349 |
echo $db->get_error(); |
|
1350 |
return; |
|
1351 |
} |
|
1352 |
} |
|
1353 |
} |
|
1354 |
} |
|
1355 |
$db->free_result(); |
|
1356 |
if(isset($_POST['edit_do']['add_member'])) |
|
1357 |
{ |
|
1358 |
$q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['edit_add_username']).'\';'); |
|
1359 |
if(!$q) |
|
1360 |
{ |
|
1361 |
echo $db->get_error(); |
|
1362 |
return; |
|
1363 |
} |
|
1364 |
if($db->numrows() > 0) |
|
1365 |
{ |
|
1366 |
$row = $db->fetchrow(); |
|
1367 |
$user_id = $row['user_id']; |
|
1368 |
$is_mod = ( isset( $_POST['add_mod'] ) ) ? '1' : '0'; |
|
1369 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id,is_mod) VALUES('.intval($_POST['group_edit_id']).','.$user_id.','.$is_mod.');'); |
|
1370 |
if(!$q) |
|
1371 |
{ |
|
1372 |
echo $db->get_error(); |
|
1373 |
return; |
|
1374 |
} |
|
1375 |
else |
|
1376 |
{ |
|
1377 |
echo '<div class="info-box" style="margin: 0 0 10px 0;""> |
|
1378 |
The user "'.$_POST['edit_add_username'].'" has been added to this usergroup. |
|
1379 |
</div>'; |
|
1380 |
} |
|
1381 |
} |
|
1382 |
else |
|
1383 |
echo '<div class="warning-box"><b>The user "'.$_POST['edit_add_username'].'" could not be added.</b><br />This username does not exist.</div>'; |
|
1384 |
} |
|
1385 |
} |
|
1386 |
$sg_disabled = ( $row['system_group'] == 1 ) ? ' value="Can\'t delete system group" disabled="disabled" style="color: #FF9773" ' : ' value="Delete this group" style="color: #FF3713" '; |
|
1387 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1388 |
echo '<div class="tblholder"> |
|
1389 |
<table border="0" style="width:100%;" cellspacing="1" cellpadding="4"> |
|
1390 |
<tr><th>Edit group name</th></tr> |
|
1391 |
<tr> |
|
1392 |
<td class="row1"> |
|
1393 |
Group name: <input type="text" name="group_name" value="'.$name.'" /> |
|
1394 |
</td> |
|
1395 |
</tr> |
|
1396 |
<tr> |
|
1397 |
<th class="subhead"> |
|
1398 |
<input type="submit" name="edit_do[save_name]" value="Save name" /> |
|
1399 |
<input type="submit" name="edit_do[del_group]" '.$sg_disabled.' /> |
|
1400 |
</th> |
|
1401 |
</tr> |
|
1402 |
</table> |
|
1403 |
</div> |
|
1404 |
<input type="hidden" name="group_edit_id" value="'.$_POST['group_edit_id'].'" />'; |
|
1405 |
echo '</form>'; |
|
1406 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1407 |
echo '<div class="tblholder"> |
|
1408 |
<table border="0" style="width:100%;" cellspacing="1" cellpadding="4"> |
|
1409 |
<tr><th colspan="3">Edit group members</th></tr>'; |
|
1410 |
$q = $db->sql_query('SELECT m.member_id,m.is_mod,u.username FROM '.table_prefix.'group_members AS m |
|
1411 |
LEFT JOIN '.table_prefix.'users AS u |
|
1412 |
ON u.user_id=m.user_id |
|
1413 |
WHERE m.group_id='.intval($_POST['group_edit_id']).' |
|
1414 |
ORDER BY m.is_mod DESC, u.username ASC;'); |
|
1415 |
if(!$q) |
|
1416 |
{ |
|
1417 |
echo $db->get_error(); |
|
1418 |
return; |
|
1419 |
} |
|
1420 |
if($db->numrows() < 1) |
|
1421 |
{ |
|
1422 |
echo '<tr><td colspan="3" class="row1">This group has no members.</td></tr>'; |
|
1423 |
} |
|
1424 |
else |
|
1425 |
{ |
|
1426 |
$cls = 'row2'; |
|
1427 |
while($row = $db->fetchrow()) |
|
1428 |
{ |
|
1429 |
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
|
1430 |
$mod = ( $row['is_mod'] == 1 ) ? 'Mod' : ''; |
|
1431 |
echo '<tr> |
|
1432 |
<td class="'.$cls.'" style="width: 100%;"> |
|
1433 |
' . $row['username'] . ' |
|
1434 |
</td> |
|
1435 |
<td class="'.$cls.'"> |
|
1436 |
'.$mod.' |
|
1437 |
</td> |
|
1438 |
<td class="'.$cls.'"> |
|
1439 |
<input type="submit" name="edit_do[del_'.$row['member_id'].']" value="Remove member" /> |
|
1440 |
</td> |
|
1441 |
</tr>'; |
|
1442 |
} |
|
1443 |
} |
|
1444 |
$db->free_result(); |
|
1445 |
echo '</table> |
|
1446 |
</div> |
|
1447 |
<input type="hidden" name="group_edit_id" value="'.$_POST['group_edit_id'].'" />'; |
|
1448 |
echo '</form>'; |
|
1449 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1450 |
echo '<div class="tblholder"> |
|
1451 |
<table border="0" style="width:100%;" cellspacing="1" cellpadding="4"> |
|
1452 |
<tr> |
|
1453 |
<th>Add a new member</th> |
|
1454 |
</tr> |
|
1455 |
<tr> |
|
1456 |
<td class="row1"> |
|
1457 |
Username: ' . $template->username_field('edit_add_username') . ' |
|
1458 |
</td> |
|
1459 |
</tr> |
|
1460 |
<tr> |
|
1461 |
<td class="row2"> |
|
1462 |
<label><input type="checkbox" name="add_mod" /> Is a group moderator</label> (can add and delete other members) |
|
1463 |
</td> |
|
1464 |
</tr> |
|
1465 |
<tr> |
|
1466 |
<th class="subhead"> |
|
1467 |
<input type="submit" name="edit_do[add_member]" value="Add user to group" /> |
|
1468 |
</th> |
|
1469 |
</tr> |
|
1470 |
</table> |
|
1471 |
</div> |
|
1472 |
<input type="hidden" name="group_edit_id" value="'.$_POST['group_edit_id'].'" />'; |
|
1473 |
echo '</form>'; |
|
1474 |
return; |
|
1475 |
} |
|
1476 |
echo '<h3>Manage Usergroups</h3>'; |
|
1477 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1478 |
$q = $db->sql_query('SELECT group_id,group_name FROM '.table_prefix.'groups ORDER BY group_name ASC;'); |
|
1479 |
if(!$q) |
|
1480 |
{ |
|
1481 |
echo $db->get_error(); |
|
1482 |
} |
|
1483 |
else |
|
1484 |
{ |
|
1485 |
echo '<div class="tblholder"> |
|
1486 |
<table border="0" cellspacing="1" cellpadding="4" style="width: 100%;"> |
|
1487 |
<tr> |
|
1488 |
<th>Edit an existing group</th> |
|
1489 |
</tr>'; |
|
1490 |
echo '<tr><td class="row2"><select name="group_edit_id">'; |
|
1491 |
while ( $row = $db->fetchrow() ) |
|
1492 |
{ |
|
1493 |
if ( $row['group_name'] != 'Everyone' ) |
|
1494 |
{ |
|
1495 |
echo '<option value="' . $row['group_id'] . '">' . htmlspecialchars( $row['group_name'] ) . '</option>'; |
|
1496 |
} |
|
1497 |
} |
|
1498 |
$db->free_result(); |
|
1499 |
echo '</select></td></tr>'; |
|
1500 |
echo '<tr><td class="row1" style="text-align: center;"><input type="submit" name="do_edit" value="Edit group" /></td></tr> |
|
1501 |
</table> |
|
1502 |
</div> |
|
1503 |
</form><br />'; |
|
1504 |
} |
|
1505 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1506 |
echo '<div class="tblholder"> |
|
1507 |
<table border="0" cellspacing="1" cellpadding="4" style="width: 100%;"> |
|
1508 |
<tr> |
|
1509 |
<th colspan="2">Create a new group</th> |
|
1510 |
</tr>'; |
|
1511 |
echo '<tr><td class="row2">Group name:</td><td class="row2"><input type="text" name="create_group_name" /></td></tr>'; |
|
1512 |
echo '<tr><td colspan="2" class="row1" style="text-align: center;"><input type="submit" name="do_create_stage1" value="Continue >" /></td></tr> |
|
1513 |
</table> |
|
1514 |
</div>'; |
|
1515 |
echo '</form>'; |
|
1516 |
} |
|
1517 |
||
30 | 1518 |
function page_Admin_COPPA() |
1519 |
{ |
|
1520 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
1521 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
1522 |
{ |
|
1523 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
1524 |
return; |
|
1525 |
} |
|
1526 |
||
1527 |
echo '<h2>Background information</h2>'; |
|
1528 |
echo '<p> |
|
1529 |
The United States Childrens\' Online Privacy Protection Act (COPPA) was a law passed in 2001 that requires sites oriented towards |
|
1530 |
children under 13 years old or with a significant amount of under-13 children clearly state what information is being collected |
|
1531 |
in a privacy policy and obtain authorization from a parent or legal guardian before allowing children to use the site. Enano |
|
1532 |
provides an easy way to allow you, as the website administrator, to obtain this authorization. |
|
1533 |
</p>'; |
|
1534 |
||
1535 |
// Start form |
|
1536 |
||
1537 |
if ( isset($_POST['coppa_address']) ) |
|
1538 |
{ |
|
1539 |
// Saving changes |
|
1540 |
$enable_coppa = ( isset($_POST['enable_coppa']) ) ? '1' : '0'; |
|
1541 |
setConfig('enable_coppa', $enable_coppa); |
|
1542 |
||
1543 |
$address = $_POST['coppa_address']; // RenderMan::preprocess_text($_POST['coppa_address'], true, false); |
|
1544 |
setConfig('coppa_address', $address); |
|
1545 |
||
1546 |
echo '<div class="info-box">Your changes have been saved.</div>'; |
|
1547 |
} |
|
1548 |
||
1549 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', (( isset($_GET['sqldbg'])) ? 'sqldbg&' : '') .'module='.$paths->cpage['module']).'" method="post">'; |
|
1550 |
||
1551 |
echo '<div class="tblholder">'; |
|
1552 |
echo '<table border="0" cellspacing="1" cellpadding="4">'; |
|
1553 |
echo '<tr> |
|
1554 |
<th colspan="2"> |
|
1555 |
COPPA support |
|
1556 |
</th> |
|
1557 |
</tr>'; |
|
1558 |
||
1559 |
echo '<tr> |
|
1560 |
<td class="row1"> |
|
1561 |
Enable COPPA support: |
|
1562 |
</td> |
|
1563 |
<td class="row2"> |
|
1564 |
<label><input type="checkbox" name="enable_coppa" ' . ( ( getConfig('enable_coppa') == '1' ) ? 'checked="checked"' : '' ) . ' /> COPPA enabled</label><br /> |
|
1565 |
<small>If this is checked, users will be asked if they are under 13 years of age before registering</small> |
|
1566 |
</td> |
|
1567 |
</tr>'; |
|
1568 |
||
1569 |
echo '<tr> |
|
1570 |
<td class="row1"> |
|
1571 |
Your mailing address:<br /> |
|
1572 |
<small>This is the address to which parents will send authorization forms.</small> |
|
1573 |
</td> |
|
1574 |
<td class="row2"> |
|
1575 |
<textarea name="coppa_address" rows="7" cols="40">' . getConfig('coppa_address') . '</textarea> |
|
1576 |
</td> |
|
1577 |
</tr>'; |
|
1578 |
||
1579 |
echo '<tr> |
|
1580 |
<th colspan="2" class="subhead"> |
|
1581 |
<input type="submit" value="Save changes" /> |
|
1582 |
</th> |
|
1583 |
</tr>'; |
|
1584 |
||
1585 |
echo '</table>'; |
|
1586 |
||
1587 |
echo '</form>'; |
|
1588 |
||
1589 |
} |
|
1590 |
||
0 | 1591 |
function page_Admin_PageManager() |
1592 |
{ |
|
1593 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
1594 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
1595 |
{ |
|
1596 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
1597 |
return; |
|
1598 |
} |
|
1599 |
||
1600 |
||
1601 |
echo '<h2>Page management</h2>'; |
|
1602 |
||
1603 |
if(isset($_POST['search']) || isset($_POST['select']) || ( isset($_GET['source']) && $_GET['source'] == 'ajax' )) { |
|
1604 |
// The object of the game: using only the text a user entered, guess the page ID and namespace. *sigh* I HATE writing search algorithms... |
|
1605 |
$source = ( isset($_GET['source']) ) ? $_GET['source'] : false; |
|
1606 |
if ( $source == 'ajax' ) |
|
1607 |
{ |
|
1608 |
$_POST['search'] = true; |
|
1609 |
$_POST['page_url'] = $_GET['page_id']; |
|
1610 |
} |
|
1611 |
if(isset($_POST['search'])) $pid = $_POST['page_url']; |
|
1612 |
elseif(isset($_POST['select'])) $pid = $_POST['page_force_url']; |
|
1613 |
else { echo 'Internal error selecting page search terms'; return false; } |
|
1614 |
// Look for a namespace prefix in the urlname, and assign a different namespace, if necessary |
|
1615 |
$k = array_keys($paths->nslist); |
|
1616 |
for($i=0;$i<sizeof($paths->nslist);$i++) |
|
1617 |
{ |
|
1618 |
$ln = strlen($paths->nslist[$k[$i]]); |
|
1619 |
if(substr($pid, 0, $ln) == $paths->nslist[$k[$i]]) |
|
1620 |
{ |
|
1621 |
$ns = $k[$i]; |
|
1622 |
$page_id = substr($pid, $ln, strlen($pid)); |
|
1623 |
} |
|
1624 |
} |
|
1625 |
// The namespace is in $ns and the page name or ID (we don't know which yet) is in $page_id |
|
1626 |
// Now, iterate through $paths->pages searching for a page with this name or ID |
|
1627 |
for($i=0;$i<sizeof($paths->pages)/2;$i++) |
|
1628 |
{ |
|
1629 |
if(!isset($final_pid)) |
|
1630 |
{ |
|
1631 |
if ($paths->pages[$i]['urlname_nons'] == str_replace(' ', '_', $page_id)) $final_pid = str_replace(' ', '_', $page_id); |
|
1632 |
elseif($paths->pages[$i]['name'] == $page_id) $final_pid = $paths->pages[$i]['urlname_nons']; |
|
1633 |
elseif(strtolower($paths->pages[$i]['urlname_nons']) == strtolower(str_replace(' ', '_', $page_id))) $final_pid = $paths->pages[$i]['urlname_nons']; |
|
1634 |
elseif(strtolower($paths->pages[$i]['name']) == strtolower(str_replace('_', ' ', $page_id))) $final_pid = $paths->pages[$i]['urlname_nons']; |
|
1635 |
if(isset($final_pid)) { $_POST['name'] = $paths->pages[$i]['name']; $_POST['urlname'] = $paths->pages[$i]['urlname_nons']; } |
|
1636 |
} |
|
1637 |
} |
|
1638 |
if(!isset($final_pid)) { echo 'The page you searched for cannot be found. <a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'PageManager\'); return false;">Back</a>'; return false; } |
|
1639 |
$_POST['namespace'] = $ns; |
|
1640 |
$_POST['old_namespace'] = $ns; |
|
1641 |
$_POST['page_id'] = $final_pid; |
|
1642 |
$_POST['old_page_id'] = $final_pid; |
|
1643 |
if(!isset($paths->pages[$paths->nslist[$_POST['namespace']].$_POST['urlname']])) { echo 'The page you searched for cannot be found. <a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'PageManager\'); return false;">Back</a>'; return false; } |
|
1644 |
} |
|
1645 |
||
1646 |
if(isset($_POST['page_id']) && isset($_POST['namespace']) && !isset($_POST['cancel'])) |
|
1647 |
{ |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
1648 |
$cpage = $paths->pages[$paths->nslist[$_POST['old_namespace']].$_POST['old_page_id']]; |
0 | 1649 |
if(isset($_POST['submit'])) |
1650 |
{ |
|
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1651 |
switch(true) |
0 | 1652 |
{ |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1653 |
case true: |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1654 |
// Create a list of things to update |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1655 |
$page_info = Array( |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1656 |
'name'=>$_POST['name'], |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1657 |
'urlname'=>sanitize_page_id($_POST['page_id']), |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1658 |
'namespace'=>$_POST['namespace'], |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1659 |
'special'=>isset($_POST['special']) ? '1' : '0', |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1660 |
'visible'=>isset($_POST['visible']) ? '1' : '0', |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1661 |
'comments_on'=>isset($_POST['comments_on']) ? '1' : '0', |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1662 |
'protected'=>isset($_POST['protected']) ? '1' : '0' |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1663 |
); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1664 |
|
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
1665 |
$updating_urlname_or_namespace = ( $page_info['namespace'] != $cpage['namespace'] || $page_info['urlname'] != $cpage['urlname_nons'] ); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1666 |
|
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1667 |
if ( !isset($paths->nslist[ $page_info['namespace'] ]) ) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1668 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1669 |
echo '<div class="error-box">The namespace you selected is not properly registered.</div>'; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1670 |
break; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1671 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1672 |
if ( isset($paths->pages[ $paths->nslist[$page_info['namespace']] . $page_info[ 'urlname' ] ]) && $updating_urlname_or_namespace ) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1673 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1674 |
echo '<div class="error-box">There is already a page that exists with that URL string and namespace.</div>'; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1675 |
break; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1676 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1677 |
// Build the query |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1678 |
$q = 'UPDATE '.table_prefix.'pages SET '; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1679 |
$k = array_keys($page_info); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1680 |
foreach($k as $c) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1681 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1682 |
$q .= $c.'=\''.$db->escape($page_info[$c]).'\','; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1683 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1684 |
$q = substr($q, 0, strlen($q)-1); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1685 |
// Build the WHERE statements |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1686 |
$q .= ' WHERE '; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1687 |
$k = array_keys($cpage); |
40
723bb7acf914
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility
Dan
parents:
37
diff
changeset
|
1688 |
if ( !isset($cpage) ) |
110 | 1689 |
die('[internal] no cpage'); |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1690 |
foreach($k as $c) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1691 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1692 |
if($c != 'urlname_nons' && $c != 'urlname' && $c != 'really_protected') |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1693 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1694 |
$q .= $c.'=\''.$db->escape($cpage[$c]).'\' AND '; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1695 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1696 |
else if($c == 'urlname') |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1697 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1698 |
$q .= $c.'=\''.$db->escape($cpage['urlname_nons']).'\' AND '; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1699 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1700 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1701 |
// Trim off the last " AND " and append a semicolon |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1702 |
$q = substr($q, 0, strlen($q)-5) . ';'; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1703 |
// Send the completed query to MySQL |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1704 |
$e = $db->sql_query($q); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1705 |
if(!$e) $db->_die('The page data could not be updated.'); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1706 |
// Update any additional tables |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1707 |
$q = Array( |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1708 |
'UPDATE '.table_prefix.'categories SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1709 |
'UPDATE '.table_prefix.'comments SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1710 |
'UPDATE '.table_prefix.'logs SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1711 |
'UPDATE '.table_prefix.'page_text SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
72
bda11e521e8a
Fixed a few presentation bugs in installer, made installer more "legally binding", and fixed global permissions inheritance in $session->fetch_page_acl()
Dan
parents:
61
diff
changeset
|
1712 |
'UPDATE '.table_prefix.'acl SET page_id=\''.$page_info['urlname'].'\',namespace=\''.$page_info['namespace'].'\' WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';' |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1713 |
); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1714 |
foreach($q as $cq) |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1715 |
{ |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1716 |
$e = $db->sql_query($cq); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1717 |
if(!$e) $db->_die('Some of the additional tables containing page information could not be updated.'); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1718 |
} |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1719 |
// Update $cpage |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1720 |
$cpage = $page_info; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1721 |
$cpage['urlname_nons'] = $cpage['urlname']; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1722 |
$cpage['urlname'] = $paths->nslist[$cpage['namespace']].$cpage['urlname']; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1723 |
$_POST['old_page_id'] = $page_info['urlname']; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1724 |
$_POST['old_namespace'] = $page_info['namespace']; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1725 |
echo '<div class="info-box">Your changes have been saved.</div>'; |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1726 |
break; |
0 | 1727 |
} |
1728 |
} elseif(isset($_POST['delete'])) { |
|
1729 |
$q = Array( |
|
1730 |
'DELETE FROM '.table_prefix.'categories WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1731 |
'DELETE FROM '.table_prefix.'comments WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1732 |
'DELETE FROM '.table_prefix.'logs WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1733 |
'DELETE FROM '.table_prefix.'page_text WHERE page_id=\'' . $db->escape($_POST['old_page_id']) . '\' AND namespace=\'' . $db->escape($_POST['old_namespace']) . '\';', |
|
1734 |
); |
|
1735 |
foreach($q as $cq) |
|
1736 |
{ |
|
1737 |
$e = $db->sql_query($cq); |
|
1738 |
if(!$e) $db->_die('Some of the additional tables containing page information could not be updated.'); |
|
1739 |
} |
|
1740 |
||
1741 |
if(!$db->sql_query( |
|
1742 |
'DELETE FROM '.table_prefix.'pages WHERE urlname="'.$db->escape($_POST['old_page_id']).'" AND namespace="'.$db->escape($_POST['old_namespace']).'";' |
|
1743 |
)) $db->_die('The page could not be deleted.'); |
|
1744 |
echo '<div class="info-box">This page has been deleted.</p><p><a href="javascript:ajaxPage(\''.$paths->nslist['Admin'].'PageManager\');">Return to Page manager</a><br /><a href="javascript:ajaxPage(\''.$paths->nslist['Admin'].'Home\');">Admin home</a></div>'; |
|
1745 |
return; |
|
1746 |
} |
|
130
c4ce1640e1f4
Fixed unwanted sanitization in Admin:PageManager form submit
Dan
parents:
128
diff
changeset
|
1747 |
$url = makeUrlNS('Special', 'Administration', 'module='.$paths->cpage['module'], true); |
c4ce1640e1f4
Fixed unwanted sanitization in Admin:PageManager form submit
Dan
parents:
128
diff
changeset
|
1748 |
echo '<form action="'.$url.'" method="post">'; |
0 | 1749 |
?> |
89 | 1750 |
<h3>Modify page: <?php echo htmlspecialchars($_POST['name']); ?></h3> |
0 | 1751 |
<table border="0"> |
1752 |
<tr><td>Namespace:</td><td><select name="namespace"><?php $nm = array_keys($paths->nslist); foreach($nm as $ns) { if($ns != 'Special' && $ns != 'Admin') { echo '<option '; if($_POST['namespace']==$ns) echo 'selected="selected" '; echo 'value="'.$ns.'">'; if($paths->nslist[$ns] == '') echo '[No prefix]'; else echo $paths->nslist[$ns]; echo '</option>'; } } ?></select></td></tr> |
|
89 | 1753 |
<tr><td>Page title:</td><td><input type="text" name="name" value="<?php echo htmlspecialchars($cpage['name']); ?>" /></td></tr> |
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
20
diff
changeset
|
1754 |
<tr><td>Page URL string:<br /><small>No spaces, and don't enter the namespace prefix (e.g. User:).<br />Changing this value is usually not a good idea, especially for templates and project pages.</small></td><td><input type="text" name="page_id" value="<?php echo htmlspecialchars(dirtify_page_id($cpage['urlname_nons'])); ?>" /></td></tr> |
0 | 1755 |
<tr><td></td><td><input <?php if($cpage['comments_on']) echo 'checked="checked"'; ?> name="comments_on" type="checkbox" id="cmt" /> <label for="cmt">Enable comments for this page</label></td></tr> |
1756 |
<tr><td></td><td><input <?php if($cpage['special']) echo 'checked="checked"'; ?> name="special" type="checkbox" id="spc" /> <label for="spc">Bypass the template engine for this page</label><br /><small>This option enables you to use your own HTML headers and other code. It is recommended that only advanced users enable this feature. As with other Enano pages, you may use PHP code in your pages, meaning you can use Enano's API on the page.</small></td></tr> |
|
1757 |
<tr><td></td><td><input <?php if($cpage['visible']) echo 'checked="checked"'; ?> name="visible" type="checkbox" id="vis" /> <label for="vis">Allow this page to be shown in page lists</label><br /><small>Unchecking this checkbox prevents the page for being indexed for searching. The index is rebuilt each time a page is saved, and you can force an index rebuild by going to the page <?php echo $paths->nslist['Special']; ?>SearchRebuild.</small></td></tr> |
|
1758 |
<tr><td></td><td><input <?php if($cpage['protected']) echo 'checked="checked"'; ?> name="protected" type="checkbox" id="prt" /> <label for="prt">Prevent non-administrators from editing this page</label><br /><small>This option only has an effect when Wiki Mode is enabled.</small></td></tr> |
|
1759 |
<tr><td></td><td><input type="submit" name="delete" value="Delete page" style="color: red" onclick="return confirm('Do you REALLY want to delete this page?')" /></td></tr> |
|
1760 |
<tr><td colspan="2" style="text-align: center;"><hr /></td></tr> |
|
1761 |
<tr><td colspan="2" style="text-align: right;"> |
|
1762 |
<input type="hidden" name="old_page_id" value="<?php echo $_POST['old_page_id']; ?>" /> |
|
1763 |
<input type="hidden" name="old_namespace" value="<?php echo $_POST['old_namespace']; ?>" /> |
|
1764 |
<input type="Submit" name="submit" value="Save changes" style="font-weight: bold;" /> <input type="submit" name="cancel" value="Cancel changes" /></td></tr> |
|
1765 |
</table> |
|
1766 |
<?php |
|
1767 |
echo '</form>'; |
|
1768 |
} else { |
|
1769 |
echo '<h3>Please select a page</h3>'; |
|
1770 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1771 |
?> |
|
1772 |
<p>Search for page title (remember prefixes like User: and File:) <?php echo $template->pagename_field('page_url'); ?> <input type="submit" style="font-weight: bold;" name="search" value="Search" /></p> |
|
1773 |
<p>Select page title from a list: <select name="page_force_url"> |
|
1774 |
<?php |
|
1775 |
for($i=0;$i<sizeof($paths->pages)/2;$i++) |
|
1776 |
{ |
|
89 | 1777 |
if($paths->pages[$i]['namespace'] != 'Admin' && $paths->pages[$i]['namespace'] != 'Special') echo '<option value="'.$paths->nslist[$paths->pages[$i]['namespace']].$paths->pages[$i]['urlname_nons'].'">'.htmlspecialchars($paths->nslist[$paths->pages[$i]['namespace']].$paths->pages[$i]['name']).'</option>'."\n"; |
0 | 1778 |
} |
1779 |
?> |
|
1780 |
</select> <input type="submit" name="select" value="Select" /></p> |
|
1781 |
<?php |
|
1782 |
echo '</form>'; |
|
1783 |
||
1784 |
} |
|
1785 |
} |
|
1786 |
||
1787 |
function page_Admin_PageEditor() |
|
1788 |
{ |
|
1789 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
1790 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
1791 |
{ |
|
1792 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
1793 |
return; |
|
1794 |
} |
|
1795 |
||
1796 |
||
1797 |
echo '<h2>Edit page content</h2>'; |
|
1798 |
||
1799 |
if(isset($_POST['search']) || isset($_POST['select'])) { |
|
1800 |
// The object of the game: using only the text a user entered, guess the page ID and namespace. *sigh* I HATE writing search algorithms... |
|
1801 |
if(isset($_POST['search'])) $pid = $_POST['page_url']; |
|
1802 |
elseif(isset($_POST['select'])) $pid = $_POST['page_force_url']; |
|
1803 |
else { echo 'Internal error selecting page search terms'; return false; } |
|
1804 |
// Look for a namespace prefix in the urlname, and assign a different namespace, if necessary |
|
1805 |
$k = array_keys($paths->nslist); |
|
1806 |
for($i=0;$i<sizeof($paths->nslist);$i++) |
|
1807 |
{ |
|
1808 |
$ln = strlen($paths->nslist[$k[$i]]); |
|
1809 |
if(substr($pid, 0, $ln) == $paths->nslist[$k[$i]]) |
|
1810 |
{ |
|
1811 |
$ns = $k[$i]; |
|
1812 |
$page_id = substr($pid, $ln, strlen($pid)); |
|
1813 |
} |
|
1814 |
} |
|
1815 |
// The namespace is in $ns and the page name or ID (we don't know which yet) is in $page_id |
|
1816 |
// Now, iterate through $paths->pages searching for a page with this name or ID |
|
1817 |
for($i=0;$i<sizeof($paths->pages)/2;$i++) |
|
1818 |
{ |
|
1819 |
if(!isset($final_pid)) |
|
1820 |
{ |
|
1821 |
if ($paths->pages[$i]['urlname_nons'] == str_replace(' ', '_', $page_id)) $final_pid = str_replace(' ', '_', $page_id); |
|
1822 |
elseif($paths->pages[$i]['name'] == $page_id) $final_pid = $paths->pages[$i]['urlname_nons']; |
|
1823 |
elseif(strtolower($paths->pages[$i]['urlname_nons']) == strtolower(str_replace(' ', '_', $page_id))) $final_pid = $paths->pages[$i]['urlname_nons']; |
|
1824 |
elseif(strtolower($paths->pages[$i]['name']) == strtolower(str_replace('_', ' ', $page_id))) $final_pid = $paths->pages[$i]['urlname_nons']; |
|
1825 |
if(isset($final_pid)) { $_POST['name'] = $paths->pages[$i]['name']; $_POST['urlname'] = $paths->pages[$i]['urlname_nons']; } |
|
1826 |
} |
|
1827 |
} |
|
1828 |
if(!isset($final_pid)) { echo 'The page you searched for cannot be found. <a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'PageManager\'); return false;">Back</a>'; return false; } |
|
1829 |
$_POST['namespace'] = $ns; |
|
1830 |
$_POST['page_id'] = $final_pid; |
|
1831 |
if(!isset($paths->pages[$paths->nslist[$_POST['namespace']].$_POST['urlname']])) { echo 'The page you searched for cannot be found. <a href="#" onclick="ajaxPage(\''.$paths->nslist['Admin'].'PageManager\'); return false;">Back</a>'; return false; } |
|
1832 |
} |
|
1833 |
||
1834 |
if(isset($_POST['page_id']) && !isset($_POST['cancel'])) |
|
1835 |
{ |
|
1836 |
echo '<form name="main" action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post">'; |
|
1837 |
if(!isset($_POST['content']) || isset($_POST['revert'])) $content = RenderMan::getPage($_POST['page_id'], $_POST['namespace'], 0, false, false, false, false); |
|
1838 |
else $content = $_POST['content']; |
|
1839 |
if(isset($_POST['save'])) |
|
1840 |
{ |
|
1841 |
$data = $content; |
|
1842 |
$id = md5( microtime() . mt_rand() ); |
|
1843 |
||
1844 |
$minor = isset($_POST['minor']) ? 'true' : 'false'; |
|
1845 |
$q='INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $db->escape($_POST['page_id']) . '\', \'' . $db->escape($_POST['namespace']) . '\', \''.$data.'\', \''.$id.'\', \''.$session->username.'\', \''.$db->escape(htmlspecialchars($_POST['summary'])).'\', '.$minor.');'; |
|
1846 |
if(!$db->sql_query($q)) $db->_die('The history (log) entry could not be inserted into the logs table.'); |
|
1847 |
||
1848 |
$query = 'UPDATE '.table_prefix.'page_text SET page_text=\''.$db->escape($data).'\',char_tag=\''.$id.'\' WHERE page_id=\'' . $db->escape($_POST['page_id']) . '\' AND namespace=\'' . $db->escape($_POST['namespace']) . '\';'; |
|
1849 |
$e = $db->sql_query($query); |
|
1850 |
if(!$e) echo '<div class="warning-box">The page data could not be saved. MySQL said: '.mysql_error().'<br /><br />Query:<br /><pre>'.$query.'</pre></div>'; |
|
1851 |
else echo '<div class="info-box">Your page has been saved. <a href="'.makeUrlNS($_POST['namespace'], $_POST['page_id']).'">View page...</a></div>'; |
|
1852 |
} elseif(isset($_POST['preview'])) { |
|
1853 |
echo '<h3>Preview</h3><p><b>Reminder:</b> This is only a preview; your changes to this page have not yet been saved.</p><div style="margin: 1em; padding: 10px; border: 1px dashed #606060; background-color: #F8F8F8; max-height: 200px; overflow: auto;">'.RenderMan::render($content).'</div>'; |
|
1854 |
} |
|
1855 |
?> |
|
1856 |
<p> |
|
1857 |
<textarea name="content" rows="20" cols="60" style="width: 100%;"><?php echo htmlspecialchars($content); ?></textarea><br /> |
|
1858 |
Edit summary: <input name="summary" value="<?php if(isset($_POST['summary'])) echo $_POST['summary']; ?>" size="40" /><br /> |
|
1859 |
<label><input type="checkbox" name="minor" <?php if(isset($_POST['minor'])) echo 'checked="checked" '; ?>/> This is a minor edit</label> |
|
1860 |
</p> |
|
1861 |
<p> |
|
1862 |
<input type="hidden" name="page_id" value="<?php echo $_POST['page_id']; ?>" /> |
|
1863 |
<input type="hidden" name="namespace" value="<?php echo $_POST['namespace']; ?>" /> |
|
1864 |
<input type="submit" name="save" value="Save changes" style="font-weight: bold;" /> <input type="submit" name="preview" value="Show preview" /> <input type="submit" name="revert" value="Revert changes" onclick="return confirm('Do you really want to revert your changes?');" /> <input type="submit" name="cancel" value="Cancel" onclick="return confirm('Do you really want to cancel your changes?');" /> |
|
1865 |
</p> |
|
1866 |
<?php |
|
1867 |
echo '</form>'; |
|
1868 |
} else { |
|
1869 |
echo '<h3>Please select a page</h3>'; |
|
1870 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">'; |
|
1871 |
?> |
|
1872 |
<p>Search for page title (remember prefixes like User: and File:) <?php echo $template->pagename_field('page_url'); ?> <input type="submit" style="font-weight: bold;" name="search" value="Search" /></p> |
|
1873 |
<p>Select page title from a list: <select name="page_force_url"> |
|
1874 |
<?php |
|
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents:
72
diff
changeset
|
1875 |
for ( $i = 0; $i < sizeof($paths->pages) / 2; $i++ ) |
0 | 1876 |
{ |
1877 |
if($paths->pages[$i]['namespace'] != 'Admin' && $paths->pages[$i]['namespace'] != 'Special') echo '<option value="'.$paths->nslist[$paths->pages[$i]['namespace']].$paths->pages[$i]['urlname_nons'].'">'.$paths->nslist[$paths->pages[$i]['namespace']].$paths->pages[$i]['name'].'</option>'."\n"; |
|
1878 |
} |
|
1879 |
?> |
|
1880 |
</select> <input type="submit" name="select" value="Select" /></p> |
|
1881 |
<?php |
|
1882 |
echo '</form>'; |
|
1883 |
} |
|
1884 |
} |
|
1885 |
||
1886 |
function page_Admin_ThemeManager() |
|
1887 |
{ |
|
1888 |
||
1889 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
1890 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
1891 |
{ |
|
1892 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
1893 |
return; |
|
1894 |
} |
|
1895 |
||
1896 |
||
1897 |
// Get the list of styles in the themes/ dir |
|
1898 |
$h = opendir('./themes'); |
|
1899 |
$l = Array(); |
|
1900 |
if(!$h) die('Error opening directory "./themes" for reading.'); |
|
1901 |
while(false !== ($n = readdir($h))) { |
|
1902 |
if($n != '.' && $n != '..' && is_dir('./themes/'.$n)) |
|
1903 |
$l[] = $n; |
|
1904 |
} |
|
1905 |
closedir($h); |
|
1906 |
echo(' |
|
1907 |
<h3>Theme Management</h3> |
|
1908 |
<p>Install, uninstall, and manage Enano themes.</p> |
|
1909 |
'); |
|
1910 |
if(isset($_POST['disenable'])) { |
|
1911 |
$q = 'SELECT enabled FROM '.table_prefix.'themes WHERE theme_id=\'' . $db->escape($_POST['theme_id']) . '\''; |
|
1912 |
$s = $db->sql_query($q); |
|
1913 |
if(!$s) die('Error selecting enabled/disabled state value: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1914 |
$r = $db->fetchrow_num($s); |
|
1915 |
$db->free_result(); |
|
1916 |
if($r[0] == 1) $e = 0; |
|
1917 |
else $e = 1; |
|
1918 |
$s=true; |
|
1919 |
if($e==0) |
|
1920 |
{ |
|
1921 |
$c = $db->sql_query('SELECT * FROM '.table_prefix.'themes WHERE enabled=1'); |
|
1922 |
if(!$c) $db->_die('The backup check for having at least on theme enabled failed.'); |
|
1923 |
if($db->numrows() <= 1) { echo '<div class="warning-box">You cannot disable the last remaining theme.</div>'; $s=false; } |
|
1924 |
} |
|
1925 |
$db->free_result(); |
|
1926 |
if($s) { |
|
1927 |
$q = 'UPDATE '.table_prefix.'themes SET enabled='.$e.' WHERE theme_id=\'' . $db->escape($_POST['theme_id']) . '\''; |
|
1928 |
$a = $db->sql_query($q); |
|
1929 |
if(!$a) die('Error updating enabled/disabled state value: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1930 |
else echo('<div class="info-box">The theme "'.$_POST['theme_id'].'" has been '. ( ( $e == '1' ) ? 'enabled' : 'disabled' ).'.</div>'); |
|
1931 |
} |
|
1932 |
} |
|
1933 |
elseif(isset($_POST['edit'])) { |
|
1934 |
||
1935 |
$dir = './themes/'.$_POST['theme_id'].'/css/'; |
|
1936 |
$list = Array(); |
|
1937 |
// Open a known directory, and proceed to read its contents |
|
1938 |
if (is_dir($dir)) { |
|
1939 |
if ($dh = opendir($dir)) { |
|
1940 |
while (($file = readdir($dh)) !== false) { |
|
1941 |
if(preg_match('#^(.*?)\.css$#is', $file) && $file != '_printable.css') { |
|
1942 |
$list[$file] = capitalize_first_letter(substr($file, 0, strlen($file)-4)); |
|
1943 |
} |
|
1944 |
} |
|
1945 |
closedir($dh); |
|
1946 |
} |
|
1947 |
} |
|
1948 |
$lk = array_keys($list); |
|
1949 |
||
1950 |
$q = 'SELECT theme_name,default_style FROM '.table_prefix.'themes WHERE theme_id=\''.$db->escape($_POST['theme_id']).'\''; |
|
1951 |
$s = $db->sql_query($q); |
|
1952 |
if(!$s) die('Error selecting name value: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1953 |
$r = $db->fetchrow_num($s); |
|
1954 |
$db->free_result(); |
|
1955 |
echo('<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post">'); |
|
1956 |
echo('<div class="question-box"> |
|
1957 |
Theme name displayed to users: <input type="text" name="name" value="'.$r[0].'" /><br /><br /> |
|
1958 |
Default stylesheet: <select name="defaultcss">'); |
|
1959 |
foreach ($lk as $l) |
|
1960 |
{ |
|
1961 |
if($r[1] == $l) $v = ' selected="selected"'; |
|
1962 |
else $v = ''; |
|
1963 |
echo "<option value='{$l}'$v>{$list[$l]}</option>"; |
|
1964 |
} |
|
1965 |
echo('</select><br /><br /> |
|
1966 |
<input type="submit" name="editsave" value="OK" /><input type="hidden" name="theme_id" value="'.$_POST['theme_id'].'" /> |
|
1967 |
</div>'); |
|
1968 |
echo('</form>'); |
|
1969 |
} |
|
1970 |
elseif(isset($_POST['editsave'])) { |
|
1971 |
$q = 'UPDATE '.table_prefix.'themes SET theme_name=\'' . $db->escape($_POST['name']) . '\',default_style=\''.$db->escape($_POST['defaultcss']).'\' WHERE theme_id=\'' . $db->escape($_POST['theme_id']) . '\''; |
|
1972 |
$s = $db->sql_query($q); |
|
1973 |
if(!$s) die('Error updating name value: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1974 |
else echo('<div class="info-box">Theme data updated.</div>'); |
|
1975 |
} |
|
1976 |
elseif(isset($_POST['up'])) { |
|
1977 |
// If there is only one theme or if the selected theme is already at the top, do nothing |
|
1978 |
$q = 'SELECT theme_order FROM '.table_prefix.'themes ORDER BY theme_order;'; |
|
1979 |
$s = $db->sql_query($q); |
|
1980 |
if(!$s) die('Error selecting order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1981 |
$q = 'SELECT theme_order FROM '.table_prefix.'themes WHERE theme_id=\''.$db->escape($_POST['theme_id']).'\''; |
|
1982 |
$sn = $db->sql_query($q); |
|
1983 |
if(!$sn) die('Error selecting order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1984 |
$r = $db->fetchrow_num($sn); |
|
1985 |
if( /* check for only one theme... */ $db->numrows($s) < 2 || $r[0] == 1 /* ...and check if this theme is already at the top */ ) { echo('<div class="warning-box">This theme is already at the top of the list, or there is only one theme installed.</div>'); } else { |
|
1986 |
// Get the order IDs of the selected theme and the theme before it |
|
1987 |
$q = 'SELECT theme_order FROM '.table_prefix.'themes WHERE theme_id=\'' . $db->escape($_POST['theme_id']) . '\''; |
|
1988 |
$s = $db->sql_query($q); |
|
1989 |
if(!$s) die('Error selecting order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1990 |
$r = $db->fetchrow_num($s); |
|
1991 |
$r = $r[0]; |
|
1992 |
$rb = $r - 1; |
|
1993 |
// Thank God for jEdit's rectangular selection and the ablity to edit multiple lines at the same time ;) |
|
1994 |
$q = 'UPDATE '.table_prefix.'themes SET theme_order=0 WHERE theme_order='.$rb.''; /* Check for errors... <sigh> */ $s = $db->sql_query($q); if(!$s) die('Error updating order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1995 |
$q = 'UPDATE '.table_prefix.'themes SET theme_order='.$rb.' WHERE theme_order='.$r.''; /* Check for errors... <sigh> */ $s = $db->sql_query($q); if(!$s) die('Error updating order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1996 |
$q = 'UPDATE '.table_prefix.'themes SET theme_order='.$r.' WHERE theme_order=0'; /* Check for errors... <sigh> */ $s = $db->sql_query($q); if(!$s) die('Error updating order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
1997 |
echo('<div class="info-box">Theme moved up.</div>'); |
|
1998 |
} |
|
1999 |
$db->free_result($s); |
|
2000 |
$db->free_result($sn); |
|
2001 |
} |
|
2002 |
elseif(isset($_POST['down'])) { |
|
2003 |
// If there is only one theme or if the selected theme is already at the top, do nothing |
|
2004 |
$q = 'SELECT theme_order FROM '.table_prefix.'themes ORDER BY theme_order;'; |
|
2005 |
$s = $db->sql_query($q); |
|
2006 |
if(!$s) die('Error selecting order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2007 |
$r = $db->fetchrow_num($s); |
|
2008 |
if( /* check for only one theme... */ $db->numrows($s) < 2 || $r[0] == $db->numrows($s) /* ...and check if this theme is already at the bottom */ ) { echo('<div class="warning-box">This theme is already at the bottom of the list, or there is only one theme installed.</div>'); } else { |
|
2009 |
// Get the order IDs of the selected theme and the theme before it |
|
2010 |
$q = 'SELECT theme_order FROM '.table_prefix.'themes WHERE theme_id=\''.$db->escape($_POST['theme_id']).'\''; |
|
2011 |
$s = $db->sql_query($q); |
|
2012 |
if(!$s) die('Error selecting order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2013 |
$r = $db->fetchrow_num($s); |
|
2014 |
$r = $r[0]; |
|
2015 |
$rb = $r + 1; |
|
2016 |
// Thank God for jEdit's rectangular selection and the ablity to edit multiple lines at the same time ;) |
|
2017 |
$q = 'UPDATE '.table_prefix.'themes SET theme_order=0 WHERE theme_order='.$rb.''; /* Check for errors... <sigh> */ $s = $db->sql_query($q); if(!$s) die('Error updating order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2018 |
$q = 'UPDATE '.table_prefix.'themes SET theme_order='.$rb.' WHERE theme_order='.$r.''; /* Check for errors... <sigh> */ $s = $db->sql_query($q); if(!$s) die('Error updating order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2019 |
$q = 'UPDATE '.table_prefix.'themes SET theme_order='.$r.' WHERE theme_order=0'; /* Check for errors... <sigh> */ $s = $db->sql_query($q); if(!$s) die('Error updating order information: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2020 |
echo('<div class="info-box">Theme moved down.</div>'); |
|
2021 |
} |
|
2022 |
} |
|
2023 |
else if(isset($_POST['uninstall'])) |
|
2024 |
{ |
|
2025 |
$q = 'SELECT * FROM '.table_prefix.'themes;'; |
|
2026 |
$s = $db->sql_query($q); |
|
2027 |
if ( !$s ) |
|
2028 |
{ |
|
2029 |
die('Error getting theme count: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2030 |
} |
|
2031 |
$n = $db->numrows($s); |
|
2032 |
$db->free_result(); |
|
2033 |
||
2034 |
if ( $_POST['theme_id'] == 'oxygen' ) |
|
2035 |
{ |
|
2036 |
echo '<div class="error-box">The Oxygen theme is used by Enano for installation, upgrades, and error messages, and cannot be uninstalled.</div>'; |
|
2037 |
} |
|
2038 |
else |
|
2039 |
{ |
|
2040 |
if($n < 2) |
|
2041 |
{ |
|
2042 |
echo '<div class="error-box">The theme could not be uninstalled because it is the only theme left.</div>'; |
|
2043 |
} |
|
2044 |
else |
|
2045 |
{ |
|
2046 |
$q = 'DELETE FROM '.table_prefix.'themes WHERE theme_id=\''.$db->escape($_POST['theme_id']).'\' LIMIT 1;'; |
|
2047 |
$s = $db->sql_query($q); |
|
2048 |
if ( !$s ) |
|
2049 |
{ |
|
2050 |
die('Error deleting theme data: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2051 |
} |
|
2052 |
else |
|
2053 |
{ |
|
2054 |
echo('<div class="info-box">Theme uninstalled.</div>'); |
|
2055 |
} |
|
2056 |
} |
|
2057 |
} |
|
2058 |
} |
|
2059 |
elseif(isset($_POST['install'])) { |
|
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2060 |
$q = 'SELECT theme_id FROM '.table_prefix.'themes;'; |
0 | 2061 |
$s = $db->sql_query($q); |
2062 |
if(!$s) die('Error getting theme count: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
|
2063 |
$n = $db->numrows($s); |
|
2064 |
$n++; |
|
2065 |
$theme_id = $_POST['theme_id']; |
|
2066 |
$theme = Array(); |
|
2067 |
include('./themes/'.$theme_id.'/theme.cfg'); |
|
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2068 |
if ( !isset($theme['theme_id']) ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2069 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2070 |
echo '<div class="error-box">Could not load theme.cfg (theme metadata file)</div>'; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2071 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2072 |
else |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2073 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2074 |
$default_style = false; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2075 |
if ( $dh = opendir('./themes/' . $theme_id . '/css') ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2076 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2077 |
while ( $file = readdir($dh) ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2078 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2079 |
if ( $file != '_printable.css' && preg_match('/\.css$/i', $file) ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2080 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2081 |
$default_style = $file; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2082 |
break; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2083 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2084 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2085 |
closedir($dh); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2086 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2087 |
else |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2088 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2089 |
die('The /css subdirectory could not be located in the theme\'s directory'); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2090 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2091 |
|
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2092 |
if ( $default_style ) |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2093 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2094 |
$q = 'INSERT INTO '.table_prefix.'themes(theme_id,theme_name,theme_order,enabled,default_style) VALUES(\''.$db->escape($theme['theme_id']).'\', \''.$db->escape($theme['theme_name']).'\', '.$n.', 1, \'' . $db->escape($default_style) . '\')'; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2095 |
$s = $db->sql_query($q); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2096 |
if(!$s) die('Error inserting theme data: '.mysql_error().'<br /><u>SQL:</u><br />'.$q); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2097 |
else echo('<div class="info-box">Theme "'.$theme['theme_name'].'" installed.</div>'); |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2098 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2099 |
else |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2100 |
{ |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2101 |
echo '<div class="error-box">Could not determine the default style for the theme.</div>'; |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2102 |
} |
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents:
74
diff
changeset
|
2103 |
} |
0 | 2104 |
} |
2105 |
echo(' |
|
2106 |
<h3>Currently installed themes</h3> |
|
2107 |
<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post"> |
|
2108 |
<p> |
|
2109 |
<select name="theme_id"> |
|
2110 |
'); |
|
2111 |
$q = 'SELECT theme_id,theme_name,enabled FROM '.table_prefix.'themes ORDER BY theme_order'; |
|
2112 |
$s = $db->sql_query($q); |
|
2113 |
if(!$s) die('Error selecting theme data: '.mysql_error().'<br /><u>Attempted SQL:</u><br />'.$q); |
|
2114 |
while ( $r = $db->fetchrow_num($s) ) { |
|
2115 |
if($r[2] < 1) $r[1] .= ' (disabled)'; |
|
2116 |
echo('<option value="'.$r[0].'">'.$r[1].'</option>'); |
|
2117 |
} |
|
2118 |
$db->free_result(); |
|
2119 |
echo(' |
|
2120 |
</select> <input type="submit" name="disenable" value="Enable/Disable" /> <input type="submit" name="edit" value="Change settings" /> <input type="submit" name="up" value="Move up" /> <input type="submit" name="down" value="Move down" /> <input type="submit" name="uninstall" value="Uninstall" style="color: #DD3300; font-weight: bold;" /> |
|
2121 |
</p> |
|
2122 |
</form> |
|
2123 |
<h3>Install a new theme</h3> |
|
2124 |
'); |
|
2125 |
$theme = Array(); |
|
2126 |
$obb = ''; |
|
2127 |
for($i=0;$i<sizeof($l);$i++) { |
|
2128 |
if(is_file('./themes/'.$l[$i].'/theme.cfg') && file_exists('./themes/'.$l[$i].'/theme.cfg')) { |
|
2129 |
include('./themes/'.$l[$i].'/theme.cfg'); |
|
2130 |
$q = 'SELECT * FROM '.table_prefix.'themes WHERE theme_id=\''.$theme['theme_id'].'\''; |
|
2131 |
$s = $db->sql_query($q); |
|
2132 |
if(!$s) die('Error selecting list of currently installed themes: '.mysql_error().'<br /><u>Attempted SQL:</u><br />'.$q); |
|
2133 |
if($db->numrows($s) < 1) { |
|
2134 |
$obb .= '<option value="'.$theme['theme_id'].'">'.$theme['theme_name'].'</option>'; |
|
2135 |
} |
|
2136 |
$db->free_result(); |
|
2137 |
} |
|
2138 |
} |
|
2139 |
if($obb != '') { |
|
2140 |
echo('<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post"><p>'); |
|
2141 |
echo('<select name="theme_id">'); |
|
2142 |
echo($obb); |
|
2143 |
echo('</select>'); |
|
2144 |
echo(' |
|
2145 |
<input type="submit" name="install" value="Install this theme" /> |
|
2146 |
</p></form>'); |
|
2147 |
} else echo('<p>All themes are currently installed.</p>'); |
|
2148 |
} |
|
2149 |
||
2150 |
function page_Admin_BanControl() |
|
2151 |
{ |
|
2152 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
2153 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
2154 |
{ |
|
2155 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
2156 |
return; |
|
2157 |
} |
|
2158 |
||
2159 |
if(isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && $_GET['id'] != '') |
|
2160 |
{ |
|
2161 |
$e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . $db->escape($_GET['id']) . ''); |
|
2162 |
if(!$e) $db->_die('The ban list entry was not deleted.'); |
|
2163 |
} |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2164 |
if(isset($_POST['create']) && !defined('ENANO_DEMO_MODE')) |
0 | 2165 |
{ |
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2166 |
$type = intval($_POST['type']); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2167 |
$value = trim($_POST['value']); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2168 |
if ( !in_array($type, array(BAN_IP, BAN_USER, BAN_EMAIL)) ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2169 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2170 |
echo '<div class="error-box">Hacking attempt.</div>'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2171 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2172 |
else if ( empty($value) ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2173 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2174 |
echo '<div class="error-box">Please enter something to ban.</div>'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2175 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2176 |
else |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2177 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2178 |
$entries = array(); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2179 |
$input = explode(',', $_POST['value']); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2180 |
$error = false; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2181 |
foreach ( $input as $entry ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2182 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2183 |
$entry = trim($entry); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2184 |
if ( empty($entry) ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2185 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2186 |
echo '<div class="error-box">Malformed entry.</div>'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2187 |
$error = true; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2188 |
break; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2189 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2190 |
if ( $type == BAN_IP ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2191 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2192 |
// parse a range of addresses |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2193 |
$range = parse_ip_range($entry); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2194 |
if ( !$range ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2195 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2196 |
$error = true; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2197 |
echo '<div class="error-box">Malformed IP address expression.</div>'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2198 |
break; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2199 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2200 |
foreach ($range as $ip) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2201 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2202 |
$entries[] = $ip; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2203 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2204 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2205 |
else |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2206 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2207 |
$entries[] = $entry; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2208 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2209 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2210 |
if ( !$error ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2211 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2212 |
$regex = ( isset($_POST['regex']) ) ? '1' : '0'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2213 |
$to_insert = array(); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2214 |
$reason = $db->escape($_POST['reason']); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2215 |
foreach ( $entries as $entry ) |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2216 |
{ |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2217 |
$entry = $db->escape($entry); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2218 |
$to_insert[] = "($type, '$entry', '$reason', $regex)"; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2219 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2220 |
$q = 'INSERT INTO '.table_prefix."banlist(ban_type, ban_value, reason, is_regex)\n VALUES" . implode(",\n ", $to_insert) . ';'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2221 |
@set_time_limit(0); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2222 |
$e = $db->sql_query($q); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2223 |
if(!$e) $db->_die('The banlist could not be updated.'); |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2224 |
} |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2225 |
} |
0 | 2226 |
} |
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2227 |
else if ( isset($_POST['create']) && defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2228 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2229 |
echo '<div class="error-box">This function is disabled in the demo. Just because <i>you</i> don\'t like ' . htmlspecialchars($_POST['value']) . ' doesn\'t mean <i>we</i> don\'t like ' . htmlspecialchars($_POST['value']) . '.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2230 |
} |
0 | 2231 |
$q = $db->sql_query('SELECT ban_id,ban_type,ban_value,is_regex FROM '.table_prefix.'banlist ORDER BY ban_type;'); |
2232 |
if(!$q) $db->_die('The banlist data could not be selected.'); |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2233 |
echo '<div class="tblholder" style="max-height: 800px; clip: rect(0px,auto,auto,0px); overflow: auto;"> |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2234 |
<table border="0" cellspacing="1" cellpadding="4">'; |
0 | 2235 |
echo '<tr><th>Type</th><th>Value</th><th>Regular Expression</th><th></th></tr>'; |
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2236 |
if($db->numrows() < 1) echo '<td class="row1" colspan="4">No ban rules yet.</td>'; |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2237 |
$cls = 'row2'; |
0 | 2238 |
while($r = $db->fetchrow()) |
2239 |
{ |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2240 |
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
0 | 2241 |
if($r['ban_type']==BAN_IP) $t = 'IP address'; |
2242 |
elseif($r['ban_type']==BAN_USER) $t = 'Username'; |
|
2243 |
elseif($r['ban_type']==BAN_EMAIL) $t = 'E-mail address'; |
|
2244 |
if($r['is_regex']) $g = 'Yes'; else $g = 'No'; |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2245 |
echo '<tr><td class="'.$cls.'">'.$t.'</td><td class="'.$cls.'">'.$r['ban_value'].'</td><td class="'.$cls.'">'.$g.'</td><td class="'.$cls.'"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'BanControl&action=delete&id='.$r['ban_id']).'">Delete</a></td></tr>'; |
0 | 2246 |
} |
2247 |
$db->free_result(); |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2248 |
echo '</table></div>'; |
0 | 2249 |
echo '<h3>Create new ban rule</h3>'; |
2250 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post">'; |
|
2251 |
?> |
|
2252 |
Type: <select name="type"><option value="<?php echo BAN_IP; ?>">IP address</option><option value="<?php echo BAN_USER; ?>">Username</option><option value="<?php echo BAN_EMAIL; ?>">E-mail address</option></select><br /> |
|
2253 |
Rule: <input type="text" name="value" size="30" /><br /> |
|
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2254 |
<small>You can ban multiple IP addresses, users, or e-mail addresses by separating entries with a single comma (User1,User2). Do not put a space after the comma. For IP addresses, you may specify ranges like 172|192.168.4-30|90-167.1-90, which will turn into 172 and 192 . 168 . 4-30 and 90-167 . 1 - 90, which matches 18,899 IP addresses. Don't specify large ranges (like the example one here) at once or you risk temporarily (~60sec) overloading the server.</small><br /> |
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
parents:
118
diff
changeset
|
2255 |
Reason to show to the banned user: <textarea name="reason" rows="7" cols="40"></textarea><br /> |
0 | 2256 |
<input type="checkbox" name="regex" id="regex" /> <label for="regex">This rule is a regular expression</label> (advanced users only)<br /> |
2257 |
<input type="submit" style="font-weight: bold;" name="create" value="Create new ban rule" /> |
|
2258 |
<?php |
|
2259 |
echo '</form>'; |
|
2260 |
} |
|
2261 |
||
2262 |
function page_Admin_MassEmail() |
|
2263 |
{ |
|
2264 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
2265 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
2266 |
{ |
|
2267 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
2268 |
return; |
|
2269 |
} |
|
2270 |
||
2271 |
global $enano_config; |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2272 |
if ( isset($_POST['do_send']) && !defined('ENANO_DEMO_MODE') ) |
0 | 2273 |
{ |
2274 |
$use_smtp = getConfig('smtp_enabled') == '1'; |
|
2275 |
||
2276 |
// |
|
2277 |
// Let's do some checking to make sure that mass mail functions |
|
2278 |
// are working in win32 versions of php. (copied from phpBB) |
|
2279 |
// |
|
2280 |
if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$use_smtp) |
|
2281 |
{ |
|
2282 |
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; |
|
2283 |
||
2284 |
// We are running on windows, force delivery to use our smtp functions |
|
2285 |
// since php's are broken by default |
|
2286 |
$use_smtp = true; |
|
2287 |
$enano_config['smtp_server'] = @$ini_val('SMTP'); |
|
2288 |
} |
|
2289 |
||
2290 |
$mail = new emailer( !empty($use_smtp) ); |
|
2291 |
||
2292 |
// Validate subject/message body |
|
2293 |
$subject = stripslashes(trim($_POST['subject'])); |
|
2294 |
$message = stripslashes(trim($_POST['message'])); |
|
2295 |
||
2296 |
if ( empty($subject) ) |
|
2297 |
$errors[] = 'Please enter a subject.'; |
|
2298 |
if ( empty($message) ) |
|
2299 |
$errors[] = 'Please enter a message.'; |
|
2300 |
||
2301 |
// Get list of members |
|
2302 |
if ( !empty($_POST['userlist']) ) |
|
2303 |
{ |
|
2304 |
$userlist = str_replace(', ', ',', $_POST['userlist']); |
|
2305 |
$userlist = explode(',', $userlist); |
|
2306 |
foreach ( $userlist as $k => $u ) |
|
2307 |
{ |
|
2308 |
if ( $u == $session->username ) |
|
2309 |
{ |
|
2310 |
// Message is automatically sent to the sender |
|
2311 |
unset($userlist[$k]); |
|
2312 |
} |
|
2313 |
else |
|
2314 |
{ |
|
2315 |
$userlist[$k] = $db->escape($u); |
|
2316 |
} |
|
2317 |
} |
|
2318 |
$userlist = 'WHERE username=\'' . implode('\' OR username=\'', $userlist) . '\''; |
|
2319 |
||
2320 |
$q = $db->sql_query('SELECT email FROM '.table_prefix.'users ' . $userlist . ';'); |
|
2321 |
if ( !$q ) |
|
2322 |
$db->_die(); |
|
2323 |
||
2324 |
if ( $row = $db->fetchrow() ) |
|
2325 |
{ |
|
2326 |
do { |
|
2327 |
$mail->cc($row['email']); |
|
2328 |
} while ( $row = $db->fetchrow() ); |
|
2329 |
} |
|
2330 |
||
2331 |
$db->free_result(); |
|
2332 |
||
2333 |
} |
|
2334 |
else |
|
2335 |
{ |
|
2336 |
// Sending to a usergroup |
|
2337 |
||
2338 |
$group_id = intval($_POST['group_id']); |
|
2339 |
if ( $group_id < 1 ) |
|
2340 |
{ |
|
2341 |
$errors[] = 'Invalid group ID'; |
|
2342 |
} |
|
2343 |
else |
|
2344 |
{ |
|
2345 |
$q = $db->sql_query('SELECT u.email FROM '.table_prefix.'group_members AS g |
|
2346 |
LEFT JOIN '.table_prefix.'users AS u |
|
2347 |
ON (u.user_id=g.user_id) |
|
2348 |
WHERE g.group_id=' . $group_id . ';'); |
|
2349 |
if ( !$q ) |
|
2350 |
$db->_die(); |
|
2351 |
||
2352 |
if ( $row = $db->fetchrow() ) |
|
2353 |
{ |
|
2354 |
do { |
|
2355 |
$mail->cc($row['email']); |
|
2356 |
} while ( $row = $db->fetchrow() ); |
|
2357 |
} |
|
2358 |
||
2359 |
$db->free_result(); |
|
2360 |
} |
|
2361 |
} |
|
2362 |
||
2363 |
if ( sizeof($errors) < 1 ) |
|
2364 |
{ |
|
2365 |
||
2366 |
$mail->from(getConfig('contact_email')); |
|
2367 |
$mail->replyto(getConfig('contact_email')); |
|
2368 |
$mail->set_subject($subject); |
|
2369 |
$mail->email_address(getConfig('contact_email')); |
|
2370 |
||
2371 |
// Copied/modified from phpBB |
|
2372 |
$email_headers = 'X-AntiAbuse: Website server name - ' . $_SERVER['SERVER_NAME'] . "\n"; |
|
2373 |
$email_headers .= 'X-AntiAbuse: User_id - ' . $session->user_id . "\n"; |
|
2374 |
$email_headers .= 'X-AntiAbuse: Username - ' . $session->username . "\n"; |
|
2375 |
$email_headers .= 'X-AntiAbuse: User IP - ' . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
2376 |
||
2377 |
$mail->extra_headers($email_headers); |
|
2378 |
||
2379 |
$tpl = 'The following message was mass-mailed by {SENDER}, one of the administrators from {SITE_NAME}. If this message contains spam or any comments which you find abusive or offensive, please contact the administration team at: |
|
2380 |
||
2381 |
{CONTACT_EMAIL} |
|
2382 |
||
2383 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
2384 |
{MESSAGE} |
|
2385 |
'; |
|
2386 |
||
2387 |
$mail->use_template($tpl); |
|
2388 |
||
2389 |
$mail->assign_vars(array( |
|
2390 |
'SENDER' => $session->username, |
|
2391 |
'SITE_NAME' => getConfig('site_name'), |
|
2392 |
'CONTACT_EMAIL' => getConfig('contact_email'), |
|
2393 |
'MESSAGE' => $message |
|
2394 |
)); |
|
2395 |
||
2396 |
//echo '<pre>'.print_r($mail,true).'</pre>'; |
|
2397 |
||
2398 |
// All done |
|
2399 |
$mail->send(); |
|
2400 |
$mail->reset(); |
|
2401 |
||
2402 |
echo '<div class="info-box">Your message has been sent.</div>'; |
|
2403 |
||
2404 |
} |
|
2405 |
else |
|
2406 |
{ |
|
2407 |
echo '<div class="warning-box">Could not send message for the following reason(s):<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>'; |
|
2408 |
} |
|
2409 |
||
2410 |
} |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2411 |
else if ( isset($_POST['do_send']) && defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2412 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2413 |
echo '<div class="error-box">This function is disabled in the demo. You think demo@enanocms.org likes getting "test" mass e-mails?</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2414 |
} |
0 | 2415 |
echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post">'; |
2416 |
?> |
|
2417 |
<div class="tblholder"> |
|
2418 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
2419 |
<tr> |
|
2420 |
<th colspan="2">Send mass e-mail</th> |
|
2421 |
</tr> |
|
2422 |
<tr> |
|
2423 |
<td class="row2" rowspan="2" style="width: 30%; min-width: 200px;"> |
|
2424 |
Send message to:<br /> |
|
2425 |
<small> |
|
2426 |
By default, this message will be sent to the group selected here. You may instead send the message to a specific |
|
2427 |
list of users by entering them in the second row, with usernames separated by a single comma (no space). |
|
2428 |
</small> |
|
2429 |
</td> |
|
2430 |
<td class="row1"> |
|
2431 |
<select name="group_id"> |
|
2432 |
<?php |
|
2433 |
$q = $db->sql_query('SELECT group_name,group_id FROM '.table_prefix.'groups ORDER BY group_name ASC;'); |
|
2434 |
if ( !$q ) |
|
2435 |
$db->_die(); |
|
2436 |
while ( $row = $db->fetchrow() ) |
|
2437 |
{ |
|
2438 |
echo '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; |
|
2439 |
} |
|
2440 |
?> |
|
2441 |
</select> |
|
2442 |
</td> |
|
2443 |
</tr> |
|
2444 |
<tr> |
|
2445 |
<td class="row1"> |
|
2446 |
Usernames: <input type="text" name="userlist" size="50" /> |
|
2447 |
</td> |
|
2448 |
</tr> |
|
2449 |
<tr> |
|
2450 |
<td class="row2" style="width: 30%; min-width: 200px;"> |
|
2451 |
Subject: |
|
2452 |
</td> |
|
2453 |
<td class="row1"> |
|
2454 |
<input name="subject" type="text" size="50" /> |
|
2455 |
</td> |
|
2456 |
</tr> |
|
2457 |
<tr> |
|
2458 |
<td class="row2" style="width: 30%; min-width: 200px;"> |
|
2459 |
Message: |
|
2460 |
</td> |
|
2461 |
<td class="row1"> |
|
2462 |
<textarea name="message" rows="30" cols="60" style="width: 100%;"></textarea> |
|
2463 |
</td> |
|
2464 |
</tr> |
|
2465 |
<tr> |
|
2466 |
<th class="subhead" colspan="2" style="text-align: left;" valign="middle"> |
|
2467 |
<div style="float: right;"><input type="submit" name="do_send" value="Send message" /></div> |
|
2468 |
<small style="font-weight: normal;">Please be warned: it may take a LONG time to send this message. <b>Please do not stop the script until the process is finished.</b></small> |
|
2469 |
</th> |
|
2470 |
</tr> |
|
2471 |
||
2472 |
</table> |
|
2473 |
</div> |
|
2474 |
<?php |
|
2475 |
echo '</form>'; |
|
2476 |
} |
|
2477 |
||
2478 |
function page_Admin_DBBackup() |
|
2479 |
{ |
|
2480 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
2481 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
2482 |
{ |
|
2483 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
2484 |
return; |
|
2485 |
} |
|
2486 |
||
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2487 |
if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes' && defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2488 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2489 |
redirect(makeUrlComplete('Special', 'Administration'), 'Access denied', 'You\'ve got to be kidding me. Forget it, kid.', 4 ); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2490 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2491 |
|
0 | 2492 |
global $system_table_list; |
2493 |
if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes') |
|
2494 |
{ |
|
2495 |
||
2496 |
if(defined('SQL_BACKUP_CRYPT')) |
|
2497 |
// Try to increase our time limit |
|
2498 |
@set_time_limit(300); // five minutes |
|
2499 |
// Do the actual export |
|
2500 |
$aesext = ( defined('SQL_BACKUP_CRYPT') ) ? '.tea' : ''; |
|
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:
102
diff
changeset
|
2501 |
$filename = 'enano_backup_' . date('ymd') . '.sql' . $aesext; |
0 | 2502 |
ob_start(); |
2503 |
header('Content-disposition: attachment, filename="'.$filename.'";'); |
|
2504 |
header('Content-type: application/transact-sql'); |
|
2505 |
// Spew some headers |
|
2506 |
$headdate = date('F d, Y \a\t h:i a'); |
|
2507 |
echo <<<HEADER |
|
2508 |
-- Enano CMS SQL backup |
|
2509 |
-- Generated on {$headdate} by {$session->username} |
|
2510 |
||
2511 |
HEADER; |
|
2512 |
// build the table list |
|
2513 |
$base = ( isset($_POST['do_system_tables']) ) ? $system_table_list : Array(); |
|
2514 |
$add = ( isset($_POST['additional_tables'])) ? $_POST['additional_tables'] : Array(); |
|
2515 |
$tables = array_merge($base, $add); |
|
2516 |
||
2517 |
// Log it! |
|
2518 |
$e = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary,page_text) VALUES(\'security\', \'db_backup\', '.time().', \''.date('d M Y h:i a').'\', \''.$db->escape($session->username).'\', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', \'' . $db->escape(implode(', ', $tables)) . '\')'); |
|
2519 |
if ( !$e ) |
|
2520 |
$db->_die(); |
|
2521 |
||
2522 |
foreach($tables as $i => $t) |
|
2523 |
{ |
|
2524 |
if(!preg_match('#^([a-z0-9_]+)$#i', $t)) |
|
2525 |
die('Hacking attempt'); |
|
2526 |
// if($t == table_prefix.'files' && isset($_POST['do_data'])) |
|
2527 |
// unset($tables[$i]); |
|
2528 |
} |
|
2529 |
foreach($tables as $t) |
|
2530 |
{ |
|
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:
102
diff
changeset
|
2531 |
// THE FOLLOWING COMMENT DOES NOT APPLY AS OF 1.0. |
0 | 2532 |
// Sorry folks - this script CAN'T backup enano_files, enano_search_index, and enano_search_cache due to the sheer size of the tables. |
2533 |
// If encryption is enabled the log data will be excluded too. |
|
2534 |
echo export_table( |
|
2535 |
$t, |
|
2536 |
isset($_POST['do_struct']), |
|
2537 |
( isset($_POST['do_data']) /* && $t != table_prefix.'files' && $t != table_prefix.'search_index' && $t != table_prefix.'search_cache' && ( !defined('SQL_BACKUP_CRYPT') || ( defined('SQL_BACKUP_CRYPT') && $t != table_prefix.'logs' ) ) */ ), |
|
2538 |
false |
|
2539 |
) . "\n"; |
|
2540 |
} |
|
2541 |
$data = ob_get_contents(); |
|
2542 |
ob_end_clean(); |
|
2543 |
if(defined('SQL_BACKUP_CRYPT')) |
|
2544 |
{ |
|
2545 |
// Free some memory, we don't need this stuff any more |
|
2546 |
$db->close(); |
|
2547 |
unset($paths, $db, $template, $plugins); |
|
2548 |
$tea = new TEACrypt(); |
|
2549 |
$data = $tea->encrypt($data, $session->private_key); |
|
2550 |
} |
|
2551 |
header('Content-length: '.strlen($data)); |
|
2552 |
echo $data; |
|
2553 |
exit; |
|
2554 |
} |
|
2555 |
else |
|
2556 |
{ |
|
2557 |
// Show the UI |
|
2558 |
echo '<form action="'.makeUrlNS('Admin', 'DBBackup', 'submitting=yes', true).'" method="post" enctype="multipart/form-data">'; |
|
2559 |
?> |
|
2560 |
<p>This page allows you to back up your Enano database should something go miserably wrong.</p> |
|
2561 |
<p><label><input type="checkbox" name="do_system_tables" checked="checked" /> Export tables that are part of the Enano core</label><p> |
|
2562 |
<p>Additional tables to export:</p> |
|
2563 |
<p><select name="additional_tables[]" multiple="multiple"> |
|
2564 |
<?php |
|
2565 |
$q = $db->sql_query('SHOW TABLES;') or $db->_die('Somehow we were denied the request to get the list of tables.'); |
|
2566 |
while($row = $db->fetchrow_num()) |
|
2567 |
{ |
|
2568 |
if(!in_array($row[0], $system_table_list)) echo '<option value="'.$row[0].'">'.$row[0].'</option>'; |
|
2569 |
} |
|
2570 |
?> |
|
2571 |
</select> |
|
2572 |
</p> |
|
2573 |
<p><label><input type="checkbox" name="do_struct" checked="checked" /> Include table structure</label><br /> |
|
2574 |
<label><input type="checkbox" name="do_data" checked="checked" /> Include table data</label> |
|
2575 |
</p> |
|
2576 |
<p><input type="submit" value="Create backup" /></p> |
|
2577 |
<?php |
|
2578 |
echo '</form>'; |
|
2579 |
} |
|
2580 |
} |
|
2581 |
||
2582 |
function page_Admin_AdminLogout() |
|
2583 |
{ |
|
2584 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
2585 |
if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
|
2586 |
{ |
|
2587 |
echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>'; |
|
2588 |
return; |
|
2589 |
} |
|
2590 |
||
2591 |
$session->logout(USER_LEVEL_ADMIN); |
|
2592 |
echo '<h3>You have now been logged out of the administration panel.</h3><p>You will continue to be logged into the website, but you will need to re-authenticate before you can access the administration panel again.</p><p>Return to the <a href="'.makeUrl(getConfig('main_page')).'">Main Page</a>.</p>'; |
|
2593 |
} |
|
2594 |
||
2595 |
function page_Special_Administration() |
|
2596 |
{ |
|
2597 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
2598 |
||
2599 |
if($session->auth_level < USER_LEVEL_ADMIN) { |
|
2600 |
redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), 'Not authorized', 'You need an authorization level of '.USER_LEVEL_ADMIN.' to use this page, your auth level is: ' . $session->auth_level, 0); |
|
2601 |
exit; |
|
2602 |
} |
|
2603 |
else |
|
2604 |
{ |
|
2605 |
$template->load_theme('admin', 'default'); |
|
2606 |
$template->init_vars(); |
|
2607 |
if( !isset( $_GET['noheaders'] ) ) |
|
2608 |
{ |
|
2609 |
$template->header(); |
|
2610 |
} |
|
2611 |
echo 'Administer your Enano website.'; |
|
2612 |
?> |
|
2613 |
<script type="text/javascript"> |
|
2614 |
function ajaxPage(t) |
|
2615 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2616 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2617 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2618 |
document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2619 |
return false; |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2620 |
} |
0 | 2621 |
if ( t == namespace_list.Admin + 'AdminLogout' ) |
2622 |
{ |
|
2623 |
var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, 'Are you sure you want to de-authenticate?', 'If you de-authenticate, you will no longer be able to use the administration panel until you re-authenticate again. You may do so at any time using the Administration button on the sidebar.'); |
|
2624 |
mb.onclick['Yes'] = function() { |
|
2625 |
var tigraentry = document.getElementById('i_div0_0').parentNode; |
|
2626 |
var tigraobj = $(tigraentry); |
|
2627 |
var div = document.createElement('div'); |
|
2628 |
div.style.backgroundColor = '#FFFFFF'; |
|
2629 |
domObjChangeOpac(70, div); |
|
2630 |
div.style.position = 'absolute'; |
|
2631 |
var top = tigraobj.Top(); |
|
2632 |
var left = tigraobj.Left(); |
|
2633 |
var width = tigraobj.Width(); |
|
2634 |
var height = tigraobj.Height(); |
|
2635 |
div.style.top = top + 'px'; |
|
2636 |
div.style.left = left + 'px'; |
|
2637 |
div.style.width = width + 'px'; |
|
2638 |
div.style.height = height + 'px'; |
|
2639 |
var body = document.getElementsByTagName('body')[0]; |
|
2640 |
enlighten(true); |
|
2641 |
body.appendChild(div); |
|
2642 |
ajaxPageBin(namespace_list.Admin + 'AdminLogout'); |
|
2643 |
} |
|
2644 |
return; |
|
2645 |
} |
|
2646 |
ajaxPageBin(t); |
|
2647 |
} |
|
2648 |
function ajaxPageBin(t) |
|
2649 |
{ |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2650 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2651 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2652 |
document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2653 |
return false; |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2654 |
} |
0 | 2655 |
document.getElementById('ajaxPageContainer').innerHTML = '<div class="wait-box">Loading page...</div>'; |
2656 |
ajaxGet('<?php echo scriptPath; ?>/ajax.php?title='+t+'&_mode=getpage&noheaders&auth=<?php echo $session->sid_super; ?>', function() { |
|
2657 |
if(ajax.readyState == 4) { |
|
2658 |
document.getElementById('ajaxPageContainer').innerHTML = ajax.responseText; |
|
2659 |
fadeInfoBoxes(); |
|
2660 |
} |
|
2661 |
}); |
|
2662 |
} |
|
2663 |
function _enanoAdminOnload() { ajaxPage('<?php echo $paths->nslist['Admin']; ?>Home'); } |
|
2664 |
var TREE_TPL = { |
|
2665 |
'target' : '_self', // name of the frame links will be opened in |
|
2666 |
// other possible values are: _blank, _parent, _search, _self and _top |
|
2667 |
||
2668 |
'icon_e' : '<?php echo scriptPath; ?>/images/icons/empty.gif', // empty image |
|
2669 |
'icon_l' : '<?php echo scriptPath; ?>/images/icons/line.gif', // vertical line |
|
2670 |
'icon_32' : '<?php echo scriptPath; ?>/images/icons/base.gif', // root leaf icon normal |
|
2671 |
'icon_36' : '<?php echo scriptPath; ?>/images/icons/base.gif', // root leaf icon selected |
|
2672 |
'icon_48' : '<?php echo scriptPath; ?>/images/icons/base.gif', // root icon normal |
|
2673 |
'icon_52' : '<?php echo scriptPath; ?>/images/icons/base.gif', // root icon selected |
|
2674 |
'icon_56' : '<?php echo scriptPath; ?>/images/icons/base.gif', // root icon opened |
|
2675 |
'icon_60' : '<?php echo scriptPath; ?>/images/icons/base.gif', // root icon selected |
|
2676 |
'icon_16' : '<?php echo scriptPath; ?>/images/icons/folder.gif', // node icon normal |
|
2677 |
'icon_20' : '<?php echo scriptPath; ?>/images/icons/folderopen.gif', // node icon selected |
|
2678 |
'icon_24' : '<?php echo scriptPath; ?>/images/icons/folder.gif', // node icon opened |
|
2679 |
'icon_28' : '<?php echo scriptPath; ?>/images/icons/folderopen.gif', // node icon selected opened |
|
2680 |
'icon_0' : '<?php echo scriptPath; ?>/images/icons/page.gif', // leaf icon normal |
|
2681 |
'icon_4' : '<?php echo scriptPath; ?>/images/icons/page.gif', // leaf icon selected |
|
2682 |
'icon_8' : '<?php echo scriptPath; ?>/images/icons/page.gif', // leaf icon opened |
|
2683 |
'icon_12' : '<?php echo scriptPath; ?>/images/icons/page.gif', // leaf icon selected |
|
2684 |
'icon_2' : '<?php echo scriptPath; ?>/images/icons/joinbottom.gif', // junction for leaf |
|
2685 |
'icon_3' : '<?php echo scriptPath; ?>/images/icons/join.gif', // junction for last leaf |
|
2686 |
'icon_18' : '<?php echo scriptPath; ?>/images/icons/plusbottom.gif', // junction for closed node |
|
2687 |
'icon_19' : '<?php echo scriptPath; ?>/images/icons/plus.gif', // junction for last closed node |
|
2688 |
'icon_26' : '<?php echo scriptPath; ?>/images/icons/minusbottom.gif',// junction for opened node |
|
2689 |
'icon_27' : '<?php echo scriptPath; ?>/images/icons/minus.gif' // junction for last opended node |
|
2690 |
}; |
|
118
0c5efda996bf
Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents:
116
diff
changeset
|
2691 |
addOnloadHook(keepalive_onload); |
0 | 2692 |
<?php |
2693 |
echo $paths->parseAdminTree(); // Make a Javascript array that defines the tree |
|
2694 |
if(!isset($_GET['module'])) { echo 'addOnloadHook(_enanoAdminOnload);'; } ?> |
|
2695 |
</script> |
|
2696 |
<table border="0" width="100%"> |
|
2697 |
<tr> |
|
2698 |
<td class="holder" valign="top"> |
|
2699 |
<div class="pad" style="padding-right: 20px;"> |
|
2700 |
<script type="text/javascript"> |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2701 |
if ( !KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2702 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2703 |
new tree(TREE_ITEMS, TREE_TPL); |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2704 |
} |
0 | 2705 |
</script> |
2706 |
</div> |
|
2707 |
</td> |
|
2708 |
<td width="100%" valign="top"> |
|
2709 |
<div class="pad" id="ajaxPageContainer"> |
|
2710 |
<?php |
|
2711 |
if(isset($_GET['module'])) |
|
2712 |
{ |
|
2713 |
// Look for a namespace prefix in the urlname, and assign a different namespace, if necessary |
|
2714 |
$k = array_keys($paths->nslist); |
|
2715 |
for ( $i = 0; $i < sizeof($paths->nslist); $i++ ) |
|
2716 |
{ |
|
2717 |
$ln = strlen( $paths->nslist[ $k[ $i ] ] ); |
|
2718 |
if ( substr($_GET['module'], 0, $ln) == $paths->nslist[$k[$i]] ) |
|
2719 |
{ |
|
2720 |
$ns = $k[$i]; |
|
2721 |
$nm = substr($_GET['module'], $ln, strlen($_GET['module'])); |
|
2722 |
} |
|
2723 |
} |
|
2724 |
$fname = 'page_'.$ns.'_'.$nm; |
|
2725 |
$s = strpos($fname, '?noheaders'); |
|
2726 |
if($s) $fname = substr($fname, 0, $s); |
|
2727 |
$paths->cpage['module'] = $_GET['module']; |
|
2728 |
if ( function_exists($fname) && $_GET['module'] != $paths->nslist['Special'] . 'Administration' ) |
|
2729 |
{ |
|
2730 |
eval($fname.'();'); |
|
2731 |
} |
|
2732 |
} |
|
2733 |
else |
|
2734 |
{ |
|
179
36b287f1d85c
[F] Added support for account lockouts. User is locked out or required to complete a CAPTCHA after specified threshold for specified period.
Dan
parents:
166
diff
changeset
|
2735 |
echo '<script type="text/javascript">document.write(\'<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>\');</script><noscript><div class="error-box">It looks like Javascript isn\'t enabled in your browser. Please enable Javascript or use a different browser to continue.</div></noscript>'; |
0 | 2736 |
} |
2737 |
?> |
|
2738 |
</div> |
|
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2739 |
<script type="text/javascript"> |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2740 |
if ( KILL_SWITCH ) |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2741 |
{ |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2742 |
document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2743 |
} |
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents:
43
diff
changeset
|
2744 |
</script> |
0 | 2745 |
</td> |
2746 |
</tr> |
|
2747 |
</table> |
|
2748 |
||
2749 |
<?php |
|
2750 |
} |
|
2751 |
if(!isset($_GET['noheaders'])) |
|
2752 |
{ |
|
2753 |
$template->footer(); |
|
2754 |
} |
|
2755 |
} |
|
2756 |
||
2757 |
function page_Special_EditSidebar() |
|
2758 |
{ |
|
2759 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
2760 |
||
2761 |
if($session->auth_level < USER_LEVEL_ADMIN) |
|
2762 |
{ |
|
2763 |
redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), '', '', false); |
|
2764 |
exit; |
|
2765 |
} |
|
2766 |
else |
|
2767 |
{ |
|
2768 |
||
2769 |
$template->add_header('<script type="text/javascript" src="'.scriptPath.'/includes/clientside/dbx.js"></script>'); |
|
2770 |
$template->add_header('<script type="text/javascript" src="'.scriptPath.'/includes/clientside/dbx-key.js"></script>'); |
|
2771 |
$template->add_header('<script type="text/javascript" src="'.scriptPath.'/includes/clientside/sbedit.js"></script>'); |
|
2772 |
$template->add_header('<link rel="stylesheet" type="text/css" href="'.scriptPath.'/includes/clientside/dbx.css" />'); |
|
2773 |
||
2774 |
// Knock the sidebars dead to keep javascript in plugins from interfering |
|
2775 |
$template->tpl_strings['SIDEBAR_LEFT'] = ''; |
|
2776 |
$template->tpl_strings['SIDEBAR_RIGHT'] = ''; |
|
2777 |
||
2778 |
$template->load_theme('oxygen', 'bleu'); |
|
2779 |
$template->init_vars(); |
|
2780 |
||
2781 |
$template->header(); |
|
2782 |
||
2783 |
if(isset($_POST['save'])) |
|
2784 |
{ |
|
2785 |
// Write the new block order to the database |
|
2786 |
// The only way to do this is with tons of queries (one per block + one select query at the start to count everything) but afaik its safe... |
|
2787 |
// Anyone know a better way to do this? |
|
2788 |
$q = $db->sql_query('SELECT item_order,item_id,sidebar_id FROM '.table_prefix.'sidebar ORDER BY sidebar_id ASC, item_order ASC;'); |
|
2789 |
if ( !$q ) |
|
2790 |
{ |
|
2791 |
$db->_die('The sidebar order data could not be selected.'); |
|
2792 |
} |
|
2793 |
$orders = Array(); |
|
2794 |
while($row = $db->fetchrow()) |
|
2795 |
{ |
|
2796 |
$orders[] = Array( |
|
2797 |
count($orders), |
|
2798 |
$row['item_id'], |
|
2799 |
$row['sidebar_id'], |
|
2800 |
); |
|
2801 |
} |
|
2802 |
$db->free_result(); |
|
2803 |
||
2804 |
// We now have an array with each sidebar ID in its respective order. Explode the order string in $_POST['order_(left|right)'] and use it to build a set of queries. |
|
2805 |
$ol = explode(',', $_POST['order_left']); |
|
2806 |
$odr = explode(',', $_POST['order_right']); |
|
2807 |
$om = array_merge($ol, $odr); |
|
2808 |
unset($ol, $odr); |
|
2809 |
$queries = Array(); |
|
2810 |
foreach($orders as $k => $v) |
|
2811 |
{ |
|
2812 |
$queries[] = 'UPDATE '.table_prefix.'sidebar SET item_order='.$om[$k].' WHERE item_id='.$v[1].';'; |
|
2813 |
} |
|
2814 |
foreach($queries as $sql) |
|
2815 |
{ |
|
2816 |
$q = $db->sql_query($sql); |
|
2817 |
if(!$q) |
|
2818 |
{ |
|
2819 |
$t = $db->get_error(); |
|
2820 |
echo $t; |
|
2821 |
$template->footer(); |
|
2822 |
exit; |
|
2823 |
} |
|
2824 |
} |
|
2825 |
echo '<div class="info-box" style="margin: 10px 0;">The sidebar order information was updated successfully.</div>'; |
|
2826 |
} |
|
2827 |
elseif(isset($_POST['create'])) |
|
2828 |
{ |
|
2829 |
switch((int)$_POST['type']) |
|
2830 |
{ |
|
2831 |
case BLOCK_WIKIFORMAT: |
|
2832 |
$content = $_POST['wikiformat_content']; |
|
2833 |
break; |
|
2834 |
case BLOCK_TEMPLATEFORMAT: |
|
2835 |
$content = $_POST['templateformat_content']; |
|
2836 |
break; |
|
2837 |
case BLOCK_HTML: |
|
2838 |
$content = $_POST['html_content']; |
|
2839 |
break; |
|
2840 |
case BLOCK_PHP: |
|
2841 |
$content = $_POST['php_content']; |
|
2842 |
break; |
|
2843 |
case BLOCK_PLUGIN: |
|
2844 |
$content = $_POST['plugin_id']; |
|
2845 |
break; |
|
2846 |
} |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2847 |
|
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2848 |
if ( defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2849 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2850 |
// Sanitize the HTML |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2851 |
$content = sanitize_html($content, true); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2852 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2853 |
|
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2854 |
if ( defined('ENANO_DEMO_MODE') && intval($_POST['type']) == BLOCK_PHP ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2855 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2856 |
echo '<div class="error-box" style="margin: 10px 0 10px 0;">Adding PHP code blocks in the Enano administration demo has been disabled for security reasons.</div>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2857 |
$_POST['php_content'] = '?><Nulled>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2858 |
$content = $_POST['php_content']; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2859 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2860 |
|
0 | 2861 |
// Get the value of item_order |
2862 |
||
2863 |
$q = $db->sql_query('SELECT * FROM '.table_prefix.'sidebar WHERE sidebar_id='.$db->escape($_POST['sidebar_id']).';'); |
|
2864 |
if(!$q) $db->_die('The order number could not be selected'); |
|
2865 |
$io = $db->numrows(); |
|
2866 |
||
2867 |
$db->free_result(); |
|
2868 |
||
2869 |
$q = 'INSERT INTO '.table_prefix.'sidebar(block_name, block_type, sidebar_id, block_content, item_order) VALUES ( \''.$db->escape($_POST['title']).'\', \''.$db->escape($_POST['type']).'\', \''.$db->escape($_POST['sidebar_id']).'\', \''.$db->escape($content).'\', '.$io.' );'; |
|
2870 |
$result = $db->sql_query($q); |
|
2871 |
if(!$result) |
|
2872 |
{ |
|
2873 |
echo $db->get_error(); |
|
2874 |
$template->footer(); |
|
2875 |
exit; |
|
2876 |
} |
|
2877 |
||
2878 |
echo '<div class="info-box" style="margin: 10px 0;">The item was added.</div>'; |
|
2879 |
||
2880 |
} |
|
2881 |
||
2882 |
if(isset($_GET['action']) && isset($_GET['id'])) |
|
2883 |
{ |
|
162
e1a22031b5bd
Major revamps to the template parser. Fixed a few security holes that could allow PHP to be injected in untimely places in TPL code. Improved Ux for XSS attempt in tplWikiFormat. Documented many functions. Backported much cleaner parser from 2.0 branch. Beautified a lot of code in the depths of the template class. Pretty much a small-scale Extreme Makeover.
Dan
parents:
142
diff
changeset
|
2884 |
if(!preg_match('#^([0-9]*)$#', $_GET['id'])) |
0 | 2885 |
{ |
2886 |
echo '<div class="warning-box">Error with action: $_GET["id"] was not an integer, aborting to prevent SQL injection</div>'; |
|
2887 |
} |
|
2888 |
switch($_GET['action']) |
|
2889 |
{ |
|
2890 |
case 'new': |
|
2891 |
?> |
|
2892 |
<script type="text/javascript"> |
|
2893 |
function setType(input) |
|
2894 |
{ |
|
2895 |
val = input.value; |
|
2896 |
if(!val) |
|
2897 |
{ |
|
2898 |
return false; |
|
2899 |
} |
|
2900 |
var divs = getElementsByClassName(document, 'div', 'sbadd_block'); |
|
2901 |
for(var i in divs) |
|
2902 |
{ |
|
2903 |
if(divs[i].id == 'blocktype_'+val) divs[i].style.display = 'block'; |
|
2904 |
else divs[i].style.display = 'none'; |
|
2905 |
} |
|
2906 |
} |
|
2907 |
</script> |
|
2908 |
||
2909 |
<form action="<?php echo makeUrl($paths->page); ?>" method="post"> |
|
2910 |
||
2911 |
<p> |
|
2912 |
What type of block should this be? |
|
2913 |
</p> |
|
2914 |
<p> |
|
2915 |
<select name="type" onchange="setType(this)"> <?php /* (NOT WORKING, at least in firefox 2) onload="var thingy = this; setTimeout('setType(thingy)', 500);" */ ?> |
|
2916 |
<option value="<?php echo BLOCK_WIKIFORMAT; ?>">Wiki-formatted block</option> |
|
2917 |
<option value="<?php echo BLOCK_TEMPLATEFORMAT; ?>">Template-formatted block (old pre-beta 3 behavior)</option> |
|
2918 |
<option value="<?php echo BLOCK_HTML; ?>">Raw HTML block</option> |
|
2919 |
<option value="<?php echo BLOCK_PHP; ?>">PHP code block (danger, Will Robinson!)</option> |
|
2920 |
<option value="<?php echo BLOCK_PLUGIN; ?>">Use code from a plugin</option> |
|
2921 |
</select> |
|
2922 |
</p> |
|
2923 |
||
2924 |
<p> |
|
2925 |
||
2926 |
Block title: <input name="title" type="text" size="40" /><br /> |
|
2927 |
Which sidebar: <select name="sidebar_id"><option value="<?php echo SIDEBAR_LEFT; ?>">Left</option><option value="<?php echo SIDEBAR_RIGHT; ?>">Right</option></select> |
|
2928 |
||
2929 |
</p> |
|
2930 |
||
2931 |
<div class="sbadd_block" id="blocktype_<?php echo BLOCK_WIKIFORMAT; ?>"> |
|
2932 |
<p> |
|
2933 |
Wikitext: |
|
2934 |
</p> |
|
2935 |
<p> |
|
2936 |
<textarea style="width: 98%;" name="wikiformat_content" rows="15" cols="50"></textarea> |
|
2937 |
</p> |
|
2938 |
</div> |
|
2939 |
||
2940 |
<div class="sbadd_block" id="blocktype_<?php echo BLOCK_TEMPLATEFORMAT; ?>"> |
|
2941 |
<p> |
|
2942 |
Template code: |
|
2943 |
</p> |
|
2944 |
<p> |
|
2945 |
<textarea style="width: 98%;" name="templateformat_content" rows="15" cols="50"></textarea> |
|
2946 |
</p> |
|
2947 |
</div> |
|
2948 |
||
2949 |
<div class="sbadd_block" id="blocktype_<?php echo BLOCK_HTML; ?>"> |
|
2950 |
<p> |
|
2951 |
HTML to place inside the sidebar: |
|
2952 |
</p> |
|
2953 |
<p> |
|
2954 |
<textarea style="width: 98%;" name="html_content" rows="15" cols="50"></textarea> |
|
2955 |
</p> |
|
2956 |
</div> |
|
2957 |
||
2958 |
<div class="sbadd_block" id="blocktype_<?php echo BLOCK_PHP; ?>"> |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2959 |
<?php if ( defined('ENANO_DEMO_MODE') ) { ?> |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2960 |
<p>Creating PHP blocks in demo mode is disabled for security reasons.</p> |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2961 |
<?php } else { ?> |
0 | 2962 |
<p> |
2963 |
<b>WARNING:</b> If you don't know what you're doing, or if you are not fluent in PHP, stop now and choose a different block type. You will brick your Enano installation if you are not careful here. |
|
2964 |
ALWAYS remember to write secure code! The Enano team is not responsible if someone drops all your tables because of an SQL injection vulnerability in your sidebar code. You are probably better off using the template-formatted block type. |
|
2965 |
</p> |
|
2966 |
<p> |
|
2967 |
<span style="color: red;"> |
|
2968 |
It is especially important to note that this code is NOT checked for errors! If there is a syntax error in your code here, it will prevent any pages from loading AT ALL. So you need to use an external PHP editor (like <a href="http://www.jedit.org">jEdit</a>) to check your syntax before you hit save. |
|
2969 |
</span> You have been warned. |
|
2970 |
</p> |
|
2971 |
<p> |
|
2972 |
Also, you should avoid using output buffering functions (ob_[start|end|get_contents|clean]) here, because Enano uses those to track output from this script. |
|
2973 |
</p> |
|
2974 |
<p> |
|
2975 |
The standard <?php and ?> tags work here. Don't use an initial "<?php" or it will cause a parse error. |
|
2976 |
</p> |
|
2977 |
<p> |
|
2978 |
PHP code: |
|
2979 |
</p> |
|
2980 |
<p> |
|
2981 |
<textarea style="width: 98%;" name="php_content" rows="15" cols="50"></textarea> |
|
2982 |
</p> |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
2983 |
<?php } ?> |
0 | 2984 |
</div> |
2985 |
||
2986 |
<div class="sbadd_block" id="blocktype_<?php echo BLOCK_PLUGIN; ?>"> |
|
2987 |
<p> |
|
2988 |
Plugin: |
|
2989 |
</p> |
|
2990 |
<p> |
|
2991 |
<select name="plugin_id"> |
|
2992 |
<?php |
|
2993 |
foreach($template->plugin_blocks as $k => $c) |
|
2994 |
{ |
|
2995 |
echo '<option value="'.$k.'">'.$k.'</option>'; |
|
2996 |
} |
|
2997 |
?> |
|
2998 |
</select> |
|
2999 |
</p> |
|
3000 |
</div> |
|
3001 |
||
3002 |
<p> |
|
3003 |
||
3004 |
<input type="submit" name="create" value="Create new block" style="font-weight: bold;" /> |
|
3005 |
<input type="submit" name="cancel" value="Cancel" /> |
|
3006 |
||
3007 |
</p> |
|
3008 |
||
3009 |
</form> |
|
3010 |
||
3011 |
<script type="text/javascript"> |
|
3012 |
var divs = getElementsByClassName(document, 'div', 'sbadd_block'); |
|
3013 |
for(var i in divs) |
|
3014 |
{ |
|
3015 |
if(divs[i].id != 'blocktype_<?php echo BLOCK_WIKIFORMAT; ?>') setTimeout("document.getElementById('"+divs[i].id+"').style.display = 'none';", 500); |
|
3016 |
} |
|
3017 |
</script> |
|
3018 |
||
3019 |
<?php |
|
3020 |
$template->footer(); |
|
3021 |
return; |
|
3022 |
break; |
|
3023 |
case 'move': |
|
3024 |
if( !isset($_GET['side']) || ( isset($_GET['side']) && !preg_match('#^([0-9]+)$#', $_GET['side']) ) ) |
|
3025 |
{ |
|
3026 |
echo '<div class="warning-box" style="margin: 10px 0;">$_GET[\'side\'] contained an SQL injection attempt</div>'; |
|
3027 |
break; |
|
3028 |
} |
|
3029 |
$query = $db->sql_query('UPDATE '.table_prefix.'sidebar SET sidebar_id=' . $db->escape($_GET['side']) . ' WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
|
3030 |
if(!$query) |
|
3031 |
{ |
|
3032 |
echo $db->get_error(); |
|
3033 |
$template->footer(); |
|
3034 |
exit; |
|
3035 |
} |
|
3036 |
echo '<div class="info-box" style="margin: 10px 0;">Item moved.</div>'; |
|
3037 |
break; |
|
3038 |
case 'delete': |
|
3039 |
$query = $db->sql_query('DELETE FROM '.table_prefix.'sidebar WHERE item_id=' . $db->escape($_GET['id']) . ';'); // Already checked for injection attempts ;-) |
|
3040 |
if(!$query) |
|
3041 |
{ |
|
3042 |
echo $db->get_error(); |
|
3043 |
$template->footer(); |
|
3044 |
exit; |
|
3045 |
} |
|
3046 |
if(isset($_GET['ajax'])) |
|
3047 |
{ |
|
3048 |
ob_end_clean(); |
|
3049 |
die('GOOD'); |
|
3050 |
} |
|
3051 |
echo '<div class="error-box" style="margin: 10px 0;">Item deleted.</div>'; |
|
3052 |
break; |
|
3053 |
case 'disenable'; |
|
3054 |
$q = $db->sql_query('SELECT item_enabled FROM '.table_prefix.'sidebar WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
|
3055 |
if(!$q) |
|
3056 |
{ |
|
3057 |
echo $db->get_error(); |
|
3058 |
$template->footer(); |
|
3059 |
exit; |
|
3060 |
} |
|
3061 |
$r = $db->fetchrow(); |
|
3062 |
$db->free_result(); |
|
3063 |
$e = ( $r['item_enabled'] == 1 ) ? '0' : '1'; |
|
3064 |
$q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET item_enabled='.$e.' WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
|
3065 |
if(!$q) |
|
3066 |
{ |
|
3067 |
echo $db->get_error(); |
|
3068 |
$template->footer(); |
|
3069 |
exit; |
|
3070 |
} |
|
3071 |
if(isset($_GET['ajax'])) |
|
3072 |
{ |
|
3073 |
ob_end_clean(); |
|
3074 |
die('GOOD'); |
|
3075 |
} |
|
3076 |
break; |
|
3077 |
case 'getsource': |
|
3078 |
$q = $db->sql_query('SELECT block_content,block_type FROM '.table_prefix.'sidebar WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
|
3079 |
if(!$q) |
|
3080 |
{ |
|
3081 |
echo $db->get_error(); |
|
3082 |
$template->footer(); |
|
3083 |
exit; |
|
3084 |
} |
|
3085 |
ob_end_clean(); |
|
3086 |
$r = $db->fetchrow(); |
|
3087 |
$db->free_result(); |
|
3088 |
if($r['block_type'] == BLOCK_PLUGIN) die('HOUSTON_WE_HAVE_A_PLUGIN'); |
|
3089 |
die($r['block_content']); |
|
3090 |
break; |
|
3091 |
case 'save': |
|
19
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3092 |
if ( defined('ENANO_DEMO_MODE') ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3093 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3094 |
$q = $db->sql_query('SELECT block_type FROM '.table_prefix.'sidebar WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3095 |
if(!$q) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3096 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3097 |
echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3098 |
exit; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3099 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3100 |
$row = $db->fetchrow(); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3101 |
if ( $row['block_type'] == BLOCK_PHP ) |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3102 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3103 |
$_POST['content'] = '?><Nulled>'; |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3104 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3105 |
else |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3106 |
{ |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3107 |
$_POST['content'] = sanitize_html($_POST['content'], true); |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3108 |
} |
5d003b6c9e89
Added demo mode functionality to various parts of Enano (unlocked only with a plugin) and fixed groups table
Dan
parents:
15
diff
changeset
|
3109 |
} |
0 | 3110 |
$q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_content=\''.$db->escape(rawurldecode($_POST['content'])).'\' WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
3111 |
if(!$q) |
|
3112 |
{ |
|
3113 |
echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
|
3114 |
exit; |
|
3115 |
} |
|
3116 |
$q = $db->sql_query('SELECT block_type,block_content FROM '.table_prefix.'sidebar WHERE item_id=' . $db->escape($_GET['id']) . ';'); |
|
3117 |
if(!$q) |
|
3118 |
{ |
|
3119 |
echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
|
3120 |
exit; |
|
3121 |
} |
|
3122 |
$row = $db->fetchrow(); |
|
3123 |
$db->free_result(); |
|
3124 |
switch($row['block_type']) |
|
3125 |
{ |
|
3126 |
case BLOCK_WIKIFORMAT: |
|
3127 |
default: |
|
3128 |
$c = RenderMan::render($row['block_content']); |
|
3129 |
break; |
|
3130 |
case BLOCK_TEMPLATEFORMAT: |
|
3131 |
$c = $template->tplWikiFormat($row['block_content'], false, 'sidebar-editor.tpl'); |
|
3132 |
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c); |
|
3133 |
break; |
|
3134 |
case BLOCK_HTML: |
|
3135 |
$c = $row['block_content']; |
|
3136 |
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c); |
|
3137 |
break; |
|
3138 |
case BLOCK_PHP: |
|
3139 |
ob_start(); |
|
3140 |
eval($row['block_content']); |
|
3141 |
$c = ob_get_contents(); |
|
3142 |
ob_end_clean(); |
|
3143 |
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c); |
|
3144 |
break; |
|
3145 |
case BLOCK_PLUGIN: |
|
3146 |
$c = ($template->fetch_block($row['block_content'])) ? $template->fetch_block($row['block_content']) : 'Can\'t find plugin block'; |
|
3147 |
break; |
|
3148 |
} |
|
3149 |
die('var status = \'GOOD\'; var content = unescape(\''.hexencode($c).'\');'); |
|
3150 |
break; |
|
3151 |
} |
|
3152 |
} |
|
3153 |
||
3154 |
$q = $db->sql_query('SELECT item_id,sidebar_id,item_enabled,block_name,block_type,block_content FROM '.table_prefix.'sidebar ORDER BY sidebar_id ASC, item_order ASC;'); |
|
3155 |
if(!$q) $db->_die('The sidebar text data could not be selected.'); |
|
3156 |
||
3157 |
$vars = $template->extract_vars('sidebar-editor.tpl'); |
|
3158 |
||
3159 |
$parser = $template->makeParserText($vars['sidebar_button']); |
|
3160 |
$parser->assign_vars(Array( |
|
3161 |
'HREF'=>'#', |
|
3162 |
'FLAGS'=>'onclick="return false;"', |
|
3163 |
'TEXT'=>'Change theme' |
|
3164 |
)); |
|
3165 |
$template->tpl_strings['THEME_LINK'] = $parser->run(); |
|
3166 |
$parser->assign_vars(Array( |
|
3167 |
'TEXT'=>'Log out', |
|
3168 |
)); |
|
3169 |
$template->tpl_strings['LOGOUT_LINK'] = $parser->run(); |
|
3170 |
||
3171 |
$n1 = Array(); |
|
3172 |
$n2 = Array(); |
|
3173 |
$n =& $n1; |
|
3174 |
||
3175 |
echo '<table border="0"><tr><td valign="top"><div class="dbx-group" id="sbedit_left">'; |
|
3176 |
//if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_top']); |
|
3177 |
||
3178 |
// Time for the loop |
|
3179 |
// what this loop does is fetch the row data, then send it out to the appropriate parser for formatting, |
|
3180 |
// then puts the result into $c, which is then sent to the template compiler for insertion into the TPL code. |
|
3181 |
while($row = $db->fetchrow()) |
|
3182 |
{ |
|
3183 |
if(isset($current_side)) |
|
3184 |
{ |
|
3185 |
if($current_side != $row['sidebar_id']) |
|
3186 |
{ |
|
3187 |
// Time to switch! |
|
3188 |
//if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_bottom']); |
|
3189 |
echo '</div></td><td valign="top"><div class="dbx-group" id="sbedit_right">'; |
|
3190 |
//echo '</td><td valign="top">'; |
|
3191 |
//if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_top']); |
|
3192 |
$n =& $n2; |
|
3193 |
} |
|
3194 |
} |
|
3195 |
$n[] = count($n); |
|
3196 |
$current_side = $row['sidebar_id']; |
|
3197 |
switch($row['block_type']) |
|
3198 |
{ |
|
3199 |
case BLOCK_WIKIFORMAT: |
|
3200 |
default: |
|
3201 |
$parser = $template->makeParserText($vars['sidebar_section']); |
|
3202 |
$c = RenderMan::render($row['block_content']); |
|
3203 |
break; |
|
3204 |
case BLOCK_TEMPLATEFORMAT: |
|
3205 |
$parser = $template->makeParserText($vars['sidebar_section']); |
|
3206 |
$c = $template->tplWikiFormat($row['block_content'], false, 'sidebar-editor.tpl'); |
|
3207 |
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c); |
|
3208 |
break; |
|
3209 |
case BLOCK_HTML: |
|
3210 |
$parser = $template->makeParserText($vars['sidebar_section_raw']); |
|
3211 |
$c = $row['block_content']; |
|
3212 |
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c); |
|
3213 |
break; |
|
3214 |
case BLOCK_PHP: |
|
3215 |
$parser = $template->makeParserText($vars['sidebar_section_raw']); |
|
3216 |
ob_start(); |
|
3217 |
eval($row['block_content']); |
|
3218 |
$c = ob_get_contents(); |
|
3219 |
ob_end_clean(); |
|
3220 |
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c); |
|
3221 |
break; |
|
3222 |
case BLOCK_PLUGIN: |
|
3223 |
$parser = $template->makeParserText($vars['sidebar_section_raw']); |
|
3224 |
$c = ($template->fetch_block($row['block_content'])) ? $template->fetch_block($row['block_content']) : 'Can\'t find plugin block'; |
|
3225 |
break; |
|
3226 |
} |
|
3227 |
$t = $template->tplWikiFormat($row['block_name']); |
|
3228 |
if($row['item_enabled'] == 0) $t .= ' <span id="disabled_'.$row['item_id'].'" style="color: red;">(disabled)</span>'; |
|
3229 |
else $t .= ' <span id="disabled_'.$row['item_id'].'" style="color: red; display: none;">(disabled)</span>'; |
|
3230 |
$side = ( $row['sidebar_id'] == SIDEBAR_LEFT ) ? SIDEBAR_RIGHT : SIDEBAR_LEFT; |
|
3231 |
$tb = '<a title="Enable or disable this block" href="'.makeUrl($paths->page, 'action=disenable&id='.$row['item_id'].'' , true).'" onclick="ajaxDisenableBlock(\''.$row['item_id'].'\'); return false;" ><img alt="Enable/disable this block" style="border-width: 0;" src="'.scriptPath.'/images/disenable.png" /></a> |
|
3232 |
<a title="Edit the contents of this block" href="'.makeUrl($paths->page, 'action=edit&id='.$row['item_id'].'' , true).'" onclick="ajaxEditBlock(\''.$row['item_id'].'\', this); return false;"><img alt="Edit this block" style="border-width: 0;" src="'.scriptPath.'/images/edit.png" /></a> |
|
3233 |
<a title="Permanently delete this block" href="'.makeUrl($paths->page, 'action=delete&id='.$row['item_id'].'' , true).'" onclick="if(confirm(\'Do you really want to delete this block?\')) { ajaxDeleteBlock(\''.$row['item_id'].'\', this); } return false;"><img alt="Delete this block" style="border-width: 0;" src="'.scriptPath.'/images/delete.png" /></a> |
|
3234 |
<a title="Move this block to the other sidebar" href="'.makeUrl($paths->page, 'action=move&id='.$row['item_id'].'&side='.$side, true).'"><img alt="Move this block" style="border-width: 0;" src="'.scriptPath.'/images/move.png" /></a>'; |
|
3235 |
$as = ''; |
|
3236 |
$ae = ' '.$tb; |
|
3237 |
$parser->assign_vars(Array('CONTENT'=>$c,'TITLE'=>$t,'ADMIN_START'=>$as,'ADMIN_END'=>$ae)); |
|
3238 |
echo $parser->run(); |
|
3239 |
unset($parser); |
|
3240 |
||
3241 |
} |
|
3242 |
$db->free_result(); |
|
3243 |
//if(isset($vars['sidebar_top'])) echo $template->parse($vars['sidebar_bottom']); |
|
3244 |
echo '</div></td></tr></table>'; |
|
3245 |
echo '<form action="'.makeUrl($paths->page).'" method="post">'; |
|
3246 |
$order = implode(',', $n1); |
|
3247 |
echo "<input type='hidden' id='divOrder_Left' name='order_left' value='{$order}' />"; |
|
3248 |
$order = implode(',', $n2); |
|
3249 |
echo "<input type='hidden' id='divOrder_Right' name='order_right' value='{$order}' />"; |
|
3250 |
echo ' |
|
3251 |
<div style="margin: 0 auto 0 auto; text-align: center;"> |
|
3252 |
<input type="submit" name="save" style="font-weight: bold;" value="Save changes" /> |
|
3253 |
<input type="submit" name="revert" style="font-weight: normal;" value="Revert" onclick="return confirm(\'Do you really want to revert your changes?\nNote: this does not revert edits or deletions, those are saved as soon as you confirm the action.\')" /> |
|
3254 |
<br /> |
|
3255 |
<a href="'.makeUrl($paths->page, 'action=new&id=0', true).'">Create new block</a> | <a href="'.makeUrl(getConfig('main_page'), false, true).'">Main Page</a> |
|
3256 |
</div> |
|
3257 |
</form> |
|
3258 |
'; |
|
3259 |
} |
|
3260 |
||
3261 |
$template->footer(); |
|
3262 |
} |
|
3263 |
||
3264 |
?> |