plugins/SpecialPageFuncs.php
author Dan
Sat, 27 Oct 2007 13:29:17 -0400
changeset 205 c4542792db2b
parent 194 bf0fdec102e9
child 221 e5302cb1945c
child 285 7846d45bd250
permissions -rw-r--r--
Localization low-level framework added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
<?php
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
/*
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     3
Plugin Name: Special page-related pages
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     4
Plugin URI: http://enanocms.org/
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     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.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     6
Author: Dan Fuhry
192
9237767a23ae Implemented cron image into Oxygen and St Patty as promised; fixed way-outdated version numbers in plugins
Dan
parents: 157
diff changeset
     7
Version: 1.0.2
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     8
Author URI: http://enanocms.org/
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     9
*/
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    10
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    11
/*
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    12
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
192
9237767a23ae Implemented cron image into Oxygen and St Patty as promised; fixed way-outdated version numbers in plugins
Dan
parents: 157
diff changeset
    13
 * Version 1.0.2
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    14
 * Copyright (C) 2006-2007 Dan Fuhry
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    15
 *
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    16
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    17
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    18
 *
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    19
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    20
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    21
 */
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    22
 
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    23
global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    24
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    25
$plugins->attachHook('base_classes_initted', '
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    26
  global $paths;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    27
    $paths->add_page(Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    28
      \'name\'=>\'Create page\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    29
      \'urlname\'=>\'CreatePage\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    30
      \'namespace\'=>\'Special\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    31
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
      ));
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    34
    $paths->add_page(Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    35
      \'name\'=>\'All pages\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    36
      \'urlname\'=>\'AllPages\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    37
      \'namespace\'=>\'Special\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    38
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    39
      ));
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    40
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    41
    $paths->add_page(Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    42
      \'name\'=>\'List of special pages\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    43
      \'urlname\'=>\'SpecialPages\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    44
      \'namespace\'=>\'Special\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    45
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    46
      ));
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    47
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    48
    $paths->add_page(Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    49
      \'name\'=>\'About Enano\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    50
      \'urlname\'=>\'About_Enano\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    51
      \'namespace\'=>\'Special\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    52
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    53
      ));
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    54
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    55
    $paths->add_page(Array(
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    56
      \'name\'=>\'GNU General Public License\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    57
      \'urlname\'=>\'GNU_General_Public_License\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    58
      \'namespace\'=>\'Special\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    59
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    60
      ));
83
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    61
    
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    62
    $paths->add_page(Array(
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    63
      \'name\'=>\'Tag cloud\',
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    64
      \'urlname\'=>\'TagCloud\',
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    65
      \'namespace\'=>\'Special\',
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    66
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
    67
      ));
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
    ');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    69
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    70
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    71
22
d0314575e2f0 More preliminary l10n work; userpage portal style basics implemented
Dan
parents: 0
diff changeset
    72
function page_Special_CreatePage()
d0314575e2f0 More preliminary l10n work; userpage portal style basics implemented
Dan
parents: 0
diff changeset
    73
{
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    74
  global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    75
  if ( isset($_POST['do']) )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    76
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    77
    $p = $_POST['pagename'];
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    78
    $k = array_keys($paths->nslist);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    79
    for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    80
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    81
      $ln = strlen( $paths->nslist[$k[$i]] );
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    82
      if ( substr($p, 0, $ln) == $paths->nslist[$k[$i]] )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    83
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    84
        $namespace = $k[$i];
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    85
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    86
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    87
    if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin')
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    88
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    89
      $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    90
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    91
      echo '<h3>The page could not be created.</h3><p>The name "'.$p.'" is invalid.</p>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    92
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    93
      $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    94
      $db->close();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    95
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    96
      exit;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    97
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    98
    $name = $db->escape(str_replace('_', ' ', $p));
22
d0314575e2f0 More preliminary l10n work; userpage portal style basics implemented
Dan
parents: 0
diff changeset
    99
    $urlname = str_replace(' ', '_', $p);
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   100
    $namespace = $_POST['namespace'];
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   101
    if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin')
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   102
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   103
      $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   104
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   105
      echo '<h3>The page could not be created.</h3><p>The name "'.$paths->nslist[$namespace].$p.'" is invalid.</p>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   106
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   107
      $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   108
      $db->close();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   109
      
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   110
      exit;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   111
    }
194
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   112
    if ( substr($urlname, 0, 8) == 'Project:' )
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   113
    {
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   114
      $template->header();
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   115
      
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   116
      echo '<h3>The page could not be created.</h3><p>The page title can\'t start with "Project:" because this prefix is reserved for a parser shortcut.</p>';
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   117
      
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   118
      $template->footer();
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   119
      $db->close();
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   120
      
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   121
      exit;
bf0fdec102e9 SECURITY: Fixed possible SQL injection in PageUtils page protection; general cleanup of PageUtils; blocked using Project: prefix for page URL strings
Dan
parents: 192
diff changeset
   122
    }
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   123
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   124
    $tn = $paths->nslist[$_POST['namespace']] . $urlname;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   125
    if ( isset($paths->pages[$tn]) )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   126
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   127
      die_friendly('Error creating page', '<p>The page already exists.</p>');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   128
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   129
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   130
    if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   131
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   132
      $urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname));
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   133
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   134
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   135
    $k = array_keys( $paths->nslist );
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   136
    if(!in_array($_POST['namespace'], $k))
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   137
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   138
      $db->_die('An SQL injection attempt was caught at '.dirname(__FILE__).':'.__LINE__.'.');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   139
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   140
    
112
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   141
    $ips = array(
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   142
      'ip' => array(),
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   143
      'u' => array()
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   144
      );
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   145
    $ips = $db->escape(serialize($ips));
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   146
    
22
d0314575e2f0 More preliminary l10n work; userpage portal style basics implemented
Dan
parents: 0
diff changeset
   147
    $urlname = sanitize_page_id($urlname);
d0314575e2f0 More preliminary l10n work; userpage portal style basics implemented
Dan
parents: 0
diff changeset
   148
    $urlname = $db->escape($urlname);
d0314575e2f0 More preliminary l10n work; userpage portal style basics implemented
Dan
parents: 0
diff changeset
   149
    
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   150
    $perms = $session->fetch_page_acl($urlname, $namespace);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   151
    if ( !$perms->get_permissions('create_page') )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   152
      die_friendly('Error creating page', '<p>An access control rule is preventing you from creating pages.</p>');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   153
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   154
    $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'].'\');');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   155
    if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   156
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   157
      $db->_die('The page log could not be updated.');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   158
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   159
    
112
008b1c42be72 Rewrote all code related to delvote_ips column to use serialize()
Dan
parents: 91
diff changeset
   160
    $q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   161
    if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   162
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   163
      $db->_die('The page entry could not be inserted.');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   164
    }
157
6df5f7a55a30 Creating pages doesn't insert that crappy javascript hack anymore
Dan
parents: 132
diff changeset
   165
    $q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.'\');');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   166
    if ( !$q )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   167
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   168
      $db->_die('The page text entry could not be inserted.');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   169
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   170
    
157
6df5f7a55a30 Creating pages doesn't insert that crappy javascript hack anymore
Dan
parents: 132
diff changeset
   171
    header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)) . '#do:edit');
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   172
    exit;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   173
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   174
  $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   175
  if ( !$session->get_permissions('create_page') )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   176
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   177
    echo 'Wiki mode is disabled, only admins can create pages.';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   178
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   179
    $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   180
    $db->close();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   181
    
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   182
    exit;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   183
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   184
  echo RenderMan::render('Using the form below you can create a page.');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   185
  ?>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   186
  <form action="" method="post">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   187
    <p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   188
      <select name="namespace">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   189
        <?php
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   190
        $k = array_keys($paths->nslist);
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   191
        for ( $i = 0; $i < sizeof($k); $i++ )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   192
        {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   193
          if ( $paths->nslist[$k[$i]] == '' )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   194
          {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   195
            $s = '[No prefix]';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   196
          }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   197
          else
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   198
          {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   199
            $s = $paths->nslist[$k[$i]];
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   200
          }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   201
          if ( ( $k[$i] != 'System' || $session->user_level >= USER_LEVEL_ADMIN ) && $k[$i] != 'Admin' && $k[$i] != 'Special')
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   202
          {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   203
            echo '<option value="'.$k[$i].'">'.$s.'</option>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   204
          }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   205
        }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   206
        ?>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   207
      </select> <input type="text" name="pagename" /></p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
      <p><input type="submit" name="do" value="Create Page" /></p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   209
  </form>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
  <?php
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   211
  $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   212
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   213
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   214
function PagelistingFormatter($id, $row)
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   215
{
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   216
  global $db, $session, $paths, $template, $plugins; // Common objects
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   217
  static $rowtracker = 0;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   218
  static $tdclass = 'row2';
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   219
  static $per_row = 2;
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   220
  static $first = true;
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   221
  $return = '';
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   222
  if ( $id === false && $row === false )
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   223
  {
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   224
    $rowtracker = 0;
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   225
    $first = true;
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   226
    return false;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   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
parents: 112
diff changeset
   228
  $rowtracker++;
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   229
  if ( $rowtracker == $per_row || $first )
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   230
  {
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   231
    $rowtracker = 0;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   232
    $tdclass = ( $tdclass == 'row2' ) ? 'row1' : 'row2';
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   233
  }
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   234
  if ( $rowtracker == 0 && !$first )
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   235
    $return .= "</tr>\n<tr>";
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   236
  
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   237
  $first = false;
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   238
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   239
  preg_match('/^ns=(' . implode('|', array_keys($paths->nslist)) . ');pid=(.*?)$/i', $id, $match);
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   240
  $namespace =& $match[1];
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   241
  $page_id   =& $match[2];
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   242
  $page_id   = sanitize_page_id($page_id);
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   243
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   244
  $url = makeUrlNS($namespace, $page_id);
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   245
  $url = htmlspecialchars($url);
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   246
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   247
  $link = '<a href="' . $url . '">' . htmlspecialchars($row['name']) . '</a>';
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   248
  $td = '<td class="' . $tdclass . '" style="width: 50%;">' . $link . '</td>';
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   249
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   250
  $return .= $td;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   251
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   252
  return $return;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   253
}
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   254
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   255
function page_Special_AllPages() 
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   256
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   257
  // This should be an easy one
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   258
  global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   259
  $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   260
  $sz = sizeof( $paths->pages ) / 2;
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   261
  echo '<p>Below is a list of all of the pages on this website.</p>';
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   262
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   263
  $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;');
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   264
  if ( !$q )
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   265
    $db->_die();
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   266
  $row = $db->fetchrow_num();
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   267
  $count = $row[0];
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   268
  
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   269
  switch($count % 4)
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   270
  {
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   271
    case 0:
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   272
    case 2:
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   273
      // even number of results; do nothing
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   274
      $last_cell = '';
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   275
      break;
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   276
    case 1:
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   277
      // odd number of results and odd number of rows, use row1
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   278
      $last_cell = '<td class="row1"></td>';
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   279
      break;
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   280
    case 3:
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   281
      // odd number of results and even number of rows, use row2
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   282
      $last_cell = '<td class="row2"></td>';
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   283
      break;
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   284
  }
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   285
  
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   286
  $db->free_result();
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   287
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   288
  $q = $db->sql_unbuffered_query('SELECT CONCAT("ns=",namespace,";pid=",urlname) AS identifier, name FROM '.table_prefix.'pages WHERE visible!=0 ORDER BY name ASC;');
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   289
  if ( !$q )
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   290
    $db->_die();
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   291
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   292
  $offset = ( isset($_GET['offset']) ) ? intval($_GET['offset']) : 0;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   293
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   294
  // reset formatter
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   295
  PagelistingFormatter(false, false);
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   296
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   297
  $result = paginate(
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   298
      $q,                  // result resource
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   299
      '{identifier}',      // formatting template
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   300
      $count,              // # of results
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   301
      makeUrlNS('Special', 'AllPages', 'offset=%s'), // result URL
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   302
      $offset,             // start offset
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   303
      40,                  // results per page
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   304
      array( 'identifier' => 'PagelistingFormatter' ), // hooks
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   305
      '<div class="tblholder">
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   306
         <table border="0" cellspacing="1" cellpadding="4">
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   307
           <tr>',          // print at start
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 116
diff changeset
   308
      '    ' . $last_cell . '</tr>
116
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   309
         </table>
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   310
       </div>'             // print at end
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   311
       );
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   312
  
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   313
  echo $result;
77c75179bb95 Made most special pages "visible"; fixup for non-existent special page redirect in paths.php; rewrote Special:AllPages to have pagination (WiP, Special:SpecialPages is possibly next, depending on whether paginate_array works or not)
Dan
parents: 112
diff changeset
   314
  
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   315
  $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   316
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   317
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   318
function page_Special_SpecialPages()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   319
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   320
  // This should be an easy one
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   321
  global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   322
  $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   323
  $sz = sizeof($paths->pages) / 2;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   324
  echo '<p>Below is a list of all of the special pages on this website.</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   325
  $cclass='row1';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   326
  for ( $i = 0; $i < $sz; $i = $i)
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   327
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   328
    if ( $cclass == 'row1' )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   329
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   330
      $cclass = 'row3';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   331
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   332
    else if ( $cclass == 'row3')
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   333
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   334
      $cclass='row1';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   335
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   336
    echo '<tr>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   337
    for ( $j = 0; $j < 2; $j = $j )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   338
    {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   339
      if ( $i < $sz && $paths->pages[$i]['namespace'] == 'Special' && $paths->pages[$i]['visible'] == 1)
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   340
      {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   341
        echo '<td style="width: 50%" class="'.$cclass.'"><a href="'.makeUrl($paths->pages[$i]['urlname']).'">';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   342
        echo $paths->pages[$i]['name'].'</a></td>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   343
        $j++;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   344
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   345
      else if ( $i >= $sz )
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   346
      {  
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   347
        echo '<td style="width: 50%" class="row2"></td>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   348
        $j++;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   349
      }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   350
      $i++;
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   351
    }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   352
    echo '</tr>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   353
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   354
  echo '</table></div>';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   355
  $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   356
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   357
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   358
function page_Special_About_Enano()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   359
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   360
  global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   361
  $platform = 'Unknown';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   362
  $uname = @file_get_contents('/proc/sys/kernel/ostype');
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   363
  if($uname == "Linux\n")
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   364
    $platform = 'Linux';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   365
  else if(file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   366
    $platform = 'GNU/Hurd';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   367
  else if(file_exists('C:\Windows\system32\ntoskrnl.exe'))
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   368
    $platform = 'Windows NT';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   369
  else if(file_exists('C:\Windows\system\krnl386.exe'))
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   370
    $platform = 'Windows 9x/DOS';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   371
  else if(file_exists('/bin/bash'))
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   372
    $platform = 'Other GNU/Mac OS X';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   373
  else if(is_dir('/bin'))
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   374
    $platform = 'Other POSIX';
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   375
  $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   376
  ?>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   377
  <br />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   378
  <div class="tblholder">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   379
    <table border="0" cellspacing="1" cellpadding="4">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   380
      <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr>
23
320acf077276 At last, I fixed all those phased-out enano.homelinux.org links!
Dan
parents: 22
diff changeset
   381
      <tr><td colspan="2" class="row3"><p>This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source
38
ed06961e54dd Fixed user pages + the new .xx page URL format
Dan
parents: 36
diff changeset
   382
      CMS that everyone can use. Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano
23
320acf077276 At last, I fixed all those phased-out enano.homelinux.org links!
Dan
parents: 22
diff changeset
   383
      uses, please see <a href="http://enanocms.org/Legal_information">Legal Information</a>.</p>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   384
      <p>The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   385
         distributed, and used to create derivative works. For more information about Free Software, check out the
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   386
         <a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   387
         the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage.</p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   388
      <p>This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   389
      as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   390
      <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   391
      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.</p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   392
      <p>You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   393
         the GNU General Public License</a> along with this program; if not, write to:</p>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   394
      <p style="margin-left 2em;">Free Software Foundation, Inc.,<br />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   395
         51 Franklin Street, Fifth Floor<br />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   396
         Boston, MA 02110-1301, USA</p>
129
0b5244001799 Rebranded as 1.0.1.1; fixed category page drawing bug; updated link to GPL in the about page to the GPLv2
Dan
parents: 117
diff changeset
   397
      <p>Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.</p>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   398
      </td></tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   399
      <tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   400
        <td class="row2" colspan="2">
53
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   401
          <table border="0" style="margin: 0 auto; background: none; width: 100%;" cellpadding="5">
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   402
            <tr>
53
3dea509d88ae Enano CMS Project button can fade now
Dan
parents: 38
diff changeset
   403
              <td style="text-align: center;">
87
570f68c3fe36 Redid stupid fading button code and fixed several RC2 bugs in the upgrade schema; 1.0.1 release candidate
Dan
parents: 85
diff changeset
   404
                <?php echo $template->fading_button; ?>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   405
              </td>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   406
              <td style="text-align: center;">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   407
                <a href="http://www.php.net/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   408
                  <img alt="Written in PHP" src="<?php echo scriptPath; ?>/images/about-powered-php.png" style="border-width: 0px;" width="88" height="31" />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   409
                </a>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   410
              </td>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   411
              <td style="text-align: center;">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   412
                <a href="http://www.mysql.com/" onclick="window.open(this.href); return false;" style="background: none; padding: 0;">
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   413
                  <img alt="Database engine powered by MySQL" src="<?php echo scriptPath; ?>/images/about-powered-mysql.png" style="border-width: 0px;" width="88" height="31" />
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   414
                </a>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   415
              </td>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   416
            </tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   417
          </table>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   418
        </td>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   419
      </tr>
132
0ae1b281a884 [sync only] Minor display change in Special:About_Enano; added initial PHP function for password strength testing
Dan
parents: 129
diff changeset
   420
      <tr><td style="width: 100px;" class="row1"><a href="http://enanocms.org">Enano</a> version:</td><td class="row1"><?php echo enano_version(true) . ' (' . enano_codename() . ')'; ?></td></tr>
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   421
      <tr><td style="width: 100px;" class="row2">Web server:</td><td class="row2"><?php if(isset($_SERVER['SERVER_SOFTWARE'])) echo $_SERVER['SERVER_SOFTWARE']; else echo 'Unable to determine web server software.'; ?></td></tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   422
      <tr><td style="width: 100px;" class="row1">Server platform:</td><td class="row1"><?php echo $platform; ?></td></tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   423
      <tr><td style="width: 100px;" class="row2"><a href="http://www.php.net/">PHP</a> version:</td><td class="row2"><?php echo PHP_VERSION; ?></td></tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   424
      <tr><td style="width: 100px;" class="row1"><a href="http://www.mysql.com/">MySQL</a> version:</td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   425
    </table>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   426
  </div>
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   427
  <?php
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   428
  $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   429
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   430
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   431
function page_Special_GNU_General_Public_License()
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   432
{
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   433
  global $db, $session, $paths, $template, $plugins; // Common objects
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   434
  $template->header();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   435
  if(file_exists(ENANO_ROOT.'/GPL'))
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   436
  {
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   437
    echo '<p>The following text represents the license that the <a href="'.makeUrlNS('Special', 'About_Enano').'">Enano</a> content management system is under. To make it easier to read, the text has been wiki-formatted; in no other way has it been changed.</p>';
73
0a74676a2f2f Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
parents: 69
diff changeset
   438
    echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) );
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   439
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   440
  else
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   441
  {
36
425261984266 Added "page hint" on search page; deprecated "www." on EnanoCMS.org links
Dan
parents: 23
diff changeset
   442
    echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>.</p>';
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   443
  }
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   444
  $template->footer();
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   445
}
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   446
83
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   447
function page_Special_TagCloud()
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   448
{
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   449
  global $db, $session, $paths, $template, $plugins; // Common objects
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   450
  
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   451
  $template->header();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   452
  
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   453
  if ( $tag = $paths->getParam(0) )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   454
  {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   455
    $tag = sanitize_tag($tag);
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   456
    $q = $db->sql_query('SELECT page_id, namespace FROM '.table_prefix.'tags WHERE tag_name=\'' . $db->escape($tag) . '\';');
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   457
    if ( !$q )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   458
      $db->_die();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   459
    if ( $row = $db->fetchrow() )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   460
    {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   461
      echo '<div class="tblholder">
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   462
              <table border="0" cellspacing="1" cellpadding="4">';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   463
      echo '<tr><th colspan="2">Pages tagged "' . htmlspecialchars($tag) . '"</th></tr>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   464
      echo '<tr>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   465
      $i = 0;
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   466
      $td_class = 'row1';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   467
      do
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   468
      {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   469
        if ( $i % 2 == 0 && $i > 1 )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   470
        {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   471
          $td_class = ( $td_class == 'row2' ) ? 'row1' : 'row2';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   472
          echo '</tr><tr>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   473
        }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   474
        $i++;
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   475
        $title = get_page_title_ns($row['page_id'], $row['namespace']);
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   476
        if ( $row['namespace'] != 'Article' && isset($paths->nslist[$row['namespace']]) )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   477
          $title = $paths->nslist[$row['namespace']] . $title;
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   478
        $url = makeUrlNS($row['namespace'], $row['page_id']);
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   479
        $class = ( isPage( $paths->nslist[$row['namespace']] . $row['page_id'] ) ) ? '' : ' class="wikilink-nonexistent"';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   480
        $link = '<a href="' . htmlspecialchars($url) . '"' . $class . '>' . htmlspecialchars($title) . '</a>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   481
        echo "<td class=\"$td_class\" style=\"width: 50%;\">$link</td>";
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   482
        // " workaround for jEdit highlighting bug
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   483
      }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   484
      while ( $row = $db->fetchrow() );
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   485
      while ( $i % 2 > 0 )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   486
      {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   487
        $i++;
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   488
        echo "<td class=\"$td_class\" style=\"width: 50%;\"></td>";
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   489
      }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   490
      // " workaround for jEdit highlighting bug
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   491
      echo '<tr>
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   492
              <th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '" style="color: white;">&laquo; Return to tag cloud</a></th>
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   493
            </tr>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   494
      echo '</table>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   495
      echo '</div>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   496
    }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   497
  }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   498
  else
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   499
  {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   500
    $cloud = new TagCloud();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   501
    
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   502
    $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;');
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   503
    if ( !$q )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   504
      $db->_die();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   505
    if ( $db->numrows() < 1 )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   506
    {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   507
      echo '<p>No pages are tagged yet.</p>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   508
    }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   509
    else
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   510
    {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   511
      echo '<h3>Summary of page tagging</h3>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   512
      while ( $row = $db->fetchrow() )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   513
      {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   514
        $cloud->add_word($row['tag_name']);
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   515
      }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   516
      echo $cloud->make_html('normal');
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   517
      echo '<p>Hover your mouse over a tag to see how many pages have the tag. Click on a tag to see a list of the pages that have it.</p>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   518
    }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   519
  }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   520
  
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   521
  $template->footer();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   522
}
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   523
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   524
// tag cloud sidebar block
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   525
function sidebar_add_tag_cloud()
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   526
{
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   527
  global $db, $session, $paths, $template, $plugins; // Common objects
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   528
  $cloud = new TagCloud();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   529
    
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   530
  $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;');
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   531
  if ( !$q )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   532
    $db->_die();
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   533
  if ( $db->numrows() < 1 )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   534
  {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   535
    $sb_html = 'No pages are tagged yet.';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   536
  }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   537
  else
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   538
  {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   539
    while ( $row = $db->fetchrow() )
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   540
    {
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   541
      $cloud->add_word($row['tag_name']);
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   542
    }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   543
    $sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">Larger version</a>';
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   544
  }
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   545
  $template->sidebar_widget('Tag cloud', "<div style='padding: 5px;'>$sb_html</div>");
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   546
}
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   547
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   548
$plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();');
80facec76d9f Tag cloud is now implemented
Dan
parents: 73
diff changeset
   549
0
902822492a68 Initial population
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   550
?>