# HG changeset patch
# User Dan
# Date 1198039495 18000
# Node ID 5f1cd51bf1be985e73697bb76d81864457a6f3f3
# Parent 112debff64bd6b268d39bf04743045a5adc94d11
Many changes. Installer with PostgreSQL is broken badly and will be for some time.
diff -r 112debff64bd -r 5f1cd51bf1be ajax.php
--- a/ajax.php Sat Dec 15 18:10:14 2007 -0500
+++ b/ajax.php Tue Dec 18 23:44:55 2007 -0500
@@ -97,13 +97,22 @@
echo PageUtils::checkusername($_GET['name']);
break;
case "getsource":
- $p = ( isset($_GET['pagepass']) ) ? $_GET['pagepass'] : false;
- echo PageUtils::getsource($paths->page, $p);
+ $password = ( isset($_GET['pagepass']) ) ? $_GET['pagepass'] : false;
+ $page = new PageProcessor($paths->page_id, $paths->namespace);
+ $page->password = $password;
+ if ( $src = $page->fetch_source() )
+ {
+ echo $src;
+ }
+ else
+ {
+ echo 'err_access_denied';
+ }
break;
case "getpage":
// echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
$revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
- $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
+ $page = new PageProcessor( $paths->page_id, $paths->namespace, $revision_id );
$pagepass = ( isset($_REQUEST['pagepass']) ) ? $_REQUEST['pagepass'] : '';
$page->password = $pagepass;
@@ -113,10 +122,10 @@
case "savepage":
$summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
$minor = isset($_POST['minor']);
- $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['text'], $summ, $minor);
+ $e = PageUtils::savepage($paths->page_id, $paths->namespace, $_POST['text'], $summ, $minor);
if($e=='good')
{
- $page = new PageProcessor($paths->cpage['urlname_nons'], $paths->namespace);
+ $page = new PageProcessor($paths->page_id, $paths->namespace);
$page->send();
}
else
@@ -125,16 +134,16 @@
}
break;
case "protect":
- echo PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, (int)$_POST['level'], $_POST['reason']);
+ echo PageUtils::protect($paths->page_id, $paths->namespace, (int)$_POST['level'], $_POST['reason']);
break;
case "histlist":
- echo PageUtils::histlist($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::histlist($paths->page_id, $paths->namespace);
break;
case "rollback":
echo PageUtils::rollback( (int)$_GET['id'] );
break;
case "comments":
- $comments = new Comments($paths->cpage['urlname_nons'], $paths->namespace);
+ $comments = new Comments($paths->page_id, $paths->namespace);
if ( isset($_POST['data']) )
{
$comments->process_json($_POST['data']);
@@ -145,37 +154,37 @@
}
break;
case "rename":
- echo PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newtitle']);
+ echo PageUtils::rename($paths->page_id, $paths->namespace, $_POST['newtitle']);
break;
case "flushlogs":
- echo PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::flushlogs($paths->page_id, $paths->namespace);
break;
case "deletepage":
$reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
if ( empty($reason) )
die('Please enter a reason for deleting this page.');
- echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason);
+ echo PageUtils::deletepage($paths->page_id, $paths->namespace, $reason);
break;
case "delvote":
- echo PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::delvote($paths->page_id, $paths->namespace);
break;
case "resetdelvotes":
- echo PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::resetdelvotes($paths->page_id, $paths->namespace);
break;
case "getstyles":
echo PageUtils::getstyles($_GET['id']);
break;
case "catedit":
- echo PageUtils::catedit($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::catedit($paths->page_id, $paths->namespace);
break;
case "catsave":
- echo PageUtils::catsave($paths->cpage['urlname_nons'], $paths->namespace, $_POST);
+ echo PageUtils::catsave($paths->page_id, $paths->namespace, $_POST);
break;
case "setwikimode":
- echo PageUtils::setwikimode($paths->cpage['urlname_nons'], $paths->namespace, (int)$_GET['mode']);
+ echo PageUtils::setwikimode($paths->page_id, $paths->namespace, (int)$_GET['mode']);
break;
case "setpass":
- echo PageUtils::setpass($paths->cpage['urlname_nons'], $paths->namespace, $_POST['password']);
+ echo PageUtils::setpass($paths->page_id, $paths->namespace, $_POST['password']);
break;
case "fillusername":
break;
@@ -230,7 +239,7 @@
if(!$id1 || !$id2) { echo '
Invalid request.
'; $template->footer(); break; }
if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) ||
!preg_match('#^([0-9]+)$#', (string)$_GET['diff2'] )) { echo 'SQL injection attempt
'; $template->footer(); break; }
- echo PageUtils::pagediff($paths->cpage['urlname_nons'], $paths->namespace, $id1, $id2);
+ echo PageUtils::pagediff($paths->page_id, $paths->namespace, $id1, $id2);
break;
case "jsres":
die('// ERROR: this section is deprecated and has moved to includes/clientside/static/enano-lib-basic.js.');
@@ -278,7 +287,7 @@
$q = $db->sql_query('SELECT t.tag_id, t.tag_name, pg.pg_target IS NOT NULL AS used_in_acl, t.user_id FROM '.table_prefix.'tags AS t
LEFT JOIN '.table_prefix.'page_groups AS pg
ON ( ( pg.pg_type = ' . PAGE_GRP_TAGGED . ' AND pg.pg_target=t.tag_name ) OR ( pg.pg_type IS NULL AND pg.pg_target IS NULL ) )
- WHERE t.page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND t.namespace=\'' . $db->escape($paths->namespace) . '\';');
+ WHERE t.page_id=\'' . $db->escape($paths->page_id) . '\' AND t.namespace=\'' . $db->escape($paths->namespace) . '\';');
if ( !$q )
$db->_die();
@@ -338,7 +347,7 @@
}
// check if tag is already on page
- $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $db->escape($paths->namespace) . '\' AND tag_name=\'' . $tag . '\';');
+ $q = $db->sql_query('SELECT 1 FROM '.table_prefix.'tags WHERE page_id=\'' . $db->escape($paths->page_id) . '\' AND namespace=\'' . $db->escape($paths->namespace) . '\' AND tag_name=\'' . $tag . '\';');
if ( !$q )
$db->_die();
if ( $db->numrows() > 0 )
@@ -362,7 +371,7 @@
$db->free_result();
// we're good
- $q = $db->sql_query('INSERT INTO '.table_prefix.'tags(tag_name,page_id,namespace,user_id) VALUES(\'' . $tag . '\', \'' . $db->escape($paths->cpage['urlname_nons']) . '\', \'' . $db->escape($paths->namespace) . '\', ' . $session->user_id . ');');
+ $q = $db->sql_query('INSERT INTO '.table_prefix.'tags(tag_name,page_id,namespace,user_id) VALUES(\'' . $tag . '\', \'' . $db->escape($paths->page_id) . '\', \'' . $db->escape($paths->namespace) . '\', ' . $session->user_id . ');');
if ( !$q )
$db->_die();
@@ -392,7 +401,7 @@
$row = $db->fetchrow();
$db->free_result();
- if ( $row['page_id'] == $paths->cpage['urlname_nons'] && $row['namespace'] == $paths->namespace )
+ if ( $row['page_id'] == $paths->page_id && $row['namespace'] == $paths->namespace )
$perms =& $session;
else
$perms = $session->fetch_page_acl($row['page_id'], $row['namespace']);
diff -r 112debff64bd -r 5f1cd51bf1be includes/captcha.php
--- a/includes/captcha.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/captcha.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
* captcha.php - visual confirmation system used during registration
*
diff -r 112debff64bd -r 5f1cd51bf1be includes/clientside/jsres.php
--- a/includes/clientside/jsres.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/clientside/jsres.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
* jsres.php - the Enano client-side runtime, a.k.a. AJAX on steroids
*
@@ -40,7 +40,7 @@
{
echo "/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* [Aggressively compressed] Javascript client code
* Copyright (C) 2006-2007 Dan Fuhry
* Enano is Free Software, licensed under the GNU General Public License; see http://enanocms.org/ for details.
diff -r 112debff64bd -r 5f1cd51bf1be includes/comment.php
--- a/includes/comment.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/comment.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
@@ -54,7 +54,7 @@
global $db, $session, $paths, $template, $plugins; // Common objects
// Initialize permissions
- if ( $page_id == $paths->cpage['urlname_nons'] && $namespace == $paths->namespace )
+ if ( $page_id == $paths->page_id && $namespace == $paths->namespace )
$this->perms =& $GLOBALS['session'];
else
$this->perms = $session->fetch_page_acl($page_id, $namespace);
diff -r 112debff64bd -r 5f1cd51bf1be includes/common.php
--- a/includes/common.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/common.php Tue Dec 18 23:44:55 2007 -0500
@@ -152,7 +152,7 @@
// even be installed. If this connection attempt fails and it's because of a missing or corrupt config file, the
// user will be redirected (intelligently) to install.php.
-require(ENANO_ROOT . '/config.php');
+@include(ENANO_ROOT . '/config.php');
unset($dbuser, $dbpasswd);
if ( !isset($dbdriver) )
$dbdriver = 'mysql';
@@ -328,7 +328,7 @@
// If the site is disabled, bail out, unless we're trying to log in or administer the site
if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
{
- if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->cpage['urlname_nons'] == 'CSS' || $paths->cpage['urlname_nons'] == 'Administration' || $paths->cpage['urlname_nons'] == 'Login' ) ) )
+ if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->page_id == 'CSS' || $paths->page_id == 'Administration' || $paths->page_id == 'Login' ) ) )
{
// do nothing; allow execution to continue
}
diff -r 112debff64bd -r 5f1cd51bf1be includes/constants.php
--- a/includes/constants.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/constants.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
* constants.php - important defines used Enano-wide
*
diff -r 112debff64bd -r 5f1cd51bf1be includes/dbal.php
--- a/includes/dbal.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/dbal.php Tue Dec 18 23:44:55 2007 -0500
@@ -120,7 +120,7 @@
return $internal_text;
}
- function connect()
+ function connect($manual_credentials = false, $dbhost = false, $dbuser = false, $dbpasswd = false, $dbname = false)
{
$this->enable_errorhandler();
@@ -130,42 +130,46 @@
define('ENANO_SQL_BOOLEAN_TRUE', 'true');
define('ENANO_SQL_BOOLEAN_FALSE', 'false');
- if ( defined('IN_ENANO_INSTALL') && !defined('IN_ENANO_UPGRADE') )
- {
- @include(ENANO_ROOT.'/config.new.php');
- }
- else
+ if ( !$manual_credentials )
{
- @include(ENANO_ROOT.'/config.php');
- }
+ if ( defined('IN_ENANO_INSTALL') && !defined('IN_ENANO_UPGRADE') )
+ {
+ @include(ENANO_ROOT.'/config.new.php');
+ }
+ else
+ {
+ @include(ENANO_ROOT.'/config.php');
+ }
+
+ if ( isset($crypto_key) )
+ unset($crypto_key); // Get this sucker out of memory fast
- if ( isset($crypto_key) )
- unset($crypto_key); // Get this sucker out of memory fast
-
- if ( !defined('ENANO_INSTALLED') && !defined('MIDGET_INSTALLED') && !defined('IN_ENANO_INSTALL') )
- {
- // scriptPath isn't set yet - we need to autodetect it to avoid infinite redirects
- if ( !defined('scriptPath') )
+ if ( !defined('ENANO_INSTALLED') && !defined('MIDGET_INSTALLED') && !defined('IN_ENANO_INSTALL') )
{
- if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) )
+ // scriptPath isn't set yet - we need to autodetect it to avoid infinite redirects
+ if ( !defined('scriptPath') )
{
- $_SERVER['REQUEST_URI'] = preg_replace(';' . preg_quote($_SERVER['PATH_INFO']) . '$;', '', $_SERVER['REQUEST_URI']);
- }
- if ( !preg_match('/\.php$/', $_SERVER['REQUEST_URI']) )
- {
- // user requested http://foo/enano as opposed to http://foo/enano/index.php
- $_SERVER['REQUEST_URI'] .= '/index.php';
+ if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) )
+ {
+ $_SERVER['REQUEST_URI'] = preg_replace(';' . preg_quote($_SERVER['PATH_INFO']) . '$;', '', $_SERVER['REQUEST_URI']);
+ }
+ if ( !preg_match('/\.php$/', $_SERVER['REQUEST_URI']) )
+ {
+ // user requested http://foo/enano as opposed to http://foo/enano/index.php
+ $_SERVER['REQUEST_URI'] .= '/index.php';
+ }
+ $sp = dirname($_SERVER['REQUEST_URI']);
+ if($sp == '/' || $sp == '\\') $sp = '';
+ define('scriptPath', $sp);
+ define('contentPath', "$sp/index.php?title=");
}
- $sp = dirname($_SERVER['REQUEST_URI']);
- if($sp == '/' || $sp == '\\') $sp = '';
- define('scriptPath', $sp);
- define('contentPath', "$sp/index.php?title=");
+ $loc = scriptPath . '/install.php';
+ // header("Location: $loc");
+ redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 3);
+ exit;
}
- $loc = scriptPath . '/install.php';
- // header("Location: $loc");
- redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 3);
- exit;
}
+
$this->_conn = @mysql_connect($dbhost, $dbuser, $dbpasswd);
unset($dbuser);
unset($dbpasswd); // Security
@@ -871,7 +875,7 @@
return $internal_text;
}
- function connect()
+ function connect($manual_credentials = false, $dbhost = false, $dbuser = false, $dbpasswd = false, $dbname = false)
{
$this->enable_errorhandler();
@@ -881,41 +885,44 @@
define('ENANO_SQL_BOOLEAN_TRUE', '1');
define('ENANO_SQL_BOOLEAN_FALSE', '0');
- if ( defined('IN_ENANO_INSTALL') && !defined('IN_ENANO_UPGRADE') )
- {
- @include(ENANO_ROOT.'/config.new.php');
- }
- else
+ if ( !$manual_credentials )
{
- @include(ENANO_ROOT.'/config.php');
- }
+ if ( defined('IN_ENANO_INSTALL') && !defined('IN_ENANO_UPGRADE') )
+ {
+ @include(ENANO_ROOT.'/config.new.php');
+ }
+ else
+ {
+ @include(ENANO_ROOT.'/config.php');
+ }
+
+ if ( isset($crypto_key) )
+ unset($crypto_key); // Get this sucker out of memory fast
- if ( isset($crypto_key) )
- unset($crypto_key); // Get this sucker out of memory fast
-
- if ( !defined('ENANO_INSTALLED') && !defined('MIDGET_INSTALLED') && !defined('IN_ENANO_INSTALL') )
- {
- // scriptPath isn't set yet - we need to autodetect it to avoid infinite redirects
- if ( !defined('scriptPath') )
+ if ( !defined('ENANO_INSTALLED') && !defined('MIDGET_INSTALLED') && !defined('IN_ENANO_INSTALL') )
{
- if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) )
+ // scriptPath isn't set yet - we need to autodetect it to avoid infinite redirects
+ if ( !defined('scriptPath') )
{
- $_SERVER['REQUEST_URI'] = preg_replace(';' . preg_quote($_SERVER['PATH_INFO']) . '$;', '', $_SERVER['REQUEST_URI']);
- }
- if ( !preg_match('/\.php$/', $_SERVER['REQUEST_URI']) )
- {
- // user requested http://foo/enano as opposed to http://foo/enano/index.php
- $_SERVER['REQUEST_URI'] .= '/index.php';
+ if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) )
+ {
+ $_SERVER['REQUEST_URI'] = preg_replace(';' . preg_quote($_SERVER['PATH_INFO']) . '$;', '', $_SERVER['REQUEST_URI']);
+ }
+ if ( !preg_match('/\.php$/', $_SERVER['REQUEST_URI']) )
+ {
+ // user requested http://foo/enano as opposed to http://foo/enano/index.php
+ $_SERVER['REQUEST_URI'] .= '/index.php';
+ }
+ $sp = dirname($_SERVER['REQUEST_URI']);
+ if($sp == '/' || $sp == '\\') $sp = '';
+ define('scriptPath', $sp);
+ define('contentPath', "$sp/index.php?title=");
}
- $sp = dirname($_SERVER['REQUEST_URI']);
- if($sp == '/' || $sp == '\\') $sp = '';
- define('scriptPath', $sp);
- define('contentPath', "$sp/index.php?title=");
+ $loc = scriptPath . '/install.php';
+ // header("Location: $loc");
+ redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 3);
+ exit;
}
- $loc = scriptPath . '/install.php';
- // header("Location: $loc");
- redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 3);
- exit;
}
$this->_conn = @pg_connect("host=$dbhost port=5432 dbname=$dbname user=$dbuser password=$dbpasswd");
unset($dbuser);
diff -r 112debff64bd -r 5f1cd51bf1be includes/email.php
--- a/includes/email.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/email.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r 112debff64bd -r 5f1cd51bf1be includes/functions.php
--- a/includes/functions.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/functions.php Tue Dec 18 23:44:55 2007 -0500
@@ -565,7 +565,7 @@
$q = $db->sql_query('SELECT p.urlname, p.namespace, p.name, p.namespace=\'Category\' AS is_category FROM '.table_prefix.'categories AS c
LEFT JOIN '.table_prefix.'pages AS p
ON ( p.urlname = c.page_id AND p.namespace = c.namespace )
- WHERE c.category_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\'
+ WHERE c.category_id=\'' . $db->escape($paths->page_id) . '\'
ORDER BY is_category DESC, p.name ASC;');
if ( !$q )
{
@@ -677,7 +677,7 @@
echo '';
echo 'Categories: ';
- $where = '( c.page_id=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND c.namespace=\'' . $db->escape($paths->namespace) . '\' )';
+ $where = '( c.page_id=\'' . $db->escape($paths->page_id) . '\' AND c.namespace=\'' . $db->escape($paths->namespace) . '\' )';
$prefix = table_prefix;
$sql = <<
namespace != 'File') return null; // Prevent unnecessary work
- $selfn = $paths->cpage['urlname_nons']; // substr($paths->page, strlen($paths->nslist['File']), strlen($paths->cpage));
- if(substr($paths->cpage['name'], 0, strlen($paths->nslist['File']))==$paths->nslist['File']) $selfn = substr($paths->cpage['urlname_nons'], strlen($paths->nslist['File']), strlen($paths->cpage['urlname_nons']));
+ $selfn = $paths->page_id; // substr($paths->page, strlen($paths->nslist['File']), strlen($paths->cpage));
+ if(substr($paths->cpage['name'], 0, strlen($paths->nslist['File']))==$paths->nslist['File']) $selfn = substr($paths->page_id, strlen($paths->nslist['File']), strlen($paths->page_id));
$q = $db->sql_query('SELECT mimetype,time_id,size FROM '.table_prefix.'files WHERE page_id=\''.$selfn.'\' ORDER BY time_id DESC;');
if(!$q) $db->_die('The file type could not be fetched.');
- if($db->numrows() < 1) { echo '
'; return; }
+ if($db->numrows() < 1) { echo '
'; return; }
$r = $db->fetchrow();
$mimetype = $r['mimetype'];
$datestring = date('F d, Y h:i a', (int)$r['time_id']);
@@ -2418,7 +2418,6 @@
function sanitize_page_id($page_id)
{
-
// Remove character escapes
$page_id = dirtify_page_id($page_id);
@@ -2473,11 +2472,17 @@
$page_id = str_replace(' ', '_', $page_id);
// Exception for userpages for IP addresses
- if ( preg_match('/^' . preg_quote($paths->nslist['User']) . '/', $page_id) )
+ if ( isset($paths->nslist['User']) )
{
- $ip = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $page_id);
- if ( is_valid_ip($ip) )
- return $page_id;
+ if ( preg_match('/^' . preg_quote($paths->nslist['User']) . '/', $page_id) )
+ {
+ $ip = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $page_id);
+ if ( is_valid_ip($ip) )
+ {
+ die('valid IP');
+ return $page_id;
+ }
+ }
}
preg_match_all('/\.[A-Fa-f0-9][A-Fa-f0-9]/', $page_id, $matches);
diff -r 112debff64bd -r 5f1cd51bf1be includes/graphs.php
--- a/includes/graphs.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/graphs.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r 112debff64bd -r 5f1cd51bf1be includes/js-compressor.php
--- a/includes/js-compressor.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/js-compressor.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
* Javascript compression library - used to compact the client-side Javascript code (all 72KB of it!) to save some bandwidth
*
diff -r 112debff64bd -r 5f1cd51bf1be includes/pageprocess.php
--- a/includes/pageprocess.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/pageprocess.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* pageprocess.php - intelligent retrieval of pages
* Copyright (C) 2006-2007 Dan Fuhry
*
@@ -15,6 +15,7 @@
/**
* Class to handle fetching page text (possibly from a cache) and formatting it.
+ * As of 1.0.4, this also handles the fetching and editing of certain data for pages.
* @package Enano
* @subpackage UI
* @copyright 2007 Dan Fuhry
@@ -113,6 +114,13 @@
);
/**
+ * The list of errors raised in the class.
+ * @var array
+ */
+
+ var $_errors = array();
+
+ /**
* Constructor.
* @param string The page ID (urlname) of the page
* @param string The namespace of the page
@@ -312,6 +320,173 @@
}
/**
+ * Fetches the wikitext or HTML source for the page.
+ * @return string
+ */
+
+ function fetch_source()
+ {
+ if ( !$this->perms->get_permissions('view_source') )
+ {
+ return false;
+ }
+ return $this->fetch_text();
+ }
+
+ /**
+ * Updates the content of the page.
+ * @param string The new text for the page
+ * @param string A summary of edits made to the page.
+ * @return bool True on success, false on failure
+ */
+
+ function update_page($text, $edit_summary = false)
+ {
+ global $db, $session, $paths, $template, $plugins; // Common objects
+
+ // Create the page if it doesn't exist
+ if ( !$this->page_exists )
+ {
+ if ( !$this->create_page() )
+ {
+ return false;
+ }
+ }
+
+ //
+ // Validation
+ //
+
+ $page_id = $db->escape($this->page_id);
+ $namespace = $db->escape($this->namespace);
+
+ $q = $db->sql_query('SELECT protected FROM ' . table_prefix . "pages WHERE urlname='$page_id' AND namespace='$namespace';");
+ if ( !$q )
+ $db->_die('PageProcess updating page content');
+ if ( $db->numrows() < 1 )
+ {
+ $this->raise_error('Page doesn\'t exist in the database');
+ return false;
+ }
+
+ // Do we have permission to edit the page?
+ if ( !$this->perms->get_permissions('edit_page') )
+ {
+ $this->raise_error('You do not have permission to edit this page.');
+ return false;
+ }
+
+ list($protection) = $db->fetchrow_num();
+ $db->free_result();
+
+ if ( $protection == 1 )
+ {
+ // The page is protected - do we have permission to edit protected pages?
+ if ( !$this->perms->get_permissions('even_when_protected') )
+ {
+ $this->raise_error('This page is protected, and you do not have permission to edit protected pages.');
+ return false;
+ }
+ }
+ else if ( $protection == 2 )
+ {
+ // The page is semi-protected.
+ if (
+ ( !$session->user_logged_in || // Is the user logged in?
+ ( $session->user_logged_in && $session->reg_time + ( 4 * 86400 ) >= time() ) ) // If so, have they been registered for 4 days?
+ && !$this->perms->get_permissions('even_when_protected') ) // And of course, is there an ACL that overrides semi-protection?
+ {
+ $this->raise_error('This page is protected, and you do not have permission to edit protected pages.');
+ return false;
+ }
+ }
+
+ // Protection validated
+
+ }
+
+ /**
+ * Creates the page if it doesn't already exist.
+ * @return bool True on success, false on failure.
+ */
+
+ function create_page()
+ {
+ global $db, $session, $paths, $template, $plugins; // Common objects
+
+ // Do we have permission to create the page?
+ if ( !$this->perms->get_permissions('create_page') )
+ {
+ $this->raise_error('You do not have permission to create this page.');
+ return false;
+ }
+
+ // Does it already exist?
+ if ( $this->page_exists )
+ {
+ $this->raise_error('The page already exists.');
+ return false;
+ }
+
+ // It's not in there. Perform validation.
+
+ // We can't create special, admin, or external pages.
+ if ( $this->namespace == 'Special' || $this->namespace == 'Admin' || $this->namespace == 'Anonymous' )
+ {
+ $this->raise_error('You cannot create Special or Admin pages - they can\'t be stored in the database.');
+ return false;
+ }
+
+ // Guess the proper title
+ $name = dirtify_page_id($this->page_id);
+
+ // Check for the restricted Project: prefix
+ if ( substr($this->page_id, 0, 8) == 'Project:' )
+ {
+ $this->raise_error('The prefix "Project:" is reserved for internal links and can\'t be used on a page name.');
+ return false;
+ }
+
+ // Validation successful - insert the page
+
+ $metadata = array(
+ 'urlname' => $this->page_id,
+ 'namespace' => $this->namespace,
+ 'name' => $name,
+ 'special' => 0,
+ 'visible' => 1,
+ 'comments_on' => 1,
+ 'protected' => ( $this->namespace == 'System' ? 1 : 0 ),
+ 'delvotes' => 0,
+ 'delvote_ips' => serialize(array()),
+ 'wiki_mode' => 2
+ );
+
+ $paths->add_page($metadata);
+
+ $page_id = $db->escape($this->page_id);
+ $namespace = $db->escape($this->namespace);
+ $name = $db->escape($name);
+ $protect = ( $this->namespace == 'System' ) ? '1' : '0';
+ $blank_array = $db->escape(serialize(array()));
+
+ // Query 1: Metadata entry
+ $q = $db->sql_query('INSERT INTO ' . table_prefix . "pages(name, urlname, namespace, protected, delvotes, delvote_ips, wiki_mode)\n"
+ . "VALUES ( '$name', '$page_id', '$namespace', $protect, 0, '$blank_array', 2 );");
+ if ( !$q )
+ $db->_die('PageProcessor page creation - metadata stage');
+
+ // Query 2: Text insertion
+ $q = $db->sql_query('INSERT INTO ' . table_prefix . "page_text(page_id, namespace, page_text)\n"
+ . "VALUES ( '$page_id', '$namespace', '' );");
+ if ( !$q )
+ $db->_die('PageProcessor page creation - text stage');
+
+ // Page created. We're good!
+ return true;
+ }
+
+ /**
* Sets internal variables.
* @access private
*/
@@ -336,7 +511,7 @@
}
// Does the page "exist"?
- if ( $paths->cpage['urlname_nons'] == $page_id && $paths->namespace == $namespace && !$paths->page_exists && ( $this->namespace != 'Admin' || ($this->namespace == 'Admin' && !function_exists($fname) ) ) )
+ if ( $paths->page_id == $page_id && $paths->namespace == $namespace && !$paths->page_exists && ( $this->namespace != 'Admin' || ($this->namespace == 'Admin' && !function_exists($fname) ) ) )
{
$this->page_exists = false;
}
@@ -354,7 +529,7 @@
{
$page_id = str_replace('.2e', '.', $page_id);
- if ( $paths->cpage['urlname_nons'] == $page_id && $paths->namespace == $namespace && !$paths->page_exists && ( $this->namespace != 'Admin' || ($this->namespace == 'Admin' && !function_exists($fname) ) ) )
+ if ( $paths->page_id == $page_id && $paths->namespace == $namespace && !$paths->page_exists && ( $this->namespace != 'Admin' || ($this->namespace == 'Admin' && !function_exists($fname) ) ) )
{
$this->page_exists = false;
}
@@ -630,7 +805,7 @@
global $email;
$page_urlname = dirtify_page_id($this->page_id);
- if ( $this->page_id == $paths->cpage['urlname_nons'] && $this->namespace == $paths->namespace )
+ if ( $this->page_id == $paths->page_id && $this->namespace == $paths->namespace )
{
$page_name = ( isset($paths->cpage['name']) ) ? $paths->cpage['name'] : $this->page_id;
}
@@ -1246,6 +1421,30 @@
}
+ /**
+ * Raises an error.
+ * @param string Error string
+ */
+
+ function raise_error($string)
+ {
+ if ( !is_string($string) )
+ return false;
+ $this->_errors[] = $string;
+ }
+
+ /**
+ * Retrieves the latest error from the error stack and returns it ('pops' the error stack)
+ * @return string
+ */
+
+ function pop_error()
+ {
+ if ( count($this->_errors) < 1 )
+ return false;
+ return array_pop($this->_errors);
+ }
+
} // class PageProcessor
?>
diff -r 112debff64bd -r 5f1cd51bf1be includes/pageutils.php
--- a/includes/pageutils.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/pageutils.php Tue Dec 18 23:44:55 2007 -0500
@@ -202,7 +202,7 @@
else echo ' Return to the homepage.';
if ( $session->get_permissions('history_rollback') )
{
- $e = $db->sql_query('SELECT * FROM ' . table_prefix.'logs WHERE action=\'delete\' AND page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $pid[1] . '\' ORDER BY time_id DESC;');
+ $e = $db->sql_query('SELECT * FROM ' . table_prefix.'logs WHERE action=\'delete\' AND page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $pid[1] . '\' ORDER BY time_id DESC;');
if ( !$e )
{
$db->_die('The deletion log could not be selected.');
@@ -379,7 +379,7 @@
$msg = $db->escape($message);
$minor = $minor ? ENANO_SQL_BOOLEAN_TRUE : ENANO_SQL_BOOLEAN_FALSE;
- $q='INSERT INTO ' . table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $paths->cpage['urlname_nons'] . '\', \'' . $paths->namespace . '\', ' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\', \'' . $uid . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($summary)) . '\', ' . $minor . ');';
+ $q='INSERT INTO ' . table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $paths->page_id . '\', \'' . $paths->namespace . '\', ' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\', \'' . $uid . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($summary)) . '\', ' . $minor . ');';
if(!$db->sql_query($q)) $db->_die('The history (log) entry could not be inserted into the logs table.');
$q = 'UPDATE ' . table_prefix.'page_text SET page_text=' . ENANO_SQL_MULTISTRING_PRFIX . '\'' . $msg . '\',char_tag=\'' . $uid . '\' WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\';';
@@ -654,7 +654,7 @@
}
$db->free_result();
echo 'Other changes:
';
- $q = 'SELECT time_id,action,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action!=\'edit\' AND page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\' ORDER BY time_id DESC;';
+ $q = 'SELECT time_id,action,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action!=\'edit\' AND page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $paths->namespace . '\' ORDER BY time_id DESC;';
if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.');
if($db->numrows() < 1) echo 'No history entries in this category.';
else {
@@ -1371,7 +1371,7 @@
}
if( ( $session->get_permissions('rename') && ( ( $prot && $session->get_permissions('even_when_protected') ) || !$prot ) ) && ( $paths->namespace != 'Special' && $paths->namespace != 'Admin' ))
{
- $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'rename\', \'' . $db->escape($paths->cpage['urlname_nons']) . '\', \'' . $paths->namespace . '\', \'' . $db->escape($session->username) . '\', \'' . $db->escape($paths->cpage['name']) . '\')');
+ $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'rename\', \'' . $db->escape($paths->page_id) . '\', \'' . $paths->namespace . '\', \'' . $db->escape($session->username) . '\', \'' . $db->escape($paths->cpage['name']) . '\')');
if ( !$e )
{
$db->_die('The page title could not be updated.');
@@ -1597,7 +1597,7 @@
global $db, $session, $paths, $template, $plugins; // Common objects
ob_start();
$_ob = '';
- $e = $db->sql_query('SELECT category_id FROM ' . table_prefix.'categories WHERE page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\'');
+ $e = $db->sql_query('SELECT category_id FROM ' . table_prefix.'categories WHERE page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $paths->namespace . '\'');
if(!$e) jsdie('Error selecting category information for current page: '.mysql_error());
$cat_current = Array();
while($r = $db->fetchrow())
@@ -2183,7 +2183,7 @@
-
+
';
diff -r 112debff64bd -r 5f1cd51bf1be includes/paths.php
--- a/includes/paths.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/paths.php Tue Dec 18 23:44:55 2007 -0500
@@ -18,7 +18,7 @@
*/
class pathManager {
- var $pages, $custom_page, $cpage, $page, $fullpage, $page_exists, $namespace, $nslist, $admin_tree, $wiki_mode, $page_protected, $template_cache, $anonymous_page;
+ var $pages, $custom_page, $cpage, $page, $fullpage, $page_exists, $page_id, $namespace, $nslist, $admin_tree, $wiki_mode, $page_protected, $template_cache, $anonymous_page;
function __construct()
{
global $db, $session, $paths, $template, $plugins; // Common objects
@@ -293,6 +293,7 @@
{
$this->page_exists = true;
$this->cpage = $this->pages[$this->page];
+ $this->page_id =& $this->cpage['urlname_nons'];
$this->namespace = $this->cpage['namespace'];
if(!isset($this->cpage['wiki_mode'])) $this->cpage['wiki_mode'] = 2;
diff -r 112debff64bd -r 5f1cd51bf1be includes/plugins.php
--- a/includes/plugins.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/plugins.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r 112debff64bd -r 5f1cd51bf1be includes/render.php
--- a/includes/render.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/render.php Tue Dec 18 23:44:55 2007 -0500
@@ -44,7 +44,7 @@
$perms =& $session;
- if ( $page_id != $paths->cpage['urlname_nons'] || $namespace != $paths->namespace )
+ if ( $page_id != $paths->page_id || $namespace != $paths->namespace )
{
unset($perms);
unset($perms); // PHP <5.1.5 Zend bug
diff -r 112debff64bd -r 5f1cd51bf1be includes/search.php
--- a/includes/search.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/search.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
* search.php - algorithm used to search pages
*
diff -r 112debff64bd -r 5f1cd51bf1be includes/sessions.php
--- a/includes/sessions.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/sessions.php Tue Dec 18 23:44:55 2007 -0500
@@ -1378,11 +1378,11 @@
{
$sql = "SELECT $col_reason, ban_value, ban_type, is_regex FROM " . table_prefix . "banlist WHERE \n"
. " ( ban_type = " . BAN_IP . " AND is_regex = 0 ) OR \n"
- . " ( ban_type = " . BAN_IP . " AND is_regex = 1 AND '{$_SERVER['REMOTE_ADDR']}' LIKE ban_value ) OR \n"
+ . " ( ban_type = " . BAN_IP . " AND is_regex = 1 AND '{$_SERVER['REMOTE_ADDR']}' ~ ban_value ) OR \n"
. " ( ban_type = " . BAN_USER . " AND is_regex = 0 AND ban_value = '{$this->username}' ) OR \n"
- . " ( ban_type = " . BAN_USER . " AND is_regex = 1 AND '{$this->username}' LIKE ban_value ) OR \n"
+ . " ( ban_type = " . BAN_USER . " AND is_regex = 1 AND '{$this->username}' ~ ban_value ) OR \n"
. " ( ban_type = " . BAN_EMAIL . " AND is_regex = 0 AND ban_value = '{$this->email}' ) OR \n"
- . " ( ban_type = " . BAN_EMAIL . " AND is_regex = 1 AND '{$this->email}' LIKE ban_value ) \n"
+ . " ( ban_type = " . BAN_EMAIL . " AND is_regex = 1 AND '{$this->email}' ~ ban_value ) \n"
. " ORDER BY ban_type ASC;";
}
$q = $this->sql($sql);
@@ -1426,7 +1426,7 @@
{
$sql = "SELECT $col_reason, ban_value, ban_type, is_regex FROM " . table_prefix . "banlist WHERE
( ban_type = " . BAN_IP . " AND is_regex = 0 ) OR
- ( ban_type = " . BAN_IP . " AND is_regex = 1 AND '{$_SERVER['REMOTE_ADDR']}' LIKE ban_value )
+ ( ban_type = " . BAN_IP . " AND is_regex = 1 AND '{$_SERVER['REMOTE_ADDR']}' ~ ban_value )
ORDER BY ban_type ASC;";
}
$q = $this->sql($sql);
@@ -2274,7 +2274,7 @@
}
// PAGE group info
- $pg_list = $paths->get_page_groups($paths->cpage['urlname_nons'], $paths->namespace);
+ $pg_list = $paths->get_page_groups($paths->page_id, $paths->namespace);
$pg_info = '';
foreach ( $pg_list as $g_id )
{
@@ -2294,7 +2294,7 @@
}
// The reason we're using an ORDER BY statement here is because ACL_TYPE_GROUP is less than ACL_TYPE_USER, causing the user's individual
// permissions to override group permissions.
- $bs .= implode(" OR\n ", $q) . " )\n AND (" . $pg_info . ' ( page_id=\''.$db->escape($paths->cpage['urlname_nons']).'\' AND namespace=\''.$db->escape($paths->namespace).'\' ) )
+ $bs .= implode(" OR\n ", $q) . " )\n AND (" . $pg_info . ' ( page_id=\''.$db->escape($paths->page_id).'\' AND namespace=\''.$db->escape($paths->namespace).'\' ) )
ORDER BY target_type ASC, page_id ASC, namespace ASC;';
$q = $this->sql($bs);
if ( $row = $db->fetchrow() )
diff -r 112debff64bd -r 5f1cd51bf1be includes/stats.php
--- a/includes/stats.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/stats.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
* stats.php - handles statistics for pages (disablable in the admin CP)
*
@@ -22,7 +22,7 @@
{
if(!$page_id || !$namespace)
{
- $page_id = $paths->cpage['urlname_nons'];
+ $page_id = $paths->page_id;
$namespace = $paths->namespace;
}
if($namespace == 'Special' || $namespace == 'Admin')
diff -r 112debff64bd -r 5f1cd51bf1be includes/tagcloud.php
--- a/includes/tagcloud.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/tagcloud.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r 112debff64bd -r 5f1cd51bf1be includes/template.php
--- a/includes/template.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/template.php Tue Dec 18 23:44:55 2007 -0500
@@ -259,7 +259,7 @@
if ( $session->get_permissions('read') && getConfig('enable_comments')=='1' && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $paths->cpage['comments_on'] == 1 )
{
- $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$paths->cpage['urlname_nons'].'\' AND namespace=\''.$paths->namespace.'\';');
+ $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$paths->page_id.'\' AND namespace=\''.$paths->namespace.'\';');
if ( !$e )
{
$db->_die();
@@ -625,7 +625,7 @@
$this->tpl_bool['stupid_mode'] = false;
- $this->tpl_bool['in_admin'] = ( ( $paths->cpage['urlname_nons'] == 'Administration' && $paths->namespace == 'Special' ) || $paths->namespace == 'Admin' );
+ $this->tpl_bool['in_admin'] = ( ( $paths->page_id == 'Administration' && $paths->namespace == 'Special' ) || $paths->namespace == 'Admin' );
$p = ( isset($_GET['printable']) ) ? '/printable' : '';
@@ -741,7 +741,7 @@
'ADMIN_LINK'=>$admin_link,
'THEME_LINK'=>$theme_link,
'SEARCH_ACTION'=>makeUrlNS('Special', 'Search'),
- 'INPUT_TITLE'=>( urlSeparator == '&' ? '' : ''),
+ 'INPUT_TITLE'=>( urlSeparator == '&' ? '' : ''),
'INPUT_AUTH'=>( $session->sid_super ? '' : ''),
'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
'THEME_ID'=>$this->theme,
@@ -1703,7 +1703,7 @@
function notify_unread_pms()
{
global $db, $session, $paths, $template, $plugins; // Common objects
- if ( ( $paths->cpage['urlname_nons'] == 'PrivateMessages' || $paths->cpage['urlname_nons'] == 'Preferences' ) && $paths->namespace == 'Special' )
+ if ( ( $paths->page_id == 'PrivateMessages' || $paths->page_id == 'Preferences' ) && $paths->namespace == 'Special' )
{
return '';
}
diff -r 112debff64bd -r 5f1cd51bf1be includes/wikiengine/Tables.php
--- a/includes/wikiengine/Tables.php Sat Dec 15 18:10:14 2007 -0500
+++ b/includes/wikiengine/Tables.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r 112debff64bd -r 5f1cd51bf1be index.php
--- a/index.php Sat Dec 15 18:10:14 2007 -0500
+++ b/index.php Tue Dec 18 23:44:55 2007 -0500
@@ -64,7 +64,7 @@
case 'view':
// echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
$rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
- $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $rev_id );
+ $page = new PageProcessor( $paths->page_id, $paths->namespace, $rev_id );
$page->send_headers = true;
$pagepass = ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '';
$page->password = $pagepass;
@@ -79,7 +79,7 @@
default:
$act = ( isset ($_GET['action']) ) ? $_GET['action'] : false;
$id = ( isset ($_GET['id']) ) ? intval($_GET['id']) : -1;
- echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace, $act, Array('id'=>$id));
+ echo PageUtils::comments_html($paths->page_id, $paths->namespace, $act, Array('id'=>$id));
break;
case 'postcomment':
if(empty($_POST['name']) ||
@@ -88,8 +88,8 @@
) { echo 'Invalid request'; break; }
$cid = ( isset($_POST['captcha_id']) ) ? $_POST['captcha_id'] : false;
$cin = ( isset($_POST['captcha_input']) ) ? $_POST['captcha_input'] : false;
- PageUtils::addcomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cin, $cid); // All filtering, etc. is handled inside this method
- echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace);
+ PageUtils::addcomment($paths->page_id, $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cin, $cid); // All filtering, etc. is handled inside this method
+ echo PageUtils::comments_html($paths->page_id, $paths->namespace);
break;
case 'editcomment':
if(!isset($_GET['id']) || ( isset($_GET['id']) && !preg_match('#^([0-9]+)$#', $_GET['id']) )) { echo 'Invalid comment ID
'; break; }
@@ -107,16 +107,16 @@
break;
case 'savecomment':
if(empty($_POST['subj']) || empty($_POST['text'])) { echo 'Invalid request
'; break; }
- $r = PageUtils::savecomment_neater($paths->cpage['urlname_nons'], $paths->namespace, $_POST['subj'], $_POST['text'], (int)$_POST['id']);
+ $r = PageUtils::savecomment_neater($paths->page_id, $paths->namespace, $_POST['subj'], $_POST['text'], (int)$_POST['id']);
if($r != 'good') { echo "$r
"; break; }
- echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::comments_html($paths->page_id, $paths->namespace);
break;
case 'deletecomment':
if(!empty($_GET['id']))
{
- PageUtils::deletecomment_neater($paths->cpage['urlname_nons'], $paths->namespace, (int)$_GET['id']);
+ PageUtils::deletecomment_neater($paths->page_id, $paths->namespace, (int)$_GET['id']);
}
- echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace);
+ echo PageUtils::comments_html($paths->page_id, $paths->namespace);
break;
}
$template->footer();
@@ -129,7 +129,7 @@
}
if(isset($_POST['_save']))
{
- $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['page_text'], $_POST['edit_summary'], isset($_POST['minor']));
+ $e = PageUtils::savepage($paths->page_id, $paths->namespace, $_POST['page_text'], $_POST['edit_summary'], isset($_POST['minor']));
if ( $e == 'good' )
{
redirect(makeUrl($paths->page), 'Changes saved', 'Your changes to this page have been saved. Redirecting...', 3);
@@ -141,7 +141,7 @@
$text = $_POST['page_text'];
echo PageUtils::genPreview($_POST['page_text']);
}
- else $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
+ else $text = RenderMan::getPage($paths->page_id, $paths->namespace, 0, false, false, false, false);
echo '
+ restart the installation.';
@@ -1577,6 +2071,7 @@
!isset($_POST['db_name']) ||
!isset($_POST['db_user']) ||
!isset($_POST['db_pass']) ||
+ !isset($_POST['db_driver']) ||
!isset($_POST['sitename']) ||
!isset($_POST['sitedesc']) ||
!isset($_POST['copyright']) ||
@@ -1590,6 +2085,12 @@
$template->footer();
exit;
}
+ if ( !in_array($_POST['db_driver'], array('mysql', 'postgresql')) )
+ {
+ echo 'Invalid database driver.';
+ $template->footer();
+ exit;
+ }
switch($_POST['urlscheme'])
{
case "ugly":
diff -r 112debff64bd -r 5f1cd51bf1be plugins/SpecialAdmin.php
--- a/plugins/SpecialAdmin.php Sat Dec 15 18:10:14 2007 -0500
+++ b/plugins/SpecialAdmin.php Tue Dec 18 23:44:55 2007 -0500
@@ -2165,6 +2165,10 @@
return;
}
+ if ( ENANO_DBLAYER != 'MYSQL' )
+ die('Not supported
+ This function is only supported under the MySQL database driver.
');
+
if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes' && defined('ENANO_DEMO_MODE') )
{
redirect(makeUrlComplete('Special', 'Administration'), 'Access denied', 'You\'ve got to be kidding me. Forget it, kid.', 4 );
@@ -2176,13 +2180,11 @@
if(defined('SQL_BACKUP_CRYPT'))
// Try to increase our time limit
- @set_time_limit(300); // five minutes
+ @set_time_limit(0);
// Do the actual export
$aesext = ( defined('SQL_BACKUP_CRYPT') ) ? '.tea' : '';
$filename = 'enano_backup_' . date('ymd') . '.sql' . $aesext;
ob_start();
- header('Content-disposition: attachment, filename="'.$filename.'";');
- header('Content-type: application/transact-sql');
// Spew some headers
$headdate = date('F d, Y \a\t h:i a');
echo <<_die();
+ }
+ echo $result;
}
$data = ob_get_contents();
ob_end_clean();
@@ -2229,6 +2236,8 @@
$tea = new TEACrypt();
$data = $tea->encrypt($data, $session->private_key);
}
+ header('Content-disposition: attachment, filename="'.$filename.'";');
+ header('Content-type: application/transact-sql');
header('Content-length: '.strlen($data));
echo $data;
exit;
@@ -2243,7 +2252,14 @@
Additional tables to export:
escape($finduser);
- $username_where = 'u.username LIKE "' . $finduser . '"';
+ $username_where = ENANO_SQLFUNC_LOWERCASE . '(u.username) LIKE \'%' . strtolower($finduser) . '%\'';
$finduser_url = 'finduser=' . rawurlencode($_GET['finduser']) . '&';
}
else
{
- $username_where = 'u.username REGEXP "^' . $startletter_sql . '"';
+ if ( ENANO_DBLAYER == 'MYSQL' )
+ $username_where = 'lcase(u.username) REGEXP lcase("^' . $startletter_sql . '")';
+ else if ( ENANO_DBLAYER == 'PGSQL' )
+ $username_where = 'lower(u.username) ~ lower(\'^' . $startletter_sql . '\')';
$finduser_url = '';
}
@@ -1371,7 +1374,7 @@
';
// determine number of rows
- $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != "Anonymous";');
+ $q = $db->sql_query('SELECT u.user_id FROM '.table_prefix.'users AS u WHERE ' . $username_where . ' AND u.username != \'Anonymous\';');
if ( !$q )
$db->_die();
@@ -1388,7 +1391,7 @@
$q = $db->sql_unbuffered_query('SELECT u.user_id, u.username, u.reg_time, u.email, u.user_level, u.reg_time, x.email_public FROM '.table_prefix.'users AS u
LEFT JOIN '.table_prefix.'users_extra AS x
ON ( u.user_id = x.user_id )
- WHERE ' . $username_where . ' AND u.username != "Anonymous"
+ WHERE ' . $username_where . ' AND u.username != \'Anonymous\'
ORDER BY ' . $sort_sqllet . ' ' . $target_order . ';');
if ( !$q )
$db->_die();
@@ -1418,7 +1421,7 @@
' .
'
diff -r 112debff64bd -r 5f1cd51bf1be plugins/SpecialUserPrefs.php
--- a/plugins/SpecialUserPrefs.php Sat Dec 15 18:10:14 2007 -0500
+++ b/plugins/SpecialUserPrefs.php Tue Dec 18 23:44:55 2007 -0500
@@ -47,7 +47,7 @@
{
global $db, $session, $paths, $template, $plugins; // Common objects
- if ( $paths->namespace != 'Special' || $paths->cpage['urlname_nons'] != 'Preferences' )
+ if ( $paths->namespace != 'Special' || $paths->page_id != 'Preferences' )
return false;
$tb .= "
";
diff -r 112debff64bd -r 5f1cd51bf1be plugins/admin/SecurityLog.php
--- a/plugins/admin/SecurityLog.php Sat Dec 15 18:10:14 2007 -0500
+++ b/plugins/admin/SecurityLog.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* Copyright (C) 2006-2007 Dan Fuhry
*
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
diff -r 112debff64bd -r 5f1cd51bf1be themes/oxygen/css/bleu.css
--- a/themes/oxygen/css/bleu.css Sat Dec 15 18:10:14 2007 -0500
+++ b/themes/oxygen/css/bleu.css Tue Dec 18 23:44:55 2007 -0500
@@ -246,6 +246,11 @@
color: #202020;
}
+input[type ^="image"][disabled ^="disabled"] {
+ opacity: 0.5;
+ filter: alpha(opacity=50);
+}
+
/* JWS window theming */
div.jswindow { border: 2px solid #7090B0; border-top: 5px solid #7090B0; padding: 0px; font-family: Trebuchet MS, tahoma, verdana, arial, sans-serif; font-size: 9pt; display: none; position: absolute; background-color: #FFFFFF; }
div.titlebar { background-color: #7090B0; color: #FFFFFF; font-family: Trebuchet MS, tahoma, verdana, arial, sans-serif; font-size: 9pt; padding-bottom: 4px; cursor: default; }
diff -r 112debff64bd -r 5f1cd51bf1be upgrade.php
--- a/upgrade.php Sat Dec 15 18:10:14 2007 -0500
+++ b/upgrade.php Tue Dec 18 23:44:55 2007 -0500
@@ -2,7 +2,7 @@
/*
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.1.1
+ * Version 1.0.3 (Dyrad)
* upgrade.php - upgrade script
* Copyright (C) 2006-2007 Dan Fuhry
*
Uploaded file
There are no files uploaded with this name yet. Upload a file...