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