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