author | Dan |
Thu, 20 Dec 2007 22:23:07 -0500 | |
changeset 328 | dc838fd61a06 |
parent 326 | ab66d6d1f1f4 |
child 334 | c72b545f1304 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/* |
|
3 |
Plugin Name: Special page-related pages |
|
4 |
Plugin URI: http://enanocms.org/ |
|
5 |
Description: Provides the page Special:CreatePage, which can be used to create new pages. Also adds the About Enano and GNU General Public License pages. |
|
6 |
Author: Dan Fuhry |
|
317 | 7 |
Version: 1.0.3 |
0 | 8 |
Author URI: http://enanocms.org/ |
9 |
*/ |
|
10 |
||
11 |
/* |
|
12 |
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
|
317 | 13 |
* Version 1.0.3 |
0 | 14 |
* Copyright (C) 2006-2007 Dan Fuhry |
15 |
* |
|
16 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
20 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
|
21 |
*/ |
|
22 |
||
23 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
24 |
||
25 |
$plugins->attachHook('base_classes_initted', ' |
|
26 |
global $paths; |
|
27 |
$paths->add_page(Array( |
|
28 |
\'name\'=>\'Create page\', |
|
29 |
\'urlname\'=>\'CreatePage\', |
|
30 |
\'namespace\'=>\'Special\', |
|
31 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
32 |
)); |
|
33 |
||
34 |
$paths->add_page(Array( |
|
35 |
\'name\'=>\'All pages\', |
|
36 |
\'urlname\'=>\'AllPages\', |
|
37 |
\'namespace\'=>\'Special\', |
|
38 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
39 |
)); |
|
40 |
||
41 |
$paths->add_page(Array( |
|
42 |
\'name\'=>\'List of special pages\', |
|
43 |
\'urlname\'=>\'SpecialPages\', |
|
44 |
\'namespace\'=>\'Special\', |
|
45 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
46 |
)); |
|
47 |
||
48 |
$paths->add_page(Array( |
|
49 |
\'name\'=>\'About Enano\', |
|
50 |
\'urlname\'=>\'About_Enano\', |
|
51 |
\'namespace\'=>\'Special\', |
|
52 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
53 |
)); |
|
54 |
||
55 |
$paths->add_page(Array( |
|
56 |
\'name\'=>\'GNU General Public License\', |
|
57 |
\'urlname\'=>\'GNU_General_Public_License\', |
|
58 |
\'namespace\'=>\'Special\', |
|
59 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
60 |
)); |
|
83 | 61 |
|
62 |
$paths->add_page(Array( |
|
63 |
\'name\'=>\'Tag cloud\', |
|
64 |
\'urlname\'=>\'TagCloud\', |
|
65 |
\'namespace\'=>\'Special\', |
|
66 |
\'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
67 |
)); |
|
0 | 68 |
'); |
69 |
||
70 |
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
|
71 |
||
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
72 |
function page_Special_CreatePage() |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
73 |
{ |
0 | 74 |
global $db, $session, $paths, $template, $plugins; // Common objects |
75 |
if ( isset($_POST['do']) ) |
|
76 |
{ |
|
77 |
$p = $_POST['pagename']; |
|
78 |
$k = array_keys($paths->nslist); |
|
79 |
for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ ) |
|
80 |
{ |
|
81 |
$ln = strlen( $paths->nslist[$k[$i]] ); |
|
82 |
if ( substr($p, 0, $ln) == $paths->nslist[$k[$i]] ) |
|
83 |
{ |
|
84 |
$namespace = $k[$i]; |
|
85 |
} |
|
86 |
} |
|
87 |
if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin') |
|
88 |
{ |
|
89 |
$template->header(); |
|
90 |
||
91 |
echo '<h3>The page could not be created.</h3><p>The name "'.$p.'" is invalid.</p>'; |
|
92 |
||
93 |
$template->footer(); |
|
94 |
$db->close(); |
|
95 |
||
96 |
exit; |
|
97 |
} |
|
98 |
$name = $db->escape(str_replace('_', ' ', $p)); |
|
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
99 |
$urlname = str_replace(' ', '_', $p); |
0 | 100 |
$namespace = $_POST['namespace']; |
101 |
if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin') |
|
102 |
{ |
|
103 |
$template->header(); |
|
104 |
||
105 |
echo '<h3>The page could not be created.</h3><p>The name "'.$paths->nslist[$namespace].$p.'" is invalid.</p>'; |
|
106 |
||
107 |
$template->footer(); |
|
108 |
$db->close(); |
|
109 |
||
110 |
exit; |
|
111 |
} |
|
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
|
112 |
$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
|
113 |
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
|
114 |
{ |
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
|
115 |
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
|
116 |
} |
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
|
117 |
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
|
118 |
{ |
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
|
119 |
$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
|
120 |
|
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
|
121 |
echo '<h3>The page could not be created.</h3><p>The page title can\'t start with "Project:" because this prefix is reserved for a parser shortcut.</p>'; |
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
|
122 |
|
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
|
123 |
$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
|
124 |
$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
|
125 |
|
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
|
126 |
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
|
127 |
} |
0 | 128 |
|
129 |
$tn = $paths->nslist[$_POST['namespace']] . $urlname; |
|
130 |
if ( isset($paths->pages[$tn]) ) |
|
131 |
{ |
|
132 |
die_friendly('Error creating page', '<p>The page already exists.</p>'); |
|
133 |
} |
|
134 |
||
135 |
if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) ) |
|
136 |
{ |
|
137 |
$urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname)); |
|
138 |
} |
|
139 |
||
140 |
$k = array_keys( $paths->nslist ); |
|
141 |
if(!in_array($_POST['namespace'], $k)) |
|
142 |
{ |
|
143 |
$db->_die('An SQL injection attempt was caught at '.dirname(__FILE__).':'.__LINE__.'.'); |
|
144 |
} |
|
145 |
||
112
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
146 |
$ips = array( |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
147 |
'ip' => array(), |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
148 |
'u' => array() |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
149 |
); |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
150 |
$ips = $db->escape(serialize($ips)); |
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
151 |
|
22
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
152 |
$urlname = sanitize_page_id($urlname); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
153 |
$urlname = $db->escape($urlname); |
d0314575e2f0
More preliminary l10n work; userpage portal style basics implemented
Dan
parents:
0
diff
changeset
|
154 |
|
0 | 155 |
$perms = $session->fetch_page_acl($urlname, $namespace); |
156 |
if ( !$perms->get_permissions('create_page') ) |
|
157 |
die_friendly('Error creating page', '<p>An access control rule is preventing you from creating pages.</p>'); |
|
158 |
||
159 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\');'); |
|
160 |
if ( !$q ) |
|
161 |
{ |
|
162 |
$db->_die('The page log could not be updated.'); |
|
163 |
} |
|
164 |
||
112
008b1c42be72
Rewrote all code related to delvote_ips column to use serialize()
Dan
parents:
91
diff
changeset
|
165 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');'); |
0 | 166 |
if ( !$q ) |
167 |
{ |
|
168 |
$db->_die('The page entry could not be inserted.'); |
|
169 |
} |
|
157
6df5f7a55a30
Creating pages doesn't insert that crappy javascript hack anymore
Dan
parents:
132
diff
changeset
|
170 |
$q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.'\');'); |
0 | 171 |
if ( !$q ) |
172 |
{ |
|
173 |
$db->_die('The page text entry could not be inserted.'); |
|
174 |
} |
|
175 |
||
157
6df5f7a55a30
Creating pages doesn't insert that crappy javascript hack anymore
Dan
parents:
132
diff
changeset
|
176 |
header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)) . '#do:edit'); |
0 | 177 |
exit; |
178 |
} |
|
179 |
$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
|
180 |
/* |
0 | 181 |
if ( !$session->get_permissions('create_page') ) |
182 |
{ |
|
183 |
echo 'Wiki mode is disabled, only admins can create pages.'; |
|
184 |
||
185 |
$template->footer(); |
|
186 |
$db->close(); |
|
187 |
||
188 |
exit; |
|
189 |
} |
|
285
7846d45bd250
Changed all urlname/page_id columns to varchar(255) because 63 characters just isn't long enough
Dan
parents:
194
diff
changeset
|
190 |
*/ |
0 | 191 |
echo RenderMan::render('Using the form below you can create a page.'); |
192 |
?> |
|
193 |
<form action="" method="post"> |
|
194 |
<p> |
|
195 |
<select name="namespace"> |
|
196 |
<?php |
|
197 |
$k = array_keys($paths->nslist); |
|
198 |
for ( $i = 0; $i < sizeof($k); $i++ ) |
|
199 |
{ |
|
200 |
if ( $paths->nslist[$k[$i]] == '' ) |
|
201 |
{ |
|
202 |
$s = '[No prefix]'; |
|
203 |
} |
|
204 |
else |
|
205 |
{ |
|
206 |
$s = $paths->nslist[$k[$i]]; |
|
207 |
} |
|
208 |
if ( ( $k[$i] != 'System' || $session->user_level >= USER_LEVEL_ADMIN ) && $k[$i] != 'Admin' && $k[$i] != 'Special') |
|
209 |
{ |
|
210 |
echo '<option value="'.$k[$i].'">'.$s.'</option>'; |
|
211 |
} |
|
212 |
} |
|
213 |
?> |
|
214 |
</select> <input type="text" name="pagename" /></p> |
|
215 |
<p><input type="submit" name="do" value="Create Page" /></p> |
|
216 |
</form> |
|
217 |
<?php |
|
218 |
$template->footer(); |
|
219 |
} |
|
220 |
||
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
|
221 |
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
|
222 |
{ |
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
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
static $per_row = 2; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
227 |
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
|
228 |
$return = ''; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
229 |
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
|
230 |
{ |
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
|
231 |
$rowtracker = 0; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
232 |
$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
|
233 |
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
|
234 |
} |
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
|
235 |
$rowtracker++; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
236 |
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
|
237 |
{ |
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
|
238 |
$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
|
239 |
$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
|
240 |
} |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
241 |
if ( $rowtracker == 0 && !$first ) |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
242 |
$return .= "</tr>\n<tr>"; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
243 |
|
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
244 |
$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
|
245 |
|
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
|
246 |
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
|
247 |
$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
|
248 |
$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
|
249 |
$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
|
250 |
|
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
|
251 |
$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
|
252 |
$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
|
253 |
|
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
|
254 |
$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
|
255 |
$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
|
256 |
|
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
|
257 |
$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
|
258 |
|
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
|
259 |
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
|
260 |
} |
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
|
261 |
|
0 | 262 |
function page_Special_AllPages() |
263 |
{ |
|
264 |
// This should be an easy one |
|
265 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
266 |
$template->header(); |
|
267 |
$sz = sizeof( $paths->pages ) / 2; |
|
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
|
268 |
echo '<p>Below is a list of all of the pages on this website.</p>'; |
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
|
269 |
|
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
|
270 |
$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
|
271 |
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
|
272 |
$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
|
273 |
$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
|
274 |
$count = $row[0]; |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
275 |
|
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
276 |
switch($count % 4) |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
277 |
{ |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
278 |
case 0: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
279 |
case 2: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
280 |
// even number of results; do nothing |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
281 |
$last_cell = ''; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
282 |
break; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
283 |
case 1: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
284 |
// 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
|
285 |
$last_cell = '<td class="row1"></td>'; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
286 |
break; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
287 |
case 3: |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
288 |
// 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
|
289 |
$last_cell = '<td class="row2"></td>'; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
290 |
break; |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
291 |
} |
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
292 |
|
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
|
293 |
$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
|
294 |
|
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
|
295 |
$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
|
296 |
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
|
297 |
$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
|
298 |
|
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
|
299 |
$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
|
300 |
|
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
|
301 |
// 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
|
302 |
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
|
303 |
|
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
|
304 |
$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
|
305 |
$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
|
306 |
'{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
|
307 |
$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
|
308 |
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
|
309 |
$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
|
310 |
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
|
311 |
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
|
312 |
'<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
|
313 |
<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
|
314 |
<tr>', // print at start |
117
7cfdbb2fd17a
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents:
116
diff
changeset
|
315 |
' ' . $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
|
316 |
</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
|
317 |
</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
|
318 |
); |
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
|
319 |
|
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
|
320 |
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
|
321 |
|
0 | 322 |
$template->footer(); |
323 |
} |
|
324 |
||
325 |
function page_Special_SpecialPages() |
|
326 |
{ |
|
327 |
// This should be an easy one |
|
328 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
329 |
$template->header(); |
|
330 |
$sz = sizeof($paths->pages) / 2; |
|
331 |
echo '<p>Below is a list of all of the special pages on this website.</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">'; |
|
332 |
$cclass='row1'; |
|
333 |
for ( $i = 0; $i < $sz; $i = $i) |
|
334 |
{ |
|
335 |
if ( $cclass == 'row1' ) |
|
336 |
{ |
|
337 |
$cclass = 'row3'; |
|
338 |
} |
|
339 |
else if ( $cclass == 'row3') |
|
340 |
{ |
|
341 |
$cclass='row1'; |
|
342 |
} |
|
343 |
echo '<tr>'; |
|
344 |
for ( $j = 0; $j < 2; $j = $j ) |
|
345 |
{ |
|
346 |
if ( $i < $sz && $paths->pages[$i]['namespace'] == 'Special' && $paths->pages[$i]['visible'] == 1) |
|
347 |
{ |
|
348 |
echo '<td style="width: 50%" class="'.$cclass.'"><a href="'.makeUrl($paths->pages[$i]['urlname']).'">'; |
|
349 |
echo $paths->pages[$i]['name'].'</a></td>'; |
|
350 |
$j++; |
|
351 |
} |
|
352 |
else if ( $i >= $sz ) |
|
353 |
{ |
|
354 |
echo '<td style="width: 50%" class="row2"></td>'; |
|
355 |
$j++; |
|
356 |
} |
|
357 |
$i++; |
|
358 |
} |
|
359 |
echo '</tr>'; |
|
360 |
} |
|
361 |
echo '</table></div>'; |
|
362 |
$template->footer(); |
|
363 |
} |
|
364 |
||
365 |
function page_Special_About_Enano() |
|
366 |
{ |
|
367 |
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
|
368 |
global $lang; |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
369 |
|
0 | 370 |
$platform = 'Unknown'; |
371 |
$uname = @file_get_contents('/proc/sys/kernel/ostype'); |
|
372 |
if($uname == "Linux\n") |
|
373 |
$platform = 'Linux'; |
|
374 |
else if(file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/ |
|
375 |
$platform = 'GNU/Hurd'; |
|
376 |
else if(file_exists('C:\Windows\system32\ntoskrnl.exe')) |
|
377 |
$platform = 'Windows NT'; |
|
378 |
else if(file_exists('C:\Windows\system\krnl386.exe')) |
|
379 |
$platform = 'Windows 9x/DOS'; |
|
380 |
else if(file_exists('/bin/bash')) |
|
381 |
$platform = 'Other GNU/Mac OS X'; |
|
382 |
else if(is_dir('/bin')) |
|
383 |
$platform = 'Other POSIX'; |
|
384 |
$template->header(); |
|
385 |
?> |
|
386 |
<br /> |
|
387 |
<div class="tblholder"> |
|
388 |
<table border="0" cellspacing="1" cellpadding="4"> |
|
389 |
<tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</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
|
390 |
<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
|
391 |
<?php |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
392 |
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
|
393 |
$subst = array( |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
394 |
'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
|
395 |
); |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
396 |
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
|
397 |
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
|
398 |
// 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
|
399 |
// 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
|
400 |
?> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
401 |
<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
|
402 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
403 |
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
|
404 |
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
|
405 |
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
|
406 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
407 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
408 |
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
|
409 |
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
|
410 |
<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
|
411 |
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
|
412 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
413 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
414 |
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
|
415 |
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
|
416 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
417 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
418 |
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
|
419 |
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
|
420 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
421 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
422 |
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
|
423 |
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
|
424 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
425 |
<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
|
426 |
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
|
427 |
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
|
428 |
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
|
429 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
430 |
<p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
431 |
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
|
432 |
</p> |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
433 |
<?php |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
434 |
endif; |
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
435 |
?> |
0 | 436 |
</td></tr> |
437 |
<tr> |
|
438 |
<td class="row2" colspan="2"> |
|
53 | 439 |
<table border="0" style="margin: 0 auto; background: none; width: 100%;" cellpadding="5"> |
0 | 440 |
<tr> |
53 | 441 |
<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
|
442 |
<?php echo $template->fading_button; ?> |
0 | 443 |
</td> |
444 |
<td style="text-align: center;"> |
|
445 |
<a href="http://www.php.net/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;"> |
|
446 |
<img alt="Written in PHP" src="<?php echo scriptPath; ?>/images/about-powered-php.png" style="border-width: 0px;" width="88" height="31" /> |
|
447 |
</a> |
|
448 |
</td> |
|
449 |
<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
|
450 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
451 |
switch(ENANO_DBLAYER) |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
452 |
{ |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
453 |
case 'MYSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
454 |
?> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
455 |
<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
|
456 |
<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
|
457 |
</a> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
458 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
459 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
460 |
case 'PGSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
461 |
?> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
462 |
<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
|
463 |
<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
|
464 |
</a> |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
465 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
466 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
467 |
} |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
468 |
?> |
0 | 469 |
</td> |
470 |
</tr> |
|
471 |
</table> |
|
472 |
</td> |
|
473 |
</tr> |
|
221
e5302cb1945c
Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents:
194
diff
changeset
|
474 |
<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
|
475 |
<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
|
476 |
<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
|
477 |
<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
|
478 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
479 |
switch(ENANO_DBLAYER) |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
480 |
{ |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
481 |
case 'MYSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
482 |
?> |
326 | 483 |
<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
|
484 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
485 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
486 |
case 'PGSQL': |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
487 |
$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
|
488 |
$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
|
489 |
?> |
326 | 490 |
<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
|
491 |
<?php |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
492 |
break; |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
493 |
} |
5f1cd51bf1be
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
Dan
parents:
317
diff
changeset
|
494 |
?> |
0 | 495 |
</table> |
496 |
</div> |
|
497 |
<?php |
|
498 |
$template->footer(); |
|
499 |
} |
|
500 |
||
501 |
function page_Special_GNU_General_Public_License() |
|
502 |
{ |
|
503 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
504 |
$template->header(); |
|
505 |
if(file_exists(ENANO_ROOT.'/GPL')) |
|
506 |
{ |
|
507 |
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>'; |
|
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
|
508 |
echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) ); |
0 | 509 |
} |
510 |
else |
|
511 |
{ |
|
36
425261984266
Added "page hint" on search page; deprecated "www." on EnanoCMS.org links
Dan
parents:
23
diff
changeset
|
512 |
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>.</p>'; |
0 | 513 |
} |
514 |
$template->footer(); |
|
515 |
} |
|
516 |
||
83 | 517 |
function page_Special_TagCloud() |
518 |
{ |
|
519 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
520 |
||
521 |
$template->header(); |
|
522 |
||
523 |
if ( $tag = $paths->getParam(0) ) |
|
524 |
{ |
|
525 |
$tag = sanitize_tag($tag); |
|
526 |
$q = $db->sql_query('SELECT page_id, namespace FROM '.table_prefix.'tags WHERE tag_name=\'' . $db->escape($tag) . '\';'); |
|
527 |
if ( !$q ) |
|
528 |
$db->_die(); |
|
529 |
if ( $row = $db->fetchrow() ) |
|
530 |
{ |
|
531 |
echo '<div class="tblholder"> |
|
532 |
<table border="0" cellspacing="1" cellpadding="4">'; |
|
533 |
echo '<tr><th colspan="2">Pages tagged "' . htmlspecialchars($tag) . '"</th></tr>'; |
|
534 |
echo '<tr>'; |
|
535 |
$i = 0; |
|
536 |
$td_class = 'row1'; |
|
537 |
do |
|
538 |
{ |
|
539 |
if ( $i % 2 == 0 && $i > 1 ) |
|
540 |
{ |
|
541 |
$td_class = ( $td_class == 'row2' ) ? 'row1' : 'row2'; |
|
542 |
echo '</tr><tr>'; |
|
543 |
} |
|
544 |
$i++; |
|
545 |
$title = get_page_title_ns($row['page_id'], $row['namespace']); |
|
546 |
if ( $row['namespace'] != 'Article' && isset($paths->nslist[$row['namespace']]) ) |
|
547 |
$title = $paths->nslist[$row['namespace']] . $title; |
|
548 |
$url = makeUrlNS($row['namespace'], $row['page_id']); |
|
549 |
$class = ( isPage( $paths->nslist[$row['namespace']] . $row['page_id'] ) ) ? '' : ' class="wikilink-nonexistent"'; |
|
550 |
$link = '<a href="' . htmlspecialchars($url) . '"' . $class . '>' . htmlspecialchars($title) . '</a>'; |
|
551 |
echo "<td class=\"$td_class\" style=\"width: 50%;\">$link</td>"; |
|
552 |
// " workaround for jEdit highlighting bug |
|
553 |
} |
|
554 |
while ( $row = $db->fetchrow() ); |
|
555 |
while ( $i % 2 > 0 ) |
|
556 |
{ |
|
557 |
$i++; |
|
558 |
echo "<td class=\"$td_class\" style=\"width: 50%;\"></td>"; |
|
559 |
} |
|
560 |
// " workaround for jEdit highlighting bug |
|
561 |
echo '<tr> |
|
562 |
<th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '" style="color: white;">« Return to tag cloud</a></th> |
|
563 |
</tr>'; |
|
564 |
echo '</table>'; |
|
565 |
echo '</div>'; |
|
566 |
} |
|
567 |
} |
|
568 |
else |
|
569 |
{ |
|
570 |
$cloud = new TagCloud(); |
|
571 |
||
572 |
$q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
|
573 |
if ( !$q ) |
|
574 |
$db->_die(); |
|
575 |
if ( $db->numrows() < 1 ) |
|
576 |
{ |
|
577 |
echo '<p>No pages are tagged yet.</p>'; |
|
578 |
} |
|
579 |
else |
|
580 |
{ |
|
581 |
echo '<h3>Summary of page tagging</h3>'; |
|
582 |
while ( $row = $db->fetchrow() ) |
|
583 |
{ |
|
584 |
$cloud->add_word($row['tag_name']); |
|
585 |
} |
|
586 |
echo $cloud->make_html('normal'); |
|
587 |
echo '<p>Hover your mouse over a tag to see how many pages have the tag. Click on a tag to see a list of the pages that have it.</p>'; |
|
588 |
} |
|
589 |
} |
|
590 |
||
591 |
$template->footer(); |
|
592 |
} |
|
593 |
||
594 |
// tag cloud sidebar block |
|
595 |
function sidebar_add_tag_cloud() |
|
596 |
{ |
|
597 |
global $db, $session, $paths, $template, $plugins; // Common objects |
|
598 |
$cloud = new TagCloud(); |
|
599 |
||
600 |
$q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
|
601 |
if ( !$q ) |
|
602 |
$db->_die(); |
|
603 |
if ( $db->numrows() < 1 ) |
|
604 |
{ |
|
605 |
$sb_html = 'No pages are tagged yet.'; |
|
606 |
} |
|
607 |
else |
|
608 |
{ |
|
609 |
while ( $row = $db->fetchrow() ) |
|
610 |
{ |
|
611 |
$cloud->add_word($row['tag_name']); |
|
612 |
} |
|
613 |
$sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">Larger version</a>'; |
|
614 |
} |
|
615 |
$template->sidebar_widget('Tag cloud', "<div style='padding: 5px;'>$sb_html</div>"); |
|
616 |
} |
|
617 |
||
618 |
$plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();'); |
|
619 |
||
0 | 620 |
?> |