Improved physical pages: they support comments and have their own dedicated namespace now. Still some consistency fixes to make.
authorDan
Mon, 03 Dec 2007 18:45:37 -0500
changeset 312 6c7060d36a23
parent 311 a007145a0ff6
child 313 854eecfada20
child 315 f49e3c8b638c
Improved physical pages: they support comments and have their own dedicated namespace now. Still some consistency fixes to make.
cache/index.php
files/index.php
images/index.php
includes/index.php
includes/pageprocess.php
includes/paths.php
includes/template.php
plugins/index.php
themes/index.php
--- a/cache/index.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/cache/index.php	Mon Dec 03 18:45:37 2007 -0500
@@ -1,13 +1,10 @@
 <?php
 
-$_GET['title'] = 'Enano:Access_denied';
+$title = 'Access denied';
 require('../includes/common.php');
 header('HTTP/1.1 403 Forbidden');
-$session->perms['edit_page'] = AUTH_DENY;
-$session->perms['view_source'] = AUTH_DENY;
-$template->tpl_strings['PAGE_NAME'] = 'Access denied';
 
 $template->header();
-echo '<p>The administrator has flagged the page "' . $_SERVER['REQUEST_URI'] . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
+echo '<p>The administrator has flagged the page "' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
 $template->footer();
-$db->close();
+
--- a/files/index.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/files/index.php	Mon Dec 03 18:45:37 2007 -0500
@@ -1,13 +1,10 @@
 <?php
 
-$_GET['title'] = 'Enano:Access_denied';
+$title = 'Access denied';
 require('../includes/common.php');
 header('HTTP/1.1 403 Forbidden');
-$session->perms['edit_page'] = AUTH_DENY;
-$session->perms['view_source'] = AUTH_DENY;
-$template->tpl_strings['PAGE_NAME'] = 'Access denied';
 
 $template->header();
-echo '<p>The administrator has flagged the page "' . $_SERVER['REQUEST_URI'] . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
+echo '<p>The administrator has flagged the page "' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
 $template->footer();
-$db->close();
+
--- a/images/index.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/images/index.php	Mon Dec 03 18:45:37 2007 -0500
@@ -1,13 +1,10 @@
 <?php
 
-$_GET['title'] = 'Enano:Access_denied';
+$title = 'Access denied';
 require('../includes/common.php');
 header('HTTP/1.1 403 Forbidden');
-$session->perms['edit_page'] = AUTH_DENY;
-$session->perms['view_source'] = AUTH_DENY;
-$template->tpl_strings['PAGE_NAME'] = 'Access denied';
 
 $template->header();
-echo '<p>The administrator has flagged the page "' . $_SERVER['REQUEST_URI'] . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
+echo '<p>The administrator has flagged the page "' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
 $template->footer();
-$db->close();
+
--- a/includes/index.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/includes/index.php	Mon Dec 03 18:45:37 2007 -0500
@@ -1,13 +1,10 @@
 <?php
 
-$_GET['title'] = 'Enano:Access_denied';
+$title = 'Access denied';
 require('../includes/common.php');
 header('HTTP/1.1 403 Forbidden');
-$session->perms['edit_page'] = AUTH_DENY;
-$session->perms['view_source'] = AUTH_DENY;
-$template->tpl_strings['PAGE_NAME'] = 'Access denied';
 
 $template->header();
-echo '<p>The administrator has flagged the page "' . $_SERVER['REQUEST_URI'] . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
+echo '<p>The administrator has flagged the page "' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
 $template->footer();
-$db->close();
+
--- a/includes/pageprocess.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/includes/pageprocess.php	Mon Dec 03 18:45:37 2007 -0500
@@ -232,7 +232,16 @@
       echo $text;
       
       $this->footer();
-      
+    }
+    else if ( $this->namespace == 'Anonymous' )
+    {
+      $uri = scriptPath . '/' . $this->page_id;
+      if ( !$this->send_headers )
+      {
+        $sep = ( strstr($uri, '?') ) ? '&' : '?';
+        $uri .= "{$sep}noheaders";
+      }
+      redirect( $uri, '', '', 0 );
     }
     else if ( !$this->page_exists )
     {
--- a/includes/paths.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/includes/paths.php	Mon Dec 03 18:45:37 2007 -0500
@@ -38,6 +38,7 @@
       'System'  =>'Enano:',
       'Template'=>'Template:',
       'Category'=>'Category:',
+      'Anonymous'=>'PhysicalRedirect:',
       'Project' =>sanitize_page_id(getConfig('site_name')).':',
       );
     
@@ -148,7 +149,7 @@
       
     }
     $db->free_result();
-    if ( defined('ENANO_INTERFACE_INDEX') || defined('ENANO_INTERFACE_AJAX') )
+    if ( defined('ENANO_INTERFACE_INDEX') || defined('ENANO_INTERFACE_AJAX') || defined('IN_ENANO_INSTALL') || defined('IN_ENANO_UPGRADE') )
     {
       if( isset($_GET['title']) )
       {
@@ -258,28 +259,31 @@
       {
         $title =& $GLOBALS['title'];
       }
-      else if ( isset($_SERVER['REQUEST_URI']) )
-      {
-        $title = basename($_SERVER['REQUEST_URI']);
-      }
       else
       {
-        $title = 'Untitled page';
+        $title = basename($_SERVER['SCRIPT_NAME']);
       }
-      $this->page = $this->nslist['Special'] . 'AnonymousPage';
-      $this->fullpage = $this->nslist['Special'] . 'AnonymousPage';
+      $base_uri = str_replace( scriptPath . '/', '', $_SERVER['SCRIPT_NAME'] );
+      $this->page = $this->nslist['Anonymous'] . sanitize_page_id($base_uri);
+      $this->fullpage = $this->nslist['Anonymous'] . sanitize_page_id($base_uri);
+      $this->namespace = 'Anonymous';
       $this->cpage = array(
           'name' => $title,
-          'urlname' => 'AnonymousPage',
-          'namespace' => 'Special',
-          'special' => 0,
+          'urlname' => sanitize_page_id($base_uri),
+          'namespace' => 'Anonymous',
+          'special' => 1,
           'visible' => 1,
-          'comments_on' => 0,
+          'comments_on' => 1,
           'protected' => 1,
           'delvotes' => 0,
           'delvote_ips' => ''
         );
       $this->anonymous_page = true;
+      $code = $plugins->setHook('paths_anonymous_page');
+      foreach ( $code as $cmd )
+      {
+        eval($cmd);
+      }
     }
     
     $this->page = sanitize_page_id($this->page);
--- a/includes/template.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/includes/template.php	Mon Dec 03 18:45:37 2007 -0500
@@ -220,6 +220,9 @@
       case "Category":
         $ns = 'category';
         break;
+      case "Anonymous":
+        $ns = 'external page';
+        break;
     }
     $this->namespace_string = $ns;
     $code = $plugins->setHook('page_type_string_set');
@@ -237,7 +240,7 @@
     $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button'];
     $parser = $this->makeParserText($btn_selected);
     
-    if ( !$paths->anonymous_page )
+    if ( true || !$paths->anonymous_page )
     {
       $parser->assign_vars(array(
           'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="View the page contents, all of the page contents, and nothing but the page contents (alt-a)" accesskey="a"',
--- a/plugins/index.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/plugins/index.php	Mon Dec 03 18:45:37 2007 -0500
@@ -1,21 +1,10 @@
 <?php
-/*
-Plugin Name:
-Plugin URI:
-Description: 
-Author:
-Version:
-Author URI:
-*/
 
-$_GET['title'] = 'Enano:Access_denied';
+$title = 'Access denied';
 require('../includes/common.php');
 header('HTTP/1.1 403 Forbidden');
-$session->perms['edit_page'] = AUTH_DENY;
-$session->perms['view_source'] = AUTH_DENY;
-$template->tpl_strings['PAGE_NAME'] = 'Access denied';
 
 $template->header();
-echo '<p>The administrator has flagged the page "' . $_SERVER['REQUEST_URI'] . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
+echo '<p>The administrator has flagged the page "' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
 $template->footer();
-$db->close();
+
--- a/themes/index.php	Mon Dec 03 17:36:25 2007 -0500
+++ b/themes/index.php	Mon Dec 03 18:45:37 2007 -0500
@@ -1,13 +1,10 @@
 <?php
 
-$_GET['title'] = 'Enano:Access_denied';
+$title = 'Access denied';
 require('../includes/common.php');
 header('HTTP/1.1 403 Forbidden');
-$session->perms['edit_page'] = AUTH_DENY;
-$session->perms['view_source'] = AUTH_DENY;
-$template->tpl_strings['PAGE_NAME'] = 'Access denied';
 
 $template->header();
-echo '<p>The administrator has flagged the page "' . $_SERVER['REQUEST_URI'] . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
+echo '<p>The administrator has flagged the page "' . htmlspecialchars($_SERVER['REQUEST_URI']) . '" so that it cannot be accessed from the web. Perhaps this is because this is a cache or includes directory and only needs to be accessed by scripts.</p><p>HTTP error: 403 Forbidden</p>';
 $template->footer();
-$db->close();
+