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