cs-content-commits Mailing List for CS-Content [Dynamic Content System] (Page 9)
PHP Templating & Includes System
Brought to you by:
crazedsanity
You can subscribe to this list here.
| 2009 |
Jan
(32) |
Feb
(24) |
Mar
(5) |
Apr
(1) |
May
(14) |
Jun
(16) |
Jul
(11) |
Aug
(43) |
Sep
(9) |
Oct
(5) |
Nov
(1) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(4) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(6) |
Feb
(3) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
(2) |
Nov
(8) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <cra...@us...> - 2009-01-08 05:28:40
|
Revision: 311
http://cs-content.svn.sourceforge.net/cs-content/?rev=311&view=rev
Author: crazedsanity
Date: 2009-01-08 05:28:35 +0000 (Thu, 08 Jan 2009)
Log Message:
-----------
*** RELEASE 0.10.14 ***
SUMMARY OF CHANGES:
* cs_fileSystemClass can now remove directories
* pgsql layer of cs_phpDB has new method, get_currval(), for retrieving the
current value of a given sequence (right after insertion).
* pgsql layer of cs_phpDB gives more informative details in connect errors.
* restore cleaning for "insert" style of
cs_globalFunctions::string_from_array().
* ability to force SQL quotes in cs_globalFunctions::string_from_array()
* drop local version parser to use cs-versionparse project.
* add a credits file to show who's doing the development.
SVN COMMAND:
merge --depth=infinity -r302:310 https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/0.10
Modified Paths:
--------------
releases/0.10/VERSION
releases/0.10/contentSystemClass.php
releases/0.10/cs_bbCodeParser.class.php
releases/0.10/cs_fileSystemClass.php
releases/0.10/cs_genericPageClass.php
releases/0.10/cs_globalFunctions.php
releases/0.10/cs_phpDB.php
releases/0.10/cs_sessionClass.php
releases/0.10/cs_tabsClass.php
releases/0.10/db_types/cs_phpDB__pgsql.class.php
Added Paths:
-----------
releases/0.10/CREDITS
Removed Paths:
-------------
releases/0.10/cs_versionAbstract.class.php
Copied: releases/0.10/CREDITS (from rev 310, trunk/0.10/CREDITS)
===================================================================
--- releases/0.10/CREDITS (rev 0)
+++ releases/0.10/CREDITS 2009-01-08 05:28:35 UTC (rev 311)
@@ -0,0 +1,3 @@
+
+Lead Developer: Dan Falconer (cra...@us...)
+
Modified: releases/0.10/VERSION
===================================================================
--- releases/0.10/VERSION 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/VERSION 2009-01-08 05:28:35 UTC (rev 311)
@@ -1,5 +1,5 @@
## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file.
-VERSION: 0.10.13
+VERSION: 0.10.14
PROJECT: cs-content
$HeadURL:https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/VERSION $
\ No newline at end of file
Modified: releases/0.10/contentSystemClass.php
===================================================================
--- releases/0.10/contentSystemClass.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/contentSystemClass.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -75,7 +75,7 @@
require_once(dirname(__FILE__) ."/cs_sessionClass.php");
require_once(dirname(__FILE__) ."/cs_genericPageClass.php");
require_once(dirname(__FILE__) ."/cs_tabsClass.php");
-require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php");
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class contentSystem extends cs_versionAbstract {
@@ -109,6 +109,7 @@
$this->isTest = TRUE;
}
else {
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
$this->get_version();
$this->get_project();
//make a cs_globalFunctions{} object.
Modified: releases/0.10/cs_bbCodeParser.class.php
===================================================================
--- releases/0.10/cs_bbCodeParser.class.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_bbCodeParser.class.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -18,7 +18,7 @@
* been converted.
*/
-require_once(dirname(__FILE__) .'/cs_versionAbstract.class.php');
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class cs_bbCodeParser extends cs_versionAbstract {
@@ -30,6 +30,7 @@
* Setup internal structures.
*/
function __construct() {
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
# Which BBCode is accepted here
$this->bbCodeData = array(
'bold' => array(
Modified: releases/0.10/cs_fileSystemClass.php
===================================================================
--- releases/0.10/cs_fileSystemClass.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_fileSystemClass.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -10,7 +10,7 @@
*/
require_once(dirname(__FILE__) ."/cs_globalFunctions.php");
-require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php");
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class cs_fileSystemClass extends cs_versionAbstract {
@@ -29,6 +29,7 @@
* The constructor.
*/
public function __construct($rootDir=NULL, $cwd=NULL, $initialMode=NULL) {
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
//set the root directory that we'll be using; this is considered just like "/" in
// linux. Directories above it are considered non-existent.
if(($rootDir) AND (is_dir($rootDir))) {
@@ -476,6 +477,15 @@
//========================================================================================
+ public function rmdir($dirname) {
+ $dirname = $this->filename2absolute($dirname);
+ return(rmdir($dirname));
+ }//end rm()
+ //========================================================================================
+
+
+
+ //========================================================================================
/**
* Return the next line for a file.
*
@@ -902,6 +912,7 @@
}
}
else {
+ cs_debug_backtrace(1);
throw new exception(__METHOD__ .': invalid data: ('. $name .')');
}
Modified: releases/0.10/cs_genericPageClass.php
===================================================================
--- releases/0.10/cs_genericPageClass.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_genericPageClass.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -8,7 +8,7 @@
* $LastChangedRevision$
*/
require_once(dirname(__FILE__) ."/template.inc");
-require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php");
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class cs_genericPage extends cs_versionAbstract {
var $templateObj; //template object to parse the pages
@@ -33,6 +33,7 @@
$this->allowRedirect = $allowRedirect;
//initialize some internal stuff.
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
$this->initialize_locals($mainTemplateFile);
//if they need to be logged-in...
Modified: releases/0.10/cs_globalFunctions.php
===================================================================
--- releases/0.10/cs_globalFunctions.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_globalFunctions.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -1,6 +1,6 @@
<?php
-require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php");
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class cs_globalFunctions extends cs_versionAbstract {
@@ -10,6 +10,9 @@
public $debugRemoveHr = 0;
public $debugPrintOpt = 0;
+ private $forceSqlQuotes=0;
+ private $oldForceSqlQuotes=0;
+
//=========================================================================
public function __construct() {
//These checks have been implemented for pseudo backwards-compatibility
@@ -20,11 +23,51 @@
if(isset($GLOBALS['DEBUGPRINTOPT'])) {
$this->debugPrintOpt = $GLOBALS['DEBUGPRINTOPT'];
}
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
}//end __construct()
//=========================================================================
+ //=========================================================================
+ public function switch_force_sql_quotes($newSetting) {
+ if(is_bool($newSetting)) {
+ if($newSetting === true) {
+ $newSetting = 1;
+ }
+ else {
+ $newSetting = 1;
+ }
+ }
+ elseif(is_numeric($newSetting)) {
+ if($newSetting > 0) {
+ $newSetting = 1;
+ }
+ else {
+ $newSetting = 0;
+ }
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid new setting (". $newSetting .")");
+ }
+
+ if($newSetting !== $this->forceSqlQuotes) {
+ $this->oldForceSqlQuotes = $this->forceSqlQuotes;
+ $this->forceSqlQuotes = $newSetting;
+ $retval = true;
+ $this->debug_print(__METHOD__ .": swapped (OLD=". $this->oldForceSqlQuotes .", CUR=". $this->forceSqlQuotes .")");
+ }
+ else {
+ $retval = false;
+ $this->debug_print(__METHOD__ .": no swap (OLD=". $this->oldForceSqlQuotes .", CUR=". $this->forceSqlQuotes .")");
+ }
+
+ return($retval);
+ }//end force_sql_quotes()
+ //=========================================================================
+
+
+
//================================================================================================================
/**
* Automatically selects either the header() function, or printing meta-refresh data for redirecting a browser.
@@ -145,17 +188,18 @@
//clean the string, if required.
if($cleanString) {
//make sure it's not full of poo...
- #$value = $this->cleanString($value, "sql");
- $value = "'". $value ."'";
+ $value = $this->cleanString($value, "sql");
+ #$value = "'". $value ."'";
}
if((is_null($value)) OR ($value == "")) {
$value = "NULL";
}
- @$tmp[1] = $this->create_list($tmp[1], $value);
+ @$tmp[1] = $this->create_list($tmp[1], $value, ",", 1);
}
//make the final product.
$retval = "(". $tmp[0] .")" . $separator . "(". $tmp[1] .")";
+
break;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -167,7 +211,7 @@
//build final product.
foreach($array as $field=>$value) {
$sqlQuotes = 1;
- if($value === "NULL" || $value === NULL) {
+ if(($value === "NULL" || $value === NULL) && !$this->forceSqlQuotes) {
$sqlQuotes = 0;
}
if($cleanString && !preg_match('/^\'/',$value)) {
@@ -188,7 +232,7 @@
foreach($array as $field=>$value) {
if($cleanString) {
//make sure it doesn't have crap in it...
- $value = $this->cleanString($value, "sql");
+ $value = $this->cleanString($value, "sql", $this->forceSqlQuotes);
$value = "'". $value ."'";
}
$retval = $this->create_list($retval, $value, ", ");
@@ -215,7 +259,8 @@
$delimiter = "AND";
if(is_array($value)) {
//doing tricksie things!!!
- $retval = $this->create_list($retval, $field ." IN (". $this->string_from_array($value) .")", " $delimiter ");
+ $retval = $this->create_list($retval, $field ." IN (". $this->string_from_array($value) .")",
+ " $delimiter ", $this->forceSqlQuotes);
}
else {
//if there's already an operator ($separator), don't specify one.
@@ -229,7 +274,7 @@
if(!is_numeric($value) && isset($separator)) {
$value = "'". $value ."'";
}
- $retval = $this->create_list($retval, $field . $separator . $value, " $delimiter ");
+ $retval = $this->create_list($retval, $field . $separator . $value, " $delimiter ", $this->forceSqlQuotes);
}
}
break;
@@ -288,7 +333,7 @@
if($cleanString) {
$value = $this->cleanString($value, $cleanString);
}
- $retval = $this->create_list($retval, $value, $separator);
+ $retval = $this->create_list($retval, $value, $separator, $this->forceSqlQuotes);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
@@ -347,6 +392,8 @@
*/
$cleanThis = addslashes(stripslashes($cleanThis));
$cleanThis = preg_replace('/\\\\"/', '"', $cleanThis);
+ $cleanThis = preg_replace("/'/", "\\\'", $cleanThis);
+
break;
@@ -519,12 +566,18 @@
* Returns a list delimited by the given delimiter. Does the work of checking if the given variable has data
* in it already, that needs to be added to, vs. setting the variable with the new content.
*/
- public function create_list($string=NULL, $addThis=NULL, $delimiter=", ") {
- if($string) {
+ public function create_list($string=NULL, $addThis=NULL, $delimiter=", ", $useSqlQuotes=0) {
+ if(strlen($string)) {
+ if($useSqlQuotes && !(preg_match("/^'/", $addThis) && preg_match("/'\$/", $addThis))) {
+ $addThis = "'". $addThis ."'";
+ }
$retVal = $string . $delimiter . $addThis;
}
else {
$retVal = $addThis;
+ if($useSqlQuotes && !(preg_match("/^'/", $retVal) && preg_match("/'\$/", $retVal))) {
+ $retVal = "'". $retVal ."'";
+ }
}
return($retVal);
Modified: releases/0.10/cs_phpDB.php
===================================================================
--- releases/0.10/cs_phpDB.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_phpDB.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -24,7 +24,7 @@
//
///////////////////////
-require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php");
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class cs_phpDB extends cs_versionAbstract {
@@ -33,6 +33,7 @@
//=========================================================================
public function __construct($type='pgsql') {
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
if(strlen($type)) {
Modified: releases/0.10/cs_sessionClass.php
===================================================================
--- releases/0.10/cs_sessionClass.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_sessionClass.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -8,7 +8,7 @@
* $LastChangedRevision$
*/
-require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php");
+require_once(dirname(__FILE__) ."/../cs-versionparse/cs_version.abstract.class.php");
class cs_session extends cs_versionAbstract {
@@ -26,6 +26,7 @@
* used as the session name.
*/
function __construct($createSession=1) {
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
if($createSession) {
if(!is_null($createSession) && strlen($createSession) && !is_numeric($createSession)) {
session_name($createSession);
Modified: releases/0.10/cs_tabsClass.php
===================================================================
--- releases/0.10/cs_tabsClass.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_tabsClass.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -25,6 +25,7 @@
* @param $templateVar (str,optional) What template var to find the tab blockrows in.
*/
public function __construct(cs_genericPage $csPageObj, $templateVar="tabs") {
+ $this->set_version_file_location(dirname(__FILE__) . '/VERSION');
if(is_null($csPageObj) || !is_object($csPageObj) || get_class($csPageObj) !== 'cs_genericPage') {
//can't continue without that!
throw new exception("cs_tabs::__construct(): cannot load without cs_genericPage{} object (". get_class($csPageObj) .")");
Deleted: releases/0.10/cs_versionAbstract.class.php
===================================================================
--- releases/0.10/cs_versionAbstract.class.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/cs_versionAbstract.class.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -1,86 +0,0 @@
-<?php
-/*
- * Created on Sept. 12, 2007
- *
- * SVN INFORMATION:::
- * -------------------
- * Last Author::::::::: $Author$
- * Current Revision:::: $Revision$
- * Repository Location: $HeadURL$
- * Last Updated:::::::: $Date$
- */
-
-abstract class cs_versionAbstract {
-
- public $isTest = FALSE;
-
- abstract public function __construct();
-
-
-
- //=========================================================================
- /**
- * Retrieve our version string from the VERSION file.
- */
- final public function get_version() {
- $retval = NULL;
- $versionFileLocation = dirname(__FILE__) .'/VERSION';
- if(file_exists($versionFileLocation)) {
- $myData = file($versionFileLocation);
-
- //set the logical line number that the version string is on, and
- // drop by one to get the corresponding array index.
- $lineOfVersion = 3;
- $arrayIndex = $lineOfVersion -1;
-
- $myVersionString = trim($myData[$arrayIndex]);
-
- if(preg_match('/^VERSION: /', $myVersionString)) {
- $retval = preg_replace('/^VERSION: /', '', $myVersionString);
- }
- else {
- throw new exception(__METHOD__ .": failed to retrieve version string");
- }
- }
- else {
- throw new exception(__METHOD__ .": failed to retrieve version information");
- }
-
- return($retval);
- }//end get_version()
- //=========================================================================
-
-
-
- //=========================================================================
- final public function get_project() {
- $retval = NULL;
- $versionFileLocation = dirname(__FILE__) .'/VERSION';
- if(file_exists($versionFileLocation)) {
- $myData = file($versionFileLocation);
-
- //set the logical line number that the version string is on, and
- // drop by one to get the corresponding array index.
- $lineOfProject = 4;
- $arrayIndex = $lineOfProject -1;
-
- $myProject = trim($myData[$arrayIndex]);
-
- if(preg_match('/^PROJECT: /', $myProject)) {
- $retval = preg_replace('/^PROJECT: /', '', $myProject);
- }
- else {
- throw new exception(__METHOD__ .": failed to retrieve project string");
- }
- }
- else {
- throw new exception(__METHOD__ .": failed to retrieve project information");
- }
-
- return($retval);
- }//end get_project()
- //=========================================================================
-
-
-}
-?>
\ No newline at end of file
Modified: releases/0.10/db_types/cs_phpDB__pgsql.class.php
===================================================================
--- releases/0.10/db_types/cs_phpDB__pgsql.class.php 2009-01-08 05:05:21 UTC (rev 310)
+++ releases/0.10/db_types/cs_phpDB__pgsql.class.php 2009-01-08 05:28:35 UTC (rev 311)
@@ -135,14 +135,14 @@
$required = array('host', 'port', 'dbname', 'user', 'password');
$requiredCount = 0;
- foreach($params as $index=>$value) {
- if(property_exists($this, $index) && in_array($index, $required)) {
- $this->$index = $value;
+ foreach($required as $index) {
+ if(isset($params[$index])) {
+ $this->$index = $params[$index];
$requiredCount++;
}
else {
- throw new exception(__METHOD__. ": property (". $index .") does " .
- "not exist or isn't allowed");
+ $this->gfObj->debug_print($params,1);
+ throw new exception(__METHOD__. ": property (". $index .") missing");
}
}
@@ -1155,6 +1155,30 @@
+ //=========================================================================
+ public function get_currval($sequence) {
+ if(is_string($sequence) && strlen($sequence) >= 5) {
+ $numrows = $this->exec("SELECT currval('". $sequence ."')");
+ $dberror = $this->errorMsg();
+
+ if($numrows == 1 && !strlen($dberror)) {
+ $data = $this->farray();
+ $retval = $data[0];
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid rows (". $numrows .") or database error (". $dberror .")");
+ }
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid sequence name (". $sequence .")");
+ }
+
+ return($retval);
+ }//end get_currval()
+ //=========================================================================
+
+
+
} // end class phpDB
?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cra...@us...> - 2009-01-08 05:05:26
|
Revision: 310
http://cs-content.svn.sourceforge.net/cs-content/?rev=310&view=rev
Author: crazedsanity
Date: 2009-01-08 05:05:21 +0000 (Thu, 08 Jan 2009)
Log Message:
-----------
*** RELEASE 0.10.14 ***
SUMMARY OF CHANGES:
* cs_fileSystemClass can now remove directories
* pgsql layer of cs_phpDB has new method, get_currval(), for retrieving the
current value of a given sequence (right after insertion).
* pgsql layer of cs_phpDB gives more informative details in connect errors.
* restore cleaning for "insert" style of
cs_globalFunctions::string_from_array().
* ability to force SQL quotes in cs_globalFunctions::string_from_array()
* drop local version parser to use cs-versionparse project.
* add a credits file to show who's doing the development.
Modified Paths:
--------------
trunk/0.10/VERSION
Modified: trunk/0.10/VERSION
===================================================================
--- trunk/0.10/VERSION 2009-01-04 19:25:24 UTC (rev 309)
+++ trunk/0.10/VERSION 2009-01-08 05:05:21 UTC (rev 310)
@@ -1,5 +1,5 @@
## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file.
-VERSION: 0.10.13
+VERSION: 0.10.14
PROJECT: cs-content
$HeadURL:https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/VERSION $
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|