[Nextcms-commits] CVS: nextcms class.Page.php,1.6,1.7 class.Template.php,1.2,1.3 processor.php,1.7,1
Status: Alpha
Brought to you by:
andrejb
|
From: Andrej B. <an...@us...> - 2002-12-31 03:54:42
|
Update of /cvsroot/nextcms/nextcms
In directory sc8-pr-cvs1:/tmp/cvs-serv21350
Modified Files:
class.Page.php class.Template.php processor.php
Log Message:
* some other minor changes
----------------------------------------------------------------------
Index: class.Page.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Page.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** class.Page.php 14 Jul 2002 13:54:32 -0000 1.6
--- class.Page.php 31 Dec 2002 03:54:38 -0000 1.7
***************
*** 120,125 ****
$docache = false;
! $input_vars = &$GLOBALS['input_vars'];
! switch ($input_vars['show']) {
case 'printerversion':
$this->template = $this->getTemplate($pagenode_path, "printerversion");
--- 120,125 ----
$docache = false;
! $INPUT = &$GLOBALS['input_vars'];
! switch ($INPUT['show']) {
case 'printerversion':
$this->template = $this->getTemplate($pagenode_path, "printerversion");
***************
*** 272,276 ****
if ($key[0] == "C") {$out .= $line;}
if ($key[0] == "V") {
! $out .= $this->getFieldCode($line,array());
}
if ($key == "B:section") {
--- 272,279 ----
if ($key[0] == "C") {$out .= $line;}
if ($key[0] == "V") {
! if (is_array($line))
! $out .= $this->getFieldCode($line['name'],$line['paramList']);
! else
! $out .= $this->getFieldCode($line,array());
}
if ($key == "B:section") {
***************
*** 411,414 ****
--- 414,418 ----
$nodepath = $node['parent'] . '/' . 'ext[' . $node['uniquenum'] . ']';
$children = $this->content->xmltree->getChild($nodepath, 'parameter');
+ $paramList = array();
foreach ($children as $child) {
$attrList = $this->content->xmltree->getAttributes($child);
Index: class.Template.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/class.Template.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** class.Template.php 30 Apr 2002 23:58:18 -0000 1.2
--- class.Template.php 31 Dec 2002 03:54:38 -0000 1.3
***************
*** 24,27 ****
--- 24,28 ----
$this->parseTemplate();
+ //exit(print_r($this->block));
}
***************
*** 72,77 ****
while ($index < count($this->template[$tplnum])) {
if ($this->noident)
! $this->template[$tplnum][$index] = ltrim($this->template[$tplnum][$index]);
!
if ($ignore) {
--- 73,77 ----
while ($index < count($this->template[$tplnum])) {
if ($this->noident)
! $this->template[$tplnum][$index] = ltrim($this->template[$tplnum][$index]);
if ($ignore) {
***************
*** 125,180 ****
}
} else {
! //explode current template line on the curly bracket '{'
! $sstr = explode("{", $this->template[$tplnum][$index]);
! reset($sstr);
! if (current($sstr) != '') {
! //the template didn't start with a '{',
! //so the first element of the array $sstr is just code
! $this->block[$blockname]["C:$coderow"] = current($sstr);
$coderow++;
}
! $sstrlength = sizeof($sstr);
!
! for ($i=1;$i < $sstrlength; $i++) {
! next($sstr);
! //find the position of the end curly bracket '}'
! $pos = strpos(current($sstr), '}');
if (($pos !== false) && ($pos > 0) ) {
! //it seems that the end curly bracket '}' is found
! //and at least on position 1, to eliminate '{}' (empty var = no var)
! //
! //note: position 1 taken without the '{', because we did explode on '{'
!
! $strlength = strlen( current($sstr) );
! $varname = substr( current($sstr), 0, $pos);
! //test varname on spaces
! if (strstr($varname, ' ')) {
! //it seems that the varname contains at least one white space
! //so, it isn't a variable, we can save it as code
! $this->block[$blockname]["C:$coderow"] = '{'. current($sstr);
! $coderow++;
! } else {
! //save the variable
$this->block[$blockname]["V:$varrow" ] = $varname;
$varrow++;
- //is there some code after the varname left?
if( ($pos + 1) != $strlength ) {
! //yes there is, save that code
! $this->block[$blockname]["C:$coderow"] = substr(current($sstr), ($pos + 1), ($strlength - ($pos + 1)));
$coderow++;
}
}
} else {
! //no end curly bracket '}' found
! //so, the curly bracket is part of the text (example: javascript function)
! //save it as code, with the '{'
! $this->block[$blockname]["C:$coderow"] = '{'. current($sstr);
$coderow++;
}
--- 125,177 ----
}
} else {
! $searchString = explode("{", $this->template[$tplnum][$index]);
! reset($searchString);
! if (current($searchString) != '') {
! $this->block[$blockname]["C:$coderow"] = current($searchString);
$coderow++;
}
! $searchStringLength = sizeof($searchString);
! for ($i=1;$i < $searchStringLength; $i++) {
! next($searchString);
! $pos = strpos(current($searchString), '}');
if (($pos !== false) && ($pos > 0) ) {
! $strlength = strlen(current($searchString));
! $varname = substr(current($searchString), 0, $pos);
!
! if (!strstr($varname, ' ')) {
$this->block[$blockname]["V:$varrow" ] = $varname;
$varrow++;
if( ($pos + 1) != $strlength ) {
! $this->block[$blockname]["C:$coderow"] = substr(current($searchString), ($pos + 1), ($strlength - ($pos + 1)));
! $coderow++;
! }
! } else if (preg_match('/^(\S+)\((.*)\)}/', current($searchString), $myRegs)) {
!
! // unsafe implementation, just for testing
! $params = explode(" ", $myRegs[2]);
! foreach($params as $param) {
! list($key, $value) = explode("=", $param);
! $paramList[$key] = substr($value, 1, strlen($value) - 2);
! }
! $this->block[$blockname]["V:$varrow" ] = array("name" => $myRegs[1], "paramList" => $paramList);
! $varrow++;
!
! if( ($pos + 1) != $strlength ) {
! $this->block[$blockname]["C:$coderow"] = substr(current($searchString), ($pos + 1), ($strlength - ($pos + 1)));
$coderow++;
}
+ } else {
+ $this->block[$blockname]["C:$coderow"] = '{'. current($searchString);
+ $coderow++;
}
} else {
! $this->block[$blockname]["C:$coderow"] = '{'. current($searchString);
$coderow++;
}
***************
*** 192,196 ****
return $initdev;
}
-
}
?>
--- 189,192 ----
Index: processor.php
===================================================================
RCS file: /cvsroot/nextcms/nextcms/processor.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** processor.php 14 Jul 2002 13:54:32 -0000 1.7
--- processor.php 31 Dec 2002 03:54:38 -0000 1.8
***************
*** 50,56 ****
function setupInputVars() {
! global $document_root, $input_vars, $file, $vurl, $settings;
! if (isset($document_root)) unset($document_root);
if (!include('processor.conf.php')) {
--- 50,56 ----
function setupInputVars() {
! global $document_root, $file, $vurl, $settings, $GET, $POST, $INPUT;
! if (isset($document_root)) unset($document_root);
if (!include('processor.conf.php')) {
***************
*** 65,83 ****
! $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'];
- $input_vars = array_merge($get_vars, $GLOBALS['HTTP_POST_VARS']);
$vurl = $url['path'];
! if (!empty($get_vars['show']))
! $vurl .= "?show=" . $get_vars['show'];
if (!isset($document_root)) {
--- 65,96 ----
! // collect GET variables
! if (is_array($_GET))
! $GET = $_GET;
! else
! $GET = $GLOBALS['HTTP_GET_VARS'];
+ // collect POST variables
+ if (is_array($_POST))
+ $INPUT = $_POST;
+ else
+ $INPUT = $GLOBALS['HTTP_POST_VARS'];
! $INPUT = array_merge($GET, $POST);
!
! $url = parse_url($GET['file']);
if (isset($url['query']))
! parse_str($url['query'], $GET);
else
! $GET = array();
!
! // workaround for unix homedirs e.g. http://domain.tld/~username
! $GET['file'] = ereg_replace ("/~[^/]+", '', $url['path']);
! // $GET['file'] = $url['path'];
$vurl = $url['path'];
! if (!empty($GET['show']))
! $vurl .= "?show=" . $GET['show'];
if (!isset($document_root)) {
***************
*** 85,92 ****
}
!
! 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 (strpos($file, '..') !== false) {
--- 98,104 ----
}
! if (!isset($INPUT['file'])) die(); else $file = $INPUT['file'];
! if (!isset($INPUT['show'])) $INPUT['show'] = "";
! if (!isset($INPUT['action'])) $INPUT['action'] = "";
if (strpos($file, '..') !== false) {
|