author | Dan |
Thu, 26 Jun 2008 18:05:42 -0400 | |
changeset 587 | 705ed7162315 |
parent 581 | 5e8fd89c02ea |
child 588 | 20484deb89cd |
permissions | -rwxr-xr-x |
0 | 1 |
<?php |
519
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
2 |
/**!info** |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
3 |
{ |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
4 |
"Plugin Name" : "plugin_specialpagefuncs_title", |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
5 |
"Plugin URI" : "http://enanocms.org/", |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
6 |
"Description" : "plugin_specialpagefuncs_desc", |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
7 |
"Author" : "Dan Fuhry", |
564
a1c450a911a6
Updated version number metadata in system plugin files; added some comments and removed unused code from index.php and includes/graphs.php
Dan
parents:
536
diff
changeset
|
8 |
"Version" : "1.1.4", |
519
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
9 |
"Author URI" : "http://enanocms.org/" |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
10 |
} |
94214ec0871c
Started work on the new plugin manager and associated management code. Very incomplete at this point and not usable.
Dan
parents:
504
diff
changeset
|
11 |
**!*/ |
0 | 12 |
|
13 |
/* |
|
14 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
|
536 | 15 |
* Version 1.1.4 (Caoineag alpha 4) |
16 |
* Copyright (C) 2006-2008 Dan Fuhry |
|
0 | 17 |
* |
18 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|
20 |
* |
|
21 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
22 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
|
23 |
*/ |
|
24 |
||
25 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
26 |
||
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:
326
diff
changeset
|
27 |
$plugins->attachHook('session_started', ' |
0 | 28 |
global $paths; |
29 |
$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:
326
diff
changeset
|
30 |
\'name\'=>\'specialpage_create_page\', |
0 | 31 |
\'urlname\'=>\'CreatePage\', |
32 |
\'namespace\'=>\'Special\', |
|
33 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
34 |
)); |
|
35 |
||
36 |
$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:
326
diff
changeset
|
37 |
\'name\'=>\'specialpage_all_pages\', |
0 | 38 |
\'urlname\'=>\'AllPages\', |
39 |
\'namespace\'=>\'Special\', |
|
40 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
41 |
)); |
|
42 |
||
43 |
$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:
326
diff
changeset
|
44 |
\'name\'=>\'specialpage_special_pages\', |
0 | 45 |
\'urlname\'=>\'SpecialPages\', |
46 |
\'namespace\'=>\'Special\', |
|
47 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
48 |
)); |
|
49 |
||
50 |
$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:
326
diff
changeset
|
51 |
\'name\'=>\'specialpage_about_enano\', |
0 | 52 |
\'urlname\'=>\'About_Enano\', |
53 |
\'namespace\'=>\'Special\', |
|
54 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
55 |
)); |
|
56 |
||
57 |
$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:
326
diff
changeset
|
58 |
\'name\'=>\'specialpage_gnu_gpl\', |
0 | 59 |
\'urlname\'=>\'GNU_General_Public_License\', |
60 |
\'namespace\'=>\'Special\', |
|
61 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
62 |
)); |
|
83 | 63 |
|
64 |
$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:
326
diff
changeset
|
65 |
\'name\'=>\'specialpage_tag_cloud\', |
83 | 66 |
\'urlname\'=>\'TagCloud\', |
67 |
\'namespace\'=>\'Special\', |
|
68 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
69 |
)); |
|
581
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
70 |
|
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
71 |
$paths->add_page(Array( |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
72 |
\'name\'=>\'specialpage_autofill\', |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
73 |
\'urlname\'=>\'Autofill\', |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
74 |
\'namespace\'=>\'Special\', |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
75 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
76 |
)); |
0 | 77 |
'); |
78 |
||
79 |
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
|
80 |
||
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
81 |
function page_Special_CreatePage() |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
82 |
{ |
0 | 83 |
global $db, $session, $paths, $template, $plugins; // Common objects |
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
|
84 |
global $lang; |
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
|
85 |
|
426 | 86 |
$whitelist_ns = array('Article', 'User', 'Help', 'Template', 'Category', 'Project'); |
87 |
$code = $plugins->setHook('page_create_ns_whitelist'); |
|
88 |
foreach ( $code as $cmd ) |
|
89 |
{ |
|
90 |
eval($cmd); |
|
91 |
} |
|
92 |
||
93 |
$errors = array(); |
|
94 |
||
95 |
switch ( isset($_POST['page_title']) ) |
|
96 |
{ |
|
97 |
case true: |
|
98 |
// "Create page" was clicked |
|
99 |
||
100 |
// |
|
101 |
// VALIDATION CODE |
|
102 |
// |
|
103 |
||
104 |
// Check namespace |
|
105 |
$namespace = ( isset($_POST['namespace']) ) ? $_POST['namespace'] : 'Article'; |
|
106 |
if ( !in_array($namespace, $whitelist_ns) ) |
|
107 |
{ |
|
108 |
$errors[] = $lang->get('pagetools_create_err_invalid_namespace'); |
|
109 |
} |
|
110 |
||
111 |
// Check title and figure out urlname |
|
112 |
$title = $_POST['page_title']; |
|
113 |
$urlname = $_POST['page_title']; |
|
114 |
if ( @$_POST['custom_url'] === 'yes' && isset($_POST['urlname']) ) |
|
115 |
{ |
|
116 |
$urlname = $_POST['urlname']; |
|
117 |
} |
|
118 |
$urlname = sanitize_page_id($urlname); |
|
119 |
if ( $urlname == '.00' || empty($urlname) ) |
|
120 |
{ |
|
121 |
$errors[] = $lang->get('pagetools_create_err_invalid_urlname'); |
|
122 |
} |
|
123 |
||
124 |
// Validate page existence |
|
125 |
$pathskey = $paths->nslist[$namespace] . $urlname; |
|
126 |
if ( isPage($pathskey) ) |
|
127 |
{ |
|
128 |
$errors[] = $lang->get('pagetools_create_err_already_exists'); |
|
129 |
} |
|
130 |
||
131 |
// Validate permissions |
|
132 |
$perms = $session->fetch_page_acl($urlname, $namespace); |
|
133 |
if ( !$perms->get_permissions('create_page') ) |
|
134 |
{ |
|
135 |
$errors[] = $lang->get('pagetools_create_err_no_permission'); |
|
136 |
} |
|
137 |
||
138 |
// Run hooks |
|
139 |
$code = $plugins->setHook('page_create_request'); |
|
140 |
foreach ( $code as $cmd ) |
|
141 |
{ |
|
142 |
eval($cmd); |
|
143 |
} |
|
144 |
||
145 |
// Create the page |
|
146 |
if ( count($errors) < 1 ) |
|
147 |
{ |
|
148 |
$page = new PageProcessor($urlname, $namespace); |
|
149 |
$page->create_page($title); |
|
150 |
if ( $error = $page->pop_error() ) |
|
151 |
{ |
|
152 |
do |
|
153 |
{ |
|
154 |
$errors[] = $error; |
|
155 |
} |
|
156 |
while ( $error = $page->pop_error() ); |
|
157 |
} |
|
158 |
else |
|
159 |
{ |
|
160 |
redirect(makeUrlNS($namespace, $urlname) . '#do:edit', '', '', 0); |
|
161 |
return true; |
|
162 |
} |
|
163 |
} |
|
164 |
||
165 |
break; |
|
166 |
} |
|
167 |
||
168 |
$template->header(); |
|
169 |
||
170 |
echo $lang->get('pagetools_create_blurb'); |
|
171 |
||
172 |
if ( count($errors) > 0 ) |
|
173 |
{ |
|
174 |
echo '<div class="error-box">' . implode("<br />\n ", $errors) . '</div>'; |
|
175 |
} |
|
176 |
||
177 |
?> |
|
178 |
<enano:no-opt> |
|
179 |
<script type="text/javascript"> |
|
180 |
function cpGenPreviewUrl() |
|
181 |
{ |
|
182 |
var frm = document.forms['create_form']; |
|
183 |
var radio_custom = frm.getElementsByTagName('input')[2]; |
|
184 |
var use_custom_url = radio_custom.checked; |
|
185 |
if ( use_custom_url ) |
|
186 |
{ |
|
187 |
var title_src = frm.urlname.value; |
|
188 |
} |
|
189 |
else |
|
190 |
{ |
|
191 |
var title_src = frm.page_title.value; |
|
192 |
} |
|
193 |
var url = window.location.protocol + '//' + window.location.hostname + contentPath + namespace_list[frm.namespace.value] + sanitize_page_id(title_src); |
|
194 |
document.getElementById('createpage_url_preview').firstChild.nodeValue = url; |
|
195 |
} |
|
196 |
</script> |
|
197 |
</enano:no-opt> |
|
198 |
<?php |
|
199 |
||
200 |
echo '<form action="' . makeUrlNS('Special', 'CreatePage') . '" method="post" name="create_form">'; |
|
201 |
||
202 |
echo '<p>'; |
|
203 |
echo $lang->get('pagetools_create_field_title'); |
|
204 |
echo ' <input onkeyup="cpGenPreviewUrl();" type="text" name="page_title" size="40" tabindex="1" />'; |
|
205 |
echo '</p>'; |
|
206 |
||
207 |
echo '<p>'; |
|
208 |
echo $lang->get('pagetools_create_field_namespace'); |
|
209 |
echo ' <select onchange="cpGenPreviewUrl();" name="namespace" tabindex="2">'; |
|
210 |
foreach ( $paths->nslist as $ns => $ns_prefix ) |
|
211 |
{ |
|
212 |
if ( !in_array($ns, $whitelist_ns) ) |
|
213 |
continue; |
|
214 |
$lang_string = 'onpage_lbl_page_' . strtolower($ns); |
|
215 |
$str = $lang->get($lang_string); |
|
216 |
if ( $str == $lang_string ) |
|
217 |
$str = $ns; |
|
218 |
||
219 |
echo '<option value="' . $ns . '">' . ucwords($str) . '</option>'; |
|
220 |
} |
|
221 |
echo '</select>'; |
|
222 |
echo '</p>'; |
|
223 |
||
501
9367161b2457
Added support for an enano:expand=(closed|open) attribute on fieldsets to make them act like GTK expandable widgets; implementation is on Special:CreatePage
Dan
parents:
426
diff
changeset
|
224 |
echo '<fieldset enano:expand="closed">'; |
426 | 225 |
echo '<legend>' . $lang->get('pagetools_create_group_advanced') . '</legend>'; |
226 |
||
227 |
echo '<p>'; |
|
228 |
echo '<label><input tabindex="3" type="radio" name="custom_url" value="no" checked="checked" onclick="cpGenPreviewUrl(); document.getElementById(\'createpage_custom_url\').style.display = \'none\';" /> ' . $lang->get('pagetools_create_field_url_auto') . '</label>'; |
|
229 |
echo '</p>'; |
|
230 |
||
231 |
echo '<p>'; |
|
232 |
echo '<label><input tabindex="3" type="radio" name="custom_url" value="yes" onclick="cpGenPreviewUrl(); document.getElementById(\'createpage_custom_url\').style.display = \'block\';" /> ' . $lang->get('pagetools_create_field_url_manual') . '</label>'; |
|
233 |
echo '</p>'; |
|
234 |
||
235 |
echo '<p id="createpage_custom_url" style="display: none; margin-left: 2em;">'; |
|
236 |
echo $lang->get('pagetools_create_field_url'); |
|
237 |
echo ' <input onkeyup="cpGenPreviewUrl();" tabindex="4" type="text" name="urlname" value="" size="40" />'; |
|
238 |
echo '</p>'; |
|
239 |
||
240 |
echo '<p>'; |
|
241 |
echo $lang->get('pagetools_create_field_preview') . ' <tt id="createpage_url_preview"> </tt><br />'; |
|
242 |
echo '<small>' . $lang->get('pagetools_create_field_preview_hint') . '</small>'; |
|
243 |
echo '</p>'; |
|
244 |
||
245 |
echo '</fieldset>'; |
|
246 |
||
247 |
echo '<p>'; |
|
248 |
echo '<input tabindex="5" type="submit" value="' . $lang->get('pagetools_create_btn_create') . '" />'; |
|
249 |
echo '</p>'; |
|
250 |
||
251 |
echo '</form>'; |
|
252 |
||
253 |
echo '<script type="text/javascript">cpGenPreviewUrl();</script>'; |
|
254 |
||
255 |
$template->footer(); |
|
256 |
} |
|
257 |
||
258 |
function page_Special_CreatePage_Old() |
|
259 |
{ |
|
260 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
261 |
global $lang; |
|
262 |
||
0 | 263 |
if ( isset($_POST['do']) ) |
264 |
{ |
|
265 |
$p = $_POST['pagename']; |
|
266 |
$k = array_keys($paths->nslist); |
|
267 |
for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ ) |
|
268 |
{ |
|
269 |
$ln = strlen( $paths->nslist[$k[$i]] ); |
|
270 |
if ( substr($p, 0, $ln) == $paths->nslist[$k[$i]] ) |
|
271 |
{ |
|
272 |
$namespace = $k[$i]; |
|
273 |
} |
|
274 |
} |
|
275 |
if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin') |
|
276 |
{ |
|
277 |
$template->header(); |
|
278 |
||
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
|
279 |
echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3> |
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
|
280 |
<p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($p))) . '</p>'; |
0 | 281 |
|
282 |
$template->footer(); |
|
283 |
$db->close(); |
|
284 |
||
285 |
exit; |
|
286 |
} |
|
287 |
$name = $db->escape(str_replace('_', ' ', $p)); |
|
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
288 |
$urlname = str_replace(' ', '_', $p); |
0 | 289 |
$namespace = $_POST['namespace']; |
290 |
if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin') |
|
291 |
{ |
|
292 |
$template->header(); |
|
293 |
||
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
|
294 |
echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3> |
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
|
295 |
<p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($paths->nslist[$namespace].$p))) . '</p>'; |
0 | 296 |
|
297 |
$template->footer(); |
|
298 |
$db->close(); |
|
299 |
||
300 |
exit; |
|
301 |
} |
|
315
f49e3c8b638c
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents:
285
diff
changeset
|
302 |
$code = $plugins->setHook('page_create_request'); |
f49e3c8b638c
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents:
285
diff
changeset
|
303 |
foreach ( $code as $cmd ) |
f49e3c8b638c
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents:
285
diff
changeset
|
304 |
{ |
f49e3c8b638c
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents:
285
diff
changeset
|
305 |
eval($cmd); |
f49e3c8b638c
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
Dan
parents:
285
diff
changeset
|
306 |
} |
194
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
307 |
if ( substr($urlname, 0, 8) == 'Project:' ) |
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
308 |
{ |
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
309 |
$template->header(); |
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
310 |
|
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
|
311 |
echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3> |
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
|
312 |
<p>' . $lang->get('pagetools_create_err_project_shortcut', array('page_name' => htmlspecialchars($p))) . '</p>'; |
194
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
313 |
|
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
314 |
$template->footer(); |
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
315 |
$db->close(); |
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
316 |
|
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
317 |
exit; |
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents:
192
diff
changeset
|
318 |
} |
0 | 319 |
|
320 |
$tn = $paths->nslist[$_POST['namespace']] . $urlname; |
|
321 |
if ( isset($paths->pages[$tn]) ) |
|
322 |
{ |
|
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
|
323 |
die_friendly($lang->get('pagetools_create_err_title'), '<p>' . $lang->get('pagetools_create_err_already_exist') . '</p>'); |
0 | 324 |
} |
325 |
||
326 |
if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) ) |
|
327 |
{ |
|
328 |
$urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname)); |
|
329 |
} |
|
330 |
||
331 |
$k = array_keys( $paths->nslist ); |
|
332 |
if(!in_array($_POST['namespace'], $k)) |
|
333 |
{ |
|
334 |
$db->_die('An SQL injection attempt was caught at '.dirname(__FILE__).':'.__LINE__.'.'); |
|
335 |
} |
|
336 |
||
112
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
337 |
$ips = array( |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
338 |
'ip' => array(), |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
339 |
'u' => array() |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
340 |
); |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
341 |
$ips = $db->escape(serialize($ips)); |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
342 |
|
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
343 |
$urlname = sanitize_page_id($urlname); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
344 |
$urlname = $db->escape($urlname); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
345 |
|
0 | 346 |
$perms = $session->fetch_page_acl($urlname, $namespace); |
347 |
if ( !$perms->get_permissions('create_page') ) |
|
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
|
348 |
die_friendly($lang->get('pagetools_create_err_title'), '<p>An access control rule is preventing you from creating pages.</p>'); |
0 | 349 |
|
345
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
343
diff
changeset
|
350 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.enano_date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\');'); |
0 | 351 |
if ( !$q ) |
352 |
{ |
|
353 |
$db->_die('The page log could not be updated.'); |
|
354 |
} |
|
355 |
||
112
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
356 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');'); |
0 | 357 |
if ( !$q ) |
358 |
{ |
|
359 |
$db->_die('The page entry could not be inserted.'); |
|
360 |
} |
|
157
6df5f7a55a30
Creating pages doesn't insert that crappy javascript hack anymore
Dan
parents:
132
diff
changeset
|
361 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.'\');'); |
0 | 362 |
if ( !$q ) |
363 |
{ |
|
364 |
$db->_die('The page text entry could not be inserted.'); |
|
365 |
} |
|
366 |
||
157
6df5f7a55a30
Creating pages doesn't insert that crappy javascript hack anymore
Dan
parents:
132
diff
changeset
|
367 |
header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)) . '#do:edit'); |
0 | 368 |
exit; |
369 |
} |
|
370 |
$template->header(); |
|
285
7846d45bd250
Changed all urlname/page_id columns to varchar(255) because 63 characters just isn't long enough
Dan
parents:
194
diff
changeset
|
371 |
/* |
0 | 372 |
if ( !$session->get_permissions('create_page') ) |
373 |
{ |
|
374 |
echo 'Wiki mode is disabled, only admins can create pages.'; |
|
375 |
||
376 |
$template->footer(); |
|
377 |
$db->close(); |
|
378 |
||
379 |
exit; |
|
380 |
} |
|
285
7846d45bd250
Changed all urlname/page_id columns to varchar(255) because 63 characters just isn't long enough
Dan
parents:
194
diff
changeset
|
381 |
*/ |
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
|
382 |
echo '<p>' . $lang->get('pagetools_create_blurb') . '</p>'; |
0 | 383 |
?> |
384 |
<form action="" method="post"> |
|
385 |
<p> |
|
386 |
<select name="namespace"> |
|
387 |
<?php |
|
388 |
$k = array_keys($paths->nslist); |
|
389 |
for ( $i = 0; $i < sizeof($k); $i++ ) |
|
390 |
{ |
|
391 |
if ( $paths->nslist[$k[$i]] == '' ) |
|
392 |
{ |
|
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
|
393 |
$s = $lang->get('pagetools_create_namespace_none'); |
0 | 394 |
} |
395 |
else |
|
396 |
{ |
|
397 |
$s = $paths->nslist[$k[$i]]; |
|
398 |
} |
|
399 |
if ( ( $k[$i] != 'System' || $session->user_level >= USER_LEVEL_ADMIN ) && $k[$i] != 'Admin' && $k[$i] != 'Special') |
|
400 |
{ |
|
401 |
echo '<option value="'.$k[$i].'">'.$s.'</option>'; |
|
402 |
} |
|
403 |
} |
|
404 |
?> |
|
405 |
</select> <input type="text" name="pagename" /></p> |
|
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
|
406 |
<p><input type="submit" name="do" value="<?php echo $lang->get('pagetools_create_btn_create'); ?>" /></p> |
0 | 407 |
</form> |
408 |
<?php |
|
409 |
$template->footer(); |
|
410 |
} |
|
411 |
||
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:
112
diff
changeset
|
412 |
function PagelistingFormatter($id, $row) |
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:
112
diff
changeset
|
413 |
{ |
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:
112
diff
changeset
|
414 |
global $db, $session, $paths, $template, $plugins; // Common objects |
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:
112
diff
changeset
|
415 |
static $rowtracker = 0; |
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:
112
diff
changeset
|
416 |
static $tdclass = 'row2'; |
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:
112
diff
changeset
|
417 |
static $per_row = 2; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
418 |
static $first = true; |
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:
112
diff
changeset
|
419 |
$return = ''; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
420 |
if ( $id === false && $row === false ) |
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:
112
diff
changeset
|
421 |
{ |
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:
112
diff
changeset
|
422 |
$rowtracker = 0; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
423 |
$first = true; |
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:
112
diff
changeset
|
424 |
return false; |
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:
112
diff
changeset
|
425 |
} |
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:
112
diff
changeset
|
426 |
$rowtracker++; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
427 |
if ( $rowtracker == $per_row || $first ) |
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:
112
diff
changeset
|
428 |
{ |
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:
112
diff
changeset
|
429 |
$rowtracker = 0; |
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:
112
diff
changeset
|
430 |
$tdclass = ( $tdclass == 'row2' ) ? 'row1' : 'row2'; |
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:
112
diff
changeset
|
431 |
} |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
432 |
if ( $rowtracker == 0 && !$first ) |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
433 |
$return .= "</tr>\n<tr>"; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
434 |
|
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
435 |
$first = false; |
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:
112
diff
changeset
|
436 |
|
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:
112
diff
changeset
|
437 |
preg_match('/^ns=(' . implode('|', array_keys($paths->nslist)) . ');pid=(.*?)$/i', $id, $match); |
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:
112
diff
changeset
|
438 |
$namespace =& $match[1]; |
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:
112
diff
changeset
|
439 |
$page_id =& $match[2]; |
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:
112
diff
changeset
|
440 |
$page_id = sanitize_page_id($page_id); |
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:
112
diff
changeset
|
441 |
|
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:
112
diff
changeset
|
442 |
$url = makeUrlNS($namespace, $page_id); |
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:
112
diff
changeset
|
443 |
$url = htmlspecialchars($url); |
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:
112
diff
changeset
|
444 |
|
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:
112
diff
changeset
|
445 |
$link = '<a href="' . $url . '">' . htmlspecialchars($row['name']) . '</a>'; |
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:
112
diff
changeset
|
446 |
$td = '<td class="' . $tdclass . '" style="width: 50%;">' . $link . '</td>'; |
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:
112
diff
changeset
|
447 |
|
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:
112
diff
changeset
|
448 |
$return .= $td; |
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:
112
diff
changeset
|
449 |
|
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:
112
diff
changeset
|
450 |
return $return; |
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:
112
diff
changeset
|
451 |
} |
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:
112
diff
changeset
|
452 |
|
0 | 453 |
function page_Special_AllPages() |
454 |
{ |
|
455 |
// This should be an easy one |
|
456 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
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
|
457 |
global $lang; |
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
|
458 |
|
0 | 459 |
$template->header(); |
460 |
$sz = sizeof( $paths->pages ) / 2; |
|
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
|
461 |
echo '<p>' . $lang->get('pagetools_allpages_blurb') . '</p>'; |
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:
112
diff
changeset
|
462 |
|
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:
112
diff
changeset
|
463 |
$q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;'); |
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:
112
diff
changeset
|
464 |
if ( !$q ) |
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:
112
diff
changeset
|
465 |
$db->_die(); |
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:
112
diff
changeset
|
466 |
$row = $db->fetchrow_num(); |
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:
112
diff
changeset
|
467 |
$count = $row[0]; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
468 |
|
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
469 |
switch($count % 4) |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
470 |
{ |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
471 |
case 0: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
472 |
case 2: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
473 |
// even number of results; do nothing |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
474 |
$last_cell = ''; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
475 |
break; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
476 |
case 1: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
477 |
// odd number of results and odd number of rows, use row1 |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
478 |
$last_cell = '<td class="row1"></td>'; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
479 |
break; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
480 |
case 3: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
481 |
// odd number of results and even number of rows, use row2 |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
482 |
$last_cell = '<td class="row2"></td>'; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
483 |
break; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
484 |
} |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
485 |
|
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:
112
diff
changeset
|
486 |
$db->free_result(); |
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:
112
diff
changeset
|
487 |
|
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:
112
diff
changeset
|
488 |
$q = $db->sql_unbuffered_query('SELECT CONCAT("ns=",namespace,";pid=",urlname) AS identifier, name FROM '.table_prefix.'pages WHERE visible!=0 ORDER BY name ASC;'); |
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:
112
diff
changeset
|
489 |
if ( !$q ) |
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:
112
diff
changeset
|
490 |
$db->_die(); |
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:
112
diff
changeset
|
491 |
|
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:
112
diff
changeset
|
492 |
$offset = ( isset($_GET['offset']) ) ? intval($_GET['offset']) : 0; |
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:
112
diff
changeset
|
493 |
|
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:
112
diff
changeset
|
494 |
// reset formatter |
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:
112
diff
changeset
|
495 |
PagelistingFormatter(false, false); |
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:
112
diff
changeset
|
496 |
|
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:
112
diff
changeset
|
497 |
$result = paginate( |
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:
112
diff
changeset
|
498 |
$q, // result resource |
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:
112
diff
changeset
|
499 |
'{identifier}', // formatting template |
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:
112
diff
changeset
|
500 |
$count, // # of results |
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:
112
diff
changeset
|
501 |
makeUrlNS('Special', 'AllPages', 'offset=%s'), // result URL |
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:
112
diff
changeset
|
502 |
$offset, // start offset |
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:
112
diff
changeset
|
503 |
40, // results per page |
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:
112
diff
changeset
|
504 |
array( 'identifier' => 'PagelistingFormatter' ), // hooks |
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:
112
diff
changeset
|
505 |
'<div class="tblholder"> |
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:
112
diff
changeset
|
506 |
<table border="0" cellspacing="1" cellpadding="4"> |
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:
112
diff
changeset
|
507 |
<tr>', // print at start |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
508 |
' ' . $last_cell . '</tr> |
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:
112
diff
changeset
|
509 |
</table> |
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:
112
diff
changeset
|
510 |
</div>' // print at end |
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:
112
diff
changeset
|
511 |
); |
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:
112
diff
changeset
|
512 |
|
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:
112
diff
changeset
|
513 |
echo $result; |
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:
112
diff
changeset
|
514 |
|
0 | 515 |
$template->footer(); |
516 |
} |
|
517 |
||
518 |
function page_Special_SpecialPages() |
|
519 |
{ |
|
520 |
// This should be an easy one |
|
521 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
345
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
343
diff
changeset
|
522 |
global $lang; |
4ccdfeee9a11
WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents:
343
diff
changeset
|
523 |
|
0 | 524 |
$template->header(); |
525 |
$sz = sizeof($paths->pages) / 2; |
|
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
|
526 |
echo '<p>' . $lang->get('pagetools_specialpages_blurb') . '</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">'; |
0 | 527 |
$cclass='row1'; |
528 |
for ( $i = 0; $i < $sz; $i = $i) |
|
529 |
{ |
|
530 |
if ( $cclass == 'row1' ) |
|
531 |
{ |
|
532 |
$cclass = 'row3'; |
|
533 |
} |
|
534 |
else if ( $cclass == 'row3') |
|
535 |
{ |
|
536 |
$cclass='row1'; |
|
537 |
} |
|
538 |
echo '<tr>'; |
|
539 |
for ( $j = 0; $j < 2; $j = $j ) |
|
540 |
{ |
|
541 |
if ( $i < $sz && $paths->pages[$i]['namespace'] == 'Special' && $paths->pages[$i]['visible'] == 1) |
|
542 |
{ |
|
543 |
echo '<td style="width: 50%" class="'.$cclass.'"><a href="'.makeUrl($paths->pages[$i]['urlname']).'">'; |
|
544 |
echo $paths->pages[$i]['name'].'</a></td>'; |
|
545 |
$j++; |
|
546 |
} |
|
547 |
else if ( $i >= $sz ) |
|
548 |
{ |
|
549 |
echo '<td style="width: 50%" class="row2"></td>'; |
|
550 |
$j++; |
|
551 |
} |
|
552 |
$i++; |
|
553 |
} |
|
554 |
echo '</tr>'; |
|
555 |
} |
|
556 |
echo '</table></div>'; |
|
557 |
$template->footer(); |
|
558 |
} |
|
559 |
||
560 |
function page_Special_About_Enano() |
|
561 |
{ |
|
562 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
221
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
563 |
global $lang; |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
564 |
|
0 | 565 |
$platform = 'Unknown'; |
566 |
$uname = @file_get_contents('/proc/sys/kernel/ostype'); |
|
567 |
if($uname == "Linux\n") |
|
568 |
$platform = 'Linux'; |
|
569 |
else if(file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/ |
|
570 |
$platform = 'GNU/Hurd'; |
|
571 |
else if(file_exists('C:\Windows\system32\ntoskrnl.exe')) |
|
572 |
$platform = 'Windows NT'; |
|
573 |
else if(file_exists('C:\Windows\system\krnl386.exe')) |
|
574 |
$platform = 'Windows 9x/DOS'; |
|
575 |
else if(file_exists('/bin/bash')) |
|
576 |
$platform = 'Other GNU/Mac OS X'; |
|
577 |
else if(is_dir('/bin')) |
|
578 |
$platform = 'Other POSIX'; |
|
579 |
$template->header(); |
|
580 |
?> |
|
581 |
<br /> |
|
582 |
<div class="tblholder"> |
|
583 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
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
|
584 |
<tr><th colspan="2" style="text-align: left;"><?php echo $lang->get('meta_enano_about_th'); ?></th></tr> |
221
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
585 |
<tr><td colspan="2" class="row3"> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
586 |
<?php |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
587 |
echo $lang->get('meta_enano_about_poweredby'); |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
588 |
$subst = array( |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
589 |
'gpl_link' => makeUrlNS('Special', 'GNU_General_Public_License') |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
590 |
); |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
591 |
echo $lang->get('meta_enano_about_gpl', $subst); |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
592 |
if ( $lang->lang_code != 'eng' ): |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
593 |
// Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
594 |
// must be accompanied by a copy of the English GPL.) |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
595 |
?> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
596 |
<h3>(English)</h3> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
597 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
598 |
This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source CMS that everyone can use. |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
599 |
Enano is copyright © 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano uses, please |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
600 |
see <a href="http://enanocms.org/Legal_information">Legal Information</a>. |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
601 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
602 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
603 |
The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified, |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
604 |
distributed, and used to create derivative works. For more information about Free Software, check out the |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
605 |
<a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
606 |
the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage. |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
607 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
608 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
609 |
This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
610 |
as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
611 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
612 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
613 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
614 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
615 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
616 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
617 |
You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
618 |
the GNU General Public License</a> along with this program; if not, write to: |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
619 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
620 |
<p style="margin-left 2em;"> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
621 |
Free Software Foundation, Inc.,<br /> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
622 |
51 Franklin Street, Fifth Floor<br /> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
623 |
Boston, MA 02110-1301, USA |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
624 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
625 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
626 |
Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>. |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
627 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
628 |
<?php |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
629 |
endif; |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
630 |
?> |
0 | 631 |
</td></tr> |
632 |
<tr> |
|
633 |
<td class="row2" colspan="2"> |
|
53 | 634 |
<table border="0" style="margin: 0 auto; background: none; width: 100%;" cellpadding="5"> |
0 | 635 |
<tr> |
53 | 636 |
<td style="text-align: center;"> |
87
570f68c3fe36
Redid stupid fading button code and fixed several RC2 bugs in the upgrade schema; 1.0.1 release candidate
Dan
parents:
85
diff
changeset
|
637 |
<?php echo $template->fading_button; ?> |
0 | 638 |
</td> |
639 |
<td style="text-align: center;"> |
|
640 |
<a href="http://www.php.net/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;"> |
|
641 |
<img alt="Written in PHP" src="<?php echo scriptPath; ?>/images/about-powered-php.png" style="border-width: 0px;" width="88" height="31" /> |
|
642 |
</a> |
|
643 |
</td> |
|
644 |
<td style="text-align: center;"> |
|
322
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
645 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
646 |
switch(ENANO_DBLAYER) |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
647 |
{ |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
648 |
case 'MYSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
649 |
?> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
650 |
<a href="http://www.mysql.com/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;"> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
651 |
<img alt="Database engine powered by MySQL" src="<?php echo scriptPath; ?>/images/about-powered-mysql.png" style="border-width: 0px;" width="88" height="31" /> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
652 |
</a> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
653 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
654 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
655 |
case 'PGSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
656 |
?> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
657 |
<a href="http://www.postgresql.org/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;"> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
658 |
<img alt="Database engine powered by PostgreSQL" src="<?php echo scriptPath; ?>/images/about-powered-pgsql.png" style="border-width: 0px;" width="90" height="30" /> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
659 |
</a> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
660 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
661 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
662 |
} |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
663 |
?> |
0 | 664 |
</td> |
665 |
</tr> |
|
666 |
</table> |
|
667 |
</td> |
|
668 |
</tr> |
|
221
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
669 |
<tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_enanoversion'); ?></td><td class="row1"><?php echo enano_version(true) . ' (' . enano_codename() . ')'; ?></td></tr> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
670 |
<tr><td style="width: 100px;" class="row2"><?php echo $lang->get('meta_enano_about_lbl_webserver'); ?></td><td class="row2"><?php if(isset($_SERVER['SERVER_SOFTWARE'])) echo $_SERVER['SERVER_SOFTWARE']; else echo 'Unable to determine web server software.'; ?></td></tr> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
671 |
<tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_serverplatform'); ?></td><td class="row1"><?php echo $platform; ?></td></tr> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
672 |
<tr><td style="width: 100px;" class="row2"><?php echo $lang->get('meta_enano_about_lbl_phpversion'); ?></td><td class="row2"><?php echo PHP_VERSION; ?></td></tr> |
322
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
673 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
674 |
switch(ENANO_DBLAYER) |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
675 |
{ |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
676 |
case 'MYSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
677 |
?> |
326 | 678 |
<tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_mysqlversion'); ?></td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr> |
322
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
679 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
680 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
681 |
case 'PGSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
682 |
$pg_serverdata = pg_version($db->_conn); |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
683 |
$pg_version = $pg_serverdata['server']; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
684 |
?> |
326 | 685 |
<tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_pgsqlversion'); ?></td><td class="row1"><?php echo $pg_version; ?></td></tr> |
322
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
686 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
687 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
688 |
} |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
689 |
?> |
0 | 690 |
</table> |
691 |
</div> |
|
692 |
<?php |
|
693 |
$template->footer(); |
|
694 |
} |
|
695 |
||
696 |
function page_Special_GNU_General_Public_License() |
|
697 |
{ |
|
698 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
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
|
699 |
global $lang; |
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
|
700 |
|
0 | 701 |
$template->header(); |
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
|
702 |
if(file_exists(ENANO_ROOT . '/GPL')) |
0 | 703 |
{ |
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
|
704 |
echo '<p>' . $lang->get('pagetools_gpl_blurb', array('about_url' => makeUrlNS('Special', 'About_Enano'))) . '</p>'; |
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
|
705 |
|
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
|
706 |
if ( $lang->lang_code != 'eng' ): |
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
|
707 |
// Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages |
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
|
708 |
// must be accompanied by a copy of the English GPL.) |
0 | 709 |
echo '<p>The following text represents the license that the <a href="'.makeUrlNS('Special', 'About_Enano').'">Enano</a> content management system is under. To make it easier to read, the text has been wiki-formatted; in no other way has it been changed.</p>'; |
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
|
710 |
endif; |
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
|
711 |
|
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
|
712 |
if ( file_exists(ENANO_ROOT . "/GPL_{$lang->lang_code}") ) |
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
|
713 |
{ |
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
|
714 |
echo '<h2>' . $lang->get('pagetools_gpl_title_native') . '</h2>'; |
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
|
715 |
echo '<p><a href="#gpl_english">' . $lang->get('pagetools_gpl_link_to_english') . ' / View the license in English' . '</a></p>'; |
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
|
716 |
echo RenderMan::render( file_get_contents ( ENANO_ROOT . "/GPL_{$lang->lang_code}" ) ); |
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
|
717 |
echo '<h2>' . $lang->get('pagetools_gpl_title_english') . ' / English version<a name="gpl_english" id="gpl_english"></a></h2>'; |
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
|
718 |
} |
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
|
719 |
|
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:
69
diff
changeset
|
720 |
echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) ); |
0 | 721 |
} |
722 |
else |
|
723 |
{ |
|
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
|
724 |
echo '<p>' . $lang->get('pagetools_gpl_err_file_missing') . '</p>'; |
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
|
725 |
if ( $lang->lang_code != 'eng') |
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
|
726 |
// Also print out English version |
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
|
727 |
// Do not remove the following line of code; doing so would be a violation of the GPL. |
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
|
728 |
echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>. In the mean time, you may wish to contact the site administration and ask them to replace the GPL file.</p>'; |
0 | 729 |
} |
730 |
$template->footer(); |
|
731 |
} |
|
732 |
||
83 | 733 |
function page_Special_TagCloud() |
734 |
{ |
|
735 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
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
|
736 |
global $lang; |
83 | 737 |
|
738 |
$template->header(); |
|
739 |
||
740 |
if ( $tag = $paths->getParam(0) ) |
|
741 |
{ |
|
742 |
$tag = sanitize_tag($tag); |
|
743 |
$q = $db->sql_query('SELECT page_id, namespace FROM '.table_prefix.'tags WHERE tag_name=\'' . $db->escape($tag) . '\';'); |
|
744 |
if ( !$q ) |
|
745 |
$db->_die(); |
|
746 |
if ( $row = $db->fetchrow() ) |
|
747 |
{ |
|
748 |
echo '<div class="tblholder"> |
|
749 |
<table border="0" cellspacing="1" cellpadding="4">'; |
|
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
|
750 |
echo '<tr><th colspan="2">' . $lang->get('pagetools_tagcloud_pagelist_th', array('tag' => htmlspecialchars($tag))) . '</th></tr>'; |
83 | 751 |
echo '<tr>'; |
752 |
$i = 0; |
|
753 |
$td_class = 'row1'; |
|
754 |
do |
|
755 |
{ |
|
756 |
if ( $i % 2 == 0 && $i > 1 ) |
|
757 |
{ |
|
758 |
$td_class = ( $td_class == 'row2' ) ? 'row1' : 'row2'; |
|
759 |
echo '</tr><tr>'; |
|
760 |
} |
|
761 |
$i++; |
|
762 |
$title = get_page_title_ns($row['page_id'], $row['namespace']); |
|
763 |
if ( $row['namespace'] != 'Article' && isset($paths->nslist[$row['namespace']]) ) |
|
764 |
$title = $paths->nslist[$row['namespace']] . $title; |
|
765 |
$url = makeUrlNS($row['namespace'], $row['page_id']); |
|
766 |
$class = ( isPage( $paths->nslist[$row['namespace']] . $row['page_id'] ) ) ? '' : ' class="wikilink-nonexistent"'; |
|
767 |
$link = '<a href="' . htmlspecialchars($url) . '"' . $class . '>' . htmlspecialchars($title) . '</a>'; |
|
768 |
echo "<td class=\"$td_class\" style=\"width: 50%;\">$link</td>"; |
|
769 |
// " workaround for jEdit highlighting bug |
|
770 |
} |
|
771 |
while ( $row = $db->fetchrow() ); |
|
772 |
while ( $i % 2 > 0 ) |
|
773 |
{ |
|
774 |
$i++; |
|
775 |
echo "<td class=\"$td_class\" style=\"width: 50%;\"></td>"; |
|
776 |
} |
|
777 |
// " workaround for jEdit highlighting bug |
|
778 |
echo '<tr> |
|
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
|
779 |
<th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '">« ' . $lang->get('pagetools_tagcloud_btn_return') . '</a></th> |
83 | 780 |
</tr>'; |
781 |
echo '</table>'; |
|
782 |
echo '</div>'; |
|
783 |
} |
|
784 |
} |
|
785 |
else |
|
786 |
{ |
|
787 |
$cloud = new TagCloud(); |
|
788 |
||
789 |
$q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
|
790 |
if ( !$q ) |
|
791 |
$db->_die(); |
|
792 |
if ( $db->numrows() < 1 ) |
|
793 |
{ |
|
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
|
794 |
echo '<p>' . $lang->get('pagetools_tagcloud_msg_no_tags') . '</p>'; |
83 | 795 |
} |
796 |
else |
|
797 |
{ |
|
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
|
798 |
echo '<h3>' . $lang->get('pagetools_tagcloud_blurb') . '</h3>'; |
83 | 799 |
while ( $row = $db->fetchrow() ) |
800 |
{ |
|
801 |
$cloud->add_word($row['tag_name']); |
|
802 |
} |
|
803 |
echo $cloud->make_html('normal'); |
|
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
|
804 |
echo '<p>' . $lang->get('pagetools_tagcloud_instructions') . '</p>'; |
83 | 805 |
} |
806 |
} |
|
807 |
||
808 |
$template->footer(); |
|
809 |
} |
|
810 |
||
811 |
// tag cloud sidebar block |
|
812 |
function sidebar_add_tag_cloud() |
|
813 |
{ |
|
814 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
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
|
815 |
global $lang; |
83 | 816 |
$cloud = new TagCloud(); |
817 |
||
818 |
$q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
|
819 |
if ( !$q ) |
|
820 |
$db->_die(); |
|
821 |
if ( $db->numrows() < 1 ) |
|
822 |
{ |
|
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
|
823 |
$sb_html = $lang->get('pagetools_tagcloud_msg_no_tags'); |
83 | 824 |
} |
825 |
else |
|
826 |
{ |
|
827 |
while ( $row = $db->fetchrow() ) |
|
828 |
{ |
|
829 |
$cloud->add_word($row['tag_name']); |
|
830 |
} |
|
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
|
831 |
$sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">' . $lang->get('pagetools_tagcloud_sidebar_btn_larger') . '</a>'; |
83 | 832 |
} |
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
|
833 |
$template->sidebar_widget($lang->get('pagetools_tagcloud_sidebar_title'), "<div style='padding: 5px;'>$sb_html</div>"); |
83 | 834 |
} |
835 |
||
836 |
$plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();'); |
|
837 |
||
581
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
838 |
function page_Special_Autofill() |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
839 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
840 |
global $db, $session, $paths, $template, $plugins; // Common objects |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
841 |
global $lang; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
842 |
|
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
843 |
header('Content-type: text/javascript'); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
844 |
|
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
845 |
$dataset = array(); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
846 |
if ( isset($_GET['type']) ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
847 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
848 |
switch($_GET['type']) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
849 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
850 |
case 'username': |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
851 |
if ( isset($_GET['userinput']) && strlen($_GET['userinput']) >= 3 ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
852 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
853 |
$search = '%' . escape_string_like($_GET['userinput']) . '%'; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
854 |
$q = $db->sql_query('SELECT username FROM ' . table_prefix . "users WHERE " . ENANO_SQLFUNC_LOWERCASE . "(username) LIKE '$search' AND user_id > 1"); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
855 |
if ( !$q ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
856 |
$db->die_json(); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
857 |
|
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
858 |
while ( $row = $db->fetchrow() ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
859 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
860 |
$key = array( |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
861 |
'name' => $row['username'], |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
862 |
'name_highlight' => highlight_term($_GET['userinput'], $row['username'], '<b>', '</b>') |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
863 |
); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
864 |
$key = array_merge($key, $session->get_user_rank($row['username'])); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
865 |
$key['rank_title'] = $lang->get($key['rank_title']); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
866 |
$dataset[] = $key; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
867 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
868 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
869 |
break; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
870 |
case 'page': |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
871 |
if ( isset($_GET['userinput']) && strlen($_GET['userinput']) >= 3 ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
872 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
873 |
$search = '%' . escape_string_like($_GET['userinput']) . '%'; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
874 |
$q = $db->sql_query('SELECT urlname, namespace, name FROM ' . table_prefix . "users\n" |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
875 |
. " WHERE (\n" |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
876 |
. " " . ENANO_SQLFUNC_LOWERCASE . "(urlname) LIKE '$search'\n" |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
877 |
. " OR " . ENANO_SQLFUNC_LOWERCASE . "(name) LIKE '$search'\n" |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
878 |
. " ) AND user_id > 1"); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
879 |
if ( !$q ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
880 |
$db->die_json(); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
881 |
|
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
882 |
while ( $row = $db->fetchrow() ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
883 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
884 |
$pathskey = ( isset($paths->nslist[$row['namespace']]) ? $paths->nslist[$row['namespace']] : $row['namespace'] . substr($paths->nslist['Special'], -1) ) . $row['urlname']; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
885 |
$key = array( |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
886 |
'page_id' => $pathskey, |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
887 |
'pid_highlight' => highlight_term($_GET['userinput'], dirtify_page_id($pathskey), '<b>', '</b>'), |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
888 |
'name_highlight' => highlight_term($_GET['userinput'], $row['name'], '<b>', '</b>') |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
889 |
); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
890 |
$dataset[] = $key; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
891 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
892 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
893 |
break; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
894 |
default: |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
895 |
$code = $plugins->setHook('autofill_json_request'); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
896 |
foreach ( $code as $cmd ) |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
897 |
{ |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
898 |
eval($cmd); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
899 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
900 |
break; |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
901 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
902 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
903 |
|
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
904 |
echo enano_json_encode($dataset); |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
905 |
} |
5e8fd89c02ea
Initial progress towards converting auto-completion framework to Spry. Not currently in a very working state.
Dan
parents:
564
diff
changeset
|
906 |
|
0 | 907 |
?> |