Removed the completely obsolete old Special:CreatePage function
authorDan
Fri, 19 Dec 2008 21:23:57 -0500
changeset 761 82560fba0fd1
parent 760 60c132a5bc8e
child 762 e346a3106a4e
Removed the completely obsolete old Special:CreatePage function
plugins/SpecialPageFuncs.php
--- a/plugins/SpecialPageFuncs.php	Tue Dec 02 21:11:22 2008 -0500
+++ b/plugins/SpecialPageFuncs.php	Fri Dec 19 21:23:57 2008 -0500
@@ -265,160 +265,6 @@
   $template->footer();
 }
 
-function page_Special_CreatePage_Old()
-{
-  global $db, $session, $paths, $template, $plugins; // Common objects
-  global $lang;
-  
-  if ( isset($_POST['do']) )
-  {
-    $p = $_POST['pagename'];
-    $k = array_keys($paths->nslist);
-    for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ )
-    {
-      $ln = strlen( $paths->nslist[$k[$i]] );
-      if ( substr($p, 0, $ln) == $paths->nslist[$k[$i]] )
-      {
-        $namespace = $k[$i];
-      }
-    }
-    if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin')
-    {
-      $template->header();
-      
-      echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3>
-             <p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($p))) . '</p>';
-      
-      $template->footer();
-      $db->close();
-      
-      exit;
-    }
-    $name = $db->escape(str_replace('_', ' ', $p));
-    $urlname = str_replace(' ', '_', $p);
-    $namespace = $_POST['namespace'];
-    if ( $namespace == 'Special' || ( $namespace == 'System' && $session->user_level < USER_LEVEL_ADMIN ) || $namespace == 'Admin')
-    {
-      $template->header();
-      
-      echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3>
-             <p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($paths->nslist[$namespace].$p))) . '</p>';
-      
-      $template->footer();
-      $db->close();
-      
-      exit;
-    }
-    $code = $plugins->setHook('page_create_request');
-    foreach ( $code as $cmd )
-    {
-      eval($cmd);
-    }
-    if ( substr($urlname, 0, 8) == 'Project:' )
-    {
-      $template->header();
-      
-      echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3>
-             <p>' . $lang->get('pagetools_create_err_project_shortcut', array('page_name' => htmlspecialchars($p))) . '</p>';
-      
-      $template->footer();
-      $db->close();
-      
-      exit;
-    }
-    
-    $tn = $paths->nslist[$_POST['namespace']] . $urlname;
-    if ( isset($paths->pages[$tn]) )
-    {
-      die_friendly($lang->get('pagetools_create_err_title'), '<p>' . $lang->get('pagetools_create_err_already_exist') . '</p>');
-    }
-    
-    if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) )
-    {
-      $urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname));
-    }
-    
-    $k = array_keys( $paths->nslist );
-    if(!in_array($_POST['namespace'], $k))
-    {
-      $db->_die('An SQL injection attempt was caught at '.dirname(__FILE__).':'.__LINE__.'.');
-    }
-    
-    $ips = array(
-      'ip' => array(),
-      'u' => array()
-      );
-    $ips = $db->escape(serialize($ips));
-    
-    $urlname = sanitize_page_id($urlname);
-    $urlname = $db->escape($urlname);
-    
-    $perms = $session->fetch_page_acl($urlname, $namespace);
-    if ( !$perms->get_permissions('create_page') )
-      die_friendly($lang->get('pagetools_create_err_title'), '<p>An access control rule is preventing you from creating pages.</p>');
-    
-    $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'].'\');');
-    if ( !$q )
-    {
-      $db->_die('The page log could not be updated.');
-    }
-    
-    $q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');');
-    if ( !$q )
-    {
-      $db->_die('The page entry could not be inserted.');
-    }
-    $q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.'\');');
-    if ( !$q )
-    {
-      $db->_die('The page text entry could not be inserted.');
-    }
-    
-    header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)) . '#do:edit');
-    exit;
-  }
-  $template->header();
-  /*
-  if ( !$session->get_permissions('create_page') )
-  {
-    echo 'Wiki mode is disabled, only admins can create pages.';
-    
-    $template->footer();
-    $db->close();
-    
-    exit;
-  }
-  */
-  echo '<p>' . $lang->get('pagetools_create_blurb') . '</p>';
-  ?>
-  <form action="" method="post">
-    <p>
-      <select name="namespace">
-        <?php
-        $k = array_keys($paths->nslist);
-        for ( $i = 0; $i < sizeof($k); $i++ )
-        {
-          if ( $paths->nslist[$k[$i]] == '' )
-          {
-            $s = $lang->get('pagetools_create_namespace_none');
-          }
-          else
-          {
-            $s = $paths->nslist[$k[$i]];
-          }
-          if ( ( $k[$i] != 'System' || $session->user_level >= USER_LEVEL_ADMIN ) && $k[$i] != 'Admin' && $k[$i] != 'Special')
-          {
-            echo '<option value="'.$k[$i].'">'.$s.'</option>';
-          }
-        }
-        ?>
-      </select> <input type="text" name="pagename" /></p>
-      <p><input type="submit" name="do" value="<?php echo $lang->get('pagetools_create_btn_create'); ?>" /></p>
-  </form>
-  <?php
-  $template->footer();
-}
-
 function PagelistingFormatter($id, $row)
 {
   global $db, $session, $paths, $template, $plugins; // Common objects