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