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
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
diff
changeset
+ − 25
$plugins->attachHook('session_started', '
0
+ − 26
global $paths;
+ − 27
$paths->add_page(Array(
334
c72b545f1304
More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
diff
changeset
+ − 28
\'name\'=>\'specialpage_create_page\',
0
+ − 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(
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
diff
changeset
+ − 35
\'name\'=>\'specialpage_all_pages\',
0
+ − 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(
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
diff
changeset
+ − 42
\'name\'=>\'specialpage_special_pages\',
0
+ − 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(
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
diff
changeset
+ − 49
\'name\'=>\'specialpage_about_enano\',
0
+ − 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(
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
diff
changeset
+ − 56
\'name\'=>\'specialpage_gnu_gpl\',
0
+ − 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(
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
diff
changeset
+ − 63
\'name\'=>\'specialpage_tag_cloud\',
83
+ − 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
+ − 72
function page_Special_CreatePage()
+ − 73
{
0
+ − 74
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
diff
changeset
+ − 75
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
diff
changeset
+ − 76
0
+ − 77
if ( isset($_POST['do']) )
+ − 78
{
+ − 79
$p = $_POST['pagename'];
+ − 80
$k = array_keys($paths->nslist);
+ − 81
for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ )
+ − 82
{
+ − 83
$ln = strlen( $paths->nslist[$k[$i]] );
+ − 84
if ( substr($p, 0, $ln) == $paths->nslist[$k[$i]] )
+ − 85
{
+ − 86
$namespace = $k[$i];
+ − 87
}
+ − 88
}
+ − 89
if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin')
+ − 90
{
+ − 91
$template->header();
+ − 92
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
diff
changeset
+ − 93
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
diff
changeset
+ − 94
<p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($p))) . '</p>';
0
+ − 95
+ − 96
$template->footer();
+ − 97
$db->close();
+ − 98
+ − 99
exit;
+ − 100
}
+ − 101
$name = $db->escape(str_replace('_', ' ', $p));
22
+ − 102
$urlname = str_replace(' ', '_', $p);
0
+ − 103
$namespace = $_POST['namespace'];
+ − 104
if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin')
+ − 105
{
+ − 106
$template->header();
+ − 107
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
diff
changeset
+ − 108
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
diff
changeset
+ − 109
<p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($paths->nslist[$namespace].$p))) . '</p>';
0
+ − 110
+ − 111
$template->footer();
+ − 112
$db->close();
+ − 113
+ − 114
exit;
+ − 115
}
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
diff
changeset
+ − 116
$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
diff
changeset
+ − 117
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
diff
changeset
+ − 118
{
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
diff
changeset
+ − 119
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
diff
changeset
+ − 120
}
194
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
diff
changeset
+ − 121
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
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
diff
changeset
+ − 123
$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
diff
changeset
+ − 124
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
diff
changeset
+ − 125
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
diff
changeset
+ − 126
<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
diff
changeset
+ − 127
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
diff
changeset
+ − 128
$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
diff
changeset
+ − 129
$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
diff
changeset
+ − 130
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
diff
changeset
+ − 131
exit;
bf0fdec102e9
SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
diff
changeset
+ − 132
}
0
+ − 133
+ − 134
$tn = $paths->nslist[$_POST['namespace']] . $urlname;
+ − 135
if ( isset($paths->pages[$tn]) )
+ − 136
{
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
diff
changeset
+ − 137
die_friendly($lang->get('pagetools_create_err_title'), '<p>' . $lang->get('pagetools_create_err_already_exist') . '</p>');
0
+ − 138
}
+ − 139
+ − 140
if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) )
+ − 141
{
+ − 142
$urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname));
+ − 143
}
+ − 144
+ − 145
$k = array_keys( $paths->nslist );
+ − 146
if(!in_array($_POST['namespace'], $k))
+ − 147
{
+ − 148
$db->_die('An SQL injection attempt was caught at '.dirname(__FILE__).':'.__LINE__.'.');
+ − 149
}
+ − 150
112
+ − 151
$ips = array(
+ − 152
'ip' => array(),
+ − 153
'u' => array()
+ − 154
);
+ − 155
$ips = $db->escape(serialize($ips));
+ − 156
22
+ − 157
$urlname = sanitize_page_id($urlname);
+ − 158
$urlname = $db->escape($urlname);
+ − 159
0
+ − 160
$perms = $session->fetch_page_acl($urlname, $namespace);
+ − 161
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
diff
changeset
+ − 162
die_friendly($lang->get('pagetools_create_err_title'), '<p>An access control rule is preventing you from creating pages.</p>');
0
+ − 163
+ − 164
$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'].'\');');
+ − 165
if ( !$q )
+ − 166
{
+ − 167
$db->_die('The page log could not be updated.');
+ − 168
}
+ − 169
112
+ − 170
$q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');');
0
+ − 171
if ( !$q )
+ − 172
{
+ − 173
$db->_die('The page entry could not be inserted.');
+ − 174
}
157
+ − 175
$q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.'\');');
0
+ − 176
if ( !$q )
+ − 177
{
+ − 178
$db->_die('The page text entry could not be inserted.');
+ − 179
}
+ − 180
157
+ − 181
header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)) . '#do:edit');
0
+ − 182
exit;
+ − 183
}
+ − 184
$template->header();
285
7846d45bd250
Changed all urlname/page_id columns to varchar(255) because 63 characters just isn't long enough
Dan
diff
changeset
+ − 185
/*
0
+ − 186
if ( !$session->get_permissions('create_page') )
+ − 187
{
+ − 188
echo 'Wiki mode is disabled, only admins can create pages.';
+ − 189
+ − 190
$template->footer();
+ − 191
$db->close();
+ − 192
+ − 193
exit;
+ − 194
}
285
7846d45bd250
Changed all urlname/page_id columns to varchar(255) because 63 characters just isn't long enough
Dan
diff
changeset
+ − 195
*/
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
diff
changeset
+ − 196
echo '<p>' . $lang->get('pagetools_create_blurb') . '</p>';
0
+ − 197
?>
+ − 198
<form action="" method="post">
+ − 199
<p>
+ − 200
<select name="namespace">
+ − 201
<?php
+ − 202
$k = array_keys($paths->nslist);
+ − 203
for ( $i = 0; $i < sizeof($k); $i++ )
+ − 204
{
+ − 205
if ( $paths->nslist[$k[$i]] == '' )
+ − 206
{
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
diff
changeset
+ − 207
$s = $lang->get('pagetools_create_namespace_none');
0
+ − 208
}
+ − 209
else
+ − 210
{
+ − 211
$s = $paths->nslist[$k[$i]];
+ − 212
}
+ − 213
if ( ( $k[$i] != 'System' || $session->user_level >= USER_LEVEL_ADMIN ) && $k[$i] != 'Admin' && $k[$i] != 'Special')
+ − 214
{
+ − 215
echo '<option value="'.$k[$i].'">'.$s.'</option>';
+ − 216
}
+ − 217
}
+ − 218
?>
+ − 219
</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
diff
changeset
+ − 220
<p><input type="submit" name="do" value="<?php echo $lang->get('pagetools_create_btn_create'); ?>" /></p>
0
+ − 221
</form>
+ − 222
<?php
+ − 223
$template->footer();
+ − 224
}
+ − 225
116
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 226
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
diff
changeset
+ − 227
{
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 228
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
diff
changeset
+ − 229
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
diff
changeset
+ − 230
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
diff
changeset
+ − 231
static $per_row = 2;
117
+ − 232
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
diff
changeset
+ − 233
$return = '';
117
+ − 234
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
diff
changeset
+ − 235
{
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 236
$rowtracker = 0;
117
+ − 237
$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
diff
changeset
+ − 238
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
diff
changeset
+ − 239
}
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 240
$rowtracker++;
117
+ − 241
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
diff
changeset
+ − 242
{
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 243
$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
diff
changeset
+ − 244
$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
diff
changeset
+ − 245
}
117
+ − 246
if ( $rowtracker == 0 && !$first )
+ − 247
$return .= "</tr>\n<tr>";
+ − 248
+ − 249
$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
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
diff
changeset
+ − 251
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
diff
changeset
+ − 252
$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
diff
changeset
+ − 253
$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
diff
changeset
+ − 254
$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
diff
changeset
+ − 255
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 256
$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
diff
changeset
+ − 257
$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
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
diff
changeset
+ − 259
$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
diff
changeset
+ − 260
$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
diff
changeset
+ − 261
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 262
$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
diff
changeset
+ − 263
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 264
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
diff
changeset
+ − 265
}
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 266
0
+ − 267
function page_Special_AllPages()
+ − 268
{
+ − 269
// This should be an easy one
+ − 270
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
diff
changeset
+ − 271
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
diff
changeset
+ − 272
0
+ − 273
$template->header();
+ − 274
$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
diff
changeset
+ − 275
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
diff
changeset
+ − 276
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 277
$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
diff
changeset
+ − 278
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
diff
changeset
+ − 279
$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
diff
changeset
+ − 280
$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
diff
changeset
+ − 281
$count = $row[0];
117
+ − 282
+ − 283
switch($count % 4)
+ − 284
{
+ − 285
case 0:
+ − 286
case 2:
+ − 287
// even number of results; do nothing
+ − 288
$last_cell = '';
+ − 289
break;
+ − 290
case 1:
+ − 291
// odd number of results and odd number of rows, use row1
+ − 292
$last_cell = '<td class="row1"></td>';
+ − 293
break;
+ − 294
case 3:
+ − 295
// odd number of results and even number of rows, use row2
+ − 296
$last_cell = '<td class="row2"></td>';
+ − 297
break;
+ − 298
}
+ − 299
116
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 300
$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
diff
changeset
+ − 301
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 302
$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
diff
changeset
+ − 303
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
diff
changeset
+ − 304
$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
diff
changeset
+ − 305
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 306
$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
diff
changeset
+ − 307
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 308
// 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
diff
changeset
+ − 309
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
diff
changeset
+ − 310
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 311
$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
diff
changeset
+ − 312
$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
diff
changeset
+ − 313
'{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
diff
changeset
+ − 314
$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
diff
changeset
+ − 315
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
diff
changeset
+ − 316
$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
diff
changeset
+ − 317
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
diff
changeset
+ − 318
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
diff
changeset
+ − 319
'<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
diff
changeset
+ − 320
<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
diff
changeset
+ − 321
<tr>', // print at start
117
+ − 322
' ' . $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
diff
changeset
+ − 323
</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
diff
changeset
+ − 324
</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
diff
changeset
+ − 325
);
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 326
77c75179bb95
Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
diff
changeset
+ − 327
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
diff
changeset
+ − 328
0
+ − 329
$template->footer();
+ − 330
}
+ − 331
+ − 332
function page_Special_SpecialPages()
+ − 333
{
+ − 334
// This should be an easy one
+ − 335
global $db, $session, $paths, $template, $plugins; // Common objects
+ − 336
$template->header();
+ − 337
$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
diff
changeset
+ − 338
echo '<p>' . $lang->get('pagetools_specialpages_blurb') . '</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">';
0
+ − 339
$cclass='row1';
+ − 340
for ( $i = 0; $i < $sz; $i = $i)
+ − 341
{
+ − 342
if ( $cclass == 'row1' )
+ − 343
{
+ − 344
$cclass = 'row3';
+ − 345
}
+ − 346
else if ( $cclass == 'row3')
+ − 347
{
+ − 348
$cclass='row1';
+ − 349
}
+ − 350
echo '<tr>';
+ − 351
for ( $j = 0; $j < 2; $j = $j )
+ − 352
{
+ − 353
if ( $i < $sz && $paths->pages[$i]['namespace'] == 'Special' && $paths->pages[$i]['visible'] == 1)
+ − 354
{
+ − 355
echo '<td style="width: 50%" class="'.$cclass.'"><a href="'.makeUrl($paths->pages[$i]['urlname']).'">';
+ − 356
echo $paths->pages[$i]['name'].'</a></td>';
+ − 357
$j++;
+ − 358
}
+ − 359
else if ( $i >= $sz )
+ − 360
{
+ − 361
echo '<td style="width: 50%" class="row2"></td>';
+ − 362
$j++;
+ − 363
}
+ − 364
$i++;
+ − 365
}
+ − 366
echo '</tr>';
+ − 367
}
+ − 368
echo '</table></div>';
+ − 369
$template->footer();
+ − 370
}
+ − 371
+ − 372
function page_Special_About_Enano()
+ − 373
{
+ − 374
global $db, $session, $paths, $template, $plugins; // Common objects
221
+ − 375
global $lang;
+ − 376
0
+ − 377
$platform = 'Unknown';
+ − 378
$uname = @file_get_contents('/proc/sys/kernel/ostype');
+ − 379
if($uname == "Linux\n")
+ − 380
$platform = 'Linux';
+ − 381
else if(file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/
+ − 382
$platform = 'GNU/Hurd';
+ − 383
else if(file_exists('C:\Windows\system32\ntoskrnl.exe'))
+ − 384
$platform = 'Windows NT';
+ − 385
else if(file_exists('C:\Windows\system\krnl386.exe'))
+ − 386
$platform = 'Windows 9x/DOS';
+ − 387
else if(file_exists('/bin/bash'))
+ − 388
$platform = 'Other GNU/Mac OS X';
+ − 389
else if(is_dir('/bin'))
+ − 390
$platform = 'Other POSIX';
+ − 391
$template->header();
+ − 392
?>
+ − 393
<br />
+ − 394
<div class="tblholder">
+ − 395
<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
diff
changeset
+ − 396
<tr><th colspan="2" style="text-align: left;"><?php echo $lang->get('meta_enano_about_th'); ?></th></tr>
221
+ − 397
<tr><td colspan="2" class="row3">
+ − 398
<?php
+ − 399
echo $lang->get('meta_enano_about_poweredby');
+ − 400
$subst = array(
+ − 401
'gpl_link' => makeUrlNS('Special', 'GNU_General_Public_License')
+ − 402
);
+ − 403
echo $lang->get('meta_enano_about_gpl', $subst);
+ − 404
if ( $lang->lang_code != 'eng' ):
+ − 405
// Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages
+ − 406
// must be accompanied by a copy of the English GPL.)
+ − 407
?>
+ − 408
<h3>(English)</h3>
+ − 409
<p>
+ − 410
This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source CMS that everyone can use.
+ − 411
Enano is copyright © 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano uses, please
+ − 412
see <a href="http://enanocms.org/Legal_information">Legal Information</a>.
+ − 413
</p>
+ − 414
<p>
+ − 415
The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
+ − 416
distributed, and used to create derivative works. For more information about Free Software, check out the
+ − 417
<a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or
+ − 418
the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage.
+ − 419
</p>
+ − 420
<p>
+ − 421
This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
+ − 422
as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ − 423
</p>
+ − 424
<p>
+ − 425
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ − 426
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ − 427
</p>
+ − 428
<p>
+ − 429
You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of
+ − 430
the GNU General Public License</a> along with this program; if not, write to:
+ − 431
</p>
+ − 432
<p style="margin-left 2em;">
+ − 433
Free Software Foundation, Inc.,<br />
+ − 434
51 Franklin Street, Fifth Floor<br />
+ − 435
Boston, MA 02110-1301, USA
+ − 436
</p>
+ − 437
<p>
+ − 438
Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.
+ − 439
</p>
+ − 440
<?php
+ − 441
endif;
+ − 442
?>
0
+ − 443
</td></tr>
+ − 444
<tr>
+ − 445
<td class="row2" colspan="2">
53
+ − 446
<table border="0" style="margin: 0 auto; background: none; width: 100%;" cellpadding="5">
0
+ − 447
<tr>
53
+ − 448
<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
diff
changeset
+ − 449
<?php echo $template->fading_button; ?>
0
+ − 450
</td>
+ − 451
<td style="text-align: center;">
+ − 452
<a href="http://www.php.net/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;">
+ − 453
<img alt="Written in PHP" src="<?php echo scriptPath; ?>/images/about-powered-php.png" style="border-width: 0px;" width="88" height="31" />
+ − 454
</a>
+ − 455
</td>
+ − 456
<td style="text-align: center;">
322
+ − 457
<?php
+ − 458
switch(ENANO_DBLAYER)
+ − 459
{
+ − 460
case 'MYSQL':
+ − 461
?>
+ − 462
<a href="http://www.mysql.com/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;">
+ − 463
<img alt="Database engine powered by MySQL" src="<?php echo scriptPath; ?>/images/about-powered-mysql.png" style="border-width: 0px;" width="88" height="31" />
+ − 464
</a>
+ − 465
<?php
+ − 466
break;
+ − 467
case 'PGSQL':
+ − 468
?>
+ − 469
<a href="http://www.postgresql.org/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;">
+ − 470
<img alt="Database engine powered by PostgreSQL" src="<?php echo scriptPath; ?>/images/about-powered-pgsql.png" style="border-width: 0px;" width="90" height="30" />
+ − 471
</a>
+ − 472
<?php
+ − 473
break;
+ − 474
}
+ − 475
?>
0
+ − 476
</td>
+ − 477
</tr>
+ − 478
</table>
+ − 479
</td>
+ − 480
</tr>
221
+ − 481
<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>
+ − 482
<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>
+ − 483
<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>
+ − 484
<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
+ − 485
<?php
+ − 486
switch(ENANO_DBLAYER)
+ − 487
{
+ − 488
case 'MYSQL':
+ − 489
?>
326
+ − 490
<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
+ − 491
<?php
+ − 492
break;
+ − 493
case 'PGSQL':
+ − 494
$pg_serverdata = pg_version($db->_conn);
+ − 495
$pg_version = $pg_serverdata['server'];
+ − 496
?>
326
+ − 497
<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
+ − 498
<?php
+ − 499
break;
+ − 500
}
+ − 501
?>
0
+ − 502
</table>
+ − 503
</div>
+ − 504
<?php
+ − 505
$template->footer();
+ − 506
}
+ − 507
+ − 508
function page_Special_GNU_General_Public_License()
+ − 509
{
+ − 510
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
diff
changeset
+ − 511
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
diff
changeset
+ − 512
0
+ − 513
$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
diff
changeset
+ − 514
if(file_exists(ENANO_ROOT . '/GPL'))
0
+ − 515
{
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
diff
changeset
+ − 516
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
diff
changeset
+ − 517
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
diff
changeset
+ − 518
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
diff
changeset
+ − 519
// 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
diff
changeset
+ − 520
// must be accompanied by a copy of the English GPL.)
0
+ − 521
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
diff
changeset
+ − 522
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
diff
changeset
+ − 523
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
diff
changeset
+ − 524
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
diff
changeset
+ − 525
{
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
diff
changeset
+ − 526
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
diff
changeset
+ − 527
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
diff
changeset
+ − 528
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
diff
changeset
+ − 529
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
diff
changeset
+ − 530
}
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
diff
changeset
+ − 531
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
diff
changeset
+ − 532
echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) );
0
+ − 533
}
+ − 534
else
+ − 535
{
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
diff
changeset
+ − 536
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
diff
changeset
+ − 537
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
diff
changeset
+ − 538
// 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
diff
changeset
+ − 539
// 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
diff
changeset
+ − 540
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
+ − 541
}
+ − 542
$template->footer();
+ − 543
}
+ − 544
83
+ − 545
function page_Special_TagCloud()
+ − 546
{
+ − 547
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
diff
changeset
+ − 548
global $lang;
83
+ − 549
+ − 550
$template->header();
+ − 551
+ − 552
if ( $tag = $paths->getParam(0) )
+ − 553
{
+ − 554
$tag = sanitize_tag($tag);
+ − 555
$q = $db->sql_query('SELECT page_id, namespace FROM '.table_prefix.'tags WHERE tag_name=\'' . $db->escape($tag) . '\';');
+ − 556
if ( !$q )
+ − 557
$db->_die();
+ − 558
if ( $row = $db->fetchrow() )
+ − 559
{
+ − 560
echo '<div class="tblholder">
+ − 561
<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
diff
changeset
+ − 562
echo '<tr><th colspan="2">' . $lang->get('pagetools_tagcloud_pagelist_th', array('tag' => htmlspecialchars($tag))) . '</th></tr>';
83
+ − 563
echo '<tr>';
+ − 564
$i = 0;
+ − 565
$td_class = 'row1';
+ − 566
do
+ − 567
{
+ − 568
if ( $i % 2 == 0 && $i > 1 )
+ − 569
{
+ − 570
$td_class = ( $td_class == 'row2' ) ? 'row1' : 'row2';
+ − 571
echo '</tr><tr>';
+ − 572
}
+ − 573
$i++;
+ − 574
$title = get_page_title_ns($row['page_id'], $row['namespace']);
+ − 575
if ( $row['namespace'] != 'Article' && isset($paths->nslist[$row['namespace']]) )
+ − 576
$title = $paths->nslist[$row['namespace']] . $title;
+ − 577
$url = makeUrlNS($row['namespace'], $row['page_id']);
+ − 578
$class = ( isPage( $paths->nslist[$row['namespace']] . $row['page_id'] ) ) ? '' : ' class="wikilink-nonexistent"';
+ − 579
$link = '<a href="' . htmlspecialchars($url) . '"' . $class . '>' . htmlspecialchars($title) . '</a>';
+ − 580
echo "<td class=\"$td_class\" style=\"width: 50%;\">$link</td>";
+ − 581
// " workaround for jEdit highlighting bug
+ − 582
}
+ − 583
while ( $row = $db->fetchrow() );
+ − 584
while ( $i % 2 > 0 )
+ − 585
{
+ − 586
$i++;
+ − 587
echo "<td class=\"$td_class\" style=\"width: 50%;\"></td>";
+ − 588
}
+ − 589
// " workaround for jEdit highlighting bug
+ − 590
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
diff
changeset
+ − 591
<th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '">« ' . $lang->get('pagetools_tagcloud_btn_return') . '</a></th>
83
+ − 592
</tr>';
+ − 593
echo '</table>';
+ − 594
echo '</div>';
+ − 595
}
+ − 596
}
+ − 597
else
+ − 598
{
+ − 599
$cloud = new TagCloud();
+ − 600
+ − 601
$q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;');
+ − 602
if ( !$q )
+ − 603
$db->_die();
+ − 604
if ( $db->numrows() < 1 )
+ − 605
{
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
diff
changeset
+ − 606
echo '<p>' . $lang->get('pagetools_tagcloud_msg_no_tags') . '</p>';
83
+ − 607
}
+ − 608
else
+ − 609
{
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
diff
changeset
+ − 610
echo '<h3>' . $lang->get('pagetools_tagcloud_blurb') . '</h3>';
83
+ − 611
while ( $row = $db->fetchrow() )
+ − 612
{
+ − 613
$cloud->add_word($row['tag_name']);
+ − 614
}
+ − 615
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
diff
changeset
+ − 616
echo '<p>' . $lang->get('pagetools_tagcloud_instructions') . '</p>';
83
+ − 617
}
+ − 618
}
+ − 619
+ − 620
$template->footer();
+ − 621
}
+ − 622
+ − 623
// tag cloud sidebar block
+ − 624
function sidebar_add_tag_cloud()
+ − 625
{
+ − 626
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
diff
changeset
+ − 627
global $lang;
83
+ − 628
$cloud = new TagCloud();
+ − 629
+ − 630
$q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;');
+ − 631
if ( !$q )
+ − 632
$db->_die();
+ − 633
if ( $db->numrows() < 1 )
+ − 634
{
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
diff
changeset
+ − 635
$sb_html = $lang->get('pagetools_tagcloud_msg_no_tags');
83
+ − 636
}
+ − 637
else
+ − 638
{
+ − 639
while ( $row = $db->fetchrow() )
+ − 640
{
+ − 641
$cloud->add_word($row['tag_name']);
+ − 642
}
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
diff
changeset
+ − 643
$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
+ − 644
}
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
diff
changeset
+ − 645
$template->sidebar_widget($lang->get('pagetools_tagcloud_sidebar_title'), "<div style='padding: 5px;'>$sb_html</div>");
83
+ − 646
}
+ − 647
+ − 648
$plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();');
+ − 649
0
+ − 650
?>