[Nextcms-commits] CVS: nextcms class.Cache.php,1.4,1.5 class.Log.php,1.5,1.6 class.Mapper.php,1.2,1.
Status: Alpha
Brought to you by:
andrejb
Update of /cvsroot/nextcms/nextcms
In directory usw-pr-cvs1:/tmp/cvs-serv31215
Modified Files:
class.Cache.php class.Log.php class.Mapper.php class.Page.php
class.Site.php processor.conf.php-dist processor.php xml.php
Log Message:
* some bugs fixed
* {parent_url} added
Index: class.Cache.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Cache.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** class.Cache.php 14 May 2002 16:16:00 -0000 1.4
--- class.Cache.php 27 May 2002 23:50:10 -0000 1.5
***************
*** 6,18 ****
function Cache($url = null) {
$this->is_cached = false;
if (!isset($url)) return;
! if (!isset($GLOBALS['CACHE_DIR'])) return;
$docroot = $GLOBALS['document_root'];
! $cache_filename = $docroot . $GLOBALS['CACHE_DIR'] . "/" . md5($url);
if (!file_exists($cache_filename)) return;
--- 6,19 ----
function Cache($url = null) {
+ global $settings;
$this->is_cached = false;
if (!isset($url)) return;
! if (!isset($settings->CACHE_DIR)) return;
$docroot = $GLOBALS['document_root'];
! $cache_filename = $docroot . $settings->CACHE_DIR . "/" . md5($url);
if (!file_exists($cache_filename)) return;
***************
*** 51,57 ****
}
! function writeFile($file, $data, $check_mod_files) {
! if (isset($GLOBALS['CACHE_DIR'])) {
! $cache_dir = $GLOBALS['document_root'] . $GLOBALS['CACHE_DIR'];
if (!file_exists($cache_dir))
--- 52,58 ----
}
! function writeFile($data, $check_mod_files) {
! if (isset($GLOBALS['settings']->CACHE_DIR)) {
! $cache_dir = $GLOBALS['document_root'] . $GLOBALS['settings']->CACHE_DIR;
if (!file_exists($cache_dir))
***************
*** 59,63 ****
printError("Das Cacheverzeichnis $cache_dir existiert nicht und es konnte auch nicht angelegt werden.");
! $cache_filename = $GLOBALS['CACHE_DIR'] . "/" . md5($file);
$cachefile = fopen($GLOBALS['document_root'] . $cache_filename, "w");
--- 60,64 ----
printError("Das Cacheverzeichnis $cache_dir existiert nicht und es konnte auch nicht angelegt werden.");
! $cache_filename = $GLOBALS['settings']->CACHE_DIR . "/" . md5($GLOBALS['vurl']);
$cachefile = fopen($GLOBALS['document_root'] . $cache_filename, "w");
Index: class.Log.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Log.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** class.Log.php 2 May 2002 17:13:47 -0000 1.5
--- class.Log.php 27 May 2002 23:50:10 -0000 1.6
***************
*** 2,16 ****
class Log {
function Log($filename = "") {
! $log_filename = $GLOBALS['document_root'] . $GLOBALS['LOG_FILE'];
! if (!empty($GLOBALS["LOG_FILE"])) {
$logdir = dirname($log_filename);
if (!file_exists($logdir))
if (!mkdir($logdir, 0777))
! printError("Das Logfile Verzeichnis '" . dirname($GLOBALS['LOG_FILE']) . "' existiert nicht und es konnte auch nicht angelegt werden");
if (!is_writeable($logdir))
! printError("Es bestehen keine Schreibrechte auf das Cacheverzeichnis '" . dirname($GLOBALS['LOG_FILE']) . "'.");
if (file_exists($log_filename)) {
--- 2,17 ----
class Log {
function Log($filename = "") {
! global $settings;
! $log_filename = $GLOBALS['document_root'] . $settings->LOG_FILE;
! if (!empty($settings->LOG_FILE)) {
$logdir = dirname($log_filename);
if (!file_exists($logdir))
if (!mkdir($logdir, 0777))
! printError("Das Logfile Verzeichnis '" . dirname($settings->LOG_FILE) . "' existiert nicht und es konnte auch nicht angelegt werden");
if (!is_writeable($logdir))
! printError("Es bestehen keine Schreibrechte auf das Cacheverzeichnis '" . dirname($settings->LOG_FILE) . "'.");
if (file_exists($log_filename)) {
***************
*** 29,34 ****
$remote_addr = getenv('REMOTE_ADDR');
! if (isset($GLOBALS['RESOLVE_HOST_NAMES']))
! if ($GLOBALS['RESOLVE_HOST_NAMES'])
$remote_addr = gethostbyaddr($remote_addr);
--- 30,35 ----
$remote_addr = getenv('REMOTE_ADDR');
! if (isset($settings->RESOLVE_HOST_NAMES))
! if ($settings->RESOLVE_HOST_NAMES)
$remote_addr = gethostbyaddr($remote_addr);
***************
*** 37,57 ****
fclose($f);
! if (isset($GLOBALS['LOG_MAX_SIZE'])) {
! if (filesize($log_filename) > ($GLOBALS['LOG_MAX_SIZE'] << 10)) {
! if (isset($GLOBALS['LOG_COMPRESSION_COMMAND'])) {
! if (isset($GLOBALS['LOG_COMPRESSION_EXTENSION']))
! $ext = $GLOBALS['LOG_COMPRESSION_EXTENSION']; else $ext = '';
!
! $testname = $log_filename . '.' . date('Ymd');
!
! $outfile = $testname . $ext;
! for ($i=1;file_exists($outfile);$i++)
! $outfile = $testname . '.' . $i . $ext;
!
! $trans = array('{infile}' => $log_filename, '{outfile}' => $outfile);
! $cmd = strtr($GLOBALS['LOG_COMPRESSION_COMMAND'], $trans);
! exec($cmd);
! }
! unlink($log_filename);
}
}
--- 38,70 ----
fclose($f);
! // on high server load the next part has some bugs
!
! if (isset($settings->LOG_MAX_SIZE)) {
! if (filesize($log_filename) > ($settings->LOG_MAX_SIZE << 10)) {
! // check again, if it is really the size of the file
! clearstatcache();
! if (filesize($log_filename) > ($settings->LOG_MAX_SIZE << 10))
! if (isset($settings->LOG_COMPRESSION_COMMAND)) {
! if (isset($settings->LOG_COMPRESSION_EXTENSION))
! $ext = $settings->LOG_COMPRESSION_EXTENSION; else $ext = 'bak';
!
! $testname = $log_filename . '.' . date('Ymd');
!
! $infile = $testname;
! for ($i=1;file_exists($infile . $ext);$i++)
! $infile = $testname . '.' . $i;
!
!
! $outfile = $infile . $ext;
! rename($log_filename, $infile);
!
! $trans = array('{infile}' => $infile, '{outfile}' => $outfile);
! $cmd = strtr($settings->LOG_COMPRESSION_COMMAND, $trans);
! exec($cmd);
! clearstatcache();
! unlink($in_file);
! } else {
! unlink($log_filename);
! }
}
}
Index: class.Mapper.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Mapper.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** class.Mapper.php 14 May 2002 16:16:00 -0000 1.2
--- class.Mapper.php 27 May 2002 23:50:10 -0000 1.3
***************
*** 12,16 ****
function Mapper($disable_cache = false) {
disableLoadedFiles();
! $site_file = $GLOBALS['SITE_FILES'];
if (!$disable_cache)
--- 12,16 ----
function Mapper($disable_cache = false) {
disableLoadedFiles();
! $site_file = $GLOBALS['settings']->SITE_FILES;
if (!$disable_cache)
***************
*** 38,43 ****
foreach ($site_file as $key => $file) {
! if (isset($this->site[$key]))
! if (!(fileatime($GLOBALS['document_root'] . '/' . $this->site[$key]['file']) > $this->site[$key]['modtime']))
continue;
else
--- 38,48 ----
foreach ($site_file as $key => $file) {
! if (isset($this->site[$key])) {
! $sfile = $GLOBALS['document_root'] . '/' . $this->site[$key]['file'];
! if (!file_exists($sfile)) {
! unset($this->site[$key]['file']);
! continue;
! }
! if (!(fileatime($sfile) > $this->site[$key]['modtime']))
continue;
else
***************
*** 47,51 ****
unset($this->virtual_url[$vurl]);
}
!
$this->mapping_is_modified = true;
--- 52,56 ----
unset($this->virtual_url[$vurl]);
}
! }
$this->mapping_is_modified = true;
***************
*** 100,108 ****
function writeCache() {
! if (isset($GLOBALS['CACHE_DIR'])) {
unset($this->mapping_is_modified);
! $cache_dir = $GLOBALS['document_root'] . $GLOBALS['CACHE_DIR'];
! $cache_filename = $GLOBALS['CACHE_DIR'] . "/" . 'mappercache';
! $check_mod_files = $GLOBALS['SITE_FILES'];
if (!file_exists($cache_dir))
--- 105,113 ----
function writeCache() {
! if (isset($GLOBALS['settings']->CACHE_DIR)) {
unset($this->mapping_is_modified);
! $cache_dir = $GLOBALS['document_root'] . $GLOBALS['settings']->CACHE_DIR;
! $cache_filename = $GLOBALS['settings']->CACHE_DIR . "/" . 'mappercache';
! $check_mod_files = $GLOBALS['settings']->CACHE_DIR;
if (!file_exists($cache_dir))
***************
*** 120,125 ****
function readCache() {
! if (isset($GLOBALS['CACHE_DIR'])) {
! $cache_dir = $GLOBALS['document_root'] . $GLOBALS['CACHE_DIR'];
$cache_filename = $cache_dir . "/" . 'mappercache';
--- 125,130 ----
function readCache() {
! if (isset($GLOBALS['settings']->CACHE_DIR)) {
! $cache_dir = $GLOBALS['document_root'] . $GLOBALS['settings']->CACHE_DIR;
$cache_filename = $cache_dir . "/" . 'mappercache';
Index: class.Page.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Page.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** class.Page.php 30 Apr 2002 23:58:18 -0000 1.4
--- class.Page.php 27 May 2002 23:50:10 -0000 1.5
***************
*** 18,21 ****
--- 18,22 ----
var $pagenode_path;
+ var $parentpage_path;
var $lastpage_path;
var $nextpage_path;
***************
*** 45,49 ****
// check if we can handle the requested url
if (!isset($url)) {
! //header('HTTP/1.0 404 Not Found'); exit;
printError("404 URL '$virtual_url' is not attached to any site on this server.");
}
--- 46,50 ----
// check if we can handle the requested url
if (!isset($url)) {
! header('HTTP/1.0 404 Not Found');// exit;
printError("404 URL '$virtual_url' is not attached to any site on this server.");
}
***************
*** 61,70 ****
// create a new site object
! $this->site = new Site($GLOBALS['SITE_FILES'][$this->siteid]);
// get the pagenode of the page we want to create
! $ret = $this->site->getPageLastNext($this->content->filename);
if (empty($ret))
! printError("Die Seite '" . $this->content->filename . "' wurde in '" . $this->site->filename . "' nicht definiert.");
$this->pagenode_path = $ret['this'];
--- 62,71 ----
// create a new site object
! $this->site = new Site($GLOBALS['settings']->SITE_FILES[$this->siteid]);
// get the pagenode of the page we want to create
! $ret = $this->site->getPageLastNext($this->virtual_url);
if (empty($ret))
! printError("Die Seite '" . $this->virtual_url . "' wurde in '" . $this->site->filename . "' nicht definiert.");
$this->pagenode_path = $ret['this'];
***************
*** 74,77 ****
--- 75,80 ----
if (isset($ret['next']))
$this->nextpage_path = $ret['next'];
+ if (isset($ret['parent']))
+ $this->parentpage_path = $ret['parent'];
// ident support is broken, so it is disabled
***************
*** 102,106 ****
$keywords = array();
! $keywordlists = array_reverse($this->site->xmltree->getParent($pagenode_path, "/site[1]/pages[1]", "page", "keywords"));
foreach($keywordlists as $keywordlist)
--- 105,109 ----
$keywords = array();
! $keywordlists = array_reverse($this->site->xmltree->getAncestorOrSelf($pagenode_path, "/site[1]/pages[1]", "page", "keywords"));
foreach($keywordlists as $keywordlist)
***************
*** 114,118 ****
$this->keywords = implode(", ", $keywords);
! $site_pagetree = array_reverse($this->site->xmltree->getParent($pagenode_path, "/site[1]/pages[1]", "page"));
$docache = false;
--- 117,121 ----
$this->keywords = implode(", ", $keywords);
! $site_pagetree = array_reverse($this->site->xmltree->getAncestorOrSelf($pagenode_path, "/site[1]/pages[1]", "page"));
$docache = false;
***************
*** 121,124 ****
--- 124,128 ----
case 'printerversion':
$this->template = $this->getTemplate($pagenode_path, "printerversion");
+ $docache = true;
break;
***************
*** 166,170 ****
function getPageLocationCode() {
// get pagepath code
! $site_pagetree = array_reverse($this->site->xmltree->getParent($this->pagenode_path, "/site[1]/pages[1]", "page"));
$prechars = "";
$location = "";
--- 170,174 ----
function getPageLocationCode() {
// get pagepath code
! $site_pagetree = array_reverse($this->site->xmltree->getAncestorOrSelf($this->pagenode_path, "/site[1]/pages[1]", "page"));
$prechars = "";
$location = "";
***************
*** 224,237 ****
case "last_url":
if (isset($this->lastpage_path))
! return $this->site->getPageFile($this->lastpage_path);
else
! return $this->content->filename;
break;
case "next_url":
if (isset($this->nextpage_path))
! return $this->site->getPageFile($this->nextpage_path);
else
! return $this->content->filename;
break;
--- 228,248 ----
case "last_url":
if (isset($this->lastpage_path))
! return $this->site->getVirtualUrlByPath($this->lastpage_path);
else
! return $this->virtual_url;
break;
case "next_url":
if (isset($this->nextpage_path))
! return $this->site->getVirtualUrlByPath($this->nextpage_path);
else
! return $this->virtual_url;
! break;
!
! case "parent_url":
! if (isset($this->parentpage_path))
! return $this->site->getVirtualUrlByPath($this->parentpage_path);
! else
! return $this->virtual_url;
break;
***************
*** 264,271 ****
function loadExtention($name) {
! global $document_root;
! if (isset($GLOBALS["EXTENSIONS"][$name]))
! $extension = $GLOBALS["EXTENSIONS"][$name];
if (isset($extension)) {
--- 275,282 ----
function loadExtention($name) {
! global $document_root, $settings;
! if (isset($settings->EXTENSIONS[$name]))
! $extension = $settings->EXTENSIONS[$name];
if (isset($extension)) {
***************
*** 604,613 ****
function writeCacheFile() {
! if (isset($GLOBALS['CACHE_DIR'])) {
! include_once('class.Cache.php');
! $cache = new Cache();
! $cache->writeFile($this->virtual_url, $this->htmlpage, array_unique($GLOBALS['loaded_files']));
! }
}
--- 615,622 ----
function writeCacheFile() {
! include_once('class.Cache.php');
! $cache = new Cache();
! $cache->writeFile($this->htmlpage, array_unique($GLOBALS['loaded_files']));
}
Index: class.Site.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Site.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** class.Site.php 14 May 2002 16:16:00 -0000 1.6
--- class.Site.php 27 May 2002 23:50:10 -0000 1.7
***************
*** 7,10 ****
--- 7,11 ----
var $filename;
var $root;
+
var $id;
var $url;
***************
*** 80,86 ****
*/
! function getPageLastNext($file) {
$dirname = dirname($this->filename);
! $pathlist = $this->xmltree->getNode("/site[1]/pages[1]", true, "page", "file");
// check if there are entries on pathlist
--- 81,87 ----
*/
! function getPageLastNext($vurl) {
$dirname = dirname($this->filename);
! $pathlist = $this->xmltree->getNode("/site[1]/pages[1]", true, "page");
// check if there are entries on pathlist
***************
*** 89,93 ****
$num = count($pathlist);
for ($i=0;$i<$num;$i++) {
! if (relToAbs($this->xmltree->getAttribute($pathlist[$i],'file'), $dirname) == $file) {
$name = $this->xmltree->getAttribute($pathlist[$i], 'name');
if (empty($name))
--- 90,95 ----
$num = count($pathlist);
for ($i=0;$i<$num;$i++) {
!
! if ($vurl == $this->getVirtualUrlByPath($pathlist[$i])) {
$name = $this->xmltree->getAttribute($pathlist[$i], 'name');
if (empty($name))
***************
*** 96,107 ****
--- 98,119 ----
$ret = array();
+
if ($i>0)
$ret['last'] = $pathlist[$i-1];
if (($i+1)<$num)
$ret['next'] = $pathlist[$i+1];
+
$ret['this'] = $pathlist[$i];
+ $parent = $this->xmltree->getParent($pathlist[$i], 'page');
+
+ if (!empty($parent)) {
+ $ret['parent'] = $parent[0];
+ }
+
return $ret;
+
}
+
}
}
***************
*** 144,148 ****
if (empty($template_id)) {
! $parents = $this->xmltree->getParent($nodepath, '/pages[1]', false, 'template');
if (!empty($parents))
$template_id = $this->xmltree->getAttribute($parents[0], 'template');
--- 156,160 ----
if (empty($template_id)) {
! $parents = $this->xmltree->getAncestorOrSelf($nodepath, '/pages[1]', false, 'template');
if (!empty($parents))
$template_id = $this->xmltree->getAttribute($parents[0], 'template');
Index: processor.conf.php-dist
===================================================================
RCS file: /cvsroot/nextcms/nextcms/processor.conf.php-dist,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** processor.conf.php-dist 2 May 2002 17:13:47 -0000 1.7
--- processor.conf.php-dist 27 May 2002 23:50:10 -0000 1.8
***************
*** 1,3 ****
! <?php
// The document_root can be detected automaticly.
// If you exprience problems with the automatic detection
--- 1,3 ----
! <?php class Settings { function Settings() {
// The document_root can be detected automaticly.
// If you exprience problems with the automatic detection
***************
*** 5,50 ****
// manually.
! // $document_root = '/usr/local/httpd/htdocs';
// The install path of nextcms.
! $INSTALL_DIR = '/nextcms';
! // The path in which the extensions are in.
! $EXTENSION_DIR = $INSTALL_DIR . "/extensions";
!
! // if $LOG_FILE is set logging is enabled
// remember to set write permissions
! $LOG_DIR = $INSTALL_DIR . '/logs';
! $LOG_FILE = $LOG_DIR . '/site.log';
// maximum log file size in kbyte
! // $LOG_MAX_SIZE = 1000;
// command which is called when log size limit is reached
! // $LOG_COMPRESSION_COMMAND = "gzip -c {infile} > {outfile}";
! // $LOG_COMPRESSION_EXTENSION = ".gz";
! // if $CACHE_DIR is set caching is enabled
// remember to set write permissions
! $CACHE_DIR = $INSTALL_DIR . '/cache';
// each site should be registered here
! $SITE_FILES = Array('demo_site' => '/demosite/demo.site.xml');
// each extension should be registered here
! $EXTENSIONS = Array('ExtHMenu' => "$EXTENSION_DIR/hmenu.php",
! 'ExtVMenu' => "$EXTENSION_DIR/vmenu.php",
! 'sitemap' => "$EXTENSION_DIR/sitemap.php",
! 'index' => "$EXTENSION_DIR/index.php");
// check if the requested file is a contentfile and should
// be handled by the cms
! $CHECK_IF_CONTENTFILE = true;
// should host names be resolved
! $RESOLVE_HOST_NAMES = true;
// sending a last modified header can lower your traffic
! $SEND_LAST_MODIFIED_HEADER = false;
!
! ?>
--- 5,53 ----
// manually.
! // $this->DOCUMENT_ROOT = '/usr/local/httpd/htdocs';
// The install path of nextcms.
! $this->INSTALL_DIR = '/nextcms';
! // if $this->LOG_FILE is set logging is enabled
// remember to set write permissions
! $this->LOG_DIR = $this->INSTALL_DIR . '/logs';
! $this->LOG_FILE = $this->LOG_DIR . '/site.log';
// maximum log file size in kbyte
! // $this->LOG_MAX_SIZE = 1000;
// command which is called when log size limit is reached
! // $this->LOG_COMPRESSION_COMMAND = "gzip -c {infile} > {outfile}";
! // $this->LOG_COMPRESSION_EXTENSION = ".gz";
! // if $this->CACHE_DIR is set caching is enabled
// remember to set write permissions
! $this->CACHE_DIR = $this->INSTALL_DIR . '/cache';
// each site should be registered here
! $this->SITE_FILES = Array(
! 'demo_site' => '/demosite/demo.site.xml'
! );
+ // The path in which the extensions are in.
+ $this->EXTENSION_DIR = $this->INSTALL_DIR . "/extensions";
+
// each extension should be registered here
! $this->EXTENSIONS = Array(
! 'ExtHMenu' => "$this->EXTENSION_DIR/hmenu.php",
! 'ExtVMenu' => "$this->EXTENSION_DIR/vmenu.php",
! 'sitemap' => "$this->EXTENSION_DIR/sitemap.php",
! 'index' => "$this->EXTENSION_DIR/index.php"
! );
// check if the requested file is a contentfile and should
// be handled by the cms
! $this->CHECK_IF_CONTENTFILE = true;
// should host names be resolved
! $this->RESOLVE_HOST_NAMES = true;
// sending a last modified header can lower your traffic
! $this->SEND_LAST_MODIFIED_HEADER = false;
! }}?>
Index: processor.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/processor.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** processor.php 30 Apr 2002 23:58:18 -0000 1.4
--- processor.php 27 May 2002 23:50:10 -0000 1.5
***************
*** 1,65 ****
<?php
ob_start('ob_gzhandler');
! if (!include('processor.conf.php')) {
! include_once('utils.php');
! printError("Can't find the config file processor.conf.php.");
! }
!
! // include_once('utils.php');
! // startTimer();
!
! if (!isset($document_root)) {
! include_once('utils.php');
! $document_root = getDocRoot();
! }
! $input_vars = getGetParams();
! if (!isset($input_vars['file'])) die(); else $file = $input_vars['file'];
! if (!isset($input_vars['show'])) $input_vars['show'] = "";
! if (!isset($input_vars['action'])) $input_vars['action'] = "";
! if ($CHECK_IF_CONTENTFILE) checkContent($file);
! if ($input_vars['action'] == 'edit') {
! include_once('utils.php');
! // include('class.Admin.php');
! // $admin = new Admin($file);
} else {
! include('class.Cache.php');
! $cache = new Cache($file);
!
! //$cache->is_cached = false;
!
! if ($cache->is_cached && empty($input_vars['show'])) {
! $cache->show();
! } else {
! include_once('utils.php');
! include('class.Page.php');
! $page = new Page($file);
! $page->show();
! }
! if (isset($GLOBALS['LOG_FILE'])) {
! include('class.Log.php');
! $log = new Log($file);
! }
}
- // stopTimer();
if (isset($totaltime))
print "<br>\n<div align=\"center\"><b>created in: $totaltime sec</b></div>";
- function getGetParams() {
- $get_vars = $GLOBALS['HTTP_GET_VARS'];
- $url = parse_url($get_vars['file']);
- if (isset($url['query']))
- parse_str($url['query'], $get_vars);
- else
- $get_vars = array();
- $get_vars['file'] = $url['path'];
-
- return array_merge($get_vars, $GLOBALS['HTTP_POST_VARS']);
- }
/**
--- 1,34 ----
<?php
+ // compress output when it is possible
ob_start('ob_gzhandler');
! // load config file (processor.conf.php)
! setupInputVars();
! if ($settings->CHECK_IF_CONTENTFILE) checkContent($file);
! include('class.Cache.php');
! $cache = new Cache($vurl);
!
! // disable cache for developing
! $cache->is_cached = false;
! if ($cache->is_cached) {
! $cache->show();
} else {
! include_once('utils.php');
! include('class.Page.php');
! $page = new Page($file);
! $page->show();
! }
! if (isset($settings->LOG_FILE)) {
! include('class.Log.php');
! $log = new Log($file);
}
if (isset($totaltime))
print "<br>\n<div align=\"center\"><b>created in: $totaltime sec</b></div>";
/**
***************
*** 69,73 ****
global $document_root;
include_once('utils.php');
!
if (!file_exists($document_root . $file)) return;
$code = loadFile($file);
--- 38,42 ----
global $document_root;
include_once('utils.php');
!
if (!file_exists($document_root . $file)) return;
$code = loadFile($file);
***************
*** 75,80 ****
--- 44,90 ----
// could be unsafe (just for testing)
if (strpos($code, "<contentpage") === false) {
+ //virtual($file);
die($code);
}
}
+
+ function setupInputVars() {
+ global $document_root, $input_vars, $file, $vurl, $settings;
+
+ if (isset($document_root)) unset($document_root);
+
+ if (!include('processor.conf.php')) {
+ include_once('utils.php');
+ printError("Can't find the config file processor.conf.php.");
+ }
+
+ $settings = new Settings();
+
+ if (isset($settings->DOCUMENT_ROOT))
+ $document_root = $settings->DOCUMENT_ROOT;
+
+
+ $get_vars = $GLOBALS['HTTP_GET_VARS'];
+
+ $vurl = $get_vars['file'];
+
+ $url = parse_url($get_vars['file']);
+ if (isset($url['query']))
+ parse_str($url['query'], $get_vars);
+ else
+ $get_vars = array();
+ $get_vars['file'] = $url['path'];
+
+
+ $input_vars = array_merge($get_vars, $GLOBALS['HTTP_POST_VARS']);
+
+ if (!isset($document_root)) {
+ include_once('utils.php');
+ }
+
+
+ if (!isset($input_vars['file'])) die(); else $file = $input_vars['file'];
+ if (!isset($input_vars['show'])) $input_vars['show'] = "";
+ if (!isset($input_vars['action'])) $input_vars['action'] = "";
+ }
?>
Index: xml.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/xml.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** xml.php 30 Apr 2002 23:58:18 -0000 1.2
--- xml.php 27 May 2002 23:50:10 -0000 1.3
***************
*** 114,121 ****
}
! function getParent($path, $dstpath, $tagname = "", $attname = "", $attvalue = "") {
$nodelist = array();
-
if (isset($dstpath)) {
while ($path != $dstpath) {
--- 114,120 ----
}
! function getAncestorOrSelf($path, $dstpath = null, $tagname = "", $attname = "", $attvalue = "") {
$nodelist = array();
if (isset($dstpath)) {
while ($path != $dstpath) {
***************
*** 125,133 ****
}
} else {
- array_push($nodelist, $path);
$path = $this->nodes[$path]['parent'];
! if (empty($path)) break;
}
return $this->getNeededNodes($nodelist, $tagname, $attname, $attvalue);
}
--- 124,136 ----
}
} else {
$path = $this->nodes[$path]['parent'];
! array_push($nodelist, $path);
}
+ return $this->getNeededNodes($nodelist, $tagname, $attname, $attvalue);
+ }
+
+ function getParent($path, $tagname = "", $attname = "", $attvalue = "") {
+ $nodelist[0] = $this->nodes[$path]['parent'];
return $this->getNeededNodes($nodelist, $tagname, $attname, $attvalue);
}
|