cs-project-svn_notify Mailing List for CS-Project (Page 10)
Brought to you by:
crazedsanity
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(65) |
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(34) |
Feb
(82) |
Mar
(21) |
Apr
(12) |
May
(16) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(1) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(5) |
Sep
(12) |
Oct
(11) |
Nov
(4) |
Dec
(15) |
2010 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <cra...@us...> - 2008-02-09 04:23:17
|
Revision: 816 http://cs-project.svn.sourceforge.net/cs-project/?rev=816&view=rev Author: crazedsanity Date: 2008-02-08 20:23:14 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Fixed invalid entry, added entry for ALPHA3. Modified Paths: -------------- trunk/1.2/upgrade/upgrade.xml Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-02-09 04:22:41 UTC (rev 815) +++ trunk/1.2/upgrade/upgrade.xml 2008-02-09 04:23:14 UTC (rev 816) @@ -22,11 +22,17 @@ in an unstable state. Unstable is bad, m'kay?</system_note> <matching> - <v1.2.0-ALPHA2> + <v1.2.0-ALPHA1> <target_version>1.2.0-ALPHA2</target_version> <script_name>upgradeTo1.2.0-ALPHA2.php</script_name> <class_name>upgrade_to_1_2_0_ALPHA2</class_name> <call_method>run_upgrade</call_method> + </v1.2.0-ALPHA1> + <v1.2.0-ALPHA2> + <target_version>1.2.0-ALPHA3</target_version> + <script_name>upgradeTo1.2.0-ALPHA3.php</script_name> + <class_name>upgrade_to_1_2_0_ALPHA3</class_name> + <call_method>run_upgrade</call_method> </v1.2.0-ALPHA2> </matching> </upgrade> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 04:22:43
|
Revision: 815 http://cs-project.svn.sourceforge.net/cs-project/?rev=815&view=rev Author: crazedsanity Date: 2008-02-08 20:22:41 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Check for invalid entry in upgrade.xml (which I had previously added). Modified Paths: -------------- trunk/1.2/lib/upgradeClass.php Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-02-09 03:59:16 UTC (rev 814) +++ trunk/1.2/lib/upgradeClass.php 2008-02-09 04:22:41 UTC (rev 815) @@ -190,7 +190,7 @@ throw new exception(__METHOD__ .": upgrade already in progress...????"); } else { - $lockConfig = $this->upgrade_in_progress(TRUE); + $lockConfig = $this->upgrade_in_progress(); $this->fsObj->cd("/"); //TODO: not only should the "create_file()" method be run, but also do a sanity check by calling lock_file_exists(). @@ -819,7 +819,10 @@ foreach($this->config['MATCHING'] as $matchVersion=>$data) { $matchVersion = preg_replace('/^V/', '', $matchVersion); - if($this->databaseVersion == $matchVersion || $this->is_higher_version($this->databaseVersion, $matchVersion)) { + if($matchVersion == $data['TARGET_VERSION']) { + throw new exception(__METHOD__ .": detected invalid TARGET_VERSION in (". $matchVersion ."): make sure TARGET_VERSION is higher than matching!"); + } + elseif($this->databaseVersion == $matchVersion || $this->is_higher_version($this->databaseVersion, $matchVersion)) { //the version in MATCHING is equal to or HIGHER than our database version... make sure it is NOT // higher than the version in our versionFile. if(!$this->is_higher_version($this->versionFileVersion, $matchVersion)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 03:59:20
|
Revision: 814 http://cs-project.svn.sourceforge.net/cs-project/?rev=814&view=rev Author: crazedsanity Date: 2008-02-08 19:59:16 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Beginning of ALPHA3 upgrade script (to update config file with attributes). Added Paths: ----------- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php Copied: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php (from rev 812, trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA2.php) =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php (rev 0) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA3.php 2008-02-09 03:59:16 UTC (rev 814) @@ -0,0 +1,42 @@ +<?php +/* + * Created on Nov 20, 2007 + */ + + +class upgrade_to_1_2_0_ALPHA3 extends dbAbstract { + + private $logsObj; + + //========================================================================= + public function __construct(cs_phpDB &$db) { + if(!$db->is_connected()) { + throw new exception(__METHOD__ .": database is not connected"); + } + $this->db = $db; + + $this->logsObj = new logsClass($this->db, 'Upgrade'); + + $this->gfObj = new cs_globalFunctions; + $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; + }//end __construct() + //========================================================================= + + + + //========================================================================= + public function run_upgrade() { + + + $this->db->beginTrans(__METHOD__); + + + exit; + + $this->db->commitTrans(__METHOD__); + + }//end run_upgrade() + //========================================================================= +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 03:56:44
|
Revision: 813 http://cs-project.svn.sourceforge.net/cs-project/?rev=813&view=rev Author: crazedsanity Date: 2008-02-08 19:56:41 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Remove debug_print() statements from settings/admin. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-09 03:54:43 UTC (rev 812) +++ trunk/1.2/includes/content/settings.inc 2008-02-09 03:56:41 UTC (rev 813) @@ -147,9 +147,6 @@ unset($data['type'], $data['attributes'], $data['value']); $indexName = strtolower($indexName); - #debug_print($attributes); - - //pull the appropriate template row. $rowName = $defaultRowName; if(strlen($attributes['TYPE'])) { @@ -159,16 +156,12 @@ if($attributes['TYPE'] == 'select' && isset($attributes['OPTIONS'])) { #debug_print(explode('|', $attributes['OPTIONS'])); $tmpOptionList = explode('|', $attributes['OPTIONS']); - debug_print("parsing (". $indexName .")"); - debug_print($tmpOptionList); $optionList = array(); foreach($tmpOptionList as $optionInfo) { $x = explode('=', $optionInfo); $optionList[$x[0]] = $x[1]; } - debug_print($optionList); $optionList = $page->gfObj->array_as_option_list($optionList, $attributes['DEFAULT']); - debug_print($optionList); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 03:54:46
|
Revision: 812 http://cs-project.svn.sourceforge.net/cs-project/?rev=812&view=rev Author: crazedsanity Date: 2008-02-08 19:54:43 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Remove "onSelect" attribute (unused). Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-09 03:49:54 UTC (rev 811) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-09 03:54:43 UTC (rev 812) @@ -23,7 +23,6 @@ are handled by the webserver." type="select" options="IsSMTP=SMTP|IsSendmail=Sendmail|IsQmail=Qmail|IsMail=Mail" - onSelect="IsSMTP=phpmailer_host" default="IsSMTP">IsSMTP</phpmailer_method> <phpmailer_host title="SMTP Server" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 03:49:57
|
Revision: 811 http://cs-project.svn.sourceforge.net/cs-project/?rev=811&view=rev Author: crazedsanity Date: 2008-02-08 19:49:54 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Updates to completely parse sample config (doesn't handle dependent items). Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-09 03:48:05 UTC (rev 810) +++ trunk/1.2/includes/content/settings.inc 2008-02-09 03:49:54 UTC (rev 811) @@ -130,9 +130,12 @@ if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { + //read the sample config. - $xmlObj = new XMLParser(file_get_contents(dirname(__FILE__) .'/../../docs/samples/sample_config.xml')); - $myData = $xmlObj->get_path('/CONFIG'); + require_once(dirname(__FILE__) .'/../../lib/config.class.php'); + $config = new config(dirname(__FILE__) .'/../../docs/samples/sample_config.xml', FALSE); + $myData = $config->get_config_contents(FALSE); + $mainAttributes = $myData['attributes']; unset($myData['type'], $myData['attributes']); @@ -151,10 +154,24 @@ $rowName = $defaultRowName; if(strlen($attributes['TYPE'])) { $rowName = 'setting_'. $attributes['TYPE']; + + $optionList = NULL; + if($attributes['TYPE'] == 'select' && isset($attributes['OPTIONS'])) { + #debug_print(explode('|', $attributes['OPTIONS'])); + $tmpOptionList = explode('|', $attributes['OPTIONS']); + debug_print("parsing (". $indexName .")"); + debug_print($tmpOptionList); + $optionList = array(); + foreach($tmpOptionList as $optionInfo) { + $x = explode('=', $optionInfo); + $optionList[$x[0]] = $x[1]; + } + debug_print($optionList); + $optionList = $page->gfObj->array_as_option_list($optionList, $attributes['DEFAULT']); + debug_print($optionList); + } } - debug_print("Parsing (". $indexName .") using rowName=(". $rowName .")"); - if(!isset($page->templateRows[$rowName])) { throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); } @@ -167,6 +184,9 @@ 'description' => $attributes['DESCRIPTION'], 'value' => $value ); + if(!is_null($optionList)) { + $repArr['setting_select__normal'] = $optionList; + } $parsedRows .= $page->mini_parser($page->templateRows[$rowName], $repArr); } #debug_print($parsedRows); Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-09 03:48:05 UTC (rev 810) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-09 03:49:54 UTC (rev 811) @@ -38,12 +38,7 @@ <td> <select name="%%index%%" %%disabled%%> - <!-- BEGIN xsetting_select__normal --> - <option value="%%value%%">%%displayValue%%</option> - <!-- END setting_select__normal --> - <!-- BEGIN xsetting_select__onSelect --> - <option value="%%value%%" onSelect="enableInput(%%namedSection%%);">%%displayValue%%</option> - <!-- END setting_select__onSelect --> + %%setting_select__normal%% </select> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 03:48:08
|
Revision: 810 http://cs-project.svn.sourceforge.net/cs-project/?rev=810&view=rev Author: crazedsanity Date: 2008-02-08 19:48:05 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Minor changes to the config class. /lib/config.class.php: * __construct(): -- set root of cs_fileSystemClass{} to be one level below current. * get_config_contents(): -- use internal fileName instead of always referring to site config. Modified Paths: -------------- trunk/1.2/lib/config.class.php Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-02-09 03:43:29 UTC (rev 809) +++ trunk/1.2/lib/config.class.php 2008-02-09 03:48:05 UTC (rev 810) @@ -14,7 +14,7 @@ //------------------------------------------------------------------------- public function __construct($fileName=NULL, $redirectOnFileMissing=TRUE) { $this->gf = new cs_globalFunctions(); - $this->fs = new cs_fileSystemClass(dirname(__FILE__)); + $this->fs = new cs_fileSystemClass(dirname(__FILE__) .'/..'); $this->fileName = dirname(__FILE__) .'/'. CONFIG_FILENAME; if(!is_null($fileName) && strlen($fileName)) { @@ -43,7 +43,7 @@ */ public function get_config_contents($simple=TRUE) { if($this->fileExists) { - $xmlString = $this->fs->read(CONFIG_FILENAME); + $xmlString = $this->fs->read($this->fileName); //parse the file. $xmlParser = new xmlParser($xmlString); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-09 03:43:37
|
Revision: 809 http://cs-project.svn.sourceforge.net/cs-project/?rev=809&view=rev Author: crazedsanity Date: 2008-02-08 19:43:29 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Updated sample configuration file. Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-08 20:33:05 UTC (rev 808) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-09 03:43:29 UTC (rev 809) @@ -27,7 +27,7 @@ default="IsSMTP">IsSMTP</phpmailer_method> <phpmailer_host title="SMTP Server" - description="This should be the IP of your mailserver, like 127.0.0.1..." + description="This should be the IP of your mailserver, like 127.0.0.1 (only needed if "SMTP" is selected above)" default="127.0.0.1">127.0.0.1</phpmailer_host> <max_time title="Maximum Session Length" @@ -52,7 +52,7 @@ title="Stop Logins on Global Alert" description="(<font color=red><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created." type="select" - options="" + options="0=No (0)|1=Yes (1)" default="0">0</stop_logins_on_global_alert> <debugprintopt title="Debug Printing?" @@ -64,7 +64,7 @@ title="Debug Print: Add 'HR' Tag?" description="This setting affects whether or not there are separators between debug_print()'s (useful to discover if there's a print occurring that is otherwise not visible)" type="select" - options="1=Do not show|1=Show" + options="0=Do not show (0)|1=Show (1)" default="0">0</debugremovehr> <workingonit title="Working On It?" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-08 20:33:11
|
Revision: 808 http://cs-project.svn.sourceforge.net/cs-project/?rev=808&view=rev Author: crazedsanity Date: 2008-02-08 12:33:05 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Class to read the main (or an alternate) config file. Added Paths: ----------- trunk/1.2/lib/config.class.php Added: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php (rev 0) +++ trunk/1.2/lib/config.class.php 2008-02-08 20:33:05 UTC (rev 808) @@ -0,0 +1,97 @@ +<?php + +class config { + + + private $data; + private $fs; + private $gf; + + private $fileExists; + + private $fileName; + + //------------------------------------------------------------------------- + public function __construct($fileName=NULL, $redirectOnFileMissing=TRUE) { + $this->gf = new cs_globalFunctions(); + $this->fs = new cs_fileSystemClass(dirname(__FILE__)); + + $this->fileName = dirname(__FILE__) .'/'. CONFIG_FILENAME; + if(!is_null($fileName) && strlen($fileName)) { + $this->fileName = $fileName; + } + + //Redirect them to the setup page. + if(!file_exists($this->fileName)) { + $this->fileExists = FALSE; + if($redirectOnFileMissing) { + $this->gf->conditional_header("/setup?from=". urlencode($_SERVER['REQUEST_URI'])); + exit; + } + } + else { + $this->fileExists = TRUE; + } + }//end __construct() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + /** + * Get the contents of the config file. + */ + public function get_config_contents($simple=TRUE) { + if($this->fileExists) { + $xmlString = $this->fs->read(CONFIG_FILENAME); + + //parse the file. + $xmlParser = new xmlParser($xmlString); + + if($simple) { + $config = $xmlParser->get_tree(TRUE); + $config = $config['CONFIG']; + } + else { + $config = $xmlParser->get_path('/CONFIG'); + unset($config['type'], $config['attributes']); + } + } + else { + throw new exception(__METHOD__ .": config file doesn't exist"); + } + + return($config); + + }//end get_config_contents() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + /** + * Read the XML config file & return it's simplified contents + */ + public function read_config_file($defineConstants=TRUE, $setEverything=TRUE) { + $config = $this->get_config_contents(TRUE); + + if($defineConstants) { + $conditionallySet = array('VERSION_STRING', 'WORKINGONIT'); + foreach($config as $index=>$value) { + if(in_array($index, $conditionallySet)) { + //only set this part if we're told to. + if($setEverything) { + define($index, $value); + } + } + else { + define($index, $value); + } + } + } + + return($config); + }//end read_config_file() + //------------------------------------------------------------------------- +}//end config{} +?> \ No newline at end of file Property changes on: trunk/1.2/lib/config.class.php ___________________________________________________________________ Name: svn:keywords + Id HeadURL Date Revision Author Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-08 18:50:36
|
Revision: 807 http://cs-project.svn.sourceforge.net/cs-project/?rev=807&view=rev Author: crazedsanity Date: 2008-02-08 10:50:31 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Updated sample config with proper ordering, titles, etc. Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-08 18:30:04 UTC (rev 806) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-08 18:50:31 UTC (rev 807) @@ -1,7 +1,9 @@ <config generated="2007-09-12 11:09:47" version="1.0.0-ALPHA1" svnLastAuthor="$Author:crazedsanity $" svnSignature="$Id:sample_config.xml 376 2007-10-12 13:54:50Z crazedsanity $"> <isdevsite title="Is Development Site?" - description="Whether it's a development site for cs-project or not... (TODO: add more info here)" + description="Whether it's a development site for cs-project or not... (TODO: add more info here)" + type="select" + options="0=No (0)|1=Yes (1)" default="0">0</isdevsite> <proj_name title="Project Name" @@ -40,6 +42,18 @@ description="Name of the session: really, this only matters if you have other websites running under the same domain using PHP sessions, in which case this should be unique to avoid random annoying issues." default="CS_PROJECT_SESSID">CS_PROJECT_SESSID</config_session_name> + <version_string + title="Version String" + description="This is an important <b>INTERNAL</b> setting that should NEVER be changed manually + unless you really know what you're doing." + type="locked" + disabled="1">1.0.0-ALPHA1</version_string> + <stop_logins_on_global_alert + title="Stop Logins on Global Alert" + description="(<font color=red><b>Currently unimplemented</b></font>) Stop users from logging in if a global alert has been created." + type="select" + options="" + default="0">0</stop_logins_on_global_alert> <debugprintopt title="Debug Printing?" description="Generally, this should only be turned on if you're running a development site for cs-project..." @@ -53,16 +67,15 @@ options="1=Do not show|1=Show" default="0">0</debugremovehr> <workingonit + title="Working On It?" + description="<font color="red"><b><blink>WARNING!</blink></b></font> + Setting this to a non-zero value will DISABLE all connections to the database, and make your site unuseable. + It is provided as a simple, fast way to stop connections to your database, usually for maintenance purposes. + It is displayed here for reference only." type="locked" default="0">0</workingonit> - <version_string - title="Version String" - description="This is an important <b>INTERNAL</b> setting that should NEVER be changed manually - unless you really know what you're doing." - type="locked" - disabled="1">1.0.0-ALPHA1</version_string> <database__host - title="Database Name (cs_project)" + title="Database Host Name (cs_project)" description="Hostname" default="localhost">localhost</database__host> <database__dbname This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-08 18:30:10
|
Revision: 806 http://cs-project.svn.sourceforge.net/cs-project/?rev=806&view=rev Author: crazedsanity Date: 2008-02-08 10:30:04 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Mostly parsed version of sample config... next release will need to set attributes into generated config file (from the sample, probably). Modified Paths: -------------- trunk/1.2/docs/samples/sample_config.xml trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/docs/samples/sample_config.xml =================================================================== --- trunk/1.2/docs/samples/sample_config.xml 2008-02-08 17:49:16 UTC (rev 805) +++ trunk/1.2/docs/samples/sample_config.xml 2008-02-08 18:30:04 UTC (rev 806) @@ -53,9 +53,14 @@ options="1=Do not show|1=Show" default="0">0</debugremovehr> <workingonit - type="hidden" + type="locked" default="0">0</workingonit> - <version_string>1.0.0-ALPHA1</version_string> + <version_string + title="Version String" + description="This is an important <b>INTERNAL</b> setting that should NEVER be changed manually + unless you really know what you're doing." + type="locked" + disabled="1">1.0.0-ALPHA1</version_string> <database__host title="Database Name (cs_project)" description="Hostname" Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-08 17:49:16 UTC (rev 805) +++ trunk/1.2/includes/content/settings.inc 2008-02-08 18:30:04 UTC (rev 806) @@ -128,7 +128,6 @@ $x = $page->set_all_block_rows("content"); - if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { //read the sample config. @@ -136,9 +135,44 @@ $myData = $xmlObj->get_path('/CONFIG'); $mainAttributes = $myData['attributes']; unset($myData['type'], $myData['attributes']); - debug_print($myData); + $parsedRows = ""; + $defaultRowName = 'setting_text'; + foreach($myData as $indexName=>$data) { + $attributes = $data['attributes']; + $value = $data['value']; + unset($data['type'], $data['attributes'], $data['value']); + $indexName = strtolower($indexName); + + #debug_print($attributes); + + + //pull the appropriate template row. + $rowName = $defaultRowName; + if(strlen($attributes['TYPE'])) { + $rowName = 'setting_'. $attributes['TYPE']; + } + + debug_print("Parsing (". $indexName .") using rowName=(". $rowName .")"); + + if(!isset($page->templateRows[$rowName])) { + throw new exception(__METHOD__ .": failed to retrieve block row named (". $rowName .")"); + } + + //now parse stuff into the row... + $repArr = array( + 'disabled' => $attributes['disabled'], + 'index' => $indexName, + 'title' => $attributes['TITLE'], + 'description' => $attributes['DESCRIPTION'], + 'value' => $value + ); + $parsedRows .= $page->mini_parser($page->templateRows[$rowName], $repArr); + } + #debug_print($parsedRows); + $page->add_template_var($defaultRowName, $parsedRows); + //create an object with administrative capabilities. $adminUserClass = new adminUserClass($page->db); Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-08 17:49:16 UTC (rev 805) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-08 18:30:04 UTC (rev 806) @@ -3,7 +3,7 @@ <a name="config" /> -<table border="1" cellpadding="3" cellspacing="0"> +<table border="1" cellpadding="3" cellspacing="0" width="80%"> <tr> <th colspan="2">Config Settings</th> </tr> @@ -16,13 +16,13 @@ </td> </tr> <tr> - <th>Name/Description</th> - <th>Value/Select Option</th> + <th width="80%">Name/Description</th> + <th width="20%">Value/Select Option</th> </tr> <!-- BEGIN setting_text --> <tr> <td> - <b>%%title%%</b><hr> + <b>%%title%%</b> (%%index%%)<BR> %%description%% </td> @@ -32,7 +32,7 @@ <!-- BEGIN setting_select --> <tr> <td> - <b>%%title%%</b><hr> + <b>%%title%%</b> (%%index%%)<BR> %%description%% </td> @@ -48,14 +48,19 @@ </td> </tr> <!-- END setting_select --> -<!-- BEGIN setting_hidden --> +<!-- BEGIN setting_locked --> <tr> <td> + <b>%%title%%</b> (%%index%%)<BR> + %%description%% + </td> + + <td> <!-- NOTE: should we even have hidden elements in the form? --> - <input type="HIDDEN" name="%%index%%" value="%%value%%"> + <input type="text" name="%%index%%" value="%%value%%" disabled> </td> </tr> -<!-- END setting_hidden --> +<!-- END setting_locked --> </table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-08 17:49:22
|
Revision: 805 http://cs-project.svn.sourceforge.net/cs-project/?rev=805&view=rev Author: crazedsanity Date: 2008-02-08 09:49:16 -0800 (Fri, 08 Feb 2008) Log Message: ----------- *** RELEASE 1.1.3 *** SUMMARY OF CHANGES::: * Re-add missing links to contacts section (#148) SVN COMMAND::: merge -r802:HEAD https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1.1 Modified Paths: -------------- releases/1.1/VERSION releases/1.1/templates/content/helpdesk/view.content.tmpl releases/1.1/templates/infobar.shared.tmpl Modified: releases/1.1/VERSION =================================================================== --- releases/1.1/VERSION 2008-02-08 17:47:24 UTC (rev 804) +++ releases/1.1/VERSION 2008-02-08 17:49:16 UTC (rev 805) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.2 +VERSION: 1.1.3 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ Modified: releases/1.1/templates/content/helpdesk/view.content.tmpl =================================================================== --- releases/1.1/templates/content/helpdesk/view.content.tmpl 2008-02-08 17:47:24 UTC (rev 804) +++ releases/1.1/templates/content/helpdesk/view.content.tmpl 2008-02-08 17:49:16 UTC (rev 805) @@ -108,7 +108,7 @@ <!-- BEGIN associatedUser_data --> <tr> <td nowrap style="border-bottom:solid #999 1px;border-right:solid #999 1px;border-left:solid #000 1px;"> - %%displayName%%</td> + <a href="/content/contacts/view/%%contact_id%%">%%displayName%%</a></td> <td style="border-bottom:solid #999 1px;border-left:solid #999 1px;border-right:solid #000 1px;"> %%email%%</td> Modified: releases/1.1/templates/infobar.shared.tmpl =================================================================== --- releases/1.1/templates/infobar.shared.tmpl 2008-02-08 17:47:24 UTC (rev 804) +++ releases/1.1/templates/infobar.shared.tmpl 2008-02-08 17:49:16 UTC (rev 805) @@ -11,7 +11,7 @@ <td width="100%"> <h2 style="display:inline;"><u>Current User</u></h2><BR> <h3 style="display:inline;">{LOGGED_COMPANY}</h3><br> - <h4 style="display:inline;">{LOGGED_CONTACT_NAME} ({LOGGED_USERNAME})</h4> + <h4 style="display:inline;">{LOGGED_CONTACT_NAME} (<a href="/content/contacts/view/{LOGGED_CONTACT_ID}">{LOGGED_USERNAME}</a>)</h4> </td> </tr> </table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-08 17:47:34
|
Revision: 804 http://cs-project.svn.sourceforge.net/cs-project/?rev=804&view=rev Author: crazedsanity Date: 2008-02-08 09:47:24 -0800 (Fri, 08 Feb 2008) Log Message: ----------- *** RELEASE 1.1.3 *** SUMMARY OF CHANGES::: * Re-add missing links to contacts section (#148) Modified Paths: -------------- trunk/1.1/VERSION Modified: trunk/1.1/VERSION =================================================================== --- trunk/1.1/VERSION 2008-02-08 17:20:28 UTC (rev 803) +++ trunk/1.1/VERSION 2008-02-08 17:47:24 UTC (rev 804) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.2 +VERSION: 1.1.3 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-08 17:20:36
|
Revision: 803 http://cs-project.svn.sourceforge.net/cs-project/?rev=803&view=rev Author: crazedsanity Date: 2008-02-08 09:20:28 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Re-add links to contacts page removed from last release (I must've been tired when I declared the contacts page as non-existent). Modified Paths: -------------- trunk/1.1/templates/content/helpdesk/view.content.tmpl trunk/1.1/templates/infobar.shared.tmpl Modified: trunk/1.1/templates/content/helpdesk/view.content.tmpl =================================================================== --- trunk/1.1/templates/content/helpdesk/view.content.tmpl 2008-02-07 07:56:52 UTC (rev 802) +++ trunk/1.1/templates/content/helpdesk/view.content.tmpl 2008-02-08 17:20:28 UTC (rev 803) @@ -108,7 +108,7 @@ <!-- BEGIN associatedUser_data --> <tr> <td nowrap style="border-bottom:solid #999 1px;border-right:solid #999 1px;border-left:solid #000 1px;"> - %%displayName%%</td> + <a href="/content/contacts/view/%%contact_id%%">%%displayName%%</a></td> <td style="border-bottom:solid #999 1px;border-left:solid #999 1px;border-right:solid #000 1px;"> %%email%%</td> Modified: trunk/1.1/templates/infobar.shared.tmpl =================================================================== --- trunk/1.1/templates/infobar.shared.tmpl 2008-02-07 07:56:52 UTC (rev 802) +++ trunk/1.1/templates/infobar.shared.tmpl 2008-02-08 17:20:28 UTC (rev 803) @@ -11,7 +11,7 @@ <td width="100%"> <h2 style="display:inline;"><u>Current User</u></h2><BR> <h3 style="display:inline;">{LOGGED_COMPANY}</h3><br> - <h4 style="display:inline;">{LOGGED_CONTACT_NAME} ({LOGGED_USERNAME})</h4> + <h4 style="display:inline;">{LOGGED_CONTACT_NAME} (<a href="/content/contacts/view/{LOGGED_CONTACT_ID}">{LOGGED_USERNAME}</a>)</h4> </td> </tr> </table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 07:56:56
|
Revision: 802 http://cs-project.svn.sourceforge.net/cs-project/?rev=802&view=rev Author: crazedsanity Date: 2008-02-06 23:56:52 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Parses the sample config, and there's a warning about incorrect settings. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-07 07:36:05 UTC (rev 801) +++ trunk/1.2/includes/content/settings.inc 2008-02-07 07:56:52 UTC (rev 802) @@ -131,9 +131,14 @@ if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { - //add the template to show various admin stuff. - $page->add_template_var("admin_section", $page->templateRows['admin_section']); + //read the sample config. + $xmlObj = new XMLParser(file_get_contents(dirname(__FILE__) .'/../../docs/samples/sample_config.xml')); + $myData = $xmlObj->get_path('/CONFIG'); + $mainAttributes = $myData['attributes']; + unset($myData['type'], $myData['attributes']); + debug_print($myData); + //create an object with administrative capabilities. $adminUserClass = new adminUserClass($page->db); Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:36:05 UTC (rev 801) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:56:52 UTC (rev 802) @@ -8,10 +8,18 @@ <th colspan="2">Config Settings</th> </tr> <tr> + <td colspan="2" align="center"> + <div class="note" style="width:60em"><b>NOTE:</b> You should be <font color="red"><b>absolutely certain</b></font> of the + effects of the changes you make here. Changing an item to an incorrect value make render the + installation useless. To rectify a broken configuration, you would need to modify the + <b>/lib/config.xml</b> file manually.</div> + </td> +</tr> +<tr> <th>Name/Description</th> <th>Value/Select Option</th> </tr> -<!-- BEGIN xsetting_text --> +<!-- BEGIN setting_text --> <tr> <td> <b>%%title%%</b><hr> @@ -21,7 +29,7 @@ <td><input name="%%index%%" type="text" value="%%value%%" %%disabled%%></td> </tr> <!-- END setting_text --> -<!-- BEGIN xsetting_select --> +<!-- BEGIN setting_select --> <tr> <td> <b>%%title%%</b><hr> @@ -40,7 +48,7 @@ </td> </tr> <!-- END setting_select --> -<!-- BEGIN xsetting_hidden --> +<!-- BEGIN setting_hidden --> <tr> <td> <!-- NOTE: should we even have hidden elements in the form? --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 07:36:11
|
Revision: 801 http://cs-project.svn.sourceforge.net/cs-project/?rev=801&view=rev Author: crazedsanity Date: 2008-02-06 23:36:05 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Block rows (purposely misstyped) to create each type of configuration option. Modified Paths: -------------- trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/templates/content/settings/admin.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:10:01 UTC (rev 800) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:36:05 UTC (rev 801) @@ -2,7 +2,56 @@ <h2><font color="red">Administrative Settings</font></h2> -<a name="group"> +<a name="config" /> +<table border="1" cellpadding="3" cellspacing="0"> +<tr> + <th colspan="2">Config Settings</th> +</tr> +<tr> + <th>Name/Description</th> + <th>Value/Select Option</th> +</tr> +<!-- BEGIN xsetting_text --> + <tr> + <td> + <b>%%title%%</b><hr> + %%description%% + </td> + + <td><input name="%%index%%" type="text" value="%%value%%" %%disabled%%></td> + </tr> +<!-- END setting_text --> +<!-- BEGIN xsetting_select --> + <tr> + <td> + <b>%%title%%</b><hr> + %%description%% + </td> + + <td> + <select name="%%index%%" %%disabled%%> + <!-- BEGIN xsetting_select__normal --> + <option value="%%value%%">%%displayValue%%</option> + <!-- END setting_select__normal --> + <!-- BEGIN xsetting_select__onSelect --> + <option value="%%value%%" onSelect="enableInput(%%namedSection%%);">%%displayValue%%</option> + <!-- END setting_select__onSelect --> + </select> + </td> + </tr> +<!-- END setting_select --> +<!-- BEGIN xsetting_hidden --> + <tr> + <td> + <!-- NOTE: should we even have hidden elements in the form? --> + <input type="HIDDEN" name="%%index%%" value="%%value%%"> + </td> + </tr> +<!-- END setting_hidden --> +</table> + + +<a name="group" /> <table border=1 cellpadding=3 cellspacing=0> <tr> <th colspan="3"><a href="#groupManagement"></a>Group Management</th> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 07:10:07
|
Revision: 800 http://cs-project.svn.sourceforge.net/cs-project/?rev=800&view=rev Author: crazedsanity Date: 2008-02-06 23:10:01 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Add special link for admin, clean code for doing admin/non-admin settings. Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/includes/content.inc Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-07 07:00:16 UTC (rev 799) +++ trunk/1.2/includes/content/settings.inc 2008-02-07 07:10:01 UTC (rev 800) @@ -128,49 +128,7 @@ $x = $page->set_all_block_rows("content"); - //show 'em their preferences. - $allPrefs = $prefObj->list_all_prefs(); - $userPrefs = $prefObj->get_user_prefs(); - if(is_array($allPrefs)) { - $rowColor = "#D3D3D3"; - foreach($allPrefs as $index=>$data) { - $myOptions = $data['optionList']; - - //TODO: fix this... it's sloppy. - $myOptionList = array(); - $optionListRepArr = array(); - foreach($data['optionList'] as $x=>$y) { - $tKey = $y['pref_option_id']; - $tVal = $y['name']; - $myOptionList[$tKey] = $tVal; - - $optionListRepArr[$tKey] = $y; - } - - unset($data['optionList'], $data['optionList']); - - $checkThis = NULL; - if(strlen($userPrefs[$data['pref_type_id']])) { - $checkThis = $userPrefs[$data['pref_type_id']]; - $data['currentSetting'] = $myOptionList[$checkThis]; - } - else { - $data['currentSetting'] = '<font color="red"><b>Select something!</b></font>'; - } - - $data['row_optionList'] = array_as_option_list( - $myOptionList, $checkThis, 'select', $page->templateRows['pref_optionList'], $optionListRepArr - ); - - $rowColor = swapValue($rowColor, '#D3D3D3', '#C3C3C3'); - $data['rowColor'] = $rowColor; - - $prefRow .= mini_parser($page->templateRows['pref_row'], $data, '%%', '%%'); - } - $page->add_template_var('pref_row', $prefRow); - } - if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { if($user->is_admin() == 1) { //add the template to show various admin stuff. @@ -206,6 +164,50 @@ $page->set_message_wrapper($msg); } } + else { + //show 'em their preferences. + $allPrefs = $prefObj->list_all_prefs(); + $userPrefs = $prefObj->get_user_prefs(); + + if(is_array($allPrefs)) { + $rowColor = "#D3D3D3"; + foreach($allPrefs as $index=>$data) { + $myOptions = $data['optionList']; + + //TODO: fix this... it's sloppy. + $myOptionList = array(); + $optionListRepArr = array(); + foreach($data['optionList'] as $x=>$y) { + $tKey = $y['pref_option_id']; + $tVal = $y['name']; + $myOptionList[$tKey] = $tVal; + + $optionListRepArr[$tKey] = $y; + } + + unset($data['optionList'], $data['optionList']); + + $checkThis = NULL; + if(strlen($userPrefs[$data['pref_type_id']])) { + $checkThis = $userPrefs[$data['pref_type_id']]; + $data['currentSetting'] = $myOptionList[$checkThis]; + } + else { + $data['currentSetting'] = '<font color="red"><b>Select something!</b></font>'; + } + + $data['row_optionList'] = array_as_option_list( + $myOptionList, $checkThis, 'select', $page->templateRows['pref_optionList'], $optionListRepArr + ); + + $rowColor = swapValue($rowColor, '#D3D3D3', '#C3C3C3'); + $data['rowColor'] = $rowColor; + + $prefRow .= mini_parser($page->templateRows['pref_row'], $data, '%%', '%%'); + } + $page->add_template_var('pref_row', $prefRow); + } + } } Modified: trunk/1.2/includes/content.inc =================================================================== --- trunk/1.2/includes/content.inc 2008-02-07 07:00:16 UTC (rev 799) +++ trunk/1.2/includes/content.inc 2008-02-07 07:10:01 UTC (rev 800) @@ -133,7 +133,7 @@ ); if($user->is_admin()) { - $tabNames['settings'] = "Settings<BR>\n<b>[Admin]</b>"; + $tabNames['settings'] = "Settings</a><BR>\n<a href=\"/content/settings/admin\"><b>[Admin]</b>"; } #$page->add_template_var('tabs', $page->file_to_string('tabs.shared.tmpl')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 07:00:22
|
Revision: 799 http://cs-project.svn.sourceforge.net/cs-project/?rev=799&view=rev Author: crazedsanity Date: 2008-02-06 23:00:16 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Move admin stuff to sub-section of settings (code cleaning still needed). Modified Paths: -------------- trunk/1.2/includes/content/settings.inc trunk/1.2/templates/content/settings/index.content.tmpl Added Paths: ----------- trunk/1.2/templates/content/settings/admin.content.tmpl Modified: trunk/1.2/includes/content/settings.inc =================================================================== --- trunk/1.2/includes/content/settings.inc 2008-02-07 06:24:26 UTC (rev 798) +++ trunk/1.2/includes/content/settings.inc 2008-02-07 07:00:16 UTC (rev 799) @@ -171,30 +171,40 @@ $page->add_template_var('pref_row', $prefRow); } - if($user->is_admin() == 1) { - //add the template to show various admin stuff. - $page->add_template_var("admin_section", $page->templateRows['admin_section']); - - //create an object with administrative capabilities. - $adminUserClass = new adminUserClass($page->db); - - //build the list of available groups. - $myGroups = $adminUserClass->get_groups(TRUE); - $page->add_template_var("addUser_gruppe", array_as_option_list($myGroups, $_SESSION['login_group_id'])); - - //Group administration. - { - $showGroup = $page->ui->get_cache("settings/showGroup"); - if(is_numeric($_GET['showGroup'])) { - $showGroup = $_GET['showGroup']; + if(count($page->ftsSections) == 3 && $page->ftsSections[2] == 'admin') { + if($user->is_admin() == 1) { + //add the template to show various admin stuff. + $page->add_template_var("admin_section", $page->templateRows['admin_section']); + + //create an object with administrative capabilities. + $adminUserClass = new adminUserClass($page->db); + + //build the list of available groups. + $myGroups = $adminUserClass->get_groups(TRUE); + $page->add_template_var("addUser_gruppe", array_as_option_list($myGroups, $_SESSION['login_group_id'])); + + //Group administration. + { + $showGroup = $page->ui->get_cache("settings/showGroup"); + if(is_numeric($_GET['showGroup'])) { + $showGroup = $_GET['showGroup']; + } + elseif(!is_numeric($showGroup)) { + $showGroup = $_SESSION['login_group_id']; + } + $page->ui->set_cache("settings/showGroup", $showGroup); + regenerate_group_lists($showGroup); + display_current_leader($showGroup); } - elseif(!is_numeric($showGroup)) { - $showGroup = $_SESSION['login_group_id']; - } - $page->ui->set_cache("settings/showGroup", $showGroup); - regenerate_group_lists($showGroup); - display_current_leader($showGroup); } + else { + $msg = array( + 'title' => "Insufficient Privileges ", + 'message' => "Administrative privileges are required to view this section.", + 'type' => "fatal" + ); + $page->set_message_wrapper($msg); + } } } Copied: trunk/1.2/templates/content/settings/admin.content.tmpl (from rev 789, trunk/1.2/templates/content/settings/index.content.tmpl) =================================================================== --- trunk/1.2/templates/content/settings/admin.content.tmpl (rev 0) +++ trunk/1.2/templates/content/settings/admin.content.tmpl 2008-02-07 07:00:16 UTC (rev 799) @@ -0,0 +1,117 @@ + +<h2><font color="red">Administrative Settings</font></h2> + + +<a name="group"> +<table border=1 cellpadding=3 cellspacing=0> + <tr> + <th colspan="3"><a href="#groupManagement"></a>Group Management</th> + </tr> + <tr> + <th>Select a group</th> + + <th>Current Members</th> + + <th>Non-Members</th> + </tr> + <tr> + <td> + <b>Change current group:</b><BR> + <SELECT> +<!-- BEGIN show_group_list --> + <option onClick="javascript:void(xajax_ajax__change_current_group(%%group_id%%))" %%selectedString%%>%%display%% (%%short_name%%)</option> +<!-- END show_group_list --> + </SELECT><BR><BR><hr> + <div id="currentGroupLeader"> +<!-- BEGIN currentGroupLeaderBox --> + <b>Change Leader </b>({currentGroupLeader})<b> to:</b> + <input name="changeLeader[groupId]" type="HIDDEN" value="{groupId}"> + <SELECT name="changeLeader[newLeader]"> + {changeGroupLeader_list} + </SELECT><BR> +<!-- END currentGroupLeaderBox --> + </div> + <input type="submit" value="Change Leader" onClick="this.form.action.value='changeLeader'"> + </td> + + <td> + <div id="group_nonMembers"> + <!-- BEGIN group_nonMembers --> + <table> +<!-- BEGIN show_group_list__removeUser --> + <tr> + <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'remove'));">Remove</a></b>) %%username%%</td> + </tr> +<!-- END show_group_list__removeUser --> +<!-- BEGIN show_group_list__noRemoveUser --> + <tr> + <td><b><font color="red">No users to remove</font></b></td> + </tr> +<!-- END show_group_list__noRemoveUser --> + </table> + <!-- END group_nonMembers --> + </div> + </td> + + <td> + <div id="group_currentMembers"> + <!-- BEGIN group_currentMembers --> + <table> +<!-- BEGIN show_group_list__selectUser --> + <tr> + <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'add'));">Add</a></b>) %%username%%</td> + </tr> +<!-- END show_group_list__selectUser --> +<!-- BEGIN show_group_list__noUser --> + <tr> + <td><b><font color="red">No users to add</font></b></td> + </tr> +<!-- END show_group_list__noUser --> + </table> + <!-- END group_currentMembers --> + </div> + </td> + </tr> +</table> + + +<form method="POST"> + +<table border=1 cellpadding=3 cellspacing=0> + <tr> + <th colspan="2"><a href="#createUser"></a>Create User:</th> + </tr> + <tr> + <td>Username: </td> + <td><input name="addUser[username]" type="text"></td> + </tr> + <tr> + <td>Password: </td> + <td><input name="addUser[password]" type="text"></td> + </tr> + <tr> + <td>First Name: </td> + <td><input name="addUser[fname]" type="text"></td> + </tr> + <tr> + <td>Last Name: </td> + <td><input name="addUser[lname]" type="text"></td> + </tr> + <tr> + <td>Company: </td> + <td><input name="addUser[company]" type="text"></td> + </tr> + <tr> + <td>Email: </td> + <td><input name="addUser[email]" type="text"></td> + </tr> + <tr> + <td>Default Group: </td> + <td><SELECT name="addUser[group_id]">{addUser_gruppe}</SELECT></td> + </tr> + <tr> + <td colspan="2"><input type="submit" value="Add User" OnClick="javascript:this.form.action.value='addUser';"></td> + </tr> +</table> +<input type="HIDDEN" name="action" value="Fix_JAVASCRIPT"> +</form> Modified: trunk/1.2/templates/content/settings/index.content.tmpl =================================================================== --- trunk/1.2/templates/content/settings/index.content.tmpl 2008-02-07 06:24:26 UTC (rev 798) +++ trunk/1.2/templates/content/settings/index.content.tmpl 2008-02-07 07:00:16 UTC (rev 799) @@ -80,126 +80,3 @@ <input type="hidden" name="action" value="set_preference"> </form> - - - - - -<!-- BEGIN admin_section --> -<form method="POST"> -<hr> -<h2><font color="red">Administrative Settings</font></h2> - - -<a name="group"> -<table border=1 cellpadding=3 cellspacing=0> - <tr> - <th colspan="3"><a href="#groupManagement"></a>Group Management</th> - </tr> - <tr> - <th>Select a group</th> - - <th>Current Members</th> - - <th>Non-Members</th> - </tr> - <tr> - <td> - <b>Change current group:</b><BR> - <SELECT> -<!-- BEGIN show_group_list --> - <option onClick="javascript:void(xajax_ajax__change_current_group(%%group_id%%))" %%selectedString%%>%%display%% (%%short_name%%)</option> -<!-- END show_group_list --> - </SELECT><BR><BR><hr> - <div id="currentGroupLeader"> -<!-- BEGIN currentGroupLeaderBox --> - <b>Change Leader </b>({currentGroupLeader})<b> to:</b> - <input name="changeLeader[groupId]" type="HIDDEN" value="{groupId}"> - <SELECT name="changeLeader[newLeader]"> - {changeGroupLeader_list} - </SELECT><BR> -<!-- END currentGroupLeaderBox --> - </div> - <input type="submit" value="Change Leader" onClick="this.form.action.value='changeLeader'"> - </td> - - <td> - <div id="group_nonMembers"> - <!-- BEGIN group_nonMembers --> - <table> -<!-- BEGIN show_group_list__removeUser --> - <tr> - <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'remove'));">Remove</a></b>) %%username%%</td> - </tr> -<!-- END show_group_list__removeUser --> -<!-- BEGIN show_group_list__noRemoveUser --> - <tr> - <td><b><font color="red">No users to remove</font></b></td> - </tr> -<!-- END show_group_list__noRemoveUser --> - </table> - <!-- END group_nonMembers --> - </div> - </td> - - <td> - <div id="group_currentMembers"> - <!-- BEGIN group_currentMembers --> - <table> -<!-- BEGIN show_group_list__selectUser --> - <tr> - <td>(<b><a href="javascript:void(xajax_ajax__group_user(%%group_id%%, %%uid%%, 'add'));">Add</a></b>) %%username%%</td> - </tr> -<!-- END show_group_list__selectUser --> -<!-- BEGIN show_group_list__noUser --> - <tr> - <td><b><font color="red">No users to add</font></b></td> - </tr> -<!-- END show_group_list__noUser --> - </table> - <!-- END group_currentMembers --> - </div> - </td> - </tr> -</table> - -<table border=1 cellpadding=3 cellspacing=0> - <tr> - <th colspan="2"><a href="#createUser"></a>Create User:</th> - </tr> - <tr> - <td>Username: </td> - <td><input name="addUser[username]" type="text"></td> - </tr> - <tr> - <td>Password: </td> - <td><input name="addUser[password]" type="text"></td> - </tr> - <tr> - <td>First Name: </td> - <td><input name="addUser[fname]" type="text"></td> - </tr> - <tr> - <td>Last Name: </td> - <td><input name="addUser[lname]" type="text"></td> - </tr> - <tr> - <td>Company: </td> - <td><input name="addUser[company]" type="text"></td> - </tr> - <tr> - <td>Email: </td> - <td><input name="addUser[email]" type="text"></td> - </tr> - <tr> - <td>Default Group: </td> - <td><SELECT name="addUser[group_id]">{addUser_gruppe}</SELECT></td> - </tr> - <tr> - <td colspan="2"><input type="submit" value="Add User" OnClick="javascript:this.form.action.value='addUser';"></td> - </tr> -</table> -<input type="HIDDEN" name="action" value="Fix_JAVASCRIPT"> -</form> -<!-- END admin_section --> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 06:24:31
|
Revision: 798 http://cs-project.svn.sourceforge.net/cs-project/?rev=798&view=rev Author: crazedsanity Date: 2008-02-06 22:24:26 -0800 (Wed, 06 Feb 2008) Log Message: ----------- *** RELEASE 1.1.2 *** SUMMARY OF CHANGES::: * fix invalid/missing schema for tags during initial setup (issue #147) SVN COMMANDS::: merge -r796:HEAD https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1.1 Modified Paths: -------------- releases/1.1/VERSION releases/1.1/docs/schema/cs_project.schema.sql releases/1.1/docs/sql/setup/02__tables.sql releases/1.1/includes/setup/3.inc Modified: releases/1.1/VERSION =================================================================== --- releases/1.1/VERSION 2008-02-07 05:28:32 UTC (rev 797) +++ releases/1.1/VERSION 2008-02-07 06:24:26 UTC (rev 798) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.1 +VERSION: 1.1.2 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ Modified: releases/1.1/docs/schema/cs_project.schema.sql =================================================================== --- releases/1.1/docs/schema/cs_project.schema.sql 2008-02-07 05:28:32 UTC (rev 797) +++ releases/1.1/docs/schema/cs_project.schema.sql 2008-02-07 06:24:26 UTC (rev 798) @@ -1300,7 +1300,8 @@ CREATE TABLE tag_name_table ( tag_name_id integer NOT NULL, - name text NOT NULL + name text NOT NULL, + modifier integer NOT NULL default -1 ); Modified: releases/1.1/docs/sql/setup/02__tables.sql =================================================================== --- releases/1.1/docs/sql/setup/02__tables.sql 2008-02-07 05:28:32 UTC (rev 797) +++ releases/1.1/docs/sql/setup/02__tables.sql 2008-02-07 06:24:26 UTC (rev 798) @@ -690,7 +690,8 @@ CREATE TABLE tag_name_table ( tag_name_id integer NOT NULL, - name text NOT NULL + name text NOT NULL, + modifier integer NOT NULL default -1 ); Modified: releases/1.1/includes/setup/3.inc =================================================================== --- releases/1.1/includes/setup/3.inc 2008-02-07 05:28:32 UTC (rev 797) +++ releases/1.1/includes/setup/3.inc 2008-02-07 06:24:26 UTC (rev 798) @@ -790,19 +790,21 @@ //========================================================================= private function create_tag_names() { $tags = array( - 1 => 'bug', - 2 => 'feature request', - 3 => 'information', - 4 => 'network related', - 5 => 'critical', - 6 => 'exception' + 1 => array(-1, 'bug'), + 2 => array(-1, 'feature request'), + 3 => array(0, 'information'), + 4 => array(0, 'network related'), + 5 => array(-5, 'critical'), + 6 => array(-2, 'exception') ); $retval = 0; - foreach($tags as $id=>$name) { + foreach($tags as $id=>$data) { + $name = $data[1]; $insertArr = array( 'tag_name_id' => $id, - 'name' => $name + 'name' => $data[1], + 'modifier' => $data[0] ); $sql = "INSERT INTO tag_name_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); $numrows = $this->db->exec($sql); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 05:28:50
|
Revision: 797 http://cs-project.svn.sourceforge.net/cs-project/?rev=797&view=rev Author: crazedsanity Date: 2008-02-06 21:28:32 -0800 (Wed, 06 Feb 2008) Log Message: ----------- *** RELEASE 1.1.2 *** SUMMARY OF CHANGES::: * fix invalid/missing schema for tags during initial setup (issue #147) Modified Paths: -------------- trunk/1.1/VERSION trunk/1.1/docs/schema/cs_project.schema.sql trunk/1.1/docs/sql/setup/02__tables.sql trunk/1.1/includes/setup/3.inc Modified: trunk/1.1/VERSION =================================================================== --- trunk/1.1/VERSION 2008-02-07 03:59:47 UTC (rev 796) +++ trunk/1.1/VERSION 2008-02-07 05:28:32 UTC (rev 797) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.1 +VERSION: 1.1.2 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ Modified: trunk/1.1/docs/schema/cs_project.schema.sql =================================================================== --- trunk/1.1/docs/schema/cs_project.schema.sql 2008-02-07 03:59:47 UTC (rev 796) +++ trunk/1.1/docs/schema/cs_project.schema.sql 2008-02-07 05:28:32 UTC (rev 797) @@ -1300,7 +1300,8 @@ CREATE TABLE tag_name_table ( tag_name_id integer NOT NULL, - name text NOT NULL + name text NOT NULL, + modifier integer NOT NULL default -1 ); Modified: trunk/1.1/docs/sql/setup/02__tables.sql =================================================================== --- trunk/1.1/docs/sql/setup/02__tables.sql 2008-02-07 03:59:47 UTC (rev 796) +++ trunk/1.1/docs/sql/setup/02__tables.sql 2008-02-07 05:28:32 UTC (rev 797) @@ -690,7 +690,8 @@ CREATE TABLE tag_name_table ( tag_name_id integer NOT NULL, - name text NOT NULL + name text NOT NULL, + modifier integer NOT NULL default -1 ); Modified: trunk/1.1/includes/setup/3.inc =================================================================== --- trunk/1.1/includes/setup/3.inc 2008-02-07 03:59:47 UTC (rev 796) +++ trunk/1.1/includes/setup/3.inc 2008-02-07 05:28:32 UTC (rev 797) @@ -790,19 +790,21 @@ //========================================================================= private function create_tag_names() { $tags = array( - 1 => 'bug', - 2 => 'feature request', - 3 => 'information', - 4 => 'network related', - 5 => 'critical', - 6 => 'exception' + 1 => array(-1, 'bug'), + 2 => array(-1, 'feature request'), + 3 => array(0, 'information'), + 4 => array(0, 'network related'), + 5 => array(-5, 'critical'), + 6 => array(-2, 'exception') ); $retval = 0; - foreach($tags as $id=>$name) { + foreach($tags as $id=>$data) { + $name = $data[1]; $insertArr = array( 'tag_name_id' => $id, - 'name' => $name + 'name' => $data[1], + 'modifier' => $data[0] ); $sql = "INSERT INTO tag_name_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); $numrows = $this->db->exec($sql); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 03:59:50
|
Revision: 796 http://cs-project.svn.sourceforge.net/cs-project/?rev=796&view=rev Author: crazedsanity Date: 2008-02-06 19:59:47 -0800 (Wed, 06 Feb 2008) Log Message: ----------- *** RELEASE 1.1.1 *** SUMMARY OF CHANGES::: * update to cs-content v0.10.8 * update to cs-phpxml v0.5.5 * minor template & include changes for updated version of cs-content. * remove invalid links to non-existent "contacts" page... NOTE: changes from trunk of v1.0 were merged, also, commit in trunk for v1.1 invalidly indicated release 1.0.1 (instead of 1.1.1). SVN COMMAND::: merge -r794:HEAD https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1.1 Modified Paths: -------------- releases/1.1/VERSION releases/1.1/includes/login.inc releases/1.1/lib/cs-arrayToPath/VERSION releases/1.1/lib/cs-arrayToPath/arrayToPathClass.php releases/1.1/lib/cs-content/VERSION releases/1.1/lib/cs-content/contentSystemClass.php releases/1.1/lib/cs-content/cs_fileSystemClass.php releases/1.1/lib/cs-content/cs_genericPageClass.php releases/1.1/lib/cs-content/cs_phpDB.php releases/1.1/lib/cs-phpxml/xmlAbstract.class.php releases/1.1/lib/cs-phpxml/xmlBuilderClass.php releases/1.1/lib/cs-phpxml/xmlParserClass.php releases/1.1/lib/globalFunctions.php releases/1.1/lib/projectClass.php releases/1.1/lib/sessionCacheClass.php releases/1.1/lib/session_class.php releases/1.1/lib/site_config.php releases/1.1/templates/content/helpdesk/view.content.tmpl releases/1.1/templates/infobar.shared.tmpl Added Paths: ----------- releases/1.1/lib/cs-content/db_types/ releases/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php releases/1.1/templates/content/notes/create.content.tmpl releases/1.1/templates/content/notes/view.content.tmpl releases/1.1/templates/login.content.tmpl Removed Paths: ------------- releases/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php releases/1.1/templates/content/notes/index.shared.tmpl releases/1.1/templates/login.tmpl Modified: releases/1.1/VERSION =================================================================== --- releases/1.1/VERSION 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/VERSION 2008-02-07 03:59:47 UTC (rev 796) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.0 +VERSION: 1.1.1 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ Modified: releases/1.1/includes/login.inc =================================================================== --- releases/1.1/includes/login.inc 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/includes/login.inc 2008-02-07 03:59:47 UTC (rev 796) @@ -57,7 +57,7 @@ if($_GET['destination']) { $_SESSION['loginDestination'] = urlencode($_GET['destination']); } -//show the default page. -$page->change_content(html_file_to_string("login.tmpl")); +$page->add_template_var('cs-project_version', VERSION_STRING); + ?> \ No newline at end of file Modified: releases/1.1/lib/cs-arrayToPath/VERSION =================================================================== --- releases/1.1/lib/cs-arrayToPath/VERSION 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-arrayToPath/VERSION 2008-02-07 03:59:47 UTC (rev 796) @@ -2,4 +2,4 @@ VERSION: 0.2.2 PROJECT: cs-arrayToPath -$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2.2/VERSION $ \ No newline at end of file +$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2/VERSION $ \ No newline at end of file Modified: releases/1.1/lib/cs-arrayToPath/arrayToPathClass.php =================================================================== --- releases/1.1/lib/cs-arrayToPath/arrayToPathClass.php 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-arrayToPath/arrayToPathClass.php 2008-02-07 03:59:47 UTC (rev 796) @@ -6,7 +6,7 @@ * ------------------- * Last Author::::::::: $Author: crazedsanity $ * Current Revision:::: $Revision: 17 $ - * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2.2/arrayToPathClass.php $ + * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2/arrayToPathClass.php $ * Last Updated:::::::: $Date: 2007-09-12 14:24:46 -0500 (Wed, 12 Sep 2007) $ * * Modified: releases/1.1/lib/cs-content/VERSION =================================================================== --- releases/1.1/lib/cs-content/VERSION 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-content/VERSION 2008-02-07 03:59:47 UTC (rev 796) @@ -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.6 +VERSION: 0.10.8 PROJECT: cs-content $HeadURL:https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/VERSION $ \ No newline at end of file Modified: releases/1.1/lib/cs-content/contentSystemClass.php =================================================================== --- releases/1.1/lib/cs-content/contentSystemClass.php 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-content/contentSystemClass.php 2008-02-07 03:59:47 UTC (rev 796) @@ -1,10 +1,10 @@ -<? +<?php /* * FILE INFORMATION: * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/contentSystemClass.php $ - * $Id: contentSystemClass.php 221 2007-11-21 17:39:01Z crazedsanity $ - * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ - * $LastChangedRevision: 221 $ + * $Id: contentSystemClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ + * $LastChangedRevision: 252 $ * $LastChangedBy: crazedsanity $ * * HOW THE SYSTEM WORKS::: @@ -90,12 +90,15 @@ ); protected $templateList = array(); protected $includesList = array(); - protected $templateObj = NULL; + public $templateObj = NULL; protected $gfObj = NULL; protected $tabs = NULL; protected $finalSection; + private $isValid=FALSE; + private $reason=NULL; + //------------------------------------------------------------------------ /** * The CONSTRUCTOR. Duh. @@ -257,8 +260,7 @@ * Rips apart the "section" string, setting $this->section and $this->sectionArr. */ private function parse_section() { - // - if($this->section === 0) { + if($this->section === 0 || is_null($this->section) || !strlen($this->section)) { $this->section = "content/index"; } $myArr = split('/', $this->section); @@ -286,8 +288,10 @@ //make sure we've still got something valid to work with. if(!strlen($section)) { + //TODO: remove the extra return statement (should only be one at the bottom of the method). return(0); - } else { + } + else { //check the string to make sure it doesn't begin or end with a "/" if($section[0] == '/') { $section = substr($section, 1, strlen($section)); @@ -359,8 +363,9 @@ //now cd() all the way back. $this->fileSystemObj->cd('/'); - } else { - //couldn't find the templates directory... ick. + } + else { + //couldn't find the templates directory, and no includes... it's dead. $this->die_gracefully(__METHOD__ .": unable to find the templates directory, or non-valid page [". $this->validate_page() ."]"); } }//end prepare() @@ -399,14 +404,17 @@ } $lsDir = $this->fileSystemObj->ls($indexFilename); + $lsDirVals = array_values($lsDir); $lsFile = $this->fileSystemObj->ls("$finalSection.content.tmpl"); - if(is_array(array_values($lsDir))) { - //it's the dir. + + if(is_array(array_values($lsFile)) && is_array($lsFile[$finalSection .".content.tmpl"])) { + //it's the file ("{finalSection}.content.tmpl", like "mySection.content.tmpl") + $myIndex = $finalSection .".content.tmpl"; + } + elseif(is_array(array_values($lsDir)) && (is_array($lsDir[$indexFilename]))) { $myIndex = $indexFilename; - } elseif(is_array(array_values($lsFile))) { - //it's the file (no dir, or dir w/o index) - $myIndex = $finalSection.content.tmpl; - } else { + } + else { //nothin' doin'. $myIndex = NULL; } @@ -420,21 +428,35 @@ if(isset($myIndex)) { $valid = TRUE; $this->fileSystemObj->cd('/templates'); - } else { - $this->reason = __METHOD__ .": couldn't find page template for (". $this->section .", final=[$finalSection])..."; } - } else { - //just the base template. Make sure it's good. + else { + $this->reason = __METHOD__ .": couldn't find page template for ". $this->section; + } + } + else { + //if the baseDir is "help", this would try to use "/help/index.content.tmpl" $myFile = $this->baseDir .'/index.content.tmpl'; - $lsData = $this->fileSystemObj->ls($myFile); - if(isset($lsData[$myFile]) && $lsData[$myFile]['type'] == 'file') { + $sectionLsData = $this->fileSystemObj->ls($myFile); + + //if the baseDir is "help", this would try to use "/help.content.tmpl" + $sectionFile = $this->baseDir .'.content.tmpl'; + $lsData = $this->fileSystemObj->ls(); + + if(isset($lsData[$sectionFile]) && is_array($lsData[$sectionFile])) { + $valid = TRUE; + $this->finalSection = $this->baseDir; + } + elseif(isset($sectionLsData[$myFile]) && $sectionLsData[$myFile]['type'] == 'file') { //we're good. $valid = TRUE; $this->finalSection = $this->baseDir; - } else { + } + else { $this->reason = __METHOD__ .": couldn't find base template."; } } + $this->isValid = $valid; + return($valid); }//end validate_page() //------------------------------------------------------------------------ @@ -486,6 +508,10 @@ $this->templateList[$mySection] = $myTmpl; } } + if(isset($tmplList[$this->baseDir]['content'])) { + //load template for the main page (if $this->baseDir == "help", this would load "/help.content.tmpl" as content) + $this->templateList['content'] = $tmplList[$this->baseDir]['content']; + } } }//end load_page_templates() //------------------------------------------------------------------------ @@ -553,6 +579,7 @@ if(($myType == 'file') && !in_array($index, $this->ignoredList[$myType])) { $filename = $this->gfObj->create_list($this->fileSystemObj->cwd, $index, '/'); $filename = preg_replace('/^\/templates/', '', $filename); + $filename = preg_replace('/^\/\//', '/', $filename); //call another method to rip the filename apart properly, then arrange things as needed. $pieces = $this->parse_filename($index); $myPriIndex = $pieces[$primaryIndex]; @@ -687,7 +714,7 @@ } else { //TODO: make it *actually* die gracefully... the way it works now looks more like puke than grace. - throw new exception(__METHOD__ .": something broke. \nDETAILS::: $details" . + throw new exception(__METHOD__ .": Couldn't find 404 template, plus additional error... \nDETAILS::: $details" . "\nREASON::: ". $this->reason); } }//end die_gracefully() @@ -762,7 +789,16 @@ unset($myInternalScriptName); } - $page->print_page(); + if(is_bool($this->templateObj->allow_invalid_urls() === TRUE) && $this->isValid === FALSE) { + $this->isValid = $this->templateObj->allow_invalid_urls(); + } + + if($this->isValid === TRUE) { + $page->print_page(); + } + else { + $this->die_gracefully($this->reason); + } }//end finish() //------------------------------------------------------------------------ @@ -772,8 +808,7 @@ /** * Method for accessing the protected $this->sectionArr array. */ - public function get_sectionArr() - { + public function get_sectionArr() { //give 'em what they want. return($this->sectionArr); }//end get_sectionArr() @@ -785,8 +820,7 @@ /** * Method for accessing the protected member $this->finalSection. */ - public function get_finalSection() - { + public function get_finalSection() { //give 'em what they want. return($this->finalSection); }//end get_finalSection() @@ -798,8 +832,7 @@ /** * Method for accessing "baseDir", only referenced as the base section. */ - public function get_baseSection() - { + public function get_baseSection() { return($this->baseDir); }//end get_baseSection() //------------------------------------------------------------------------ Modified: releases/1.1/lib/cs-content/cs_fileSystemClass.php =================================================================== --- releases/1.1/lib/cs-content/cs_fileSystemClass.php 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-content/cs_fileSystemClass.php 2008-02-07 03:59:47 UTC (rev 796) @@ -1,12 +1,12 @@ -<? +<?php /* * FILE INFORMATION: * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_fileSystemClass.php $ - * $Id: cs_fileSystemClass.php 221 2007-11-21 17:39:01Z crazedsanity $ - * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ + * $Id: cs_fileSystemClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 221 $ + * $LastChangedRevision: 252 $ */ require_once(dirname(__FILE__) ."/cs_globalFunctions.php"); Modified: releases/1.1/lib/cs-content/cs_genericPageClass.php =================================================================== --- releases/1.1/lib/cs-content/cs_genericPageClass.php 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-content/cs_genericPageClass.php 2008-02-07 03:59:47 UTC (rev 796) @@ -2,10 +2,10 @@ /* * FILE INFORMATION: * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_genericPageClass.php $ - * $Id: cs_genericPageClass.php 221 2007-11-21 17:39:01Z crazedsanity $ - * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ + * $Id: cs_genericPageClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 221 $ + * $LastChangedRevision: 252 $ */ require_once(dirname(__FILE__) ."/template.inc"); require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); @@ -22,6 +22,8 @@ private $showEditableLink = FALSE; + private $allowInvalidUrls=NULL; + //--------------------------------------------------------------------------------------------- /** * The constructor. @@ -257,7 +259,7 @@ if($stripUndefVars) { $numLoops = 0; - while(preg_match_all('/\{.*?\}/', $this->templateObj->varvals['out'], $tags) && $numLoops < 50) { + while(preg_match_all('/\{.\S+?\}/', $this->templateObj->varvals['out'], $tags) && $numLoops < 50) { $tags = $tags[0]; //TODO: figure out why this works when running it twice. @@ -286,8 +288,9 @@ */ public function process_set_message() { //if there's not a message set, skip. - $errorBox = $this->file_to_string("system/message_box.tmpl"); + $errorBox = ""; if(isset($_SESSION['message']) && is_array($_SESSION['message'])) { + $errorBox = $this->file_to_string("system/message_box.tmpl"); //let's make sure the "type" value is *lowercase*. $_SESSION['message']['type'] = strtolower($_SESSION['message']['type']); @@ -307,6 +310,7 @@ // they'll never get past this point). unset($_SESSION['message']); } + return($errorBox); }//end of process_set_message() //--------------------------------------------------------------------------------------------- @@ -595,6 +599,17 @@ return($retval); }//end set_all_block_rows() //--------------------------------------------------------------------------------------------- + + + + //--------------------------------------------------------------------------------------------- + public function allow_invalid_urls($newSetting=NULL) { + if(!is_null($newSetting) && is_bool($newSetting)) { + $this->allowInvalidUrls = $newSetting; + } + return($this->allowInvalidUrls); + }//end allow_invalid_urls() + //--------------------------------------------------------------------------------------------- }//end cs_genericPage{} ?> Modified: releases/1.1/lib/cs-content/cs_phpDB.php =================================================================== --- releases/1.1/lib/cs-content/cs_phpDB.php 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-content/cs_phpDB.php 2008-02-07 03:59:47 UTC (rev 796) @@ -4,8 +4,8 @@ * A class for generic PostgreSQL database access. * * SVN INFORMATION::: - * SVN Signature:::::::: $Id: cs_phpDB.php 225 2007-12-19 00:20:13Z crazedsanity $ - * Last Committted Date: $Date: 2007-12-18 18:20:13 -0600 (Tue, 18 Dec 2007) $ + * SVN Signature:::::::: $Id: cs_phpDB.php 252 2008-01-31 21:57:49Z crazedsanity $ + * Last Committted Date: $Date: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * Last Committed Path:: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_phpDB.php $ * */ @@ -32,1132 +32,51 @@ require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); class cs_phpDB extends cs_versionAbstract { - - /** Internal result set pointer. */ - protected $result = NULL; - /** Internal error code. */ - protected $errorCode = 0; + private $dbLayerObj; + private $dbType; - /** Status of the current transaction. */ - protected $transStatus = NULL; - - /** Whether there is a transaction in progress or not. */ - protected $inTrans = FALSE; - - /** Holds the last query performed. */ - protected $lastQuery = NULL; - - /** List of queries that have been run */ - protected $queryList=array(); - - /** How many seconds to wait for a query before cancelling it. */ - protected $timeOutSeconds = NULL; - - /** Internal check to determine if a connection has been established. */ - protected $isConnected=FALSE; - - /** Internal check to determine if the parameters have been set. */ - protected $paramsAreSet=FALSE; - - /** Resource handle. */ - protected $connectionID = -1; - - /** Hostname or IP to connect to */ - protected $host; - - /** Port to connect to (default for Postgres is 5432) */ - protected $port; - - /** Name of the database */ - protected $dbname; - - /** Username to connect to the database */ - protected $user; - - /** password to connect to the database */ - protected $password; - - /** Row counter for looping through records */ - protected $row = -1; - - /** cs_globalFunctions object, for string stuff. */ - protected $gfObj; - - /** Internal check to ensure the object has been properly created. */ - protected $isInitialized=FALSE; - - /** List of prepared statements, indexed off the name, with the sub-array being fieldname=>dataType. */ - protected $preparedStatements = array(); - - /** Set to TRUE to save all queries into an array. */ - protected $useQueryList=FALSE; - - /** array that essentially remembers how many times beginTrans() was called. */ - protected $transactionTree = NULL; - - //////////////////////////////////////////// - // Core primary connection/database function - //////////////////////////////////////////// - - //========================================================================= - public function __construct() { - $this->gfObj = new cs_globalFunctions; + public function __construct($type='pgsql') { - if(defined('DEBUGPRINTOPT')) { - $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; - } - - $this->isInitialized = TRUE; - }//end __construct() - //========================================================================= - - - - //========================================================================= - /** - * Make sure the object is sane. - */ - final protected function sanity_check() { - if($this->isInitialized !== TRUE) { - throw new exception(__METHOD__ .": not properly initialized"); - } - }//end sanity_check() - //========================================================================= - - - - //========================================================================= - /** - * Set appropriate parameters for database connection - */ - public function set_db_info(array $params){ - $this->sanity_check(); - $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; - $requiredCount++; - } - else { - throw new exception(__METHOD__. ": property (". $index .") does " . - "not exist or isn't allowed"); - } - } - - if($requiredCount == count($required)) { - $this->paramsAreSet = TRUE; - } - else { - throw new exception(__METHOD__ .": required count (". $requiredCount - .") does not match required number of fields (". count($required) .")"); - } - }//end set_db_info() - //========================================================================= - - - - //========================================================================= - /** - * Wrapper for close() - */ - function disconnect() { - //Disconnect from $database - return($this->close()); - }//end disconnect() - //========================================================================= - - - - //========================================================================= - /** - * Standard method to close connection. - */ - function close() { - $this->isConnected = FALSE; - $retval = null; - if($this->connectionID != -1) { - $retval = pg_close($this->connectionID); - } - else { - throw new exception(__METHOD__ .": Failed to close connection: connection is invalid"); - } - - return($retval); - }//end close() - //========================================================================= - - - - //========================================================================= - /** - * Connect to the database - */ - function connect(array $dbParams=NULL, $forceNewConnection=FALSE){ - $this->sanity_check(); - $retval = NULL; - if(is_array($dbParams)) { - $this->set_db_info($dbParams); - } - - if($this->paramsAreSet === TRUE && $this->isConnected === FALSE) { + if(strlen($type)) { - $myConnArr = array( - 'host' => $this->host, - 'port' => $this->port, - 'dbname' => $this->dbname, - 'user' => $this->user, - 'password' => $this->password - ); + require_once(dirname(__FILE__) .'/db_types/'. __CLASS__ .'__'. $type .'.class.php'); + $className = __CLASS__ .'__'. $type; + $this->dbLayerObj = new $className; + $this->dbType = $type; - //make it into a string separated by spaces, don't clean anything, remove null elements - $connStr = $this->gfObj->string_from_array($myConnArr, 'url', " "); + $this->gfObj = new cs_globalFunctions; - //start output buffer for displaying error. - ob_start(); - if($forceNewConnection) { - $connID = pg_connect($connStr, PGSQL_CONNECT_FORCE_NEW); + if(defined('DEBUGPRINTOPT')) { + $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; } - else { - $connID =pg_connect($connStr); - } - $connectError = ob_get_contents(); - ob_end_clean(); - if(is_resource($connID)) { - $this->errorCode=0; - $this->connectionID = $connID; - $this->isConnected = TRUE; - $retval = $this->connectionID; - } - else { - throw new exception(__METHOD__ .": FATAL ERROR: ". $connectError); - } + $this->isInitialized = TRUE; } else { - throw new exception(__METHOD__ .": paramsAreSet=(". $this->paramsAreSet ."), isConnected=(". $this->isConnected .")"); + throw new exception(__METHOD__ .": failed to give a type (". $type .")"); } - - return($retval); - }//end connect() + }//end __construct() //========================================================================= //========================================================================= - function get_hostname() { - $this->sanity_check(); - return($this->host); - }//end get_hostname() - //========================================================================= - - - - //========================================================================= - /** - * Run sql queries - * - * TODO: re-implement query logging (setting debug, logfilename, etc). - */ - function exec($query) { - $this->lastQuery = $query; - if($this->useQueryList) { - $this->queryList[] = $query; - } - $returnVal = false; - - if(($this->get_transaction_status() != -1) && ($this->connectionID != -1)) { - $this->result = @pg_query($this->connectionID, $query); - - if($this->result !== false) { - if (eregi("^[[:space:]]*select", $query)) { - //If we didn't have an error and we are a select statement, move the pointer to first result - $numRows = $this->numRows(); - if($numRows > 0) { - $this->move_first(); - } - $returnVal = $numRows; - - } - else { - //We got something other than an update. Use numAffected - $returnVal = $this->numAffected(); - } - } - } - return($returnVal); - }//end exec() - //========================================================================= - - - - //========================================================================= /** - * Returns any error caused by the last executed query. - * - * @return NULL OK: no error - * @return (string) FAIL: contains error returned from the query. + * Magic method to call methods within the database abstraction layer ($this->dbLayerObj). */ - function errorMsg($setMessage=NULL,$logError=NULL) { - $this->sanity_check(); - if ($this->connectionID < 0) { - switch ($this->errorCode) { - //############################################### - case -1: - $retVal = "FATAL ERROR - CONNECTION ERROR: RESOURCE NOT FOUND"; - break; - //############################################### - - //############################################### - case -2: - $retVal = "FATAL ERROR - CLASS ERROR: FUNCTION CALLED WITHOUT PARAMETERS"; - break; - //############################################### - - //############################################### - case -3: - $retVal = "Query exceeded maximum timeout (". $this->timeoutSeconds .")"; - break; - //############################################### - - //############################################### - default: - $retVal = null; - //############################################### - } - } else { - $retVal = pg_last_error($this->connectionID); + public function __call($methodName, $args) { + if(method_exists($this->dbLayerObj, $methodName)) { + $retval = call_user_func_array(array($this->dbLayerObj, $methodName), $args); } - - return($retVal); - }//end errorMsg() - //========================================================================= - - - - - //////////////////// - // Cursor movement - //////////////////// - - - - - //========================================================================= - /** - * move pointer to first row of result set - */ - function move_first() { - $this->sanity_check(); - if($this->result == NULL) { - $retval = FALSE; - } else { - $this->set_row(0); - $retval = TRUE; + throw new exception(__METHOD__ .': unsupported method ('. $methodName .') for database of type ('. $this->dbType .')'); } - return($retval); - }//end move_first() + }//end __call() //========================================================================= - - - //========================================================================= - /** - * move pointer to last row of result set - */ - function move_last() { - $this->sanity_check(); - if($this->result == NULL) { - $retval = FALSE; - } - else { - $this->set_row($this->numRows()-1); - $retval = TRUE; - } - - return($retval); - }//end move_list() - //========================================================================= - - - - //========================================================================= - /** - * point to the next row, return false if no next row - */ - function move_next() { - $this->sanity_check(); - // If more rows, then advance row pointer - if($this->row < $this->numRows()-1) { - $this->set_row($this->row +1); - $retval = TRUE; - } - else { - $retval = FALSE; - } - - return($retval); - }//end move_next() - //========================================================================= - - - - //========================================================================= - /** - * point to the previous row, return false if no previous row - */ - function move_previous() { - // If not first row, then advance row pointer - if ($this->row > 0) { - $this->set_row($this->row -1); - return true; - } - else return false; - }//end move_previous() - //========================================================================= - - - - //========================================================================= - // point to the next row, return false if no next row - function next_row() { - // If more rows, then advance row pointer - if ($this->row < $this->numRows()-1) { - $this->set_row($this->row +1); - return true; - } - else return false; - }//end next_row() - //========================================================================= - - - - //========================================================================= - // can be used to set a pointer to a perticular row - function set_row($row){ - if(is_numeric($row)) { - $this->row = $row; - } - else { - throw new exception(__METHOD__ .": invalid data for row (". $row .")"); - } - return($this->row); - }//end set_row(); - //========================================================================= - - - - - /////////////////////// - // Result set related - /////////////////////// - - - - //========================================================================= - /** - * Return the current row as an object. - */ - function fobject() { - $this->sanity_check(); - if($this->result == NULL || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_object($this->result, $this->row); - } - - return($retval); - } - //========================================================================= - - - - //========================================================================= - /** - * Fetch the current row as an array containing fieldnames AND numeric indexes. - */ - function farray(){ - if($this->result == NULL || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_array($this->result,$this->row); - } - - return($retval); - }//end farray() - //========================================================================= - - - - //========================================================================= - /** - * Another way to retrieve a single row (useful for loops). - */ - function frow(){ - $this->sanity_check(); - if($this->numRows() <= 0) { - $retval = NULL; - } - else { - if($this->result == null || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_row($this->result, $this->row); - } - } - - return($retval); - }//end frow() - //========================================================================= - - - - //========================================================================= - /** - * Similar to farray(), except all indexes are non-numeric, and the entire - * result set is retrieved: if only one row is available, no numeric index - * is set, unless $numbered is TRUE. - * - * TODO: clean this up! - */ - function farray_fieldnames($index=NULL, $numbered=NULL,$unsetIndex=1) { - $this->sanity_check(); - $retval = NULL; - - //before we get too far, let's make sure there's something there. - if($this->numRows() <= 0) { - $retval = 0; - } - else { - //keep any errors/warnings from printing to the screen by using OUTPUT BUFFERS. - ob_start(); - - $x = 0; - do { - $temp = $this->farray(); - foreach($temp as $key=>$value) { - //remove the numbered indexes. - if(is_string($key)) { - $tArr[$key] = $value; - } - } - $newArr[$x] = $tArr; - $x++; - } - while($this->next_row()); - - if($index) { - foreach($newArr as $row=>$contents) { //For each of the returned sets of information - foreach($contents as $fieldname=>$value) { //And now for each of the items in that set - if($fieldname == $index) { - //The index for the new array will be this fieldname's value - $arrayKey = $value; - } - - $tempContent[$fieldname] = $value; - //don't include the "index" field in the subarray; that always seems to end badly. - if ($unsetIndex) { - unset($tempContent[$index]); - } - } - - if (!isset($tempArr[$arrayKey])) { - //Make sure we didn't already set this in the array. If so, then we don't have a unique variable to use for the array index. - $tempArr[$arrayKey] = $tempContent; - } - else { - //TODO: bigtime cleaning... should only return at the bottom of the method. - $retval = 0; - break; - } - $arrayKey = NULL; //Blank this out after using it, just in case we don't find one in the next iteration - } - - if (count($tempArr) != count($newArr)) { - $details = "farray_fieldnames(): Array counts don't match.<BR>\n" - ."FUNCTION ARGUMENTS: index=[$index], numbered=[$numbered], unsetIndex=[$unsetIndex]<BR>\n" - ."LAST QUERY: ". $this->lastQuery; - throw new exception(__METHOD__ .": $details"); - } - $newArr = $tempArr; - } - //this is where, if there's only one row (and the planets align just the way - // I like them to), there's no row w/ a sub-array... This is only done - // if $index is NOT set... - if(($this->numRows() == 1) AND (!$index) AND (!$numbered)) { - $newArr = $newArr[0]; - } - $retval = $newArr; - ob_end_clean(); - } - return($retval); - }//end farray_fieldnames() - //========================================================================= - - - - //========================================================================= - /** - * Uses farray_fieldnames() to retrieve the entire result set, but the final - * array is contains name=>value pairs. - */ - function farray_nvp($name, $value) { - if((!$name) OR (!$value)) { - $retval = 0; - } - else { - $tArr = $this->farray_fieldnames(NULL,1); - if(!is_array($tArr)) { - $retval = 0; - } - else { - //loop through it & grab the proper info. - $retval = array(); - foreach($tArr as $row=>$array) { - $tKey = $array[$name]; - $tVal = $array[$value]; - $retval[$tKey] = $tVal; - } - } - } - - //return the new array. - return($retval); - }//end farray_nvp() - //========================================================================= - - - - //========================================================================= - /** - * Similar to farray_fieldnames(), but only returns the NUMERIC indexes - */ - function farray_numbered() { - do { - $temp = $this->frow(); - $retArr[] = $temp[0]; - } - while($this->next_row()); - - return($retArr); - }//end farray_numbered() - //========================================================================= - - - - //========================================================================= - /** - * Returns the number of tuples affected by an insert/delete/update query. - * NOTE: select queries must use numRows() - */ - function numAffected() { - if($this->result == null) { - $retval = 0; - } else { - $this->affectedRows = pg_affected_rows($this->result); - $retval = $this->affectedRows; - } - - return($retval); - }//end numAffected() - //========================================================================= - - - - //========================================================================= - /** - * Returns the number of rows in a result (from a SELECT query). - */ - function numRows() { - if ($this->result == null) { - $retval = 0; - } - else { - $this->numrows = pg_num_rows($this->result); - $retval = $this->numrows; - } - - return($retval); - }//end numRows() - //========================================================================= - - - - //========================================================================= - /** - * wrapper for numAffected() - */ - function affectedRows(){ - return($this->numAffected()); - }//end affectedRows() - //========================================================================= - - - - //========================================================================= - /** - * Returns the current row number. - */ - function currRow(){ - return($this->row); - }//end currRow() - //========================================================================= - - - - //========================================================================= - /** - * Get the number of fields in a result. - */ - // get the number of fields in a result - function num_fields() { - if($this->result == null) { - $retval = 0; - } - else { - $retval = pg_num_fields($this->result); - } - return($retval); - }//end num_fields() - //========================================================================= - - - - //========================================================================= - function column_count() { - return($this->numFields()); - }//end column_count() - //========================================================================= - - - - //========================================================================= - /** - * get last OID (object identifier) of last INSERT statement - */ - function lastOID($doItForMe=0, $field=NULL) { - if($this->result == NULL) { - $retval = NULL; - } - else { - $tOid = pg_last_oid($this->result); - $retval = $tOid; - - if(($doItForMe) AND (eregi("^insert", $this->last_query))) { - //attempt to parse the insert statement, then select - // all fields (unless $field is set) from it. - $t = split(" into ", strtolower($this->last_query)); - $t = split(" ", $t[1]); - $t = split("\(", $t[0]); - $table = $t[0]; - - //now we have the table. - if(!$field) { - $field = "*"; - } - $query = "SELECT $field FROM $table WHERE OID=$tOid"; - $this->exec($query); - $dberror = $this->errorMsg(1,1,1,"lastOID(): "); - - if(!$dberror) { - $res = $this->farray(); - if(is_string($field)) { - $retval = $res[0]; - } - } - } - } - return($retval); - }//end lastOID() - //========================================================================= - - - - //========================================================================= - /** - * get result field name of the given field number. - */ - // get result field name - function fieldname($fieldnum) { - if($this->result == NULL) { - $retval =NULL; - } - else { - $retval = pg_field_name($this->result, $fieldnum); - } - - return($retval); - }//end fieldname() - //========================================================================= - - - - - //////////////////////// - // Transaction related - //////////////////////// - - - - - //========================================================================= - /** - * Start a transaction. - */ - function beginTrans($transName=NULL) { - $transStatus = $this->get_transaction_status(TRUE); - if(!$this->inTrans) { - //not in a transaction. Set up the transaction tree properly. - $this->transactionTree = array(); - } - else { - if($this->inTrans && is_null($this->transactionTree)) { - $transLevel = $this->get_transaction_level(); - //transaction started without using beginTrans()... - $this->transactionTree = array(); - $this->gfObj->debug_print(__METHOD__ .": transaction already started, transStatus=(". $transStatus ."), transLevel=(". $transLevel .")"); - $this->transactionTree[] = "Already started..."; - } - } - - if(is_null($transName)) { - $transName = time(TRUE); - } - $this->transactionTree[] = $transName; - $transLevel = $this->get_transaction_level(); - $this->gfObj->debug_print(__METHOD__ .": starting transaction at transLevel=(". $transLevel .")"); - return($this->exec("BEGIN")); - }//end beginTrans() - //========================================================================= - - - - //========================================================================= - /** - * Commit a transaction. - */ - function commitTrans() { - $retval = $this->get_transaction_status(); - $lastTransLayer = array_pop($this->transactionTree); - $transLevel = $this->get_transaction_level(); - if($transLevel == 0) { - if($retval > 1) { - $retval = 1; - } - $this->exec("COMMIT"); - - //check to see if there was an error (deferred constraints are checked at commit time) - if(strlen($this->errorMsg())) { - $retval = 0; - } - } - $this->get_transaction_status(); - return($retval); - }//end commitTrans() - //========================================================================= - - - - //========================================================================= - // returns true/false - function rollbackTrans() { - $retval = $this->exec("ABORT"); - $this->get_transaction_status(); - return($retval); - }//end rollbackTrans() - //========================================================================= - - - - //////////////////////// - // SQL String Related - //////////////////////// - - - - //========================================================================= - /** - * Gets rid of evil characters that might lead ot SQL injection attacks. - */ - function querySafe($string) { - return($this->gfObj->cleanString($string,"query")); - }//end querySafe() - //========================================================================= - - - - //========================================================================= - /** - * Make it SQL safe. - */ - function sqlSafe($string) { - return($this->gfObj->cleanString($string,"sql")); - }//end sqlSafe() - //========================================================================= - - - - //========================================================================= - /** - * Gives textual explanation of the current status of our database - * connection. - * - * @param $goodOrBad (bool,optional) return good/bad status. - * - * @return (-1) (FAIL) connection is broken - * @return (0) (FAIL) error was encountered (transient error) - * @return (1) (PASS) useable - * @return (2) (PASS) useable, but not just yet (working - * on something) - */ - function get_transaction_status($goodOrBad=TRUE) { - $myStatus = pg_transaction_status($this->connectionID); - $text = 'unknown'; - switch($myStatus) { - case PGSQL_TRANSACTION_IDLE: { - //No query in progress: it's idle. - $goodOrBadValue = 1; - $text = 'idle'; - $this->inTrans = FALSE; - } - break; - - - case PGSQL_TRANSACTION_ACTIVE: { - //there's a command in progress. - $goodOrBadValue = 2; - $text = 'processing'; - } - break; - - - case PGSQL_TRANSACTION_INTRANS: { - //connection idle within a valid transaction block. - $goodOrBadValue = 1; - $text = 'valid transaction'; - $this->inTrans = TRUE; - } - break; - - - case PGSQL_TRANSACTION_INERROR: { - //connection idle within a broken transaction. - $goodOrBadValue = 0; - $text = 'failed transaction'; - $this->inTrans = TRUE; - } - break; - - - case PGSQL_TRANSACTION_UNKNOWN: - default: { - //the connection is bad. - $goodOrBadValue = -1; - $text = 'bad connection'; - } - break; - } - - //do they want text or the good/bad number? - $retval = $text; - $this->transactionStatus = $goodOrBadValue; - if($goodOrBad) { - //they want the number. - $retval = $goodOrBadValue; - } - - return($retval); - }//end get_transaction_status() - //========================================================================= - - - - //========================================================================= - public function is_connected() { - $retval = FALSE; - if(is_resource($this->connectionID) && $this->isConnected === TRUE) { - $retval = TRUE; - } - - return($retval); - }//end is_connected() - //========================================================================= - - - - //========================================================================= - /** - * Create a prepared statement. - */ - public function create_prepared_statement($planName,array $fieldToType, $statement) { - $retval = FALSE; - //store the mappings. - $this->preparedStatements[$planName] = $fieldToType; - - //TODO: check that the string in "$statement" has the same number of "${n}" as are in "$fieldToType". - - $dataTypeString = ""; - foreach($fieldToType as $field => $type) { - $dataTypeString = $this->gfObj->create_list($dataTypeString, $type, ", "); - } - - $sql = "PREPARE ". $planName ."(". $dataTypeString .") AS ". $statement; - - $myNumrows = $this->exec($sql); - $myDberror = $this->errorMsg(); - - if(!strlen($myDberror)) { - $retval = TRUE; - } - else { - throw new exception(__METHOD__ .": failed to create prepared statement '". $planName ."'... dberror::: ". $myDberror ."\n\nSQL::: ". $sql); - } - - return($retval); - }//end create_prepared_statement() - //========================================================================= - - - - //========================================================================= - /** - * Run a statement prepared by this object. - * - * NOTE: determination of rows affected (numAffected) vs. rows returned (numRows) - * must be done by the user via the referenced methods. - */ - public function run_prepared_statement($name, array $data) { - $retval = FALSE; - if(is_array($this->preparedStatements[$name]) && count($data) == count($this->preparedStatements[$name])) { - $this->result = pg_execute($this->connectionID, $name, $data); - $dberror = $this->errorMsg(); - - if(!strlen($dberror)) { - $retval = TRUE; - } - } - else { - throw new exception(__METHOD__ .": invalid statement name (". $name ."), or incorrect number of elements"); - } - - return($retval); - }//end run_prepared_statement() - //========================================================================= - - - - //========================================================================= - /** - * Starts a copy command. - * - * TODO: implement safeguards so they can only put a line until the copy is ended. - */ - public function start_copy($tableName, array $fields) { - $retval = FALSE; - $copyStmt = "COPY ". $tableName ." (". $this->gfObj->string_from_array($fields, NULL, ", ") . ") FROM stdin;"; - $this->exec($copyStmt); - if(!strlen($this->errorMsg())) { - //TODO: set something here so that NOTHING ELSE can be done except put_line() and end_copy(). - $this->copyInProgress = TRUE; - $retval = TRUE; - } - else { - $this->end_copy(); - $retval = FALSE; - } - - return($retval); - }//end start_copy() - //========================================================================= - - - - //========================================================================= - /** - * Used to send a line to the COPY in progress (only if it was initiated by - * the internal start_copy() method). - * - * NOTE: the "end-of-copy" line, '\.', should NEVER be sent here. - */ - public function put_line($line) { - $retval = FALSE; - if($this->copyInProgress === TRUE) { - $myLine = trim($line); - $myLine .= "\n"; - - $retval = pg_put_line($this->connectionID, $myLine); - } - else { - throw new exception(__METHOD__ .": cannot send line if no copy is in progress"); - } - - return($retval); - }//end put_line() - //========================================================================= - - - - //========================================================================= - public function end_copy() { - if($this->copyInProgress === TRUE) { - //send the end-of-copy line... - $this->put_line("\\.\n"); - } - - $retval = pg_end_copy($this->connectionID); - - return($retval); - }//end end_copy() - //========================================================================= - - - - //========================================================================= - /** - * Determines how many times a transaction has been started. Starting - * multiple transactions does NOT protect the outer transaction from - * problems that occur in the inner transaction. In fact, it does the - * opposite: it protects the code from committing too early (which might - * destroy something that depending on the transaction). - */ - public function get_transaction_level() { - if(is_array($this->transactionTree)) { - $retval = count($this->transactionTree); - } - else { - $retval = 0; - } - - return($retval); - }//end get_transaction_level() - //========================================================================= - - - - //========================================================================= - /** - * Simple way to determine if the current connection is inside a - * transaction or not. - */ - public function is_in_transaction() { - $retval = 0; - if($this->inTrans || $this->get_transaction_level() != 0) { - $retval = TRUE; - } - return($retval); - }//end is_in_transaction() - //========================================================================= - - - } // end class phpDB ?> Copied: releases/1.1/lib/cs-content/db_types (from rev 795, trunk/1.1/lib/cs-content/db_types) Deleted: releases/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php =================================================================== --- trunk/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php 2008-02-07 03:55:00 UTC (rev 795) +++ releases/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php 2008-02-07 03:59:47 UTC (rev 796) @@ -1,1160 +0,0 @@ -<?php - -/* - * A class for generic PostgreSQL database access. - * - * SVN INFORMATION::: - * SVN Signature:::::::: $Id: cs_phpDB__pgsql.class.php 252 2008-01-31 21:57:49Z crazedsanity $ - * Last Committted Date: $Date: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ - * Last Committed Path:: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/db_types/cs_phpDB__pgsql.class.php $ - * - */ - -/////////////////////// -// ORIGINATION INFO: -// Author: Trevin Chow (with contributions from Lee Pang, wle...@ho...) -// Email: t1...@ma... -// Date: February 21, 2000 -// Last Updated: August 14, 2001 -// -// Description: -// Abstracts both the php function calls and the server information to POSTGRES -// databases. Utilizes class variables to maintain connection information such -// as number of rows, result id of last operation, etc. -// -/////////////////////// - -//TODO: option to not use layered transactions -//TODO: rollbackTrans() in layered transaction causes abort when final layer is committed/aborted -//TODO: stop sending queries to backend when transction is bad/aborted. -//TODO: commit/abort specific layer requests (i.e. if there's 8 layers & the first is named "x", calling commitTrans("x") will cause the whole transaction to commit & all layers to be destroyed. - -class cs_phpDB__pgsql { - - /** Internal result set pointer. */ - protected $result = NULL; - - /** Internal error code. */ - protected $errorCode = 0; - - /** Status of the current transaction. */ - protected $transStatus = NULL; - - /** Whether there is a transaction in progress or not. */ - protected $inTrans = FALSE; - - /** Holds the last query performed. */ - protected $lastQuery = NULL; - - /** List of queries that have been run */ - protected $queryList=array(); - - /** How many seconds to wait for a query before cancelling it. */ - protected $timeOutSeconds = NULL; - - /** Internal check to determine if a connection has been established. */ - protected $isConnected=FALSE; - - /** Internal check to determine if the parameters have been set. */ - protected $paramsAreSet=FALSE; - - /** Resource handle. */ - protected $connectionID = -1; - - /** Hostname or IP to connect to */ - protected $host; - - /** Port to connect to (default for Postgres is 5432) */ - protected $port; - - /** Name of the database */ - protected $dbname; - - /** Username to connect to the database */ - protected $user; - - /** password to connect to the database */ - protected $password; - - /** Row counter for looping through records */ - protected $row = -1; - - /** cs_globalFunctions object, for string stuff. */ - protected $gfObj; - - /** Internal check to ensure the object has been properly created. */ - protected $isInitialized=FALSE; - - /** List of prepared statements, indexed off the name, with the sub-array being fieldname=>dataType. */ - protected $preparedStatements = array(); - - /** Set to TRUE to save all queries into an array. */ - protected $useQueryList=FALSE; - - /** array that essentially remembers how many times beginTrans() was called. */ - protected $transactionTree = NULL; - - //////////////////////////////////////////// - // Core primary connection/database function - //////////////////////////////////////////// - - - //========================================================================= - public function __construct() { - $this->gfObj = new cs_globalFunctions; - - if(defined('DEBUGPRINTOPT')) { - $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; - } - - $this->isInitialized = TRUE; - }//end __construct() - //========================================================================= - - - - //========================================================================= - /** - * Make sure the object is sane. - */ - final protected function sanity_check() { - if($this->isInitialized !== TRUE) { - throw new exception(__METHOD__ .": not properly initialized"); - } - }//end sanity_check() - //========================================================================= - - - - //========================================================================= - /** - * Set appropriate parameters for database connection - */ - public function set_db_info(array $params){ - $this->sanity_check(); - $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; - $requiredCount++; - } - else { - throw new exception(__METHOD__. ": property (". $index .") does " . - "not exist or isn't allowed"); - } - } - - if($requiredCount == count($required)) { - $this->paramsAreSet = TRUE; - } - else { - throw new exception(__METHOD__ .": required count (". $requiredCount - .") does not match required number of fields (". count($required) .")"); - } - }//end set_db_info() - //========================================================================= - - - - //========================================================================= - /** - * Wrapper for close() - */ - function disconnect() { - //Disconnect from $database - return($this->close()); - }//end disconnect() - //========================================================================= - - - - //========================================================================= - /** - * Standard method to close connection. - */ - function close() { - $this->isConnected = FALSE; - $retval = null; - if($this->connectionID != -1) { - $retval = pg_close($this->connectionID); - } - else { - throw new exception(__METHOD__ .": Failed to close connection: connection is invalid"); - } - - return($retval); - }//end close() - //========================================================================= - - - - //========================================================================= - /** - * Connect to the database - */ - function connect(array $dbParams=NULL, $forceNewConnection=FALSE){ - $this->sanity_check(); - $retval = NULL; - if(is_array($dbParams)) { - $this->set_db_info($dbParams); - } - - if($this->paramsAreSet === TRUE && $this->isConnected === FALSE) { - - $myConnArr = array( - 'host' => $this->host, - 'port' => $this->port, - 'dbname' => $this->dbname, - 'user' => $this->user, - 'password' => $this->password - ); - - //make it into a string separated by spaces, don't clean anything, remove null elements - $connStr = $this->gfObj->string_from_array($myConnArr, 'url', " "); - - //start output buffer for displaying error. - ob_start(); - if($forceNewConnection) { - $connID = pg_connect($connStr, PGSQL_CONNECT_FORCE_NEW); - } - else { - $connID =pg_connect($connStr); - } - $connectError = ob_get_contents(); - ob_end_clean(); - - if(is_resource($connID)) { - $this->errorCode=0; - $this->connectionID = $connID; - $this->isConnected = TRUE; - $retval = $this->connectionID; - } - else { - throw new exception(__METHOD__ .": FATAL ERROR: ". $connectError); - } - } - else { - throw new exception(__METHOD__ .": paramsAreSet=(". $this->paramsAreSet ."), isConnected=(". $this->isConnected .")"); - } - - return($retval); - }//end connect() - //========================================================================= - - - - //========================================================================= - function get_hostname() { - $this->sanity_check(); - return($this->host); - }//end get_hostname() - //========================================================================= - - - - //========================================================================= - /** - * Run sql queries - * - * TODO: re-implement query logging (setting debug, logfilename, etc). - */ - function exec($query) { - $this->lastQuery = $query; - if($this->useQueryList) { - $this->queryList[] = $query; - } - $returnVal = false; - - if(($this->get_transaction_status() != -1) && ($this->connectionID != -1)) { - $this->result = @pg_query($this->connectionID, $query); - - if($this->result !== false) { - if (eregi("^[[:space:]]*select", $query)) { - //If we didn't have an error and we are a select statement, move the pointer to first result - $numRows = $this->numRows(); - if($numRows > 0) { - $this->move_first(); - } - $returnVal = $numRows; - - } - else { - //We got something other than an update. Use numAffected - $returnVal = $this->numAffected(); - } - } - } - return($returnVal); - }//end exec() - //========================================================================= - - - - //========================================================================= - /** - * Returns any error caused by the last executed query. - * - * @return NULL OK: no error - * @return (string) FAIL: contains error returned from the query. - */ - function errorMsg($setMessage=NULL,$logError=NULL) { - $this->sanity_check(); - if ($this->connectionID < 0) { - switch ($this->errorCode) { - //############################################### - case -1: - $retVal = "FATAL ERROR - CONNECTION ERROR: RESOURCE NOT FOUND"; - break; - //############################################### - - //############################################### - case -2: - $retVal = "FATAL ERROR - CLASS ERROR: FUNCTION CALLED WITHOUT PARAMETERS"; - break; - //############################################### - - //############################################### - case -3: - $retVal = "Query exceeded maximum timeout (". $this->timeoutSeconds .")"; - break; - //############################################### - - //############################################### - default: - $retVal = null; - //############################################### - } - } else { - $retVal = pg_last_error($this->connectionID); - } - - return($retVal); - }//end errorMsg() - //========================================================================= - - - - - //////////////////// - // Cursor movement - //////////////////// - - - - - //========================================================================= - /** - * move pointer to first row... [truncated message content] |
From: <cra...@us...> - 2008-02-07 03:55:04
|
Revision: 795 http://cs-project.svn.sourceforge.net/cs-project/?rev=795&view=rev Author: crazedsanity Date: 2008-02-06 19:55:00 -0800 (Wed, 06 Feb 2008) Log Message: ----------- *** RELEASE 1.0.1 *** SUMMARY OF CHANGES::: * update to cs-content v0.10.8 * update to cs-phpxml v0.5.5 * minor template & include changes for updated version of cs-content. * remove invalid links to non-existent "contacts" page... NOTE: changes from trunk of v1.0 were merged SVN COMMAND::: merge -r789:HEAD https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1.0 Modified Paths: -------------- trunk/1.1/VERSION trunk/1.1/includes/login.inc trunk/1.1/lib/cs-arrayToPath/VERSION trunk/1.1/lib/cs-arrayToPath/arrayToPathClass.php trunk/1.1/lib/cs-content/VERSION trunk/1.1/lib/cs-content/contentSystemClass.php trunk/1.1/lib/cs-content/cs_fileSystemClass.php trunk/1.1/lib/cs-content/cs_genericPageClass.php trunk/1.1/lib/cs-content/cs_phpDB.php trunk/1.1/lib/cs-phpxml/xmlAbstract.class.php trunk/1.1/lib/cs-phpxml/xmlBuilderClass.php trunk/1.1/lib/cs-phpxml/xmlParserClass.php trunk/1.1/lib/globalFunctions.php trunk/1.1/lib/projectClass.php trunk/1.1/lib/sessionCacheClass.php trunk/1.1/lib/session_class.php trunk/1.1/lib/site_config.php trunk/1.1/templates/content/helpdesk/view.content.tmpl trunk/1.1/templates/infobar.shared.tmpl Added Paths: ----------- trunk/1.1/lib/cs-content/db_types/ trunk/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php trunk/1.1/templates/content/notes/create.content.tmpl trunk/1.1/templates/content/notes/view.content.tmpl trunk/1.1/templates/login.content.tmpl Removed Paths: ------------- trunk/1.1/templates/content/notes/index.shared.tmpl trunk/1.1/templates/login.tmpl Modified: trunk/1.1/VERSION =================================================================== --- trunk/1.1/VERSION 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/VERSION 2008-02-07 03:55:00 UTC (rev 795) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.1.0 +VERSION: 1.1.1 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ Modified: trunk/1.1/includes/login.inc =================================================================== --- trunk/1.1/includes/login.inc 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/includes/login.inc 2008-02-07 03:55:00 UTC (rev 795) @@ -57,7 +57,7 @@ if($_GET['destination']) { $_SESSION['loginDestination'] = urlencode($_GET['destination']); } -//show the default page. -$page->change_content(html_file_to_string("login.tmpl")); +$page->add_template_var('cs-project_version', VERSION_STRING); + ?> \ No newline at end of file Modified: trunk/1.1/lib/cs-arrayToPath/VERSION =================================================================== --- trunk/1.1/lib/cs-arrayToPath/VERSION 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-arrayToPath/VERSION 2008-02-07 03:55:00 UTC (rev 795) @@ -2,4 +2,4 @@ VERSION: 0.2.2 PROJECT: cs-arrayToPath -$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2.2/VERSION $ \ No newline at end of file +$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2/VERSION $ \ No newline at end of file Modified: trunk/1.1/lib/cs-arrayToPath/arrayToPathClass.php =================================================================== --- trunk/1.1/lib/cs-arrayToPath/arrayToPathClass.php 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-arrayToPath/arrayToPathClass.php 2008-02-07 03:55:00 UTC (rev 795) @@ -6,7 +6,7 @@ * ------------------- * Last Author::::::::: $Author: crazedsanity $ * Current Revision:::: $Revision: 17 $ - * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2.2/arrayToPathClass.php $ + * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2/arrayToPathClass.php $ * Last Updated:::::::: $Date: 2007-09-12 14:24:46 -0500 (Wed, 12 Sep 2007) $ * * Modified: trunk/1.1/lib/cs-content/VERSION =================================================================== --- trunk/1.1/lib/cs-content/VERSION 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-content/VERSION 2008-02-07 03:55:00 UTC (rev 795) @@ -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.6 +VERSION: 0.10.8 PROJECT: cs-content $HeadURL:https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/VERSION $ \ No newline at end of file Modified: trunk/1.1/lib/cs-content/contentSystemClass.php =================================================================== --- trunk/1.1/lib/cs-content/contentSystemClass.php 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-content/contentSystemClass.php 2008-02-07 03:55:00 UTC (rev 795) @@ -1,10 +1,10 @@ -<? +<?php /* * FILE INFORMATION: * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/contentSystemClass.php $ - * $Id: contentSystemClass.php 221 2007-11-21 17:39:01Z crazedsanity $ - * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ - * $LastChangedRevision: 221 $ + * $Id: contentSystemClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ + * $LastChangedRevision: 252 $ * $LastChangedBy: crazedsanity $ * * HOW THE SYSTEM WORKS::: @@ -90,12 +90,15 @@ ); protected $templateList = array(); protected $includesList = array(); - protected $templateObj = NULL; + public $templateObj = NULL; protected $gfObj = NULL; protected $tabs = NULL; protected $finalSection; + private $isValid=FALSE; + private $reason=NULL; + //------------------------------------------------------------------------ /** * The CONSTRUCTOR. Duh. @@ -257,8 +260,7 @@ * Rips apart the "section" string, setting $this->section and $this->sectionArr. */ private function parse_section() { - // - if($this->section === 0) { + if($this->section === 0 || is_null($this->section) || !strlen($this->section)) { $this->section = "content/index"; } $myArr = split('/', $this->section); @@ -286,8 +288,10 @@ //make sure we've still got something valid to work with. if(!strlen($section)) { + //TODO: remove the extra return statement (should only be one at the bottom of the method). return(0); - } else { + } + else { //check the string to make sure it doesn't begin or end with a "/" if($section[0] == '/') { $section = substr($section, 1, strlen($section)); @@ -359,8 +363,9 @@ //now cd() all the way back. $this->fileSystemObj->cd('/'); - } else { - //couldn't find the templates directory... ick. + } + else { + //couldn't find the templates directory, and no includes... it's dead. $this->die_gracefully(__METHOD__ .": unable to find the templates directory, or non-valid page [". $this->validate_page() ."]"); } }//end prepare() @@ -399,14 +404,17 @@ } $lsDir = $this->fileSystemObj->ls($indexFilename); + $lsDirVals = array_values($lsDir); $lsFile = $this->fileSystemObj->ls("$finalSection.content.tmpl"); - if(is_array(array_values($lsDir))) { - //it's the dir. + + if(is_array(array_values($lsFile)) && is_array($lsFile[$finalSection .".content.tmpl"])) { + //it's the file ("{finalSection}.content.tmpl", like "mySection.content.tmpl") + $myIndex = $finalSection .".content.tmpl"; + } + elseif(is_array(array_values($lsDir)) && (is_array($lsDir[$indexFilename]))) { $myIndex = $indexFilename; - } elseif(is_array(array_values($lsFile))) { - //it's the file (no dir, or dir w/o index) - $myIndex = $finalSection.content.tmpl; - } else { + } + else { //nothin' doin'. $myIndex = NULL; } @@ -420,21 +428,35 @@ if(isset($myIndex)) { $valid = TRUE; $this->fileSystemObj->cd('/templates'); - } else { - $this->reason = __METHOD__ .": couldn't find page template for (". $this->section .", final=[$finalSection])..."; } - } else { - //just the base template. Make sure it's good. + else { + $this->reason = __METHOD__ .": couldn't find page template for ". $this->section; + } + } + else { + //if the baseDir is "help", this would try to use "/help/index.content.tmpl" $myFile = $this->baseDir .'/index.content.tmpl'; - $lsData = $this->fileSystemObj->ls($myFile); - if(isset($lsData[$myFile]) && $lsData[$myFile]['type'] == 'file') { + $sectionLsData = $this->fileSystemObj->ls($myFile); + + //if the baseDir is "help", this would try to use "/help.content.tmpl" + $sectionFile = $this->baseDir .'.content.tmpl'; + $lsData = $this->fileSystemObj->ls(); + + if(isset($lsData[$sectionFile]) && is_array($lsData[$sectionFile])) { + $valid = TRUE; + $this->finalSection = $this->baseDir; + } + elseif(isset($sectionLsData[$myFile]) && $sectionLsData[$myFile]['type'] == 'file') { //we're good. $valid = TRUE; $this->finalSection = $this->baseDir; - } else { + } + else { $this->reason = __METHOD__ .": couldn't find base template."; } } + $this->isValid = $valid; + return($valid); }//end validate_page() //------------------------------------------------------------------------ @@ -486,6 +508,10 @@ $this->templateList[$mySection] = $myTmpl; } } + if(isset($tmplList[$this->baseDir]['content'])) { + //load template for the main page (if $this->baseDir == "help", this would load "/help.content.tmpl" as content) + $this->templateList['content'] = $tmplList[$this->baseDir]['content']; + } } }//end load_page_templates() //------------------------------------------------------------------------ @@ -553,6 +579,7 @@ if(($myType == 'file') && !in_array($index, $this->ignoredList[$myType])) { $filename = $this->gfObj->create_list($this->fileSystemObj->cwd, $index, '/'); $filename = preg_replace('/^\/templates/', '', $filename); + $filename = preg_replace('/^\/\//', '/', $filename); //call another method to rip the filename apart properly, then arrange things as needed. $pieces = $this->parse_filename($index); $myPriIndex = $pieces[$primaryIndex]; @@ -687,7 +714,7 @@ } else { //TODO: make it *actually* die gracefully... the way it works now looks more like puke than grace. - throw new exception(__METHOD__ .": something broke. \nDETAILS::: $details" . + throw new exception(__METHOD__ .": Couldn't find 404 template, plus additional error... \nDETAILS::: $details" . "\nREASON::: ". $this->reason); } }//end die_gracefully() @@ -762,7 +789,16 @@ unset($myInternalScriptName); } - $page->print_page(); + if(is_bool($this->templateObj->allow_invalid_urls() === TRUE) && $this->isValid === FALSE) { + $this->isValid = $this->templateObj->allow_invalid_urls(); + } + + if($this->isValid === TRUE) { + $page->print_page(); + } + else { + $this->die_gracefully($this->reason); + } }//end finish() //------------------------------------------------------------------------ @@ -772,8 +808,7 @@ /** * Method for accessing the protected $this->sectionArr array. */ - public function get_sectionArr() - { + public function get_sectionArr() { //give 'em what they want. return($this->sectionArr); }//end get_sectionArr() @@ -785,8 +820,7 @@ /** * Method for accessing the protected member $this->finalSection. */ - public function get_finalSection() - { + public function get_finalSection() { //give 'em what they want. return($this->finalSection); }//end get_finalSection() @@ -798,8 +832,7 @@ /** * Method for accessing "baseDir", only referenced as the base section. */ - public function get_baseSection() - { + public function get_baseSection() { return($this->baseDir); }//end get_baseSection() //------------------------------------------------------------------------ Modified: trunk/1.1/lib/cs-content/cs_fileSystemClass.php =================================================================== --- trunk/1.1/lib/cs-content/cs_fileSystemClass.php 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-content/cs_fileSystemClass.php 2008-02-07 03:55:00 UTC (rev 795) @@ -1,12 +1,12 @@ -<? +<?php /* * FILE INFORMATION: * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_fileSystemClass.php $ - * $Id: cs_fileSystemClass.php 221 2007-11-21 17:39:01Z crazedsanity $ - * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ + * $Id: cs_fileSystemClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 221 $ + * $LastChangedRevision: 252 $ */ require_once(dirname(__FILE__) ."/cs_globalFunctions.php"); Modified: trunk/1.1/lib/cs-content/cs_genericPageClass.php =================================================================== --- trunk/1.1/lib/cs-content/cs_genericPageClass.php 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-content/cs_genericPageClass.php 2008-02-07 03:55:00 UTC (rev 795) @@ -2,10 +2,10 @@ /* * FILE INFORMATION: * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_genericPageClass.php $ - * $Id: cs_genericPageClass.php 221 2007-11-21 17:39:01Z crazedsanity $ - * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ + * $Id: cs_genericPageClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 221 $ + * $LastChangedRevision: 252 $ */ require_once(dirname(__FILE__) ."/template.inc"); require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); @@ -22,6 +22,8 @@ private $showEditableLink = FALSE; + private $allowInvalidUrls=NULL; + //--------------------------------------------------------------------------------------------- /** * The constructor. @@ -257,7 +259,7 @@ if($stripUndefVars) { $numLoops = 0; - while(preg_match_all('/\{.*?\}/', $this->templateObj->varvals['out'], $tags) && $numLoops < 50) { + while(preg_match_all('/\{.\S+?\}/', $this->templateObj->varvals['out'], $tags) && $numLoops < 50) { $tags = $tags[0]; //TODO: figure out why this works when running it twice. @@ -286,8 +288,9 @@ */ public function process_set_message() { //if there's not a message set, skip. - $errorBox = $this->file_to_string("system/message_box.tmpl"); + $errorBox = ""; if(isset($_SESSION['message']) && is_array($_SESSION['message'])) { + $errorBox = $this->file_to_string("system/message_box.tmpl"); //let's make sure the "type" value is *lowercase*. $_SESSION['message']['type'] = strtolower($_SESSION['message']['type']); @@ -307,6 +310,7 @@ // they'll never get past this point). unset($_SESSION['message']); } + return($errorBox); }//end of process_set_message() //--------------------------------------------------------------------------------------------- @@ -595,6 +599,17 @@ return($retval); }//end set_all_block_rows() //--------------------------------------------------------------------------------------------- + + + + //--------------------------------------------------------------------------------------------- + public function allow_invalid_urls($newSetting=NULL) { + if(!is_null($newSetting) && is_bool($newSetting)) { + $this->allowInvalidUrls = $newSetting; + } + return($this->allowInvalidUrls); + }//end allow_invalid_urls() + //--------------------------------------------------------------------------------------------- }//end cs_genericPage{} ?> Modified: trunk/1.1/lib/cs-content/cs_phpDB.php =================================================================== --- trunk/1.1/lib/cs-content/cs_phpDB.php 2008-02-07 02:19:25 UTC (rev 794) +++ trunk/1.1/lib/cs-content/cs_phpDB.php 2008-02-07 03:55:00 UTC (rev 795) @@ -4,8 +4,8 @@ * A class for generic PostgreSQL database access. * * SVN INFORMATION::: - * SVN Signature:::::::: $Id: cs_phpDB.php 225 2007-12-19 00:20:13Z crazedsanity $ - * Last Committted Date: $Date: 2007-12-18 18:20:13 -0600 (Tue, 18 Dec 2007) $ + * SVN Signature:::::::: $Id: cs_phpDB.php 252 2008-01-31 21:57:49Z crazedsanity $ + * Last Committted Date: $Date: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * Last Committed Path:: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_phpDB.php $ * */ @@ -32,1132 +32,51 @@ require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); class cs_phpDB extends cs_versionAbstract { - - /** Internal result set pointer. */ - protected $result = NULL; - /** Internal error code. */ - protected $errorCode = 0; + private $dbLayerObj; + private $dbType; - /** Status of the current transaction. */ - protected $transStatus = NULL; - - /** Whether there is a transaction in progress or not. */ - protected $inTrans = FALSE; - - /** Holds the last query performed. */ - protected $lastQuery = NULL; - - /** List of queries that have been run */ - protected $queryList=array(); - - /** How many seconds to wait for a query before cancelling it. */ - protected $timeOutSeconds = NULL; - - /** Internal check to determine if a connection has been established. */ - protected $isConnected=FALSE; - - /** Internal check to determine if the parameters have been set. */ - protected $paramsAreSet=FALSE; - - /** Resource handle. */ - protected $connectionID = -1; - - /** Hostname or IP to connect to */ - protected $host; - - /** Port to connect to (default for Postgres is 5432) */ - protected $port; - - /** Name of the database */ - protected $dbname; - - /** Username to connect to the database */ - protected $user; - - /** password to connect to the database */ - protected $password; - - /** Row counter for looping through records */ - protected $row = -1; - - /** cs_globalFunctions object, for string stuff. */ - protected $gfObj; - - /** Internal check to ensure the object has been properly created. */ - protected $isInitialized=FALSE; - - /** List of prepared statements, indexed off the name, with the sub-array being fieldname=>dataType. */ - protected $preparedStatements = array(); - - /** Set to TRUE to save all queries into an array. */ - protected $useQueryList=FALSE; - - /** array that essentially remembers how many times beginTrans() was called. */ - protected $transactionTree = NULL; - - //////////////////////////////////////////// - // Core primary connection/database function - //////////////////////////////////////////// - - //========================================================================= - public function __construct() { - $this->gfObj = new cs_globalFunctions; + public function __construct($type='pgsql') { - if(defined('DEBUGPRINTOPT')) { - $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; - } - - $this->isInitialized = TRUE; - }//end __construct() - //========================================================================= - - - - //========================================================================= - /** - * Make sure the object is sane. - */ - final protected function sanity_check() { - if($this->isInitialized !== TRUE) { - throw new exception(__METHOD__ .": not properly initialized"); - } - }//end sanity_check() - //========================================================================= - - - - //========================================================================= - /** - * Set appropriate parameters for database connection - */ - public function set_db_info(array $params){ - $this->sanity_check(); - $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; - $requiredCount++; - } - else { - throw new exception(__METHOD__. ": property (". $index .") does " . - "not exist or isn't allowed"); - } - } - - if($requiredCount == count($required)) { - $this->paramsAreSet = TRUE; - } - else { - throw new exception(__METHOD__ .": required count (". $requiredCount - .") does not match required number of fields (". count($required) .")"); - } - }//end set_db_info() - //========================================================================= - - - - //========================================================================= - /** - * Wrapper for close() - */ - function disconnect() { - //Disconnect from $database - return($this->close()); - }//end disconnect() - //========================================================================= - - - - //========================================================================= - /** - * Standard method to close connection. - */ - function close() { - $this->isConnected = FALSE; - $retval = null; - if($this->connectionID != -1) { - $retval = pg_close($this->connectionID); - } - else { - throw new exception(__METHOD__ .": Failed to close connection: connection is invalid"); - } - - return($retval); - }//end close() - //========================================================================= - - - - //========================================================================= - /** - * Connect to the database - */ - function connect(array $dbParams=NULL, $forceNewConnection=FALSE){ - $this->sanity_check(); - $retval = NULL; - if(is_array($dbParams)) { - $this->set_db_info($dbParams); - } - - if($this->paramsAreSet === TRUE && $this->isConnected === FALSE) { + if(strlen($type)) { - $myConnArr = array( - 'host' => $this->host, - 'port' => $this->port, - 'dbname' => $this->dbname, - 'user' => $this->user, - 'password' => $this->password - ); + require_once(dirname(__FILE__) .'/db_types/'. __CLASS__ .'__'. $type .'.class.php'); + $className = __CLASS__ .'__'. $type; + $this->dbLayerObj = new $className; + $this->dbType = $type; - //make it into a string separated by spaces, don't clean anything, remove null elements - $connStr = $this->gfObj->string_from_array($myConnArr, 'url', " "); + $this->gfObj = new cs_globalFunctions; - //start output buffer for displaying error. - ob_start(); - if($forceNewConnection) { - $connID = pg_connect($connStr, PGSQL_CONNECT_FORCE_NEW); + if(defined('DEBUGPRINTOPT')) { + $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; } - else { - $connID =pg_connect($connStr); - } - $connectError = ob_get_contents(); - ob_end_clean(); - if(is_resource($connID)) { - $this->errorCode=0; - $this->connectionID = $connID; - $this->isConnected = TRUE; - $retval = $this->connectionID; - } - else { - throw new exception(__METHOD__ .": FATAL ERROR: ". $connectError); - } + $this->isInitialized = TRUE; } else { - throw new exception(__METHOD__ .": paramsAreSet=(". $this->paramsAreSet ."), isConnected=(". $this->isConnected .")"); + throw new exception(__METHOD__ .": failed to give a type (". $type .")"); } - - return($retval); - }//end connect() + }//end __construct() //========================================================================= //========================================================================= - function get_hostname() { - $this->sanity_check(); - return($this->host); - }//end get_hostname() - //========================================================================= - - - - //========================================================================= - /** - * Run sql queries - * - * TODO: re-implement query logging (setting debug, logfilename, etc). - */ - function exec($query) { - $this->lastQuery = $query; - if($this->useQueryList) { - $this->queryList[] = $query; - } - $returnVal = false; - - if(($this->get_transaction_status() != -1) && ($this->connectionID != -1)) { - $this->result = @pg_query($this->connectionID, $query); - - if($this->result !== false) { - if (eregi("^[[:space:]]*select", $query)) { - //If we didn't have an error and we are a select statement, move the pointer to first result - $numRows = $this->numRows(); - if($numRows > 0) { - $this->move_first(); - } - $returnVal = $numRows; - - } - else { - //We got something other than an update. Use numAffected - $returnVal = $this->numAffected(); - } - } - } - return($returnVal); - }//end exec() - //========================================================================= - - - - //========================================================================= /** - * Returns any error caused by the last executed query. - * - * @return NULL OK: no error - * @return (string) FAIL: contains error returned from the query. + * Magic method to call methods within the database abstraction layer ($this->dbLayerObj). */ - function errorMsg($setMessage=NULL,$logError=NULL) { - $this->sanity_check(); - if ($this->connectionID < 0) { - switch ($this->errorCode) { - //############################################### - case -1: - $retVal = "FATAL ERROR - CONNECTION ERROR: RESOURCE NOT FOUND"; - break; - //############################################### - - //############################################### - case -2: - $retVal = "FATAL ERROR - CLASS ERROR: FUNCTION CALLED WITHOUT PARAMETERS"; - break; - //############################################### - - //############################################### - case -3: - $retVal = "Query exceeded maximum timeout (". $this->timeoutSeconds .")"; - break; - //############################################### - - //############################################### - default: - $retVal = null; - //############################################### - } - } else { - $retVal = pg_last_error($this->connectionID); + public function __call($methodName, $args) { + if(method_exists($this->dbLayerObj, $methodName)) { + $retval = call_user_func_array(array($this->dbLayerObj, $methodName), $args); } - - return($retVal); - }//end errorMsg() - //========================================================================= - - - - - //////////////////// - // Cursor movement - //////////////////// - - - - - //========================================================================= - /** - * move pointer to first row of result set - */ - function move_first() { - $this->sanity_check(); - if($this->result == NULL) { - $retval = FALSE; - } else { - $this->set_row(0); - $retval = TRUE; + throw new exception(__METHOD__ .': unsupported method ('. $methodName .') for database of type ('. $this->dbType .')'); } - return($retval); - }//end move_first() + }//end __call() //========================================================================= - - - //========================================================================= - /** - * move pointer to last row of result set - */ - function move_last() { - $this->sanity_check(); - if($this->result == NULL) { - $retval = FALSE; - } - else { - $this->set_row($this->numRows()-1); - $retval = TRUE; - } - - return($retval); - }//end move_list() - //========================================================================= - - - - //========================================================================= - /** - * point to the next row, return false if no next row - */ - function move_next() { - $this->sanity_check(); - // If more rows, then advance row pointer - if($this->row < $this->numRows()-1) { - $this->set_row($this->row +1); - $retval = TRUE; - } - else { - $retval = FALSE; - } - - return($retval); - }//end move_next() - //========================================================================= - - - - //========================================================================= - /** - * point to the previous row, return false if no previous row - */ - function move_previous() { - // If not first row, then advance row pointer - if ($this->row > 0) { - $this->set_row($this->row -1); - return true; - } - else return false; - }//end move_previous() - //========================================================================= - - - - //========================================================================= - // point to the next row, return false if no next row - function next_row() { - // If more rows, then advance row pointer - if ($this->row < $this->numRows()-1) { - $this->set_row($this->row +1); - return true; - } - else return false; - }//end next_row() - //========================================================================= - - - - //========================================================================= - // can be used to set a pointer to a perticular row - function set_row($row){ - if(is_numeric($row)) { - $this->row = $row; - } - else { - throw new exception(__METHOD__ .": invalid data for row (". $row .")"); - } - return($this->row); - }//end set_row(); - //========================================================================= - - - - - /////////////////////// - // Result set related - /////////////////////// - - - - //========================================================================= - /** - * Return the current row as an object. - */ - function fobject() { - $this->sanity_check(); - if($this->result == NULL || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_object($this->result, $this->row); - } - - return($retval); - } - //========================================================================= - - - - //========================================================================= - /** - * Fetch the current row as an array containing fieldnames AND numeric indexes. - */ - function farray(){ - if($this->result == NULL || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_array($this->result,$this->row); - } - - return($retval); - }//end farray() - //========================================================================= - - - - //========================================================================= - /** - * Another way to retrieve a single row (useful for loops). - */ - function frow(){ - $this->sanity_check(); - if($this->numRows() <= 0) { - $retval = NULL; - } - else { - if($this->result == null || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_row($this->result, $this->row); - } - } - - return($retval); - }//end frow() - //========================================================================= - - - - //========================================================================= - /** - * Similar to farray(), except all indexes are non-numeric, and the entire - * result set is retrieved: if only one row is available, no numeric index - * is set, unless $numbered is TRUE. - * - * TODO: clean this up! - */ - function farray_fieldnames($index=NULL, $numbered=NULL,$unsetIndex=1) { - $this->sanity_check(); - $retval = NULL; - - //before we get too far, let's make sure there's something there. - if($this->numRows() <= 0) { - $retval = 0; - } - else { - //keep any errors/warnings from printing to the screen by using OUTPUT BUFFERS. - ob_start(); - - $x = 0; - do { - $temp = $this->farray(); - foreach($temp as $key=>$value) { - //remove the numbered indexes. - if(is_string($key)) { - $tArr[$key] = $value; - } - } - $newArr[$x] = $tArr; - $x++; - } - while($this->next_row()); - - if($index) { - foreach($newArr as $row=>$contents) { //For each of the returned sets of information - foreach($contents as $fieldname=>$value) { //And now for each of the items in that set - if($fieldname == $index) { - //The index for the new array will be this fieldname's value - $arrayKey = $value; - } - - $tempContent[$fieldname] = $value; - //don't include the "index" field in the subarray; that always seems to end badly. - if ($unsetIndex) { - unset($tempContent[$index]); - } - } - - if (!isset($tempArr[$arrayKey])) { - //Make sure we didn't already set this in the array. If so, then we don't have a unique variable to use for the array index. - $tempArr[$arrayKey] = $tempContent; - } - else { - //TODO: bigtime cleaning... should only return at the bottom of the method. - $retval = 0; - break; - } - $arrayKey = NULL; //Blank this out after using it, just in case we don't find one in the next iteration - } - - if (count($tempArr) != count($newArr)) { - $details = "farray_fieldnames(): Array counts don't match.<BR>\n" - ."FUNCTION ARGUMENTS: index=[$index], numbered=[$numbered], unsetIndex=[$unsetIndex]<BR>\n" - ."LAST QUERY: ". $this->lastQuery; - throw new exception(__METHOD__ .": $details"); - } - $newArr = $tempArr; - } - //this is where, if there's only one row (and the planets align just the way - // I like them to), there's no row w/ a sub-array... This is only done - // if $index is NOT set... - if(($this->numRows() == 1) AND (!$index) AND (!$numbered)) { - $newArr = $newArr[0]; - } - $retval = $newArr; - ob_end_clean(); - } - return($retval); - }//end farray_fieldnames() - //========================================================================= - - - - //========================================================================= - /** - * Uses farray_fieldnames() to retrieve the entire result set, but the final - * array is contains name=>value pairs. - */ - function farray_nvp($name, $value) { - if((!$name) OR (!$value)) { - $retval = 0; - } - else { - $tArr = $this->farray_fieldnames(NULL,1); - if(!is_array($tArr)) { - $retval = 0; - } - else { - //loop through it & grab the proper info. - $retval = array(); - foreach($tArr as $row=>$array) { - $tKey = $array[$name]; - $tVal = $array[$value]; - $retval[$tKey] = $tVal; - } - } - } - - //return the new array. - return($retval); - }//end farray_nvp() - //========================================================================= - - - - //========================================================================= - /** - * Similar to farray_fieldnames(), but only returns the NUMERIC indexes - */ - function farray_numbered() { - do { - $temp = $this->frow(); - $retArr[] = $temp[0]; - } - while($this->next_row()); - - return($retArr); - }//end farray_numbered() - //========================================================================= - - - - //========================================================================= - /** - * Returns the number of tuples affected by an insert/delete/update query. - * NOTE: select queries must use numRows() - */ - function numAffected() { - if($this->result == null) { - $retval = 0; - } else { - $this->affectedRows = pg_affected_rows($this->result); - $retval = $this->affectedRows; - } - - return($retval); - }//end numAffected() - //========================================================================= - - - - //========================================================================= - /** - * Returns the number of rows in a result (from a SELECT query). - */ - function numRows() { - if ($this->result == null) { - $retval = 0; - } - else { - $this->numrows = pg_num_rows($this->result); - $retval = $this->numrows; - } - - return($retval); - }//end numRows() - //========================================================================= - - - - //========================================================================= - /** - * wrapper for numAffected() - */ - function affectedRows(){ - return($this->numAffected()); - }//end affectedRows() - //========================================================================= - - - - //========================================================================= - /** - * Returns the current row number. - */ - function currRow(){ - return($this->row); - }//end currRow() - //========================================================================= - - - - //========================================================================= - /** - * Get the number of fields in a result. - */ - // get the number of fields in a result - function num_fields() { - if($this->result == null) { - $retval = 0; - } - else { - $retval = pg_num_fields($this->result); - } - return($retval); - }//end num_fields() - //========================================================================= - - - - //========================================================================= - function column_count() { - return($this->numFields()); - }//end column_count() - //========================================================================= - - - - //========================================================================= - /** - * get last OID (object identifier) of last INSERT statement - */ - function lastOID($doItForMe=0, $field=NULL) { - if($this->result == NULL) { - $retval = NULL; - } - else { - $tOid = pg_last_oid($this->result); - $retval = $tOid; - - if(($doItForMe) AND (eregi("^insert", $this->last_query))) { - //attempt to parse the insert statement, then select - // all fields (unless $field is set) from it. - $t = split(" into ", strtolower($this->last_query)); - $t = split(" ", $t[1]); - $t = split("\(", $t[0]); - $table = $t[0]; - - //now we have the table. - if(!$field) { - $field = "*"; - } - $query = "SELECT $field FROM $table WHERE OID=$tOid"; - $this->exec($query); - $dberror = $this->errorMsg(1,1,1,"lastOID(): "); - - if(!$dberror) { - $res = $this->farray(); - if(is_string($field)) { - $retval = $res[0]; - } - } - } - } - return($retval); - }//end lastOID() - //========================================================================= - - - - //========================================================================= - /** - * get result field name of the given field number. - */ - // get result field name - function fieldname($fieldnum) { - if($this->result == NULL) { - $retval =NULL; - } - else { - $retval = pg_field_name($this->result, $fieldnum); - } - - return($retval); - }//end fieldname() - //========================================================================= - - - - - //////////////////////// - // Transaction related - //////////////////////// - - - - - //========================================================================= - /** - * Start a transaction. - */ - function beginTrans($transName=NULL) { - $transStatus = $this->get_transaction_status(TRUE); - if(!$this->inTrans) { - //not in a transaction. Set up the transaction tree properly. - $this->transactionTree = array(); - } - else { - if($this->inTrans && is_null($this->transactionTree)) { - $transLevel = $this->get_transaction_level(); - //transaction started without using beginTrans()... - $this->transactionTree = array(); - $this->gfObj->debug_print(__METHOD__ .": transaction already started, transStatus=(". $transStatus ."), transLevel=(". $transLevel .")"); - $this->transactionTree[] = "Already started..."; - } - } - - if(is_null($transName)) { - $transName = time(TRUE); - } - $this->transactionTree[] = $transName; - $transLevel = $this->get_transaction_level(); - $this->gfObj->debug_print(__METHOD__ .": starting transaction at transLevel=(". $transLevel .")"); - return($this->exec("BEGIN")); - }//end beginTrans() - //========================================================================= - - - - //========================================================================= - /** - * Commit a transaction. - */ - function commitTrans() { - $retval = $this->get_transaction_status(); - $lastTransLayer = array_pop($this->transactionTree); - $transLevel = $this->get_transaction_level(); - if($transLevel == 0) { - if($retval > 1) { - $retval = 1; - } - $this->exec("COMMIT"); - - //check to see if there was an error (deferred constraints are checked at commit time) - if(strlen($this->errorMsg())) { - $retval = 0; - } - } - $this->get_transaction_status(); - return($retval); - }//end commitTrans() - //========================================================================= - - - - //========================================================================= - // returns true/false - function rollbackTrans() { - $retval = $this->exec("ABORT"); - $this->get_transaction_status(); - return($retval); - }//end rollbackTrans() - //========================================================================= - - - - //////////////////////// - // SQL String Related - //////////////////////// - - - - //========================================================================= - /** - * Gets rid of evil characters that might lead ot SQL injection attacks. - */ - function querySafe($string) { - return($this->gfObj->cleanString($string,"query")); - }//end querySafe() - //========================================================================= - - - - //========================================================================= - /** - * Make it SQL safe. - */ - function sqlSafe($string) { - return($this->gfObj->cleanString($string,"sql")); - }//end sqlSafe() - //========================================================================= - - - - //========================================================================= - /** - * Gives textual explanation of the current status of our database - * connection. - * - * @param $goodOrBad (bool,optional) return good/bad status. - * - * @return (-1) (FAIL) connection is broken - * @return (0) (FAIL) error was encountered (transient error) - * @return (1) (PASS) useable - * @return (2) (PASS) useable, but not just yet (working - * on something) - */ - function get_transaction_status($goodOrBad=TRUE) { - $myStatus = pg_transaction_status($this->connectionID); - $text = 'unknown'; - switch($myStatus) { - case PGSQL_TRANSACTION_IDLE: { - //No query in progress: it's idle. - $goodOrBadValue = 1; - $text = 'idle'; - $this->inTrans = FALSE; - } - break; - - - case PGSQL_TRANSACTION_ACTIVE: { - //there's a command in progress. - $goodOrBadValue = 2; - $text = 'processing'; - } - break; - - - case PGSQL_TRANSACTION_INTRANS: { - //connection idle within a valid transaction block. - $goodOrBadValue = 1; - $text = 'valid transaction'; - $this->inTrans = TRUE; - } - break; - - - case PGSQL_TRANSACTION_INERROR: { - //connection idle within a broken transaction. - $goodOrBadValue = 0; - $text = 'failed transaction'; - $this->inTrans = TRUE; - } - break; - - - case PGSQL_TRANSACTION_UNKNOWN: - default: { - //the connection is bad. - $goodOrBadValue = -1; - $text = 'bad connection'; - } - break; - } - - //do they want text or the good/bad number? - $retval = $text; - $this->transactionStatus = $goodOrBadValue; - if($goodOrBad) { - //they want the number. - $retval = $goodOrBadValue; - } - - return($retval); - }//end get_transaction_status() - //========================================================================= - - - - //========================================================================= - public function is_connected() { - $retval = FALSE; - if(is_resource($this->connectionID) && $this->isConnected === TRUE) { - $retval = TRUE; - } - - return($retval); - }//end is_connected() - //========================================================================= - - - - //========================================================================= - /** - * Create a prepared statement. - */ - public function create_prepared_statement($planName,array $fieldToType, $statement) { - $retval = FALSE; - //store the mappings. - $this->preparedStatements[$planName] = $fieldToType; - - //TODO: check that the string in "$statement" has the same number of "${n}" as are in "$fieldToType". - - $dataTypeString = ""; - foreach($fieldToType as $field => $type) { - $dataTypeString = $this->gfObj->create_list($dataTypeString, $type, ", "); - } - - $sql = "PREPARE ". $planName ."(". $dataTypeString .") AS ". $statement; - - $myNumrows = $this->exec($sql); - $myDberror = $this->errorMsg(); - - if(!strlen($myDberror)) { - $retval = TRUE; - } - else { - throw new exception(__METHOD__ .": failed to create prepared statement '". $planName ."'... dberror::: ". $myDberror ."\n\nSQL::: ". $sql); - } - - return($retval); - }//end create_prepared_statement() - //========================================================================= - - - - //========================================================================= - /** - * Run a statement prepared by this object. - * - * NOTE: determination of rows affected (numAffected) vs. rows returned (numRows) - * must be done by the user via the referenced methods. - */ - public function run_prepared_statement($name, array $data) { - $retval = FALSE; - if(is_array($this->preparedStatements[$name]) && count($data) == count($this->preparedStatements[$name])) { - $this->result = pg_execute($this->connectionID, $name, $data); - $dberror = $this->errorMsg(); - - if(!strlen($dberror)) { - $retval = TRUE; - } - } - else { - throw new exception(__METHOD__ .": invalid statement name (". $name ."), or incorrect number of elements"); - } - - return($retval); - }//end run_prepared_statement() - //========================================================================= - - - - //========================================================================= - /** - * Starts a copy command. - * - * TODO: implement safeguards so they can only put a line until the copy is ended. - */ - public function start_copy($tableName, array $fields) { - $retval = FALSE; - $copyStmt = "COPY ". $tableName ." (". $this->gfObj->string_from_array($fields, NULL, ", ") . ") FROM stdin;"; - $this->exec($copyStmt); - if(!strlen($this->errorMsg())) { - //TODO: set something here so that NOTHING ELSE can be done except put_line() and end_copy(). - $this->copyInProgress = TRUE; - $retval = TRUE; - } - else { - $this->end_copy(); - $retval = FALSE; - } - - return($retval); - }//end start_copy() - //========================================================================= - - - - //========================================================================= - /** - * Used to send a line to the COPY in progress (only if it was initiated by - * the internal start_copy() method). - * - * NOTE: the "end-of-copy" line, '\.', should NEVER be sent here. - */ - public function put_line($line) { - $retval = FALSE; - if($this->copyInProgress === TRUE) { - $myLine = trim($line); - $myLine .= "\n"; - - $retval = pg_put_line($this->connectionID, $myLine); - } - else { - throw new exception(__METHOD__ .": cannot send line if no copy is in progress"); - } - - return($retval); - }//end put_line() - //========================================================================= - - - - //========================================================================= - public function end_copy() { - if($this->copyInProgress === TRUE) { - //send the end-of-copy line... - $this->put_line("\\.\n"); - } - - $retval = pg_end_copy($this->connectionID); - - return($retval); - }//end end_copy() - //========================================================================= - - - - //========================================================================= - /** - * Determines how many times a transaction has been started. Starting - * multiple transactions does NOT protect the outer transaction from - * problems that occur in the inner transaction. In fact, it does the - * opposite: it protects the code from committing too early (which might - * destroy something that depending on the transaction). - */ - public function get_transaction_level() { - if(is_array($this->transactionTree)) { - $retval = count($this->transactionTree); - } - else { - $retval = 0; - } - - return($retval); - }//end get_transaction_level() - //========================================================================= - - - - //========================================================================= - /** - * Simple way to determine if the current connection is inside a - * transaction or not. - */ - public function is_in_transaction() { - $retval = 0; - if($this->inTrans || $this->get_transaction_level() != 0) { - $retval = TRUE; - } - return($retval); - }//end is_in_transaction() - //========================================================================= - - - } // end class phpDB ?> Added: trunk/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php =================================================================== --- trunk/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php (rev 0) +++ trunk/1.1/lib/cs-content/db_types/cs_phpDB__pgsql.class.php 2008-02-07 03:55:00 UTC (rev 795) @@ -0,0 +1,1160 @@ +<?php + +/* + * A class for generic PostgreSQL database access. + * + * SVN INFORMATION::: + * SVN Signature:::::::: $Id: cs_phpDB__pgsql.class.php 252 2008-01-31 21:57:49Z crazedsanity $ + * Last Committted Date: $Date: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ + * Last Committed Path:: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/db_types/cs_phpDB__pgsql.class.php $ + * + */ + +/////////////////////// +// ORIGINATION INFO: +// Author: Trevin Chow (with contributions from Lee Pang, wle...@ho...) +// Email: t1...@ma... +// Date: February 21, 2000 +// Last Updated: August 14, 2001 +// +// Description: +// Abstracts both the php function calls and the server information to POSTGRES +// databases. Utilizes class variables to maintain connection information such +// as number of rows, result id of last operation, etc. +// +/////////////////////// + +//TODO: option to not use layered transactions +//TODO: rollbackTrans() in layered transaction causes abort when final layer is committed/aborted +//TODO: stop sending queries to backend when transction is bad/aborted. +//TODO: commit/abort specific layer requests (i.e. if there's 8 layers & the first is named "x", calling commitTrans("x") will cause the whole transaction to commit & all layers to be destroyed. + +class cs_phpDB__pgsql { + + /** Internal result set pointer. */ + protected $result = NULL; + + /** Internal error code. */ + protected $errorCode = 0; + + /** Status of the current transaction. */ + protected $transStatus = NULL; + + /** Whether there is a transaction in progress or not. */ + protected $inTrans = FALSE; + + /** Holds the last query performed. */ + protected $lastQuery = NULL; + + /** List of queries that have been run */ + protected $queryList=array(); + + /** How many seconds to wait for a query before cancelling it. */ + protected $timeOutSeconds = NULL; + + /** Internal check to determine if a connection has been established. */ + protected $isConnected=FALSE; + + /** Internal check to determine if the parameters have been set. */ + protected $paramsAreSet=FALSE; + + /** Resource handle. */ + protected $connectionID = -1; + + /** Hostname or IP to connect to */ + protected $host; + + /** Port to connect to (default for Postgres is 5432) */ + protected $port; + + /** Name of the database */ + protected $dbname; + + /** Username to connect to the database */ + protected $user; + + /** password to connect to the database */ + protected $password; + + /** Row counter for looping through records */ + protected $row = -1; + + /** cs_globalFunctions object, for string stuff. */ + protected $gfObj; + + /** Internal check to ensure the object has been properly created. */ + protected $isInitialized=FALSE; + + /** List of prepared statements, indexed off the name, with the sub-array being fieldname=>dataType. */ + protected $preparedStatements = array(); + + /** Set to TRUE to save all queries into an array. */ + protected $useQueryList=FALSE; + + /** array that essentially remembers how many times beginTrans() was called. */ + protected $transactionTree = NULL; + + //////////////////////////////////////////// + // Core primary connection/database function + //////////////////////////////////////////// + + + //========================================================================= + public function __construct() { + $this->gfObj = new cs_globalFunctions; + + if(defined('DEBUGPRINTOPT')) { + $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; + } + + $this->isInitialized = TRUE; + }//end __construct() + //========================================================================= + + + + //========================================================================= + /** + * Make sure the object is sane. + */ + final protected function sanity_check() { + if($this->isInitialized !== TRUE) { + throw new exception(__METHOD__ .": not properly initialized"); + } + }//end sanity_check() + //========================================================================= + + + + //========================================================================= + /** + * Set appropriate parameters for database connection + */ + public function set_db_info(array $params){ + $this->sanity_check(); + $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; + $requiredCount++; + } + else { + throw new exception(__METHOD__. ": property (". $index .") does " . + "not exist or isn't allowed"); + } + } + + if($requiredCount == count($required)) { + $this->paramsAreSet = TRUE; + } + else { + throw new exception(__METHOD__ .": required count (". $requiredCount + .") does not match required number of fields (". count($required) .")"); + } + }//end set_db_info() + //========================================================================= + + + + //========================================================================= + /** + * Wrapper for close() + */ + function disconnect() { + //Disconnect from $database + return($this->close()); + }//end disconnect() + //========================================================================= + + + + //========================================================================= + /** + * Standard method to close connection. + */ + function close() { + $this->isConnected = FALSE; + $retval = null; + if($this->connectionID != -1) { + $retval = pg_close($this->connectionID); + } + else { + throw new exception(__METHOD__ .": Failed to close connection: connection is invalid"); + } + + return($retval); + }//end close() + //========================================================================= + + + + //========================================================================= + /** + * Connect to the database + */ + function connect(array $dbParams=NULL, $forceNewConnection=FALSE){ + $this->sanity_check(); + $retval = NULL; + if(is_array($dbParams)) { + $this->set_db_info($dbParams); + } + + if($this->paramsAreSet === TRUE && $this->isConnected === FALSE) { + + $myConnArr = array( + 'host' => $this->host, + 'port' => $this->port, + 'dbname' => $this->dbname, + 'user' => $this->user, + 'password' => $this->password + ); + + //make it into a string separated by spaces, don't clean anything, remove null elements + $connStr = $this->gfObj->string_from_array($myConnArr, 'url', " "); + + //start output buffer for displaying error. + ob_start(); + if($forceNewConnection) { + $connID = pg_connect($connStr, PGSQL_CONNECT_FORCE_NEW); + } + else { + $connID =pg_connect($connStr); + } + $connectError = ob_get_contents(); + ob_end_clean(); + + if(is_resource($connID)) { + $this->errorCode=0; + $this->connectionID = $connID; + $this->isConnected = TRUE; + $retval = $this->connectionID; + } + else { + throw new exception(__METHOD__ .": FATAL ERROR: ". $connectError); + } + } + else { + throw new exception(__METHOD__ .": paramsAreSet=(". $this->paramsAreSet ."), isConnected=(". $this->isConnected .")"); + } + + return($retval); + }//end connect() + //========================================================================= + + + + //========================================================================= + function get_hostname() { + $this->sanity_check(); + return($this->host); + }//end get_hostname() + //========================================================================= + + + + //========================================================================= + /** + * Run sql queries + * + * TODO: re-implement query logging (setting debug, logfilename, etc). + */ + function exec($query) { + $this->lastQuery = $query; + if($this->useQueryList) { + $this->queryList[] = $query; + } + $returnVal = false; + + if(($this->get_transaction_status() != -1) && ($this->connectionID != -1)) { + $this->result = @pg_query($this->connectionID, $query); + + if($this->result !== false) { + if (eregi("^[[:space:]]*select", $query)) { + //If we didn't have an error and we are a select statement, move the pointer to first result + $numRows = $this->numRows(); + if($numRows > 0) { + $this->move_first(); + } + $returnVal = $numRows; + + } + else { + //We got something other than an update. Use numAffected + $returnVal = $this->numAffected(); + } + } + } + return($returnVal); + }//end exec() + //========================================================================= + + + + //========================================================================= + /** + * Returns any error caused by the last executed query. + * + * @return NULL OK: no error + * @return (string) FAIL: contains error returned from the query. + */ + function errorMsg($setMessage=NULL,$logError=NULL) { + $this->sanity_check(); + if ($this->connectionID < 0) { + switch ($this->errorCode) { + //############################################### + case -1: + $retVal = "FATAL ERROR - CONNECTION ERROR: RESOURCE NOT FOUND"; + break; + //############################################### + + //############################################### + case -2: + $retVal = "FATAL ERROR - CLASS ERROR: FUNCTION CALLED WITHOUT PARAMETERS"; + break; + //############################################### + + //############################################### + case -3: + $retVal = "Query exceeded maximum timeout (". $this->timeoutSeconds .")"; + break; + //############################################### + + //############################################### + default: + $retVal = null; + //############################################### + } + } else { + $retVal = pg_last_error($this->connectionID); + } + + return($retVal); + }//end errorMsg() + //========================================================================= + + + + + //////////////////// + // Cursor movement + //////////////////// + + + + + //========================================================================= + /** + * move pointer to first row of result set + */ + function move_first() { + $this->sanity_check(); + if($this->result == NULL) { + $retval = FALSE; + } + else { + $this->set_row(0); + $retval = TRUE; + } + + return($retval); + }//end move_first() + //========================================================================= + + + + //========================================================================= + /** + * move poi... [truncated message content] |
From: <cra...@us...> - 2008-02-07 02:19:28
|
Revision: 794 http://cs-project.svn.sourceforge.net/cs-project/?rev=794&view=rev Author: crazedsanity Date: 2008-02-06 18:19:25 -0800 (Wed, 06 Feb 2008) Log Message: ----------- *** RELEASE 1.0.12 *** SUMMARY OF CHANGES::: * update to cs-content v0.10.8 * update to cs-phpxml v0.5.5 * minor template & include changes for updated version of cs-content. SVN COMMAND::: merge -r789:HEAD https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1.0 Modified Paths: -------------- releases/1.0/VERSION releases/1.0/includes/login.inc releases/1.0/lib/cs-arrayToPath/VERSION releases/1.0/lib/cs-arrayToPath/arrayToPathClass.php releases/1.0/lib/cs-content/VERSION releases/1.0/lib/cs-content/contentSystemClass.php releases/1.0/lib/cs-content/cs_bbCodeParser.class.php releases/1.0/lib/cs-content/cs_fileSystemClass.php releases/1.0/lib/cs-content/cs_genericPageClass.php releases/1.0/lib/cs-content/cs_globalFunctions.php releases/1.0/lib/cs-content/cs_phpDB.php releases/1.0/lib/cs-content/cs_sessionClass.php releases/1.0/lib/cs-content/cs_versionAbstract.class.php releases/1.0/lib/cs-content/documentation/basics.pdf releases/1.0/lib/cs-phpxml/VERSION releases/1.0/lib/cs-phpxml/xmlAbstract.class.php releases/1.0/lib/cs-phpxml/xmlBuilderClass.php releases/1.0/lib/cs-phpxml/xmlCreatorClass.php releases/1.0/lib/cs-phpxml/xmlParserClass.php releases/1.0/lib/globalFunctions.php releases/1.0/lib/includes.php releases/1.0/lib/projectClass.php releases/1.0/lib/sessionCacheClass.php releases/1.0/lib/session_class.php releases/1.0/lib/site_config.php Added Paths: ----------- releases/1.0/lib/cs-content/db_types/ releases/1.0/lib/cs-content/db_types/cs_phpDB__pgsql.class.php releases/1.0/lib/cs-content/documentation/source/why_templating.odt releases/1.0/lib/cs-content/documentation/why_templating.pdf releases/1.0/templates/content/notes/create.content.tmpl releases/1.0/templates/content/notes/view.content.tmpl releases/1.0/templates/login.content.tmpl releases/1.0/templates/system/404.shared.tmpl Removed Paths: ------------- releases/1.0/lib/cs-content/db_types/cs_phpDB__pgsql.class.php releases/1.0/templates/content/notes/index.shared.tmpl releases/1.0/templates/login.tmpl Modified: releases/1.0/VERSION =================================================================== --- releases/1.0/VERSION 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/VERSION 2008-02-07 02:19:25 UTC (rev 794) @@ -1,4 +1,4 @@ $Id$ -VERSION: 1.0.11 +VERSION: 1.0.12 $HeadURL$ Modified: releases/1.0/includes/login.inc =================================================================== --- releases/1.0/includes/login.inc 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/includes/login.inc 2008-02-07 02:19:25 UTC (rev 794) @@ -55,7 +55,7 @@ if($_GET['destination']) { $_SESSION['loginDestination'] = urlencode($_GET['destination']); } -//show the default page. -$page->change_content(html_file_to_string("login.tmpl")); +$page->add_template_var('cs-project_version', VERSION_STRING); + ?> \ No newline at end of file Modified: releases/1.0/lib/cs-arrayToPath/VERSION =================================================================== --- releases/1.0/lib/cs-arrayToPath/VERSION 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-arrayToPath/VERSION 2008-02-07 02:19:25 UTC (rev 794) @@ -2,4 +2,4 @@ VERSION: 0.2.2 PROJECT: cs-arrayToPath -$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2.2/VERSION $ \ No newline at end of file +$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2/VERSION $ \ No newline at end of file Modified: releases/1.0/lib/cs-arrayToPath/arrayToPathClass.php =================================================================== --- releases/1.0/lib/cs-arrayToPath/arrayToPathClass.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-arrayToPath/arrayToPathClass.php 2008-02-07 02:19:25 UTC (rev 794) @@ -6,7 +6,7 @@ * ------------------- * Last Author::::::::: $Author: crazedsanity $ * Current Revision:::: $Revision: 17 $ - * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2.2/arrayToPathClass.php $ + * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/releases/0.2/arrayToPathClass.php $ * Last Updated:::::::: $Date: 2007-09-12 14:24:46 -0500 (Wed, 12 Sep 2007) $ * * Modified: releases/1.0/lib/cs-content/VERSION =================================================================== --- releases/1.0/lib/cs-content/VERSION 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/VERSION 2008-02-07 02:19:25 UTC (rev 794) @@ -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.9.1 +VERSION: 0.10.8 PROJECT: cs-content -$HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/VERSION $ \ No newline at end of file +$HeadURL:https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/VERSION $ \ No newline at end of file Modified: releases/1.0/lib/cs-content/contentSystemClass.php =================================================================== --- releases/1.0/lib/cs-content/contentSystemClass.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/contentSystemClass.php 2008-02-07 02:19:25 UTC (rev 794) @@ -1,10 +1,10 @@ -<? +<?php /* * FILE INFORMATION: - * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/contentSystemClass.php $ - * $Id: contentSystemClass.php 165 2007-09-21 16:00:30Z crazedsanity $ - * $LastChangedDate: 2007-09-21 11:00:30 -0500 (Fri, 21 Sep 2007) $ - * $LastChangedRevision: 165 $ + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/contentSystemClass.php $ + * $Id: contentSystemClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ + * $LastChangedRevision: 252 $ * $LastChangedBy: crazedsanity $ * * HOW THE SYSTEM WORKS::: @@ -90,12 +90,15 @@ ); protected $templateList = array(); protected $includesList = array(); - protected $templateObj = NULL; + public $templateObj = NULL; protected $gfObj = NULL; protected $tabs = NULL; protected $finalSection; + private $isValid=FALSE; + private $reason=NULL; + //------------------------------------------------------------------------ /** * The CONSTRUCTOR. Duh. @@ -201,13 +204,16 @@ * if they're not, this will cause them to be redirected to another URL * (generally, so they can login). */ - public function force_authentication($redirectToUrl, $appendDestination=TRUE) { + public function force_authentication($redirectToUrl, $destinationArg='loginDestination') { if(is_object($this->session) && method_exists($this->session, 'is_authenticated')) { if(strlen($redirectToUrl)) { $cleanedRedirect = $this->clean_url($redirectToUrl); if($this->section != $cleanedRedirect) { if(!$this->session->is_authenticated()) { //run the redirect. + if(strlen($destinationArg)) { + $redirectToUrl .= '?'. $destinationArg .'='. urlencode($_SERVER['REQUEST_URI']); + } $this->gfObj->conditional_header($redirectToUrl, TRUE); } } @@ -254,8 +260,7 @@ * Rips apart the "section" string, setting $this->section and $this->sectionArr. */ private function parse_section() { - // - if($this->section === 0) { + if($this->section === 0 || is_null($this->section) || !strlen($this->section)) { $this->section = "content/index"; } $myArr = split('/', $this->section); @@ -283,8 +288,10 @@ //make sure we've still got something valid to work with. if(!strlen($section)) { + //TODO: remove the extra return statement (should only be one at the bottom of the method). return(0); - } else { + } + else { //check the string to make sure it doesn't begin or end with a "/" if($section[0] == '/') { $section = substr($section, 1, strlen($section)); @@ -356,8 +363,9 @@ //now cd() all the way back. $this->fileSystemObj->cd('/'); - } else { - //couldn't find the templates directory... ick. + } + else { + //couldn't find the templates directory, and no includes... it's dead. $this->die_gracefully(__METHOD__ .": unable to find the templates directory, or non-valid page [". $this->validate_page() ."]"); } }//end prepare() @@ -396,14 +404,17 @@ } $lsDir = $this->fileSystemObj->ls($indexFilename); + $lsDirVals = array_values($lsDir); $lsFile = $this->fileSystemObj->ls("$finalSection.content.tmpl"); - if(is_array(array_values($lsDir))) { - //it's the dir. + + if(is_array(array_values($lsFile)) && is_array($lsFile[$finalSection .".content.tmpl"])) { + //it's the file ("{finalSection}.content.tmpl", like "mySection.content.tmpl") + $myIndex = $finalSection .".content.tmpl"; + } + elseif(is_array(array_values($lsDir)) && (is_array($lsDir[$indexFilename]))) { $myIndex = $indexFilename; - } elseif(is_array(array_values($lsFile))) { - //it's the file (no dir, or dir w/o index) - $myIndex = $finalSection.content.tmpl; - } else { + } + else { //nothin' doin'. $myIndex = NULL; } @@ -417,21 +428,35 @@ if(isset($myIndex)) { $valid = TRUE; $this->fileSystemObj->cd('/templates'); - } else { - $this->reason = __METHOD__ .": couldn't find page template for (". $this->section .", final=[$finalSection])..."; } - } else { - //just the base template. Make sure it's good. + else { + $this->reason = __METHOD__ .": couldn't find page template for ". $this->section; + } + } + else { + //if the baseDir is "help", this would try to use "/help/index.content.tmpl" $myFile = $this->baseDir .'/index.content.tmpl'; - $lsData = $this->fileSystemObj->ls($myFile); - if(isset($lsData[$myFile]) && $lsData[$myFile]['type'] == 'file') { + $sectionLsData = $this->fileSystemObj->ls($myFile); + + //if the baseDir is "help", this would try to use "/help.content.tmpl" + $sectionFile = $this->baseDir .'.content.tmpl'; + $lsData = $this->fileSystemObj->ls(); + + if(isset($lsData[$sectionFile]) && is_array($lsData[$sectionFile])) { + $valid = TRUE; + $this->finalSection = $this->baseDir; + } + elseif(isset($sectionLsData[$myFile]) && $sectionLsData[$myFile]['type'] == 'file') { //we're good. $valid = TRUE; $this->finalSection = $this->baseDir; - } else { + } + else { $this->reason = __METHOD__ .": couldn't find base template."; } } + $this->isValid = $valid; + return($valid); }//end validate_page() //------------------------------------------------------------------------ @@ -483,6 +508,10 @@ $this->templateList[$mySection] = $myTmpl; } } + if(isset($tmplList[$this->baseDir]['content'])) { + //load template for the main page (if $this->baseDir == "help", this would load "/help.content.tmpl" as content) + $this->templateList['content'] = $tmplList[$this->baseDir]['content']; + } } }//end load_page_templates() //------------------------------------------------------------------------ @@ -550,6 +579,7 @@ if(($myType == 'file') && !in_array($index, $this->ignoredList[$myType])) { $filename = $this->gfObj->create_list($this->fileSystemObj->cwd, $index, '/'); $filename = preg_replace('/^\/templates/', '', $filename); + $filename = preg_replace('/^\/\//', '/', $filename); //call another method to rip the filename apart properly, then arrange things as needed. $pieces = $this->parse_filename($index); $myPriIndex = $pieces[$primaryIndex]; @@ -684,9 +714,8 @@ } else { //TODO: make it *actually* die gracefully... the way it works now looks more like puke than grace. - $this->gfObj->debug_print(__METHOD__ .": something broke. \nDETAILS::: $details" . + throw new exception(__METHOD__ .": Couldn't find 404 template, plus additional error... \nDETAILS::: $details" . "\nREASON::: ". $this->reason); - exit; } }//end die_gracefully() //------------------------------------------------------------------------ @@ -735,15 +764,41 @@ //now include the includes scripts, if there are any. if(is_array($this->includesList) && count($this->includesList)) { - foreach($this->includesList as $myInternalIndex=>$myInternalScriptName) { - $this->myLastInclude = $myInternalScriptName; - include_once($this->myLastInclude); + try { + foreach($this->includesList as $myInternalIndex=>$myInternalScriptName) { + $this->myLastInclude = $myInternalScriptName; + include_once($this->myLastInclude); + } } + catch(exception $e) { + $myRoot = preg_replace('/\//', '\\\/', $this->fileSystemObj->root); + $displayableInclude = preg_replace('/^'. $myRoot .'/', '', $this->myLastInclude); + $this->templateObj->set_message_wrapper(array( + 'title' => "Fatal Error", + 'message' => __METHOD__ .": A fatal error occurred while processing <b>". + $displayableInclude ."</b>:<BR>\n<b>ERROR</b>: ". $e->getMessage(), + 'type' => "fatal" + )); + + //try to pass the error on to the user's exception handler, if there is one. + if(function_exists('exception_handler')) { + exception_handler($e); + } + } unset($myInternalIndex); unset($myInternalScriptName); } - $page->print_page(); + if(is_bool($this->templateObj->allow_invalid_urls() === TRUE) && $this->isValid === FALSE) { + $this->isValid = $this->templateObj->allow_invalid_urls(); + } + + if($this->isValid === TRUE) { + $page->print_page(); + } + else { + $this->die_gracefully($this->reason); + } }//end finish() //------------------------------------------------------------------------ @@ -753,8 +808,7 @@ /** * Method for accessing the protected $this->sectionArr array. */ - public function get_sectionArr() - { + public function get_sectionArr() { //give 'em what they want. return($this->sectionArr); }//end get_sectionArr() @@ -766,8 +820,7 @@ /** * Method for accessing the protected member $this->finalSection. */ - public function get_finalSection() - { + public function get_finalSection() { //give 'em what they want. return($this->finalSection); }//end get_finalSection() @@ -779,8 +832,7 @@ /** * Method for accessing "baseDir", only referenced as the base section. */ - public function get_baseSection() - { + public function get_baseSection() { return($this->baseDir); }//end get_baseSection() //------------------------------------------------------------------------ Modified: releases/1.0/lib/cs-content/cs_bbCodeParser.class.php =================================================================== --- releases/1.0/lib/cs-content/cs_bbCodeParser.class.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_bbCodeParser.class.php 2008-02-07 02:19:25 UTC (rev 794) @@ -5,11 +5,11 @@ * * SVN INFORMATION::: * ------------------ - * SVN Signature::::::: $Id: cs_bbCodeParser.class.php 173 2007-10-02 14:36:50Z crazedsanity $ + * SVN Signature::::::: $Id: cs_bbCodeParser.class.php 179 2007-10-04 22:31:43Z crazedsanity $ * Last Author::::::::: $Author: crazedsanity $ - * Current Revision:::: $Revision: 173 $ - * Repository Location: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/cs_bbCodeParser.class.php $ - * Last Updated:::::::: $Date: 2007-10-02 09:36:50 -0500 (Tue, 02 Oct 2007) $ + * Current Revision:::: $Revision: 179 $ + * Repository Location: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_bbCodeParser.class.php $ + * Last Updated:::::::: $Date: 2007-10-04 17:31:43 -0500 (Thu, 04 Oct 2007) $ * * * Originally from a snippet (just the function) on PHPFreaks.com: http://www.phpfreaks.com/quickcode/BBCode/712.php Modified: releases/1.0/lib/cs-content/cs_fileSystemClass.php =================================================================== --- releases/1.0/lib/cs-content/cs_fileSystemClass.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_fileSystemClass.php 2008-02-07 02:19:25 UTC (rev 794) @@ -1,12 +1,12 @@ -<? +<?php /* * FILE INFORMATION: - * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/cs_fileSystemClass.php $ - * $Id: cs_fileSystemClass.php 170 2007-09-25 22:54:19Z crazedsanity $ - * $LastChangedDate: 2007-09-25 17:54:19 -0500 (Tue, 25 Sep 2007) $ + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_fileSystemClass.php $ + * $Id: cs_fileSystemClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 170 $ + * $LastChangedRevision: 252 $ */ require_once(dirname(__FILE__) ."/cs_globalFunctions.php"); @@ -253,6 +253,7 @@ * can enlighten me, I'd be glad to give them credit. */ private function translate_perms($in_Perms) { + $sP = ""; $sP .= (($in_Perms & 0x0100) ? 'r' : '-') . (($in_Perms & 0x0080) ? 'w' : '-') . (($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) : @@ -307,11 +308,11 @@ $this->closeFile(); } else { - throw new exception(__METHOD__ .": unable to open specified file"); + throw new exception(__METHOD__ .": unable to open specified file (". $filename .")"); } } else { - throw new exception(__METHOD__ .": file is not writable"); + throw new exception(__METHOD__ .": Cannot truncate, file (". $filename .") is not writable"); } } return($retval); Modified: releases/1.0/lib/cs-content/cs_genericPageClass.php =================================================================== --- releases/1.0/lib/cs-content/cs_genericPageClass.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_genericPageClass.php 2008-02-07 02:19:25 UTC (rev 794) @@ -1,11 +1,11 @@ <?php /* * FILE INFORMATION: - * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/cs_genericPageClass.php $ - * $Id: cs_genericPageClass.php 172 2007-10-01 16:24:17Z crazedsanity $ - * $LastChangedDate: 2007-10-01 11:24:17 -0500 (Mon, 01 Oct 2007) $ + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_genericPageClass.php $ + * $Id: cs_genericPageClass.php 252 2008-01-31 21:57:49Z crazedsanity $ + * $LastChangedDate: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 172 $ + * $LastChangedRevision: 252 $ */ require_once(dirname(__FILE__) ."/template.inc"); require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); @@ -22,6 +22,8 @@ private $showEditableLink = FALSE; + private $allowInvalidUrls=NULL; + //--------------------------------------------------------------------------------------------- /** * The constructor. @@ -65,7 +67,7 @@ $this->add_template_var($key, $value); } } - if(is_array($GLOBALS['templateFiles'])) { + if(isset($GLOBALS['templateFiles']) && is_array($GLOBALS['templateFiles'])) { foreach($GLOBALS['templateFiles'] as $key => $value) { $this->templateFiles[$key] = $value; } @@ -257,7 +259,7 @@ if($stripUndefVars) { $numLoops = 0; - while(preg_match_all('/\{.*?\}/', $this->templateObj->varvals[out], $tags) && $numLoops < 50) { + while(preg_match_all('/\{.\S+?\}/', $this->templateObj->varvals['out'], $tags) && $numLoops < 50) { $tags = $tags[0]; //TODO: figure out why this works when running it twice. @@ -286,8 +288,9 @@ */ public function process_set_message() { //if there's not a message set, skip. - $errorBox = $this->file_to_string("system/message_box.tmpl"); - if(is_array($_SESSION['message'])) { + $errorBox = ""; + if(isset($_SESSION['message']) && is_array($_SESSION['message'])) { + $errorBox = $this->file_to_string("system/message_box.tmpl"); //let's make sure the "type" value is *lowercase*. $_SESSION['message']['type'] = strtolower($_SESSION['message']['type']); @@ -307,6 +310,7 @@ // they'll never get past this point). unset($_SESSION['message']); } + return($errorBox); }//end of process_set_message() //--------------------------------------------------------------------------------------------- @@ -595,6 +599,17 @@ return($retval); }//end set_all_block_rows() //--------------------------------------------------------------------------------------------- + + + + //--------------------------------------------------------------------------------------------- + public function allow_invalid_urls($newSetting=NULL) { + if(!is_null($newSetting) && is_bool($newSetting)) { + $this->allowInvalidUrls = $newSetting; + } + return($this->allowInvalidUrls); + }//end allow_invalid_urls() + //--------------------------------------------------------------------------------------------- }//end cs_genericPage{} ?> Modified: releases/1.0/lib/cs-content/cs_globalFunctions.php =================================================================== --- releases/1.0/lib/cs-content/cs_globalFunctions.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_globalFunctions.php 2008-02-07 02:19:25 UTC (rev 794) @@ -82,9 +82,10 @@ */ public function string_from_array($array,$style=NULL,$separator=NULL, $cleanString=NULL, $removeEmptyVals=FALSE) { + $retval = NULL; //precheck... if it's not an array, kill it. if(!is_array($array)) { - return(0); + return(NULL); } //make sure $style is valid. @@ -167,7 +168,7 @@ $value = $this->cleanString($value, "sql"); $value = "'". $value ."'"; } - $retval = $this->create_list($retval, $field . $separator . $value, " "); + $retval = $this->create_list($retval, $value, ", "); } if($style == "order" && !preg_match('/order by/', strtolower($retval))) { $retval = "ORDER BY ". $retval; @@ -271,7 +272,7 @@ } else { //not an array. - $retval = 0; + $retval = NULL; } return($retval); @@ -639,6 +640,49 @@ }//end truncate_string() //--------------------------------------------------------------------------------------------- + + + + //########################################################################## + public function array_as_option_list(array $data, $checkedValue=NULL, $type="select", $useTemplateString=NULL, array $repArr=NULL) { + $typeArr = array ( + "select" => "selected", + "radio" => "checked", + "checkbox" => "checked" + ); + + $myType = $typeArr[$type]; + if(is_null($useTemplateString)) { + // + $useTemplateString = "\t\t<option value='%%value%%'%%selectedString%%>%%display%%</option>"; + } + + $retval = ""; + foreach($data as $value=>$display) { + //see if it's the value that's been selected. + $selectedString = ""; + if($value == $checkedValue || $display == $checkedValue) { + //yep, it's selected. + $selectedString = " ". $myType; + } + + //create the string. + $myRepArr = array( + 'value' => $value, + 'display' => $display, + 'selectedString' => $selectedString + ); + if(is_array($repArr) && is_array($repArr[$value])) { + //merge the arrays. + $myRepArr = array_merge($repArr[$value], $myRepArr); + } + $addThis = $this->mini_parser($useTemplateString, $myRepArr, "%%", "%%"); + $retval = $this->create_list($retval, $addThis, "\n"); + } + + return($retval); + }//end array_as_option_list() + //########################################################################## }//end cs_globalFunctions{} Modified: releases/1.0/lib/cs-content/cs_phpDB.php =================================================================== --- releases/1.0/lib/cs-content/cs_phpDB.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_phpDB.php 2008-02-07 02:19:25 UTC (rev 794) @@ -4,9 +4,9 @@ * A class for generic PostgreSQL database access. * * SVN INFORMATION::: - * SVN Signature:::::::: $Id: cs_phpDB.php 154 2007-09-12 18:43:16Z crazedsanity $ - * Last Committted Date: $Date: 2007-09-12 13:43:16 -0500 (Wed, 12 Sep 2007) $ - * Last Committed Path:: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/cs_phpDB.php $ + * SVN Signature:::::::: $Id: cs_phpDB.php 252 2008-01-31 21:57:49Z crazedsanity $ + * Last Committted Date: $Date: 2008-01-31 15:57:49 -0600 (Thu, 31 Jan 2008) $ + * Last Committed Path:: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_phpDB.php $ * */ @@ -24,1062 +24,59 @@ // /////////////////////// +//TODO: option to not use layered transactions +//TODO: rollbackTrans() in layered transaction causes abort when final layer is committed/aborted +//TODO: stop sending queries to backend when transction is bad/aborted. +//TODO: commit/abort specific layer requests (i.e. if there's 8 layers & the first is named "x", calling commitTrans("x") will cause the whole transaction to commit & all layers to be destroyed. + require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); class cs_phpDB extends cs_versionAbstract { - - /** Internal result set pointer. */ - protected $result = NULL; - /** Internal error code. */ - protected $errorCode = 0; + private $dbLayerObj; + private $dbType; - /** Status of the current transaction. */ - protected $transStatus = NULL; - - /** Whether there is a transaction in progress or not. */ - protected $inTrans = FALSE; - - /** Holds the last query performed. */ - protected $lastQuery = NULL; - - /** List of queries that have been run */ - protected $queryList=array(); - - /** How many seconds to wait for a query before cancelling it. */ - protected $timeOutSeconds = NULL; - - /** Internal check to determine if a connection has been established. */ - protected $isConnected=FALSE; - - /** Internal check to determine if the parameters have been set. */ - protected $paramsAreSet=FALSE; - - /** Resource handle. */ - protected $connectionID = -1; - - /** Hostname or IP to connect to */ - protected $host; - - /** Port to connect to (default for Postgres is 5432) */ - protected $port; - - /** Name of the database */ - protected $dbname; - - /** Username to connect to the database */ - protected $user; - - /** password to connect to the database */ - protected $password; - - /** Row counter for looping through records */ - protected $row = -1; - - /** cs_globalFunctions object, for string stuff. */ - protected $gfObj; - - /** Internal check to ensure the object has been properly created. */ - protected $isInitialized=FALSE; - - /** List of prepared statements, indexed off the name, with the sub-array being fieldname=>dataType. */ - protected $preparedStatements = array(); - - /** Set to TRUE to save all queries into an array. */ - protected $useQueryList=FALSE; - - //////////////////////////////////////////// - // Core primary connection/database function - //////////////////////////////////////////// - - //========================================================================= - public function __construct() { - $this->gfObj = new cs_globalFunctions; - $this->gfObj->debugRemoveHr=0; - $this->gfObj->debugPrintOpt=0; + public function __construct($type='pgsql') { - $this->isInitialized = TRUE; - }//end __construct() - //========================================================================= - - - - //========================================================================= - /** - * Make sure the object is sane. - */ - final protected function sanity_check() { - if($this->isInitialized !== TRUE) { - throw new exception(__METHOD__ .": not properly initialized"); - } - }//end sanity_check() - //========================================================================= - - - - //========================================================================= - /** - * Set appropriate parameters for database connection - */ - public function set_db_info(array $params){ - $this->sanity_check(); - $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; - $requiredCount++; - } - else { - throw new exception(__METHOD__. ": property (". $index .") does " . - "not exist or isn't allowed"); - } - } - - if($requiredCount == count($required)) { - $this->paramsAreSet = TRUE; - } - else { - throw new exception(__METHOD__ .": required count (". $requiredCount - .") does not match required number of fields (". count($required) .")"); - } - }//end set_db_info() - //========================================================================= - - - - //========================================================================= - /** - * Wrapper for close() - */ - function disconnect() { - //Disconnect from $database - return($this->close()); - }//end disconnect() - //========================================================================= - - - - //========================================================================= - /** - * Standard method to close connection. - */ - function close() { - $this->isConnected = FALSE; - $retval = null; - if($this->connectionID != -1) { - $retval = pg_close($this->connectionID); - } - else { - throw new exception(__METHOD__ .": Failed to close connection: connection is invalid"); - } - - return($retval); - }//end close() - //========================================================================= - - - - //========================================================================= - /** - * Connect to the database - */ - function connect(array $dbParams=NULL, $forceNewConnection=FALSE){ - $this->sanity_check(); - $retval = NULL; - if(is_array($dbParams)) { - $this->set_db_info($dbParams); - } - - if($this->paramsAreSet === TRUE && $this->isConnected === FALSE) { + if(strlen($type)) { - $myConnArr = array( - 'host' => $this->host, - 'port' => $this->port, - 'dbname' => $this->dbname, - 'user' => $this->user, - 'password' => $this->password - ); + require_once(dirname(__FILE__) .'/db_types/'. __CLASS__ .'__'. $type .'.class.php'); + $className = __CLASS__ .'__'. $type; + $this->dbLayerObj = new $className; + $this->dbType = $type; - //make it into a string separated by spaces, don't clean anything, remove null elements - $connStr = $this->gfObj->string_from_array($myConnArr, 'url', " "); + $this->gfObj = new cs_globalFunctions; - //start output buffer for displaying error. - ob_start(); - if($forceNewConnection) { - $connID = pg_connect($connStr, PGSQL_CONNECT_FORCE_NEW); + if(defined('DEBUGPRINTOPT')) { + $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; } - else { - $connID =pg_connect($connStr); - } - $connectError = ob_get_contents(); - ob_end_clean(); - if(is_resource($connID)) { - $this->errorCode=0; - $this->connectionID = $connID; - $this->isConnected = TRUE; - $retval = $this->connectionID; - } - else { - throw new exception(__METHOD__ .": FATAL ERROR: ". $connectError); - } + $this->isInitialized = TRUE; } else { - throw new exception(__METHOD__ .": paramsAreSet=(". $this->paramsAreSet ."), isConnected=(". $this->isConnected .")"); + throw new exception(__METHOD__ .": failed to give a type (". $type .")"); } - - return($retval); - }//end connect() + }//end __construct() //========================================================================= //========================================================================= - function get_hostname() { - $this->sanity_check(); - return($this->host); - }//end get_hostname() - //========================================================================= - - - - //========================================================================= - /** - * Run sql queries - * - * TODO: re-implement query logging (setting debug, logfilename, etc). - */ - function exec($query) { - $this->lastQuery = $query; - if($this->useQueryList) { - $this->queryList[] = $query; - } - $returnVal = false; - - if(($this->get_transaction_status() != -1) && ($this->connectionID != -1)) { - $this->result = @pg_query($this->connectionID, $query); - - if($this->result !== false) { - if (eregi("^[[:space:]]*select", $query)) { - //If we didn't have an error and we are a select statement, move the pointer to first result - $numRows = $this->numRows(); - if($numRows > 0) { - $this->move_first(); - } - $returnVal = $numRows; - - } - else { - //We got something other than an update. Use numAffected - $returnVal = $this->numAffected(); - } - } - } - return($returnVal); - }//end exec() - //========================================================================= - - - - //========================================================================= /** - * Returns any error caused by the last executed query. - * - * @return NULL OK: no error - * @return (string) FAIL: contains error returned from the query. + * Magic method to call methods within the database abstraction layer ($this->dbLayerObj). */ - function errorMsg($setMessage=NULL,$logError=NULL) { - $this->sanity_check(); - if ($this->connectionID < 0) { - switch ($this->errorCode) { - //############################################### - case -1: - $retVal = "FATAL ERROR - CONNECTION ERROR: RESOURCE NOT FOUND"; - break; - //############################################### - - //############################################### - case -2: - $retVal = "FATAL ERROR - CLASS ERROR: FUNCTION CALLED WITHOUT PARAMETERS"; - break; - //############################################### - - //############################################### - case -3: - $retVal = "Query exceeded maximum timeout (". $this->timeoutSeconds .")"; - break; - //############################################### - - //############################################### - default: - $retVal = null; - //############################################### - } - } else { - $retVal = pg_last_error($this->connectionID); + public function __call($methodName, $args) { + if(method_exists($this->dbLayerObj, $methodName)) { + $retval = call_user_func_array(array($this->dbLayerObj, $methodName), $args); } - - return($retVal); - }//end errorMsg() - //========================================================================= - - - - - //////////////////// - // Cursor movement - //////////////////// - - - - - //========================================================================= - /** - * move pointer to first row of result set - */ - function move_first() { - $this->sanity_check(); - if($this->result == NULL) { - $retval = FALSE; - } else { - $this->set_row(0); - $retval = TRUE; + throw new exception(__METHOD__ .': unsupported method ('. $methodName .') for database of type ('. $this->dbType .')'); } - return($retval); - }//end move_first() + }//end __call() //========================================================================= - - - //========================================================================= - /** - * move pointer to last row of result set - */ - function move_last() { - $this->sanity_check(); - if($this->result == NULL) { - $retval = FALSE; - } - else { - $this->set_row($this->numRows()-1); - $retval = TRUE; - } - - return($retval); - }//end move_list() - //========================================================================= - - - - //========================================================================= - /** - * point to the next row, return false if no next row - */ - function move_next() { - $this->sanity_check(); - // If more rows, then advance row pointer - if($this->row < $this->numRows()-1) { - $this->set_row($this->row +1); - $retval = TRUE; - } - else { - $retval = FALSE; - } - - return($retval); - }//end move_next() - //========================================================================= - - - - //========================================================================= - /** - * point to the previous row, return false if no previous row - */ - function move_previous() { - // If not first row, then advance row pointer - if ($this->row > 0) { - $this->set_row($this->row -1); - return true; - } - else return false; - }//end move_previous() - //========================================================================= - - - - //========================================================================= - // point to the next row, return false if no next row - function next_row() { - // If more rows, then advance row pointer - if ($this->row < $this->numRows()-1) { - $this->set_row($this->row +1); - return true; - } - else return false; - }//end next_row() - //========================================================================= - - - - //========================================================================= - // can be used to set a pointer to a perticular row - function set_row($row){ - if(is_numeric($row)) { - $this->row = $row; - } - else { - throw new exception(__METHOD__ .": invalid data for row (". $row .")"); - } - return($this->row); - }//end set_row(); - //========================================================================= - - - - - /////////////////////// - // Result set related - /////////////////////// - - - - //========================================================================= - /** - * Return the current row as an object. - */ - function fobject() { - $this->sanity_check(); - if($this->result == NULL || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_object($this->result, $this->row); - } - - return($retval); - } - //========================================================================= - - - - //========================================================================= - /** - * Fetch the current row as an array containing fieldnames AND numeric indexes. - */ - function farray(){ - if($this->result == NULL || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_array($this->result,$this->row); - } - - return($retval); - }//end farray() - //========================================================================= - - - - //========================================================================= - /** - * Another way to retrieve a single row (useful for loops). - */ - function frow(){ - $this->sanity_check(); - if($this->numRows() <= 0) { - $retval = NULL; - } - else { - if($this->result == null || $this->row == -1) { - $retval = NULL; - } - else { - $retval = pg_fetch_row($this->result, $this->row); - } - } - - return($retval); - }//end frow() - //========================================================================= - - - - //========================================================================= - /** - * Similar to farray(), except all indexes are non-numeric, and the entire - * result set is retrieved: if only one row is available, no numeric index - * is set, unless $numbered is TRUE. - * - * TODO: clean this up! - */ - function farray_fieldnames($index=NULL, $numbered=NULL,$unsetIndex=1) { - $this->sanity_check(); - $retval = NULL; - - //before we get too far, let's make sure there's something there. - if($this->numRows() <= 0) { - $retval = 0; - } - else { - //keep any errors/warnings from printing to the screen by using OUTPUT BUFFERS. - ob_start(); - - $x = 0; - do { - $temp = $this->farray(); - foreach($temp as $key=>$value) { - //remove the numbered indexes. - if(is_string($key)) { - $tArr[$key] = $value; - } - } - $newArr[$x] = $tArr; - $x++; - } - while($this->next_row()); - - if($index) { - foreach($newArr as $row=>$contents) { //For each of the returned sets of information - foreach($contents as $fieldname=>$value) { //And now for each of the items in that set - if($fieldname == $index) { - //The index for the new array will be this fieldname's value - $arrayKey = $value; - } - - $tempContent[$fieldname] = $value; - //don't include the "index" field in the subarray; that always seems to end badly. - if ($unsetIndex) { - unset($tempContent[$index]); - } - } - - if (!isset($tempArr[$arrayKey])) { - //Make sure we didn't already set this in the array. If so, then we don't have a unique variable to use for the array index. - $tempArr[$arrayKey] = $tempContent; - } - else { - //TODO: bigtime cleaning... should only return at the bottom of the method. - $retval = 0; - break; - } - $arrayKey = NULL; //Blank this out after using it, just in case we don't find one in the next iteration - } - - if (count($tempArr) != count($newArr)) { - $details = "farray_fieldnames(): Array counts don't match.<BR>\n" - ."FUNCTION ARGUMENTS: index=[$index], numbered=[$numbered], unsetIndex=[$unsetIndex]<BR>\n" - ."LAST QUERY: ". $this->lastQuery; - throw new exception(__METHOD__ .": $details"); - } - $newArr = $tempArr; - } - //this is where, if there's only one row (and the planets align just the way - // I like them to), there's no row w/ a sub-array... This is only done - // if $index is NOT set... - if(($this->numRows() == 1) AND (!$index) AND (!$numbered)) { - $newArr = $newArr[0]; - } - $retval = $newArr; - ob_end_clean(); - } - return($retval); - }//end farray_fieldnames() - //========================================================================= - - - - //========================================================================= - /** - * Uses farray_fieldnames() to retrieve the entire result set, but the final - * array is contains name=>value pairs. - */ - function farray_nvp($name, $value) { - if((!$name) OR (!$value)) { - $retval = 0; - } - else { - $tArr = $this->farray_fieldnames(NULL,1); - if(!is_array($tArr)) { - $retval = 0; - } - else { - //loop through it & grab the proper info. - $retval = array(); - foreach($tArr as $row=>$array) { - $tKey = $array[$name]; - $tVal = $array[$value]; - $retval[$tKey] = $tVal; - } - } - } - - //return the new array. - return($retval); - }//end farray_nvp() - //========================================================================= - - - - //========================================================================= - /** - * Similar to farray_fieldnames(), but only returns the NUMERIC indexes - */ - function farray_numbered() { - do { - $temp = $this->frow(); - $retArr[] = $temp[0]; - } - while($this->next_row()); - - return($retArr); - }//end farray_numbered() - //========================================================================= - - - - //========================================================================= - /** - * Returns the number of tuples affected by an insert/delete/update query. - * NOTE: select queries must use numRows() - */ - function numAffected() { - if($this->result == null) { - $retval = 0; - } else { - $this->affectedRows = pg_affected_rows($this->result); - $retval = $this->affectedRows; - } - - return($retval); - }//end numAffected() - //========================================================================= - - - - //========================================================================= - /** - * Returns the number of rows in a result (from a SELECT query). - */ - function numRows() { - if ($this->result == null) { - $retval = 0; - } - else { - $this->numrows = pg_num_rows($this->result); - $retval = $this->numrows; - } - - return($retval); - }//end numRows() - //========================================================================= - - - - //========================================================================= - /** - * wrapper for numAffected() - */ - function affectedRows(){ - return($this->numAffected()); - }//end affectedRows() - //========================================================================= - - - - //========================================================================= - /** - * Returns the current row number. - */ - function currRow(){ - return($this->row); - }//end currRow() - //========================================================================= - - - - //========================================================================= - /** - * Get the number of fields in a result. - */ - // get the number of fields in a result - function num_fields() { - if($this->result == null) { - $retval = 0; - } - else { - $retval = pg_num_fields($this->result); - } - return($retval); - }//end num_fields() - //========================================================================= - - - - //========================================================================= - function column_count() { - return($this->numFields()); - }//end column_count() - //========================================================================= - - - - //========================================================================= - /** - * get last OID (object identifier) of last INSERT statement - */ - function lastOID($doItForMe=0, $field=NULL) { - if($this->result == NULL) { - $retval = NULL; - } - else { - $tOid = pg_last_oid($this->result); - $retval = $tOid; - - if(($doItForMe) AND (eregi("^insert", $this->last_query))) { - //attempt to parse the insert statement, then select - // all fields (unless $field is set) from it. - $t = split(" into ", strtolower($this->last_query)); - $t = split(" ", $t[1]); - $t = split("\(", $t[0]); - $table = $t[0]; - - //now we have the table. - if(!$field) { - $field = "*"; - } - $query = "SELECT $field FROM $table WHERE OID=$tOid"; - $this->exec($query); - $dberror = $this->errorMsg(1,1,1,"lastOID(): "); - - if(!$dberror) { - $res = $this->farray(); - if(is_string($field)) { - $retval = $res[0]; - } - } - } - } - return($retval); - }//end lastOID() - //========================================================================= - - - - //========================================================================= - /** - * get result field name of the given field number. - */ - // get result field name - function fieldname($fieldnum) { - if($this->result == NULL) { - $retval =NULL; - } - else { - $retval = pg_field_name($this->result, $fieldnum); - } - - return($retval); - }//end fieldname() - //========================================================================= - - - - - //////////////////////// - // Transaction related - //////////////////////// - - - - - //========================================================================= - /** - * Start a transaction. - */ - function beginTrans() { - $this->inTrans = TRUE; - return($this->exec("BEGIN")); - }//end beginTrans() - //========================================================================= - - - - //========================================================================= - /** - * Commit a transaction. - */ - function commitTrans() { - $retval = $this->get_transaction_status(); - if($retval > 1) { - $retval = 1; - } - $this->exec("COMMIT"); - $this->get_transaction_status(); - return($retval); - }//end commitTrans() - //========================================================================= - - - - //========================================================================= - // returns true/false - function rollbackTrans() { - $retval = $this->exec("ABORT"); - $this->get_transaction_status(); - return($retval); - }//end rollbackTrans() - //========================================================================= - - - - //////////////////////// - // SQL String Related - //////////////////////// - - - - //========================================================================= - /** - * Gets rid of evil characters that might lead ot SQL injection attacks. - */ - function querySafe($string) { - return($this->gfObj->cleanString($string,"query")); - }//end querySafe() - //========================================================================= - - - - //========================================================================= - /** - * Make it SQL safe. - */ - function sqlSafe($string) { - return($this->gfObj->cleanString($string,"sql")); - }//end sqlSafe() - //========================================================================= - - - - //========================================================================= - /** - * Gives textual explanation of the current status of our database - * connection. - * - * @param $goodOrBad (bool,optional) return good/bad status. - * - * @return (-1) (FAIL) connection is broken - * @return (0) (FAIL) error was encountered (transient error) - * @return (1) (PASS) useable - * @return (2) (PASS) useable, but not just yet (working - * on something) - */ - function get_transaction_status($goodOrBad=TRUE) { - $myStatus = pg_transaction_status($this->connectionID); - $text = 'unknown'; - switch($myStatus) { - case PGSQL_TRANSACTION_IDLE: { - //No query in progress: it's idle. - $goodOrBadValue = 1; - $text = 'idle'; - $this->inTrans = FALSE; - } - break; - - - case PGSQL_TRANSACTION_ACTIVE: { - //there's a command in progress. - $goodOrBadValue = 2; - $text = 'processing'; - } - break; - - - case PGSQL_TRANSACTION_INTRANS: { - //connection idle within a valid transaction block. - $goodOrBadValue = 1; - $text = 'valid transaction'; - $this->inTrans = TRUE; - } - break; - - - case PGSQL_TRANSACTION_INERROR: { - //connection idle within a broken transaction. - $goodOrBadValue = 0; - $text = 'failed transaction'; - $this->inTrans = TRUE; - } - break; - - - case PGSQL_TRANSACTION_UNKNOWN: - default: { - //the connection is bad. - $goodOrBadValue = -1; - $text = 'bad connection'; - } - break; - } - - //do they want text or the good/bad number? - $retval = $text; - $this->transactionStatus = $goodOrBadValue; - if($goodOrBad) { - //they want the number. - $retval = $goodOrBadValue; - } - - return($retval); - }//end valid_transaction() - //========================================================================= - - - - //========================================================================= - public function is_connected() { - $retval = FALSE; - if(is_resource($this->connectionID) && $this->isConnected === TRUE) { - $retval = TRUE; - } - - return($retval); - }//end is_connected() - //========================================================================= - - - - //========================================================================= - /** - * Create a prepared statement. - */ - public function create_prepared_statement($planName,array $fieldToType, $statement) { - $retval = FALSE; - //store the mappings. - $this->preparedStatements[$planName] = $fieldToType; - - //TODO: check that the string in "$statement" has the same number of "${n}" as are in "$fieldToType". - - $dataTypeString = ""; - foreach($fieldToType as $field => $type) { - $dataTypeString = $this->gfObj->create_list($dataTypeString, $type, ", "); - } - - $sql = "PREPARE ". $planName ."(". $dataTypeString .") AS ". $statement; - - $myNumrows = $this->exec($sql); - $myDberror = $this->errorMsg(); - - if(!strlen($myDberror)) { - $retval = TRUE; - } - else { - throw new exception(__METHOD__ .": failed to create prepared statement '". $planName ."'... dberror::: ". $myDberror ."\n\nSQL::: ". $sql); - } - - return($retval); - }//end create_prepared_statement() - //========================================================================= - - - - //========================================================================= - /** - * Run a statement prepared by this object. - * - * NOTE: determination of rows affected (numAffected) vs. rows returned (numRows) - * must be done by the user via the referenced methods. - */ - public function run_prepared_statement($name, array $data) { - $retval = FALSE; - if(is_array($this->preparedStatements[$name]) && count($data) == count($this->preparedStatements[$name])) { - $this->result = pg_execute($this->connectionID, $name, $data); - $dberror = $this->errorMsg(); - - if(!strlen($dberror)) { - $retval = TRUE; - } - } - else { - throw new exception(__METHOD__ .": invalid statement name (". $name ."), or incorrect number of elements"); - } - - return($retval); - }//end run_prepared_statement() - //========================================================================= - - - - //========================================================================= - /** - * Starts a copy command. - * - * TODO: implement safeguards so they can only put a line until the copy is ended. - */ - public function start_copy($tableName, array $fields) { - $retval = FALSE; - $copyStmt = "COPY ". $tableName ." (". $this->gfObj->string_from_array($fields, NULL, ", ") . ") FROM stdin;"; - $this->exec($copyStmt); - if(!strlen($this->errorMsg())) { - //TODO: set something here so that NOTHING ELSE can be done except put_line() and end_copy(). - $this->copyInProgress = TRUE; - $retval = TRUE; - } - else { - $this->end_copy(); - $retval = FALSE; - } - - return($retval); - }//end start_copy() - //========================================================================= - - - - //========================================================================= - /** - * Used to send a line to the COPY in progress (only if it was initiated by - * the internal start_copy() method). - * - * NOTE: the "end-of-copy" line, '\.', should NEVER be sent here. - */ - public function put_line($line) { - $retval = FALSE; - if($this->copyInProgress === TRUE) { - $myLine = trim($line); - $myLine .= "\n"; - - $retval = pg_put_line($this->connectionID, $myLine); - } - else { - throw new exception(__METHOD__ .": cannot send line if no copy is in progress"); - } - - return($retval); - }//end put_line() - //========================================================================= - - - - //========================================================================= - public function end_copy() { - if($this->copyInProgress === TRUE) { - //send the end-of-copy line... - $this->put_line("\\.\n"); - } - - $retval = pg_end_copy($this->connectionID); - - return($retval); - }//end end_copy() - //========================================================================= - - } // end class phpDB ?> Modified: releases/1.0/lib/cs-content/cs_sessionClass.php =================================================================== --- releases/1.0/lib/cs-content/cs_sessionClass.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_sessionClass.php 2008-02-07 02:19:25 UTC (rev 794) @@ -1,11 +1,11 @@ <?php /* * FILE INFORMATION: - * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/cs_sessionClass.php $ - * $Id: cs_sessionClass.php 161 2007-09-19 02:49:28Z crazedsanity $ - * $LastChangedDate: 2007-09-18 21:49:28 -0500 (Tue, 18 Sep 2007) $ + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_sessionClass.php $ + * $Id: cs_sessionClass.php 221 2007-11-21 17:39:01Z crazedsanity $ + * $LastChangedDate: 2007-11-21 11:39:01 -0600 (Wed, 21 Nov 2007) $ * $LastChangedBy: crazedsanity $ - * $LastChangedRevision: 161 $ + * $LastChangedRevision: 221 $ */ require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); @@ -18,6 +18,11 @@ public $sid_check = 1; //--------------------------------------------------------------------------------------------- + /** + * The constructor. + * + * @param $createSession (boolean,optional) determines if a session will be started or not. + */ function __construct($createSession=1) { if($createSession) { //now actually create the session. @@ -41,10 +46,91 @@ //--------------------------------------------------------------------------------------------- + /** + * Required method, so passing the object to contentSystem::handle_session() + * will work properly. + * + * @param (none) + * + * @return FALSE FAIL: user is not authenticated (hard-coded this way). + */ public function is_authenticated() { return(FALSE); }//end is_authenticated() //--------------------------------------------------------------------------------------------- + + + + //--------------------------------------------------------------------------------------------- + /** + * Retrieve data for an existing cookie. + * + * @param $name (string) Name of cookie to retrieve value for. + * + * @return NULL FAIL (?): cookie doesn't exist or has NULL value. + * @return (string) PASS: value of cookie. + */ + public function get_cookie($name) { + $retval = NULL; + if(isset($_COOKIE) && $_COOKIE[$name]) { + $retval = $_COOKIE[$name]; + } + return($retval); + }//end get_cookie() + //--------------------------------------------------------------------------------------------- + + + + //--------------------------------------------------------------------------------------------- + /** + * Create a new cookie. + * + * @param $name (string) Name of cookie + * @param $value (string) value of cookie + * @param $expiration (string/number) unix timestamp or value for strtotime(). + */ + public function create_cookie($name, $value, $expiration=NULL) { + + $expTime = NULL; + if(!is_null($expiration)) { + if(is_numeric($expiration)) { + $expTime = $expiration; + } + elseif(preg_match('/ /', $expiration)) { + $expTime = strtotime($expiration); + } + else { + throw new exception(__METHOD__ .": invalid timestamp given (". $expiration .")"); + } + } + + $retval = setcookie($name, $value, $expTime, '/'); + return($retval); + + }//end create_cookie() + //--------------------------------------------------------------------------------------------- + + + + //--------------------------------------------------------------------------------------------- + /** + * Destroy (expire) an existing cookie. + * + * @param $name (string) Name of cookie to destroy + * + * @return FALSE FAIL: no cookie by that name. + * @return TRUE PASS: cookie destroyed. + */ + public function drop_cookie($name) { + $retval = FALSE; + if(isset($_COOKIE[$name])) { + setcookie($name, $_COOKIE[$name], time() -10000, '/'); + unset($_COOKIE[$name]); + $retval = TRUE; + } + return($retval); + }//end drop_cookie() + //--------------------------------------------------------------------------------------------- }//end cs_session{} Modified: releases/1.0/lib/cs-content/cs_versionAbstract.class.php =================================================================== --- releases/1.0/lib/cs-content/cs_versionAbstract.class.php 2008-02-07 02:17:02 UTC (rev 793) +++ releases/1.0/lib/cs-content/cs_versionAbstract.class.php 2008-02-07 02:19:25 UTC (rev 794) @@ -5,9 +5,9 @@ * SVN INFORMATION::: * ------------------- * Last Author::::::::: $Author: crazedsanity $ - * Current Revision:::: $Revision: 155 $ - * Repository Location: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.9.0/cs_versionAbstract.class.php $ - * Last Updated:::::::: $Date: 2007-09-12 14:28:20 -0500 (Wed, 12 Sep 2007) $ + * Current Revision:::: $Revision: 221 $ + * Repository Location: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/releases/0.10/cs_versionAbstract.clas... [truncated message content] |
From: <cra...@us...> - 2008-02-07 02:17:05
|
Revision: 793 http://cs-project.svn.sourceforge.net/cs-project/?rev=793&view=rev Author: crazedsanity Date: 2008-02-06 18:17:02 -0800 (Wed, 06 Feb 2008) Log Message: ----------- *** RELEASE 1.0.12 *** SUMMARY OF CHANGES::: * update to cs-content v0.10.8 * update to cs-phpxml v0.5.5 * minor template & include changes for updated version of cs-content. Modified Paths: -------------- trunk/1.0/VERSION Modified: trunk/1.0/VERSION =================================================================== --- trunk/1.0/VERSION 2008-02-07 02:08:04 UTC (rev 792) +++ trunk/1.0/VERSION 2008-02-07 02:17:02 UTC (rev 793) @@ -1,4 +1,4 @@ $Id$ -VERSION: 1.0.11 +VERSION: 1.0.12 $HeadURL$ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-02-07 02:08:07
|
Revision: 792 http://cs-project.svn.sourceforge.net/cs-project/?rev=792&view=rev Author: crazedsanity Date: 2008-02-06 18:08:04 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Updates to handle templating for cs-content v0.10.8 Added Paths: ----------- trunk/1.0/templates/content/notes/create.content.tmpl trunk/1.0/templates/content/notes/view.content.tmpl Removed Paths: ------------- trunk/1.0/templates/content/notes/index.shared.tmpl Copied: trunk/1.0/templates/content/notes/create.content.tmpl (from rev 791, trunk/1.0/templates/content/notes/index.shared.tmpl) =================================================================== --- trunk/1.0/templates/content/notes/create.content.tmpl (rev 0) +++ trunk/1.0/templates/content/notes/create.content.tmpl 2008-02-07 02:08:04 UTC (rev 792) @@ -0,0 +1,45 @@ +<form action='' method='POST'> +<input type="hidden" name="note_id" value={note_id}> +<input type="hidden" name="module" value="notes"> + +<table border=0 cellpadding=0 cellspacing=0><tr><td> +<table border=0 bgcolor=#D5D5D5> +<tr> + <td><a href="javascript:void();"><b>Notes</b></a></td> + +<tr> + <td></td> +</tr> +<!-- BEGIN nonowner_options --> +<tr> + <td style="border-bottom:solid #000 1px;">Title: <b>{note_subject}</b></td> +</tr> +<tr> + <td><pre>{note_body}</pre></td> +</tr> +<!-- END nonowner_options --> +<!-- BEGIN owner_options --> +<tr> + <td colspan=2>Title:<input type='text' name='updates[subject]' size='92' value="{note_subject}" {note_name_readonly}></td> +</tr> +<tr> + <td> + <textarea rows=20 cols=95 name="updates[body]" wrap=physical>{note_body}</textarea> + </td> +<tr> +</table> + +<table align="center"> +<tr> + <td align="center"> + <input type="HIDDEN" name="updates[record_id]" value="{record_id}"> + <input type="submit" name="{submit_name}" value="{submit_value}"> + </td> +</tr> +<!-- END owner_options --> +<tr> + <td align="center"><a href='{goBackLink}'><b>GO BACK</b></a></td> +</tr> +</table> + +</td></tr></table> Deleted: trunk/1.0/templates/content/notes/index.shared.tmpl =================================================================== --- trunk/1.0/templates/content/notes/index.shared.tmpl 2008-02-07 01:48:37 UTC (rev 791) +++ trunk/1.0/templates/content/notes/index.shared.tmpl 2008-02-07 02:08:04 UTC (rev 792) @@ -1,45 +0,0 @@ -<form action='' method='POST'> -<input type="hidden" name="note_id" value={note_id}> -<input type="hidden" name="module" value="notes"> - -<table border=0 cellpadding=0 cellspacing=0><tr><td> -<table border=0 bgcolor=#D5D5D5> -<tr> - <td><a href="javascript:void();"><b>Notes</b></a></td> - -<tr> - <td></td> -</tr> -<!-- BEGIN nonowner_options --> -<tr> - <td style="border-bottom:solid #000 1px;">Title: <b>{note_subject}</b></td> -</tr> -<tr> - <td><pre>{note_body}</pre></td> -</tr> -<!-- END nonowner_options --> -<!-- BEGIN owner_options --> -<tr> - <td colspan=2>Title:<input type='text' name='updates[subject]' size='92' value="{note_subject}" {note_name_readonly}></td> -</tr> -<tr> - <td> - <textarea rows=20 cols=95 name="updates[body]" wrap=physical>{note_body}</textarea> - </td> -<tr> -</table> - -<table align="center"> -<tr> - <td align="center"> - <input type="HIDDEN" name="updates[record_id]" value="{record_id}"> - <input type="submit" name="{submit_name}" value="{submit_value}"> - </td> -</tr> -<!-- END owner_options --> -<tr> - <td align="center"><a href='{goBackLink}'><b>GO BACK</b></a></td> -</tr> -</table> - -</td></tr></table> Copied: trunk/1.0/templates/content/notes/view.content.tmpl (from rev 791, trunk/1.0/templates/content/notes/index.shared.tmpl) =================================================================== --- trunk/1.0/templates/content/notes/view.content.tmpl (rev 0) +++ trunk/1.0/templates/content/notes/view.content.tmpl 2008-02-07 02:08:04 UTC (rev 792) @@ -0,0 +1,45 @@ +<form action='' method='POST'> +<input type="hidden" name="note_id" value={note_id}> +<input type="hidden" name="module" value="notes"> + +<table border=0 cellpadding=0 cellspacing=0><tr><td> +<table border=0 bgcolor=#D5D5D5> +<tr> + <td><a href="javascript:void();"><b>Notes</b></a></td> + +<tr> + <td></td> +</tr> +<!-- BEGIN nonowner_options --> +<tr> + <td style="border-bottom:solid #000 1px;">Title: <b>{note_subject}</b></td> +</tr> +<tr> + <td><pre>{note_body}</pre></td> +</tr> +<!-- END nonowner_options --> +<!-- BEGIN owner_options --> +<tr> + <td colspan=2>Title:<input type='text' name='updates[subject]' size='92' value="{note_subject}" {note_name_readonly}></td> +</tr> +<tr> + <td> + <textarea rows=20 cols=95 name="updates[body]" wrap=physical>{note_body}</textarea> + </td> +<tr> +</table> + +<table align="center"> +<tr> + <td align="center"> + <input type="HIDDEN" name="updates[record_id]" value="{record_id}"> + <input type="submit" name="{submit_name}" value="{submit_value}"> + </td> +</tr> +<!-- END owner_options --> +<tr> + <td align="center"><a href='{goBackLink}'><b>GO BACK</b></a></td> +</tr> +</table> + +</td></tr></table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |