[Cs-content-commits] SF.net SVN: cs-content:[424] releases/1.0
PHP Templating & Includes System
Brought to you by:
crazedsanity
|
From: <cra...@us...> - 2009-08-06 20:16:37
|
Revision: 424
http://cs-content.svn.sourceforge.net/cs-content/?rev=424&view=rev
Author: crazedsanity
Date: 2009-08-06 20:16:24 +0000 (Thu, 06 Aug 2009)
Log Message:
-----------
*** RELEASE 1.0-ALPHA10 ***
SUMMARY OF CHANGES:::
* compatibility changes between pgsql & mysql layers
* support in mysql layer for resetting connect
* better transaction support in MySQL (with notes on caveats)
* ability to change selected database on an open database connection in MySQL
* generic methods in cs_phpDB for doing queries, updates, and inserts.
* unit tests for database layers & cs_globalFunctions.
* ability to ping db connection
* cs_siteConfig has special var for its location & support for prefixes.
* cs_tabs can use different templates + more vars parsed.
* lots of fixes to remove/suppress PHP warnings
* database storage of session info by setting constants!
* conversion script to push content of session files into database.
SVN COMMAND:::
merge --depth=infinity -r393:HEAD
https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/1.0
Modified Paths:
--------------
releases/1.0/VERSION
releases/1.0/contentSystem.class.php
releases/1.0/cs_fileSystem.class.php
releases/1.0/cs_globalFunctions.class.php
releases/1.0/cs_phpDB.class.php
releases/1.0/cs_session.class.php
releases/1.0/cs_siteConfig.class.php
releases/1.0/cs_tabs.class.php
releases/1.0/db_types/cs_phpDB__mysql.class.php
releases/1.0/db_types/cs_phpDB__pgsql.class.php
releases/1.0/tests/testOfCSContent.php
Added Paths:
-----------
releases/1.0/cs_sessionDB.class.php
releases/1.0/sample_files/bin/
releases/1.0/sample_files/bin/convertSessionFilesToDB.php
releases/1.0/schema/
releases/1.0/schema/db_session_schema.mysql.sql
releases/1.0/schema/db_session_schema.pgsql.sql
releases/1.0/tests/dbSchema/
releases/1.0/tests/dbSchema/cs_content_test.mysql.sql
releases/1.0/tests/testOfCSGlobalFunctions.php
releases/1.0/tests/testOfCSPHPDB.php
Removed Paths:
-------------
releases/1.0/sample_files/bin/convertSessionFilesToDB.php
releases/1.0/schema/db_session_schema.mysql.sql
releases/1.0/schema/db_session_schema.pgsql.sql
releases/1.0/tests/dbSchema/cs_content_test.mysql.sql
Modified: releases/1.0/VERSION
===================================================================
--- releases/1.0/VERSION 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/VERSION 2009-08-06 20:16:24 UTC (rev 424)
@@ -1,5 +1,5 @@
## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file.
-VERSION: 1.0-ALPHA9
+VERSION: 1.0-ALPHA10
PROJECT: cs-content
$HeadURL$
\ No newline at end of file
Modified: releases/1.0/contentSystem.class.php
===================================================================
--- releases/1.0/contentSystem.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/contentSystem.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -134,6 +134,14 @@
* Creates internal objects & prepares for later usage.
*/
private function initialize_locals() {
+
+ //create a session that gets stored in a database if they so desire...
+ if(defined('SESSION_DBSAVE')) {
+ require_once(dirname(__FILE__) .'/cs_sessionDB.class.php');
+ $obj = new cs_sessionDB();
+ $this->handle_session($obj);
+ }
+
//build the templating engine: this may cause an immediate redirect, if they need to be logged-in.
//TODO: find a way to define this on a per-page basis. Possibly have templateObj->check_login()
// run during the "finish" stage... probably using GenericPage{}->check_login().
Modified: releases/1.0/cs_fileSystem.class.php
===================================================================
--- releases/1.0/cs_fileSystem.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/cs_fileSystem.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -195,17 +195,18 @@
*/
public function get_fileinfo($tFile) {
+ //TODO: shouldn't require putting the "@" in front of these calls!
$retval = array(
- "size" => filesize($tFile),
+ "size" => @filesize($tFile),
"type" => @filetype($tFile),
- "accessed" => fileatime($tFile),
- "modified" => filemtime($tFile),
- "owner" => $this->my_getuser_group(fileowner($tFile), 'uid'),
- "uid" => fileowner($tFile),
- "group" => $this->my_getuser_group(filegroup($tFile), 'gid'),
- "gid" => filegroup($tFile),
- "perms" => $this->translate_perms(fileperms($tFile)),
- "perms_num" => substr(sprintf('%o', fileperms($tFile)), -4)
+ "accessed" => @fileatime($tFile),
+ "modified" => @filemtime($tFile),
+ "owner" => @$this->my_getuser_group(fileowner($tFile), 'uid'),
+ "uid" => @fileowner($tFile),
+ "group" => @$this->my_getuser_group(filegroup($tFile), 'gid'),
+ "gid" => @filegroup($tFile),
+ "perms" => @$this->translate_perms(fileperms($tFile)),
+ "perms_num" => @substr(sprintf('%o', fileperms($tFile)), -4)
);
return($retval);
Modified: releases/1.0/cs_globalFunctions.class.php
===================================================================
--- releases/1.0/cs_globalFunctions.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/cs_globalFunctions.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -54,6 +54,9 @@
$newSetting = 0;
}
}
+ elseif(!is_bool($newSetting) && is_bool($this->oldForceSqlQuotes)) {
+ $newSetting = $this->oldForceSqlQuotes;
+ }
else {
throw new exception(__METHOD__ .": invalid new setting (". $newSetting .")");
}
@@ -159,7 +162,6 @@
}
//make sure $style is valid.
- $typesArr = array("insert", "update");
$style = strtolower($style);
if(is_array($array)) {
@@ -191,14 +193,14 @@
foreach($array as $key=>$value) {
@$tmp[0] = $this->create_list($tmp[0], $key);
//clean the string, if required.
- if($cleanString) {
+ if(is_null($value)) {
+ $value = "NULL";
+ }
+ elseif($cleanString) {
//make sure it's not full of poo...
$value = $this->cleanString($value, "sql");
#$value = "'". $value ."'";
}
- if((is_null($value)) OR ($value == "")) {
- $value = "NULL";
- }
@$tmp[1] = $this->create_list($tmp[1], $value, ",", 1);
}
@@ -219,10 +221,17 @@
if(($value === "NULL" || $value === NULL) && !$this->forceSqlQuotes) {
$sqlQuotes = 0;
}
- if($cleanString && !preg_match('/^\'/',$value)) {
+ if($cleanString && !(preg_match('/^\'/',$value) && preg_match('/\'$/', $value))) {
//make sure it doesn't have crap in it...
$value = $this->cleanString($value, "sql",$sqlQuotes);
}
+ if($value == "'") {
+ //Fix possible SQL-injection.
+ $value = "'\''";
+ }
+ elseif(!strlen($value)) {
+ $value = "''";
+ }
$retval = $this->create_list($retval, $field . $separator . $value);
}
break;
@@ -274,12 +283,12 @@
}
if($cleanString) {
//make sure it doesn't have crap in it...
- $value = $this->cleanString($value, "sql");
+ $value = $this->cleanString($value, "sql", $this->forceSqlQuotes);
}
- if(!is_numeric($value) && isset($separator)) {
+ if(isset($separator)) {
$value = "'". $value ."'";
}
- $retval = $this->create_list($retval, $field . $separator . $value, " $delimiter ", $this->forceSqlQuotes);
+ $retval = $this->create_list($retval, $field . $separator . $value, " $delimiter ");
}
}
break;
@@ -801,8 +810,12 @@
//now figure out the value to return.
if(is_numeric($interpretThis)) {
+ if(preg_match('/\.[0-9]{1,}/', $interpretThis)) {
+ //if it is a decimal number, remove the dot (i.e. "0.000001" -> "0000001" -> 1)
+ $interpretThis = str_replace('.', '', $interpretThis);
+ }
settype($interpretThis, 'integer');
- if($interpretThis == '0') {
+ if($interpretThis == 0) {
$index=0;
}
else {
Modified: releases/1.0/cs_phpDB.class.php
===================================================================
--- releases/1.0/cs_phpDB.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/cs_phpDB.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -31,6 +31,7 @@
private $dbLayerObj;
private $dbType;
+ public $connectParams = array();
//=========================================================================
public function __construct($type='pgsql') {
@@ -60,6 +61,10 @@
*/
public function __call($methodName, $args) {
if(method_exists($this->dbLayerObj, $methodName)) {
+ if($methodName == 'connect' && is_array($args[0])) {
+ //capture the connection parameters.
+ $this->connectParams = $args[0];
+ }
$retval = call_user_func_array(array($this->dbLayerObj, $methodName), $args);
}
else {
@@ -69,6 +74,124 @@
}//end __call()
//=========================================================================
+
+
+ //=========================================================================
+ public function get_dbtype() {
+ return($this->dbType);
+ }//end get_dbtype()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ /**
+ * Performs queries which require results. Passing $indexField returns a
+ * complex array indexed from that field; passing $valueField will change
+ * it to a name=>value formatted array.
+ *
+ * NOTE:: when using an index field, be sure it is guaranteed to be unique,
+ * i.e. it is a primary key! If duplicates are found, the database class
+ * will throw an exception!
+ */
+ public function run_query($sql, $indexField=null, $valueField=null) {
+
+ $retval = array();
+
+ //length must be 19 as that's about the shortest valid SQL: "select * from table"
+ if(strlen($sql) >= 19) {
+ $this->exec($sql);
+
+ $numRows = $this->numRows();
+ $dbError = $this->errorMsg();
+ if($numRows > 0 && !strlen($dbError)) {
+ if(strlen($indexField) && (is_null($valueField) || !strlen($valueField))) {
+ //return a complex array based on a given field.
+ $retval = $this->farray_fieldnames($indexField, null, 0);
+ }
+ elseif(strlen($indexField) && strlen($valueField)) {
+ //return an array as name=>value pairs.
+ $retval = $this->farray_nvp($indexField, $valueField);
+ }
+ else {
+ $retval = $this->farray_fieldnames();
+ }
+ }
+ elseif($numRows == 0 && !strlen($dbError)) {
+ $retval = false;
+ }
+ else {
+ throw new exception(__METHOD__ .": no rows (". $numRows .") or dbError::: ". $dbError ."<BR>\nSQL::: ". $sql);
+ }
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid length SQL (". $sql .")");
+ }
+
+ return($retval);
+ }//end run_query()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ /**
+ * Handles performing the insert statement & returning the last inserted ID.
+ */
+ public function run_insert($sql, $sequence='null') {
+
+ $this->exec($sql);
+
+ if($this->numAffected() == 1 && !strlen($this->errorMsg())) {
+ //retrieve the ID just created.
+ $retval = $this->lastID($sequence);
+ }
+ else {
+ //something broke...
+ throw new exception(__METHOD__ .": failed to insert, rows=(". $this->numRows .")... "
+ ."ERROR::: ". $this->errorMsg() ."\n -- SQL:::: ". $sql);
+ }
+
+ return($retval);
+ }//end run_insert()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ /**
+ * Performs the update & returns how many rows were affected.
+ */
+ public function run_update($sql, $zeroIsOk=false) {
+ $this->exec($sql);
+
+ $dberror = $this->errorMsg();
+ $numAffected = $this->numAffected();
+
+ if(strlen($dberror)) {
+ throw new exception(__METHOD__ .": error while running update::: ". $dberror ." -- SQL::: ". $sql);
+ }
+ elseif($numAffected==0 && $zeroIsOk == false) {
+ throw new exception(__METHOD__ .": no rows updated (". $numAffected ."), SQL::: ". $sql);
+ }
+
+ return($numAffected);
+ }//end run_update()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ public function reconnect() {
+ if(is_array($this->connectParams) && count($this->connectParams)) {
+ $this->dbLayerObj->connect($this->connectParams, true);
+ }
+ else {
+ throw new exception(__METHOD__ .": no connection parameters stored");
+ }
+ }//end reconnect()
+ //=========================================================================
+
} // end class phpDB
?>
Modified: releases/1.0/cs_session.class.php
===================================================================
--- releases/1.0/cs_session.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/cs_session.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -13,12 +13,11 @@
class cs_session extends cs_contentAbstract {
- protected $db;
- public $uid;
- public $sid;
- public $sid_check = 1;
+ protected $uid;
+ protected $sid;
+ protected $sid_check = 1;
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* The constructor.
*
@@ -26,10 +25,10 @@
* this parameter is non-null and non-numeric, the value will be
* used as the session name.
*/
- function __construct($createSession=1) {
- parent::__construct(false);
+ function __construct($createSession=true) {
+ parent::__construct(true);
if($createSession) {
- if(!is_null($createSession) && strlen($createSession) && !is_numeric($createSession)) {
+ if(is_string($createSession) && strlen($createSession) >2) {
session_name($createSession);
}
@@ -49,11 +48,11 @@
$this->sid = session_id();
}//end __construct()
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* Required method, so passing the object to contentSystem::handle_session()
* will work properly.
@@ -65,11 +64,11 @@
public function is_authenticated() {
return(FALSE);
}//end is_authenticated()
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* Retrieve data for an existing cookie.
*
@@ -85,11 +84,11 @@
}
return($retval);
}//end get_cookie()
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* Create a new cookie.
*
@@ -116,11 +115,11 @@
return($retval);
}//end create_cookie()
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* Destroy (expire) an existing cookie.
*
@@ -138,7 +137,20 @@
}
return($retval);
}//end drop_cookie()
- //---------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * PHP5 magic method for retrieving the value of internal vars; this allows
+ * code to find the value of these variables, but not modify them (modifying
+ * requires the "__set($var,$val)" method).
+ */
+ public function __get($var) {
+ return($this->$var);
+ }//end __get()
+ //-------------------------------------------------------------------------
}//end cs_session{}
Copied: releases/1.0/cs_sessionDB.class.php (from rev 423, trunk/1.0/cs_sessionDB.class.php)
===================================================================
--- releases/1.0/cs_sessionDB.class.php (rev 0)
+++ releases/1.0/cs_sessionDB.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -0,0 +1,294 @@
+<?php
+/*
+ * FILE INFORMATION:
+ * $HeadURL$
+ * $Id$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ * $LastChangedRevision$
+ */
+
+require_once(dirname(__FILE__) .'/cs_session.class.php');
+require_once(constant('LIBDIR') .'/cs-phpxml/cs_arrayToPath.class.php');
+
+class cs_sessionDB extends cs_session {
+
+ protected $db;
+
+ //-------------------------------------------------------------------------
+ /**
+ * The constructor.
+ *
+ * @param $createSession (mixed,optional) determines if a session will be started or not; if
+ * this parameter is non-null and non-numeric, the value will be
+ * used as the session name.
+ */
+ function __construct() {
+
+
+ //map some constants to connection parameters.
+ //NOTE::: all constants should be prefixed...
+ $constantPrefix = 'SESSION_DB_';
+ $params = array('host', 'port', 'dbname', 'user', 'password');
+ foreach($params as $name) {
+ $value = null;
+ $constantName = $constantPrefix . strtoupper($name);
+ if(defined($constantName)) {
+ $value = constant($constantName);
+ }
+ $dbParams[$name] = $value;
+ }
+ $this->db = new cs_phpDB(constant('DBTYPE'));
+ $this->db->connect($dbParams);
+
+ $this->tableName = 'cs_session_store_table';
+ $this->tablePKey = 'session_store_id';
+ $this->sequenceName = 'cs_session_store_table_session_store_id_seq';
+
+ if(!$this->sessdb_table_exists()) {
+ $this->load_table();
+ }
+
+ //now tell PHP to use this class's methods for saving the session.
+ session_set_save_handler(
+ array(&$this, 'sessdb_open'),
+ array(&$this, 'sessdb_close'),
+ array(&$this, 'sessdb_read'),
+ array(&$this, 'sessdb_write'),
+ array(&$this, 'sessdb_destroy'),
+ array(&$this, 'sessdb_gc')
+ );
+
+ parent::__construct(true);
+
+ //Stop things from going into an audit log... see
+ //http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711/page3.html
+ // NOTE::: not sure if this is valid or not...
+ $this->audit_logging = false;
+
+ }//end __construct()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * Determines if the appropriate table exists in the database.
+ */
+ public function sessdb_table_exists() {
+ try {
+ $test = $this->db->run_query("SELECT * FROM ". $this->tableName .
+ " ORDER BY ". $this->tablePKey ." LIMIT 1");
+ $exists = true;
+ }
+ catch(exception $e) {
+ $exists = false;
+ }
+
+ return($exists);
+ }//end sessdb_table_exists()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ private function load_table() {
+ $filename = dirname(__FILE__) .'/schema/db_session_schema.'. $this->db->get_dbtype() .'.sql';
+ if(file_exists($filename)) {
+ try {
+ $this->db->run_update(file_get_contents($filename),true);
+ }
+ catch(exception $e) {
+ throw new exception(__METHOD__ .": failed to load required table " .
+ "into your database automatically::: ". $e->getMessage());
+ }
+ }
+ else {
+ throw new exception(__METHOD__ .": while attempting to load required " .
+ "table into your database, discovered you have a missing schema " .
+ "file (". $filename .")");
+ }
+ $this->logger->append_to_file(__METHOD__ .": done". microtime(true));
+ }//end load_table()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ protected function is_valid_sid($sid) {
+ $isValid = false;
+ if(strlen($sid) == 32) {
+ try {
+ $sql = "SELECT * FROM ". $this->tableName ." WHERE session_id='".
+ $sid ."'";
+ $this->db->run_query($sql);
+ $numrows = $this->db->numRows();
+ if($numrows == 1) {
+ $isValid = true;
+ }
+ elseif($numrows > 0 || $numrows < 0) {
+ throw new exception(__METHOD__ .": invalid numrows returned (". $numrows .")");
+ }
+ }
+ catch(exception $e) {
+ //well... do nothing I guess.
+ }
+ }
+
+ return($isValid);
+ }//end is_valid_sid()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * Open the session (doesn't really do anything)
+ */
+ public function sessdb_open($savePath, $sessionName) {
+ return(true);
+ }//end sessdb_open()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * Close the session (call the "gc" method)
+ */
+ public function sessdb_close() {
+ return($this->sessdb_gc(0));
+ }//end sessdb_close()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * Read information about the session. If there is no data, it MUST return
+ * an empty string instead of NULL.
+ */
+ public function sessdb_read($sid) {
+ $retval = '';
+ try {
+ $sql = "SELECT * FROM ". $this->tableName ." WHERE session_id='".
+ $sid ."'";
+ $data = $this->db->run_query($sql);
+
+ if($this->db->numRows() == 1) {
+ $retval = $data['session_data'];
+ }
+ }
+ catch(exception $e) {
+ //no throwing exceptions...
+ }
+ return($retval);
+ }//end sessdb_read()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ public function sessdb_write($sid, $data) {
+ $data = array(
+ 'session_data' => $data,
+ 'user_id' => null
+ );
+ $cleanString = array(
+ 'session_data' => 'sql',
+ 'user_id' => 'numeric'
+ );
+
+
+
+ //pull the uid out of the session...
+ if(defined('SESSION_DBSAVE_UIDPATH')) {
+ $a2p = new cs_arrayToPath($_SESSION);
+ $uidVal = $a2p->get_data(constant('SESSION_DBSAVE_UIDPATH'));
+
+ if(is_string($uidVal) || is_numeric($uidVal)) {
+ $data['user_id'] = $uidVal;
+ }
+ }
+
+ $afterSql = "";
+ if($this->is_valid_sid($sid)) {
+ $type = 'update';
+ $sql = "UPDATE ". $this->tableName ." SET ";
+ $afterSql = "WHERE session_id='". $sid ."'";
+ $data['last_updated'] = 'NOW()';
+ $secondArg = false;
+ }
+ else {
+ $type = 'insert';
+ $sql = "INSERT INTO ". $this->tableName ." ";
+ $data['session_id'] = $sid;
+ $secondArg = $this->sequenceName;
+ }
+
+ $sql .= $this->gfObj->string_from_array($data, $type, null, $cleanString) .' '. $afterSql;
+ try {
+ $funcName = 'run_'. $type;
+ $res = $this->db->$funcName($sql, $secondArg);
+ }
+ catch(exception $e) {
+ //umm... yeah.
+ }
+
+ return(true);
+ }//end sessdb_write()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ public function sessdb_destroy($sid) {
+ try {
+ $sql = "DELETE FROM ". $this->tableName ." WHERE session_id='". $sid ."'";
+ $this->db->run_update($sql, true);
+ }
+ catch(exception $e) {
+ //do... nothing?
+ }
+ return(true);
+ }//end sessdb_destroy()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * Define maximum lifetime (in seconds) to store sessions in the database.
+ * Anything that is older than that time will be purged (gc='garbage collector').
+ */
+ public function sessdb_gc($maxLifetime=null) {
+
+ $nowTime = date('Y-m-d H:i:s');
+ if(is_null($maxLifetime) || !is_numeric($maxLifetime) || $maxLifetime < 0) {
+ //pull it from PHP's ini settings.
+ $maxLifetime = ini_get("session.gc_maxlifetime");
+ }
+ $interval = $maxLifetime .' seconds';
+
+ $dt1 = strtotime($nowTime .' - '. $interval);
+ $dt2 = date('Y-m-d H:i:s', $dt1);
+
+
+
+ try {
+ //destroy old sessions, but don't complain if nothing is deleted.
+ $sql = "DELETE FROM ". $this->tableName ." WHERE last_updated < ". $dt2;
+ #$this->db->run_update($sql, true);
+ }
+ catch(exception $e) {
+ //probably should do something here.
+ }
+
+ return(true);
+
+ }//end sessdb_gc()
+ //-------------------------------------------------------------------------
+
+
+}//end cs_session{}
+?>
\ No newline at end of file
Modified: releases/1.0/cs_siteConfig.class.php
===================================================================
--- releases/1.0/cs_siteConfig.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/cs_siteConfig.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -42,6 +42,9 @@
/** Directory for the config file. */
private $configDirname;
+ /** Location of the configuration file itself. */
+ private $configFile;
+
/** Active section of the full site configuration. */
private $activeSection;
@@ -84,6 +87,7 @@
if(strlen($configFileLocation) && file_exists($configFileLocation)) {
$this->configDirname = dirname($configFileLocation);
+ $this->configFile = $configFileLocation;
$this->fs = new cs_fileSystem($this->configDirname);
$this->xmlReader = new cs_phpxmlParser($this->fs->read($configFileLocation));
@@ -212,7 +216,7 @@
$itemValue = $this->gfObj->mini_parser($itemValue, $parseThis, '{', '}');
}
- if($attribs['CLEANPATH']) {
+ if(isset($attribs['CLEANPATH'])) {
$itemValue = $this->fs->resolve_path_with_dots($itemValue);
}
@@ -221,10 +225,20 @@
$data[$section][$itemName]['value'] = $itemValue;
$setVarIndex = $this->setVarPrefix . $itemName;
- if($attribs['SETGLOBAL']) {
+ if(isset($attribs['SETGLOBAL'])) {
$GLOBALS[$setVarIndex] = $itemValue;
}
- if($attribs['SETCONSTANT']) {
+ if(isset($attribs['SETCONSTANT'])) {
+ if(isset($attribs['SETCONSTANTPREFIX'])) {
+ //did they give a specific prefix, or just a number/true?
+ if(strlen($attribs['SETCONSTANTPREFIX']) == 1) {
+ $setVarIndex = $section ."-". $setVarIndex;
+ }
+ else {
+ //use the prefix they gave.
+ $setVarIndex = $attribs['SETCONSTANTPREFIX'] ."-". $setVarIndex;
+ }
+ }
define($setVarIndex, $itemValue);
}
}
@@ -277,7 +291,7 @@
$retval = $data;
}
else {
- throw new exception(__METHOD__ .": invalid section or no data (". $data['type'] .")");
+ throw new exception(__METHOD__ .": invalid section (". $section .") or no data (". $data['type'] .")");
}
}
else {
@@ -370,6 +384,8 @@
$specialVars = array(
'_DIRNAMEOFFILE_' => $this->configDirname,
+ '_CONFIGFILE_' => $this->configFile,
+ '_THISFILE_' => $this->configFile,
'_APPURL_' => $appUrl
);
return($specialVars);
Modified: releases/1.0/cs_tabs.class.php
===================================================================
--- releases/1.0/cs_tabs.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/cs_tabs.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -149,8 +149,9 @@
}
$parseThis = array(
- 'title' => $tabName,
- 'url' => $url
+ 'title' => $tabName,
+ 'url' => $url,
+ 'cleanTitle' => preg_replace('/[^a-zA-Z0-9]/', '_', $tabName)
);
$finalString .= $this->csPageObj->mini_parser($useTabContent, $parseThis, '%%', '%%');
}
Modified: releases/1.0/db_types/cs_phpDB__mysql.class.php
===================================================================
--- releases/1.0/db_types/cs_phpDB__mysql.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/db_types/cs_phpDB__mysql.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -129,7 +129,10 @@
$this->isConnected = FALSE;
$retval = null;
if($this->connectionID != -1) {
- $retval = mysqlclose($this->connectionID);
+ $retval = mysql_close($this->connectionID);
+ $this->transStatus = null;
+ $this->inTrans=null;
+ $this->transactionTree=null;
}
else {
throw new exception(__METHOD__ .": Failed to close connection: connection is invalid");
@@ -152,7 +155,7 @@
$this->set_db_info($dbParams);
}
- if($this->paramsAreSet === TRUE && $this->isConnected === FALSE) {
+ if($this->paramsAreSet === TRUE) {
//start output buffer for displaying error.
ob_start();
@@ -280,7 +283,15 @@
+ //=========================================================================
+ public function ping() {
+ return(mysql_ping($this->connectionID));
+ }//end ping()
+ //=========================================================================
+
+
+
////////////////////
// Cursor movement
////////////////////
@@ -632,11 +643,10 @@
* Returns the number of rows in a result (from a SELECT query).
*/
function numRows() {
- if ($this->result == null) {
+ if ($this->result == null || !is_resource($this->result)) {
$retval = 0;
}
else {
- //TODO: implement MySQL version..
$this->numrows = mysql_num_rows($this->result);
$retval = $this->numrows;
}
@@ -667,7 +677,6 @@
$retval = 0;
}
else {
- //TODO: implement MySQL version..
$retval = mysql_num_fields($this->result);
}
return($retval);
@@ -689,9 +698,9 @@
* get last ID of last INSERT statement
*/
function lastID() {
- $retval = mysql_insert_id();
+ $retval = mysql_insert_id($this->connectionID);
return($retval);
- }//end lastOID()
+ }//end lastID()
//=========================================================================
@@ -769,6 +778,44 @@
+ //=========================================================================
+ public function select_db($dbName) {
+ if(mysql_select_db($dbName, $this->connectionID)) {
+ $this->dbname = $dbName;
+ }
+ else {
+ throw new exception(__METHOD__ .": failed to select db (". $dbName .")");
+ }
+ }//end select_db()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ public function beginTrans() {
+ $this->exec('BEGIN;SET autocommit=0;');
+ return(true);
+ }//end beginTrans()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ public function commitTrans() {
+ $this->exec('COMMIT');
+ return(true);
+ }//end commitTrans()
+ //=========================================================================
+
+
+
+ //=========================================================================
+ public function rollbackTrans() {
+ $this->exec('ROLLBACK');
+ return(true);
+ }//end rollbackTrans()
+ //=========================================================================
+
} // end class phpDB
?>
Modified: releases/1.0/db_types/cs_phpDB__pgsql.class.php
===================================================================
--- releases/1.0/db_types/cs_phpDB__pgsql.class.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/db_types/cs_phpDB__pgsql.class.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -305,7 +305,15 @@
+ //=========================================================================
+ public function ping() {
+ return(pg_ping($this->connectionID));
+ }//end ping()
+ //=========================================================================
+
+
+
////////////////////
// Cursor movement
////////////////////
@@ -1115,6 +1123,22 @@
+ //=========================================================================
+ public function lastID($sequence) {
+
+ if(strlen($sequence)) {
+ $retval = $this->get_currval($sequence);
+ }
+ else {
+ throw new exception(__METHOD__ .": no sequence specified (required by ". $this->dbType .")");
+ }
+
+ return($retval);
+ }//end lastID()
+ //=========================================================================
+
+
+
} // end class phpDB
?>
Deleted: releases/1.0/sample_files/bin/convertSessionFilesToDB.php
===================================================================
--- trunk/1.0/sample_files/bin/convertSessionFilesToDB.php 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/sample_files/bin/convertSessionFilesToDB.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -1,156 +0,0 @@
-<?php
-/*
- * Created on Aug 6, 2009
- *
- * SVN INFORMATION:::
- * -------------------
- * Last Author::::::::: $Author$
- * Current Revision:::: $Revision$
- * Repository Location: $HeadURL$
- * Last Updated:::::::: $Date$
- */
-
-require_once(dirname(__FILE__) .'/../../cs_fileSystem.class.php');
-require_once(dirname(__FILE__) .'/../../cs_siteConfig.class.php');
-require_once(dirname(__FILE__) .'/../../cs_phpDB.class.php');
-
-$site = new cs_siteConfig(dirname(__FILE__) .'/../../../../rw/siteConfig.xml', 'website');
-require_once(dirname(__FILE__) .'/../../cs_sessionDB.class.php');
-#error_reporting(E_ALL);
-require_once(constant('LIBDIR') .'/cs_debug.php');
-
-class convertFiles extends cs_sessionDB {
-
- //-------------------------------------------------------------------------
- public function __construct() {
- $this->fs = new cs_fileSystem(constant('RWDIR') .'/tmp');
- parent::__construct();
- $this->gfObj->debugPrintOpt = 1;
- }//end __construct()
- //-------------------------------------------------------------------------
-
-
-
- //-------------------------------------------------------------------------
- public function do_conversion() {
- $files = $this->fs->ls();
-
- $this->db->beginTrans();
-
- $created = 0;
- $skipped = 0;
- $total = count($files);
- $handled = 0;
-
- foreach($files as $filename=>$data) {
- //get the file's contents...
- $fData = $this->fs->read($filename);
-
- $sid = preg_replace('/^sess_/', '', $filename);
-
- print "Handling ". $filename ."... ";
-
- $data['accessed'] = strftime('%Y-%m-%d %H:%M:%S', $data['accessed']);
- $data['modified'] = strftime('%Y-%m-%d %H:%M:%S', $data['modified']);
-
- $bits = explode('|', $fData);
- $uid = null;
- if(is_array($bits)) {
- foreach($bits as $n=>$v) {
- $check = unserialize($v);
- if(is_array($check) && isset($check['userInfo'])) {
- #$this->gfObj->debug_print($check);
- $uid = $check['userInfo']['uid'];
- #$this->gfObj->debug_print(__METHOD__ .": uid=(". $uid .")");
- break;
- }
- }
- }
- $insertData = array(
- 'session_id' => $sid,
- 'user_id' => $uid,
- 'date_created' => $data['modified'],
- 'last_updated' => $data['accessed'],
- 'session_data' => $fData,
- );
- if(!$this->check_sid_exists($sid)) {
- $this->do_insert($insertData);
- $created++;
- }
- else {
- $skipped++;
- }
- $handled++;
-
- print " DONE (". $handled ." / ". $total .") SKIPPED=(". $skipped .") \r";
-
- $this->db->commitTrans();
- }
- }//end do_conversion()
- //-------------------------------------------------------------------------
-
-
-
- //-------------------------------------------------------------------------
- private function check_sid_exists($sid) {
- $exists = false;
- if(strlen($sid) == 32) {
- $sql = "SELECT session_id FROM ". $this->tableName ." WHERE " .
- "session_id='". $sid ."'";
- try {
- $data = $this->db->run_query($sql);
- $numrows = $this->db->numRows();
- if($numrows == 1) {
- $exists = true;
- }
- elseif($numrows == 0) {
- $exists = false;
- }
- else {
- throw new exception(__METHOD__ .": invalid value of numrows (". $numrows .")");
- }
- }
- catch(exception $e) {
-
- }
- }
- else {
- throw new exception(__METHOD__ .": invalid session id (". $sid .")");
- }
-
- return($exists);
- }//end check_sid_exists()
- //-------------------------------------------------------------------------
-
-
-
- //-------------------------------------------------------------------------
- private function do_insert(array $data) {
- $cleanString = array(
- 'session_id' => 'sql',
- 'user_id' => 'numeric',
- 'date_created' => 'sql',
- 'last_updated' => 'sql',
- 'session_data' => 'sql'
- );
- if(!is_numeric($data['user_id'])) {
- unset($data['user_id']);
- }
- $sql = "INSERT INTO ". $this->tableName ." ".
- $this->gfObj->string_from_array($data, 'insert', null, $cleanString);
-
- #$this->gfObj->debug_print($sql);
- #$this->gfObj->debug_print($data);
- $id = $this->db->run_insert($sql, $this->sequenceName);
-
- return($id);
- }//end do_insert()
- //-------------------------------------------------------------------------
-
-}
-
-
-$obj = new convertFiles;
-$obj->do_conversion();
-
-?>
Copied: releases/1.0/sample_files/bin/convertSessionFilesToDB.php (from rev 423, trunk/1.0/sample_files/bin/convertSessionFilesToDB.php)
===================================================================
--- releases/1.0/sample_files/bin/convertSessionFilesToDB.php (rev 0)
+++ releases/1.0/sample_files/bin/convertSessionFilesToDB.php 2009-08-06 20:16:24 UTC (rev 424)
@@ -0,0 +1,156 @@
+<?php
+/*
+ * Created on Aug 6, 2009
+ *
+ * SVN INFORMATION:::
+ * -------------------
+ * Last Author::::::::: $Author$
+ * Current Revision:::: $Revision$
+ * Repository Location: $HeadURL$
+ * Last Updated:::::::: $Date$
+ */
+
+require_once(dirname(__FILE__) .'/../../cs_fileSystem.class.php');
+require_once(dirname(__FILE__) .'/../../cs_siteConfig.class.php');
+require_once(dirname(__FILE__) .'/../../cs_phpDB.class.php');
+
+$site = new cs_siteConfig(dirname(__FILE__) .'/../../../../rw/siteConfig.xml', 'website');
+require_once(dirname(__FILE__) .'/../../cs_sessionDB.class.php');
+#error_reporting(E_ALL);
+require_once(constant('LIBDIR') .'/cs_debug.php');
+
+class convertFiles extends cs_sessionDB {
+
+ //-------------------------------------------------------------------------
+ public function __construct() {
+ $this->fs = new cs_fileSystem(constant('RWDIR') .'/tmp');
+ parent::__construct();
+ $this->gfObj->debugPrintOpt = 1;
+ }//end __construct()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ public function do_conversion() {
+ $files = $this->fs->ls();
+
+ $this->db->beginTrans();
+
+ $created = 0;
+ $skipped = 0;
+ $total = count($files);
+ $handled = 0;
+
+ foreach($files as $filename=>$data) {
+ //get the file's contents...
+ $fData = $this->fs->read($filename);
+
+ $sid = preg_replace('/^sess_/', '', $filename);
+
+ print "Handling ". $filename ."... ";
+
+ $data['accessed'] = strftime('%Y-%m-%d %H:%M:%S', $data['accessed']);
+ $data['modified'] = strftime('%Y-%m-%d %H:%M:%S', $data['modified']);
+
+ $bits = explode('|', $fData);
+ $uid = null;
+ if(is_array($bits)) {
+ foreach($bits as $n=>$v) {
+ $check = unserialize($v);
+ if(is_array($check) && isset($check['userInfo'])) {
+ #$this->gfObj->debug_print($check);
+ $uid = $check['userInfo']['uid'];
+ #$this->gfObj->debug_print(__METHOD__ .": uid=(". $uid .")");
+ break;
+ }
+ }
+ }
+ $insertData = array(
+ 'session_id' => $sid,
+ 'user_id' => $uid,
+ 'date_created' => $data['modified'],
+ 'last_updated' => $data['accessed'],
+ 'session_data' => $fData,
+ );
+ if(!$this->check_sid_exists($sid)) {
+ $this->do_insert($insertData);
+ $created++;
+ }
+ else {
+ $skipped++;
+ }
+ $handled++;
+
+ print " DONE (". $handled ." / ". $total .") SKIPPED=(". $skipped .") \r";
+
+ $this->db->commitTrans();
+ }
+ }//end do_conversion()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ private function check_sid_exists($sid) {
+ $exists = false;
+ if(strlen($sid) == 32) {
+ $sql = "SELECT session_id FROM ". $this->tableName ." WHERE " .
+ "session_id='". $sid ."'";
+ try {
+ $data = $this->db->run_query($sql);
+ $numrows = $this->db->numRows();
+ if($numrows == 1) {
+ $exists = true;
+ }
+ elseif($numrows == 0) {
+ $exists = false;
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid value of numrows (". $numrows .")");
+ }
+ }
+ catch(exception $e) {
+
+ }
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid session id (". $sid .")");
+ }
+
+ return($exists);
+ }//end check_sid_exists()
+ //-------------------------------------------------------------------------
+
+
+
+ //-------------------------------------------------------------------------
+ private function do_insert(array $data) {
+ $cleanString = array(
+ 'session_id' => 'sql',
+ 'user_id' => 'numeric',
+ 'date_created' => 'sql',
+ 'last_updated' => 'sql',
+ 'session_data' => 'sql'
+ );
+ if(!is_numeric($data['user_id'])) {
+ unset($data['user_id']);
+ }
+ $sql = "INSERT INTO ". $this->tableName ." ".
+ $this->gfObj->string_from_array($data, 'insert', null, $cleanString);
+
+ #$this->gfObj->debug_print($sql);
+ #$this->gfObj->debug_print($data);
+ $id = $this->db->run_insert($sql, $this->sequenceName);
+
+ return($id);
+ }//end do_insert()
+ //-------------------------------------------------------------------------
+
+}
+
+
+$obj = new convertFiles;
+$obj->do_conversion();
+
+?>
Deleted: releases/1.0/schema/db_session_schema.mysql.sql
===================================================================
--- trunk/1.0/schema/db_session_schema.mysql.sql 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/schema/db_session_schema.mysql.sql 2009-08-06 20:16:24 UTC (rev 424)
@@ -1,17 +0,0 @@
-
-
---
--- Store session data in here.
--- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711
---
-
-CREATE TABLE `test`.`sess_tmp` (
- `session_store_id` int NOT NULL AUTO_INCREMENT,
- `session_id` varchar(32) NOT NULL,
- `user_id` varchar(16) NOT NULL,
- `date_created` datetime NOT NULL,
- `last_updated` datetime NOT NULL,
- `session_data` LONGTEXT NOT NULL,
- PRIMARY KEY (`session_store_id`)
-)
-ENGINE = MyISAM;
\ No newline at end of file
Copied: releases/1.0/schema/db_session_schema.mysql.sql (from rev 423, trunk/1.0/schema/db_session_schema.mysql.sql)
===================================================================
--- releases/1.0/schema/db_session_schema.mysql.sql (rev 0)
+++ releases/1.0/schema/db_session_schema.mysql.sql 2009-08-06 20:16:24 UTC (rev 424)
@@ -0,0 +1,17 @@
+
+
+--
+-- Store session data in here.
+-- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711
+--
+
+CREATE TABLE `test`.`sess_tmp` (
+ `session_store_id` int NOT NULL AUTO_INCREMENT,
+ `session_id` varchar(32) NOT NULL,
+ `user_id` varchar(16) NOT NULL,
+ `date_created` datetime NOT NULL,
+ `last_updated` datetime NOT NULL,
+ `session_data` LONGTEXT NOT NULL,
+ PRIMARY KEY (`session_store_id`)
+)
+ENGINE = MyISAM;
\ No newline at end of file
Deleted: releases/1.0/schema/db_session_schema.pgsql.sql
===================================================================
--- trunk/1.0/schema/db_session_schema.pgsql.sql 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/schema/db_session_schema.pgsql.sql 2009-08-06 20:16:24 UTC (rev 424)
@@ -1,16 +0,0 @@
-
-
---
--- Store session data in here.
--- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711
---
-
-CREATE TABLE cs_session_store_table (
- session_store_id serial NOT NULL PRIMARY KEY,
- session_id varchar(32) NOT NULL DEFAULT '' UNIQUE,
- user_id varchar(16),
- date_created timestamp NOT NULL DEFAULT NOW(),
- last_updated timestamp NOT NULL DEFAULT NOW(),
- session_data text
-);
-
Copied: releases/1.0/schema/db_session_schema.pgsql.sql (from rev 423, trunk/1.0/schema/db_session_schema.pgsql.sql)
===================================================================
--- releases/1.0/schema/db_session_schema.pgsql.sql (rev 0)
+++ releases/1.0/schema/db_session_schema.pgsql.sql 2009-08-06 20:16:24 UTC (rev 424)
@@ -0,0 +1,16 @@
+
+
+--
+-- Store session data in here.
+-- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711
+--
+
+CREATE TABLE cs_session_store_table (
+ session_store_id serial NOT NULL PRIMARY KEY,
+ session_id varchar(32) NOT NULL DEFAULT '' UNIQUE,
+ user_id varchar(16),
+ date_created timestamp NOT NULL DEFAULT NOW(),
+ last_updated timestamp NOT NULL DEFAULT NOW(),
+ session_data text
+);
+
Deleted: releases/1.0/tests/dbSchema/cs_content_test.mysql.sql
===================================================================
--- trunk/1.0/tests/dbSchema/cs_content_test.mysql.sql 2009-08-06 20:10:49 UTC (rev 423)
+++ releases/1.0/tests/dbSchema/cs_content_test.mysql.sql 2009-08-06 20:16:24 UTC (rev 424)
@@ -1,2328 +0,0 @@
--- MySQL Administrator dump 1.4
---
--- ------------------------------------------------------
--- Server version 5.0.75-0ubuntu10.2
-
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-
-
---
--- Create schema mysql
---
-
-CREATE DATABASE IF NOT EXISTS mysql;
-USE mysql;
-
---
--- Definition of table `mysql`.`columns_priv`
---
-
-DROP TABLE IF EXISTS `mysql`.`columns_priv`;
-CREATE TABLE `mysql`.`columns_priv` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Table_name` char(64) collate utf8_bin NOT NULL default '',
- `Column_name` char(64) collate utf8_bin NOT NULL default '',
- `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
- PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges';
-
---
--- Dumping data for table `mysql`.`columns_priv`
---
-
-/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
-LOCK TABLES `columns_priv` WRITE;
-UNLOCK TABLES;
-/*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */;
-
-
---
--- Definition of table `mysql`.`db`
---
-
-DROP TABLE IF EXISTS `mysql`.`db`;
-CREATE TABLE `mysql`.`db` (
- `Host` char(60) collate utf8_bin NOT NULL default '',
- `Db` char(64) collate utf8_bin NOT NULL default '',
- `User` char(16) collate utf8_bin NOT NULL default '',
- `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- `Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
- PRIMARY KEY (`Host`,`Db`,`User`),
- KEY `User` (`User`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges';
-
---
--- Dumping data for table `mysql`.`db`
---
-
-/*!40000 ALTER TABLE `db` DISABLE KEYS */;
-LOCK TABLES `db` WRITE;
-INSERT INTO `mysql`.`db` VALUES (0x25,0x74657374,'','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'),
- (0x25,0x746573745C5F25,'','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'),
- (0x25,0x7265736F7572636572657175657374,0x63686174746572,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'),
- (0x25,0x6D7973716C,0x63686174746572,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'),
- (0x25,0x696E666F726D6174696F6E5F736368656D61,0x63686174746572,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'),
- (0x25,0x63686174,0x63686174746572,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'),
- (0x31302E25,0x7265736F7572636572657175657374,0x726F6F74,'Y','Y','Y','Y','N','N','N','N','N','N','N','Y','N','N','N','N','N'),
- (0x3132372E302E302E31,0x7265736F7572636572657175657374,0x726F6F74,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'),
- (0x6C6F63616C686F7374,0x7265736F7572636572657175657374,0x726F6F74,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'),
- (0x736B6974746C6573,0x7265736F7572636572657175657374,0x726F6F74,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
-INSERT INTO `mysql`.`db` VALUES (0x25,0x7265736F7572636572657175657374,0x7265736F7572636572657175657374,'Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','N','N','N','N','N'),
- (0x3132372E25,0x7265736F7572636572657175657374,0x7265736F7572636572657175657374,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
-UNLOCK TABLES;
-/*!40000 ALTER TABLE `db` ENABLE KEYS */;
-
-
---
--- Definition of table `mysql`.`func`
---
-
-DROP TABLE IF EXISTS `mysql`.`func`;
-CREATE TABLE `mysql`.`func` (
- `name` char(64) collate utf8_bin NOT NULL default '',
- `ret` tinyint(1) NOT NULL default '0',
- `dl` char(128) collate utf8_bin NOT NULL default '',
- `type` enum('function','aggregate') character set utf8 NOT NULL,
- PRIMARY KEY (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions';
-
---
--- Dumping data for table `mysql`.`func`
---
-
-/*!40000 ALTER TABLE `func` DISABLE KEYS */;
-LOCK TABLES `func` WRITE;
-UNLOCK TABLES;
-/*!40000 ALTER TABLE `func` ENABLE KEYS */;
-
-
---
--- Definition of table `mysql`.`help_category`
---
-
-DROP TABLE IF EXISTS `mysql`.`help_category`;
-CREATE TABLE `mysql`.`help_category` (
- `help_category_id` smallint(5) unsigned NOT NULL,
- `name` char(64) NOT NULL,
- `parent_category_id` smallint(5) unsigned default NULL,
- `url` char(128) NOT NULL,
- PRIMARY KEY (`help_category_id`),
- UNIQUE KEY `name` (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help categories';
-
---
--- Dumping data for table `mysql`.`help_category`
---
-
-/*!40000 ALTER TABLE `help_category` DISABLE KEYS */;
-LOCK TABLES `help_category` WRITE;
-INSERT INTO `mysql`.`help_category` VALUES (1,'Geographic',0,''),
- (2,'Polygon properties',31,''),
- (3,'WKT',31,''),
- (4,'Numeric Functions',35,''),
- (5,'MBR',31,''),
- (6,'Control flow functions',35,''),
- (7,'Transactions',32,''),
- (8,'Account Management',32,''),
- (9,'Point properties',31,''),
- (10,'Encryption Functions',35,''),
- (11,'LineString properties',31,''),
- (12,'Logical operators',35,''),
- (13,'Miscellaneous Functions',35,''),
- (14,'Information Functions',35,''),
- (15,'Functions and Modifiers for Use with GROUP BY',32,''),
- (16,'Comparison operators',35,''),
- (17,'Bit Functions',35,''),
- (18,'Table Maintenance',32,''),
- (19,'Data Types',32,''),
- (20,'User-Defined Functions',32,''),
- (21,'Compound Statements',32,''),
- (22,'Geometry constructors',31,''),
- (23,'GeometryCollection properties',1,''),
- (24,'Administration',32,''),
- (25,'Data Manipulation',32,''),
- (26,'Utility',32,''),
- (27,'Language Structure',32,''),
- (28,'Geometry relations',31,''),
- (29,'Date and Time Functions',35,''),
- (30,'WKB',31,'');
-INSERT INTO `mysql`.`help_category` VALUES (31,'Geographic Features',32,''),
- (32,'Contents',0,''),
- (33,'Geometry properties',31,''),
- (34,'String Functions',35,''),
- (35,'Functions',32,''),
- (36,'Data Definition',32,'');
-UNLOCK TABLES;
-/*!40000 ALTER TABLE `help_category` ENABLE KEYS */;
-
-
---
--- Definition of table `mysql`.`help_keyword`
---
-
-DROP TABLE IF EXISTS `mysql`.`help_keyword`;
-CREATE TABLE `mysql`.`help_keyword` (
- `help_keyword_id` int(10) unsigned NOT NULL,
- `name` char(64) NOT NULL,
- PRIMARY KEY (`help_keyword_id`),
- UNIQUE KEY `name` (`name`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help keywords';
-
---
--- Dumping data for table `mysql`.`help_keyword`
---
-
-/*!40000 ALTER TABLE `help_keyword` DISABLE KEYS */;
-LOCK TABLES `help_keyword` WRITE;
-INSERT INTO `mysql`.`help_keyword` VALUES (0,'JOIN'),
- (1,'REPEAT'),
- (2,'SERIALIZABLE'),
- (3,'REPLACE'),
- (4,'RETURNS'),
- (5,'MASTER_SSL_CA'),
- (6,'NCHAR'),
- (7,'COLUMNS'),
- (8,'WORK'),
- (9,'DATETIME'),
- (10,'MODE'),
- (11,'OPEN'),
- (12,'INTEGER'),
- (13,'ESCAPE'),
- (14,'VALUE'),
- (15,'SQL_BIG_RESULT'),
- (16,'DROP'),
- (17,'GEOMETRYCOLLECTIONFROMWKB'),
- (18,'EVENTS'),
- (19,'MONTH'),
- (20,'INFO'),
- (21,'PROFILES'),
- (22,'DUPLICATE'),
- (23,'REPLICATION'),
- (24,'UNLOCK'),
- (25,'INNODB'),
- (26,'YEAR_MONTH'),
- (27,'SUBJECT'),
- (28,'PREPARE'),
- (29,'LOCK'),
- (30,'NDB'),
- (31,'CHECK'),
- (32,'FULL'),
- (33,'INT4'),
- (34,'BY'),
- (35,'NO'),
- (36,'MINUTE'),
- (37,'DATA'),
- (38,'DAY'),
- (39,'SHARE'),
- (40,'REAL'),
- (41,'SEPARATOR'),
- (42,'DELETE'),
- (43,'ON'),
- (44,'CONNECTION'),
- (45,'CLOSE'),
- (46,'X509'),
- (47,'USE'),
- (48,'WHERE'),
- (49,'PRIVILEGES'),
- (50,'SPATIAL'),
- (51,'SUPER'),
- (52,'SQL_BUFFER_RESULT'),
- (53,'IGNORE'),
- (54,'QUICK'),
- (55,'SIGNED'),
- (56,'SECURITY'),
- (57,'NDBCLUSTER'),
- (58,'POLYGONFROMWKB'),
- (59,'FALSE');
-INSERT INTO `mysql`.`help_keyword` VALUES (60,'LEVEL'),
- (61,'FORCE'),
- (62,'BINARY'),
- (63,'TO'),
- (64,'CHANGE'),
- (65,'HOUR_MINUTE'),
- (66,'UPDATE'),
- (67,'INTO'),
- (68,'FEDERATED'),
- (69,'VARYING'),
- (70,'HOUR_SECOND'),
- (71,'VARIABLE'),
- (72,'ROLLBACK'),
- (73,'RTREE'),
- (74,'PROCEDURE'),
- (75,'TIMESTAMP'),
- (76,'IMPORT'),
- (77,'AGAINST'),
- (78,'CHECKSUM'),
- (79,'COUNT'),
- (80,'LONGBINARY'),
- (81,'THEN'),
- (82,'INSERT'),
- (83,'ENGINES'),
- (84,'HANDLER'),
- (85,'DAY_SECOND'),
- (86,'EXISTS'),
- (87,'MUTEX'),
- (88,'RELEASE'),
- (89,'BOOLEAN'),
- (90,'MOD'),
- (91,'DEFAULT'),
- (92,'TYPE'),
- (93,'NO_WRITE_TO_BINLOG'),
- (94,'OPTIMIZE'),
- (95,'RESET'),
- (96,'ITERATE'),
- (97,'DO'),
- (98,'BIGINT'),
- (99,'SET'),
- (100,'ISSUER'),
- (101,'DATE'),
- (102,'STATUS'),
- (103,'FULLTEXT'),
- (104,'COMMENT'),
- (105,'MASTER_CONNECT_RETRY'),
- (106,'INNER'),
- (107,'STOP'),
- (108,'MASTER_LOG_FILE'),
- (109,'MRG_MYISAM'),
- (110,'PRECISION'),
- (111,'REQUIRE'),
- (112,'TRAILING'),
- (113,'LONG'),
- (114,'OPTION'),
- (115,'ELSE'),
- (116,'DEALLOCATE');
-INSERT INTO `mysql`.`help_keyword` VALUES (117,'IO_THREAD'),
- (118,'CASE'),
- (119,'CIPHER'),
- (120,'CONTINUE'),
- (121,'FROM'),
- (122,'READ'),
- (123,'LEFT'),
- (124,'ELSEIF'),
- (125,'MINUTE_SECOND'),
- (126,'COMPACT'),
- (127,'RESTORE'),
- (128,'DEC'),
- (129,'FOR'),
- (130,'WARNINGS'),
- (131,'MIN_ROWS'),
- (132,'CONDITION'),
- (133,'STRING'),
- (134,'ENCLOSED'),
- (135,'FUNCTION'),
- (136,'AGGREGATE'),
- (137,'FIELDS'),
- (138,'INT3'),
- (139,'ARCHIVE'),
- (140,'AVG_ROW_LENGTH'),
- (141,'ADD'),
- (142,'KILL'),
- (143,'FLOAT4'),
- (144,'VIEW'),
- (145,'REPEATABLE'),
- (146,'INFILE'),
- (147,'ORDER'),
- (148,'USING'),
- (149,'MIDDLEINT'),
- (150,'GRANT'),
- (151,'UNSIGNED'),
- (152,'DECIMAL'),
- (153,'GEOMETRYFROMTEXT'),
- (154,'INDEXES'),
- (155,'FOREIGN'),
- (156,'CACHE'),
- (157,'HOSTS'),
- (158,'COMMIT'),
- (159,'SCHEMAS'),
- (160,'LEADING'),
- (161,'SNAPSHOT'),
- (162,'DECLARE'),
- (163,'LOAD'),
- (164,'SQL_CACHE'),
- (165,'CONVERT'),
- (166,'DYNAMIC'),
- (167,'COLLATE'),
- (168,'POLYGONFROMTEXT'),
- (169,'BYTE'),
- (170,'GLOBAL'),
- (171,'LINESTRINGFROMWKB');
-INSERT INTO `mysql`.`help_keyword` VALUES (172,'BERKELEYDB'),
- (173,'WHEN'),
- (174,'HAVING'),
- (175,'AS'),
- (176,'STARTING'),
- (177,'RELOAD'),
- (178,'AUTOCOMMIT'),
- (179,'REVOKE'),
- (180,'GRANTS'),
- (181,'OUTER'),
- (182,'FLOOR'),
- (183,'EXPLAIN'),
- (184,'WITH'),
- (185,'AFTER'),
- (186,'STD'),
- (187,'CSV'),
- (188,'DISABLE'),
- (189,'OUTFILE'),
- (190,'LOW_PRIORITY'),
- (191,'FILE'),
- (192,'BDB'),
- (193,'SCHEMA'),
- (194,'SONAME'),
- (195,'POW'),
- (196,'MULTIPOINTFROMWKB'),
- (197,'INDEX'),
- (198,'DUAL'),
- (199,'BACKUP'),
- (200,'MULTIPOINTFROMTEXT'),
- (201,'EXTENDED'),
- (202,'MULTILINESTRINGFROMWKB'),
- (203,'CROSS'),
- (204,'NATIONAL'),
- (205,'GROUP'),
- (206,'SHA'),
- (207,'UNDO'),
- (208,'ZEROFILL'),
- (209,'CLIENT'),
- (210,'MASTER_PASSWORD'),
- (211,'RELAY_LOG_FILE'),
- (212,'TRUE'),
- (213,'CHARACTER'),
- (214,'MASTER_USER'),
- (215,'TABLE'),
- (216,'ENGINE'),
- (217,'INSERT_METHOD'),
- (218,'CASCADE'),
- (219,'RELAY_LOG_POS'),
- (220,'SQL_CALC_FOUND_ROWS'),
- (221,'UNION'),
- (222,'MYISAM'),
- (223,'LEAVE'),
- (224,'MODIFY');
-INSERT INTO `mysql`.`help_keyword` VALUES (225,'MATCH'),
- (226,'MASTER_LOG_POS'),
- (227,'DESC'),
- (228,'DISTINCTROW'),
- (229,'TIME'),
- (230,'NUMERIC'),
- (231,'EXPANSION'),
- (232,'CURSOR'),
- (233,'CODE'),
- (234,'GEOMETRYCOLLECTIONFROMTEXT'),
- (235,'CHAIN'),
- (236,'FLUSH'),
- (237,'CREATE'),
- (238,'DESCRIBE'),
- (239,'MAX_UPDATES_PER_HOUR'),
- (240,'INT2'),
- (241,'PROCESSLIST'),
- (242,'LOGS'),
- (243,'HEAP'),
- (244,'SOUNDS'),
- (245,'BETWEEN'),
- (246,'REPAIR'),
- (247,'MULTILINESTRINGFROMTEXT'),
- (248,'PACK_KEYS'),
- (249,'FAST'),
- (250,'CALL'),
- (251,'VALUES'),
- (252,'LOOP'),
- (253,'VARCHARACTER'),
- (254,'BEFORE'),
- (255,'TRUNCATE'),
- (256,'SHOW'),
- (257,'REDUNDANT'),
- (258,'ALL'),
- (259,'USER_RESOURCES'),
- (260,'PARTIAL'),
- (261,'BINLOG'),
- (262,'END'),
- (263,'SECOND'),
- (264,'AND'),
- (265,'FLOAT8'),
- (266,'PREV'),
- (267,'HOUR'),
- (268,'SELECT'),
- (269,'DATABASES'),
- (270,'OR'),
- (271,'IDENTIFIED'),
- (272,'MASTER_SSL_CIPHER'),
- (273,'SQL_SLAVE_SKIP_COUNTER'),
- (274,'BOTH'),
- (275,'BOOL'),
- (276,'YEAR'),
- (277,'MASTER_PORT');
-INSERT INTO `mysql`.`help_keyword` VALUES (278,'CONCURRENT'),
- (279,'HELP'),
- (280,'UNIQUE'),
- (281,'TRIGGERS'),
- (282,'PROCESS'),
- (283,'CONSISTENT'),
- (284,'MASTER_SSL'),
- (285,'DATE_ADD'),
- (286,'MAX_CONNECTIONS_PER_HOUR'),
- (287,'LIKE'),
- (288,'FETCH'),
- (289,'IN'),
- (290,'COLUMN'),
- (291,'DUMPFILE'),
- (292,'USAGE'),
- (293,'EXECUTE'),
- (294,'MEMORY'),
- (295,'CEIL'),
- (296,'QUERY'),
- (297,'MASTER_HOST'),
- (298,'LINES'),
- (299,'SQL_THREAD'),
- (300,'MAX_QUERIES_PER_HOUR'),
- (301,'MASTER_SSL_CERT'),
- (302,'MULTIPOLYGONFROMWKB'),
- (303,'TRANSACTION'),
- (304,'DAY_MINUTE'),
- (305,'STDDEV'),
- (306,'DATE_SUB'),
- (307,'GEO...
[truncated message content] |