[CS-Project-svn_notify] SF.net SVN: cs-project:[944] releases/1.2/lib
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-02-06 20:57:27
|
Revision: 944 http://cs-project.svn.sourceforge.net/cs-project/?rev=944&view=rev Author: crazedsanity Date: 2009-02-06 20:57:19 +0000 (Fri, 06 Feb 2009) Log Message: ----------- New versions of libraries for version 1.2.0-ALPHA9 Added Paths: ----------- releases/1.2/lib/cs-arrayToPath/ releases/1.2/lib/cs-arrayToPath/CREDITS releases/1.2/lib/cs-arrayToPath/LICENSE releases/1.2/lib/cs-arrayToPath/VERSION releases/1.2/lib/cs-arrayToPath/cs_arrayToPath.class.php releases/1.2/lib/cs-arrayToPath/tests/ releases/1.2/lib/cs-arrayToPath/tests/example_test.php releases/1.2/lib/cs-arrayToPath/tests/testOfA2P.php releases/1.2/lib/cs-content/ releases/1.2/lib/cs-content/CREDITS releases/1.2/lib/cs-content/LICENSE releases/1.2/lib/cs-content/README.txt releases/1.2/lib/cs-content/VERSION releases/1.2/lib/cs-content/abstract/ releases/1.2/lib/cs-content/abstract/cs_content.abstract.class.php releases/1.2/lib/cs-content/abstract/cs_phpDB.abstract.class.php releases/1.2/lib/cs-content/contentSystem.class.php releases/1.2/lib/cs-content/cs_bbCodeParser.class.php releases/1.2/lib/cs-content/cs_fileSystem.class.php releases/1.2/lib/cs-content/cs_genericPage.class.php releases/1.2/lib/cs-content/cs_globalFunctions.class.php releases/1.2/lib/cs-content/cs_phpDB.class.php releases/1.2/lib/cs-content/cs_session.class.php releases/1.2/lib/cs-content/cs_siteConfig.class.php releases/1.2/lib/cs-content/cs_tabs.class.php releases/1.2/lib/cs-content/db_types/ releases/1.2/lib/cs-content/db_types/cs_phpDB__mysql.class.php releases/1.2/lib/cs-content/db_types/cs_phpDB__pgsql.class.php releases/1.2/lib/cs-content/db_types/cs_phpDB__sqlite.class.php releases/1.2/lib/cs-content/required/ releases/1.2/lib/cs-content/required/template.inc releases/1.2/lib/cs-content/sample_files/ releases/1.2/lib/cs-content/sample_files/public_html/ releases/1.2/lib/cs-content/sample_files/public_html/.htaccess releases/1.2/lib/cs-content/sample_files/public_html/content releases/1.2/lib/cs-content/sample_files/public_html/index.php releases/1.2/lib/cs-content/sample_files/templates/ releases/1.2/lib/cs-content/sample_files/templates/content/ releases/1.2/lib/cs-content/sample_files/templates/content/index.content.tmpl releases/1.2/lib/cs-content/sample_files/templates/footer.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/header.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/infobar.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/main.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/menu.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/ releases/1.2/lib/cs-content/sample_files/templates/system/404.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/construction.content.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/db_error.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/message_box.tmpl releases/1.2/lib/cs-content/tests/ releases/1.2/lib/cs-content/tests/example_test.php releases/1.2/lib/cs-content/tests/files/ releases/1.2/lib/cs-content/tests/files/gptest_all-together.txt releases/1.2/lib/cs-content/tests/files/sampleConfig.xml releases/1.2/lib/cs-content/tests/files/templates/ releases/1.2/lib/cs-content/tests/files/templates/content.shared.tmpl releases/1.2/lib/cs-content/tests/files/templates/footer.shared.tmpl releases/1.2/lib/cs-content/tests/files/templates/infobar.shared.tmpl releases/1.2/lib/cs-content/tests/files/templates/main.shared.tmpl releases/1.2/lib/cs-content/tests/files/templates/menubar.shared.tmpl releases/1.2/lib/cs-content/tests/files/templates/title.shared.tmpl releases/1.2/lib/cs-content/tests/testOfCSContent.php releases/1.2/lib/cs-phpxml/ releases/1.2/lib/cs-phpxml/CREDITS releases/1.2/lib/cs-phpxml/LICENSE releases/1.2/lib/cs-phpxml/README.txt releases/1.2/lib/cs-phpxml/VERSION releases/1.2/lib/cs-phpxml/cs_phpxml.abstract.class.php releases/1.2/lib/cs-phpxml/cs_phpxmlBuilder.class.php releases/1.2/lib/cs-phpxml/cs_phpxmlCreator.class.php releases/1.2/lib/cs-phpxml/cs_phpxmlParser.class.php releases/1.2/lib/cs-phpxml/tests/ releases/1.2/lib/cs-phpxml/tests/example_test.php releases/1.2/lib/cs-phpxml/tests/files/ releases/1.2/lib/cs-phpxml/tests/files/test1.xml releases/1.2/lib/cs-phpxml/tests/testOfCSPHPXML.php releases/1.2/lib/cs-versionparse/ releases/1.2/lib/cs-versionparse/CREDITS releases/1.2/lib/cs-versionparse/LICENSE releases/1.2/lib/cs-versionparse/VERSION releases/1.2/lib/cs-versionparse/cs_version.abstract.class.php releases/1.2/lib/cs-versionparse/tests/ releases/1.2/lib/cs-versionparse/tests/example_test.php releases/1.2/lib/cs-versionparse/tests/files/ releases/1.2/lib/cs-versionparse/tests/files/version1 releases/1.2/lib/cs-versionparse/tests/files/version2 releases/1.2/lib/cs-versionparse/tests/files/version3 releases/1.2/lib/cs-versionparse/tests/testOfCSVersionParse.php Added: releases/1.2/lib/cs-arrayToPath/CREDITS =================================================================== --- releases/1.2/lib/cs-arrayToPath/CREDITS (rev 0) +++ releases/1.2/lib/cs-arrayToPath/CREDITS 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,3 @@ + +Lead Developer: Dan Falconer (cra...@us...) + Added: releases/1.2/lib/cs-arrayToPath/LICENSE =================================================================== --- releases/1.2/lib/cs-arrayToPath/LICENSE (rev 0) +++ releases/1.2/lib/cs-arrayToPath/LICENSE 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,291 @@ +NOTE: a full HTML version of this license can be found at: +http://www.opensource.org/licenses/gpl-license.php + +It has been reproduced below without any HTML. +========================================================================== + +The GNU General Public License (GPL) + +Version 2, June 1991 + + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS Added: releases/1.2/lib/cs-arrayToPath/VERSION =================================================================== --- releases/1.2/lib/cs-arrayToPath/VERSION (rev 0) +++ releases/1.2/lib/cs-arrayToPath/VERSION 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,5 @@ +## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file. + +VERSION: 1.0 +PROJECT: cs-arrayToPath +$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk/VERSION $ \ No newline at end of file Added: releases/1.2/lib/cs-arrayToPath/cs_arrayToPath.class.php =================================================================== --- releases/1.2/lib/cs-arrayToPath/cs_arrayToPath.class.php (rev 0) +++ releases/1.2/lib/cs-arrayToPath/cs_arrayToPath.class.php 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,385 @@ +<?php +/* + * Created on Nov 20, 2006 + * + * SVN INFORMATION::: + * ------------------- + * Last Author::::::::: $Author: crazedsanity $ + * Current Revision:::: $Revision: 25 $ + * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk/cs_arrayToPath.class.php $ + * Last Updated:::::::: $Date: 2009-01-25 17:17:49 -0600 (Sun, 25 Jan 2009) $ + * + * + * Basically traverses an array as though it were a filesystem. In the given example, it looks + * more complex than necessary, but the "NEW WAY" is very programatic, whereas the "OLD WAY" is + * just that: OLD. Also, the new way is very extensible, and is handy when performing a LOT of + * complex operations on an array. + * Example: + * OLD WAY: + * $my_data = $array['path']['to']['your']['hidden']['data']; + * $my_vault = $array['path']['to']['your']['hidden']['vault']; + * $my_other = $array['path']['to']['your']['hidden']['other']; + * + * $array['path']['to']['my'] = array(); + * $array['path']['to']['my']['data'] = array(); + * $array['path']['to']['my']['data']['is'] = "here"; + * NEW WAY: + * $arrayToPath = new arrayToPath($array); + * $my_data = $arrayToPath('/path/to/your/hidden/data'); + * $my_vault = $arrayToPath('/path/to/your/hidden/vault'); + * $my_other = $arrayToPath('/path/to/your/hidden/other'); + * + * $arrayToPath->set_data('/path/to/my/data/is', 'here'); + */ + + +require_once(dirname(__FILE__) .'/../cs-versionparse/cs_version.abstract.class.php'); + +class cs_arrayToPath extends cs_versionAbstract { + + private $prefix = NULL; //the first directory to use. + private $data; + private $iteration = 0; + + //====================================================================================== + /** + * The constructor. + * + * @param $array (array) The data that will be used when + * + * TODO::: there is a strange recursion issue when $prefix is non-null: prefix is presently hardwired as NULL for now... + */ + public function __construct($array) { + $this->set_version_file_location(dirname(__FILE__) . '/VERSION'); + if($array === 'unit_test') { + //it's a unit test. + $this->isTest = TRUE; + } + else { + $this->get_version(); + if(!is_array($array)) { + //I don't deal with non-arrays. Idiot. + exit('arrayToPath{}->__construct(): got an invalid datatype.'); + } + //create a reference to the data, so if it changes, the class doesn't have to be re-initialized. + $this->data = $array; + } + }//end __construct() + //====================================================================================== + + + //====================================================================================== + /** + * Takes a path & returns the appropriate index in the session. + * + * @param $path <str> path to the appropriate section in the session. + * + * @return <NULL> FAIL: unable to find requested index. + * @return <mixed> PASS: this is the value of the index. + */ + public function get_data($path=NULL) { + $myIndexList = array(); + $path = $this->fix_path($path); + + if(is_null($path) || (strlen($path) < 1)) { + //they just want ALL THE DATA. + $retval = $this->data; + } + else { + //get the list of indices in our data that we have to traverse. + $myIndexList = $this->explode_path($path); + + //set an initial retval. + $retval = $this->get_data_segment($this->data, $myIndexList[0]); + unset($myIndexList[0]); + + if(count($myIndexList) > 0) { + foreach($myIndexList as $indexName) { + $retval = $this->get_data_segment($retval, $indexName); + if(is_null($retval)) { + //hmm... well, if it's null, it's nothing which can have a sub-index. Stop here. + break; + } + } + } + } + + return($retval); + + }//end get_data() + //====================================================================================== + + + + //====================================================================================== + /** + * Returns a given index from a piece of data, used by get_data(). + */ + private function get_data_segment($fromThis, $indexName) { + if(is_array($fromThis)) { + //it's an array. + $retval = $fromThis[$indexName]; + } + elseif(is_object($fromThis)) { + //it's an object. + $retval = $fromThis->$indexName; + } + return($retval); + }//end get_data_segment() + //====================================================================================== + + + + //====================================================================================== + /** + * Fixes issues with extra slashes and such. + * + * @param $path <str> path to fix + * + * @return <str> PASS: this is the fixed path + */ + private function fix_path($path) { + $retval = $path; + if(!is_null($path) && strlen($path)) { + + $retval = preg_replace('/[\/]{2,}/', '/', $retval); + if(strlen($retval) && preg_match('/\./', $retval)) { + + $pieces = explode('/', $retval); + + $finalPieces = array(); + for($i=0; $i < count($pieces); $i++) { + $dirName = $pieces[$i]; + if($dirName == '.') { + //do nothing; don't bother appending. + } + elseif($dirName == '..') { + $rippedIndex = array_pop($finalPieces); + } + else { + $finalPieces[] = $dirName; + } + } + + #$retval = $this->gf->string_from_array($finalPieces, NULL, '/'); + $retval = ""; + foreach($finalPieces as $bit) { + if(strlen($retval)) { + $retval .= '/'. $bit; + } + else { + $retval = '/'. $bit; + } + } + } + + //remove slashes at the beginning or end of the path. + $retval = preg_replace('/\/$/', '', $retval); + + //remove a trailing slash, if present, before returning. + $retval = preg_replace('/\/$/', '', $retval); + } + + return($retval); + + }//end fix_path() + //====================================================================================== + + + + //====================================================================================== + /** + * Sets data into the given path, with options to override our internal prefix, and to + * force-overwrite data if it's not an array. + * + * @param $path <str> path to set the data into. + * @param $data <mixed> what to set into the given path. + * + * @return 0 FAIL: old data doesn't match new data. + * @return 1 PASS: everything lines-up. + */ + public function set_data($path, $data) { + //get the list of indices in the session that we have to traverse. + $myIndexList = $this->explode_path($path); + + $retval = 0; + //Use an internal iterator to go through the little bits of the session & set the + // data where it's supposed to be. + if($path === '/' || count($myIndexList) == 0) { + //setting the data. + $this->data = $data; + $retval = 1; + } + elseif(count($myIndexList) == 1) { + //that should be simple: set the index to be $data. + $this->data[$myIndexList[0]] = $data; + $retval = 1; + } + elseif(count($myIndexList) > 1) { + $this->internal_iterator($this->data, $path, $data); + $retval = 1; + } + + return($retval); + }//end set_data() + //====================================================================================== + + + //====================================================================================== + /** + * Iterates through the session to create the values for set_data(). This method passes + * AND returns the $array argument by reference. + * + * @param &$array (array) iterate through this. + * @param $path (array) numbered array of keys, representing a path through the + * internal data to go through to set $data. + * @param $data (mixed) data to set into the path referenced in $indexList. + * + * @return <void> + */ + protected function &internal_iterator(&$array, $path, $data) { + //make sure it doesn't call itself to death. ;) + $this->iteration++; + + if($this->iteration > 1000) { + throw new exception("arrayToPath{}: too many iterations, path=($path)"); + } + + $retval = 0; + $indexList = $this->explode_path($path); + $myIndex = array_shift($indexList); + $path = $this->string_from_array($indexList); + + if(is_array($array) && !strlen($path)) { + if(isset($myIndex)) { + //set the final piece of the array. + $array[$myIndex] = $data; + } + else { + //something is broken. + throw new exception("arrayToPath{}->internal_iterator(): no index ($myIndex) to follow at the end of the path."); + } + } + elseif(is_array($array) && strlen($path)) { + if((count($indexList) == 0) || (is_array($indexList) && count($indexList) > 1)) { + if(!is_array($array[$myIndex])) { + $array[$myIndex] = array(); + } + $array = &$array[$myIndex]; + $newPath = $this->string_from_array($indexList); + + $this->internal_iterator($array, $path, $data); + } + elseif(is_array($indexList) && count($indexList) == 1) { + if(!is_array($array[$myIndex])) { + $array[$myIndex] = array(); + } + $array = &$array[$myIndex]; + $this->internal_iterator($array, $indexList[0], $data); + } + else { + //not sure what to do but throw an exception. + throw new exception("arrayToPath{}->internal_iterator(): unknown error ('not sure what to do'): ($array)"); + } + } + elseif(is_object($array)) { + //can't handle objects...? + throw new exception("arrayToPath{}->internal_iterator(): can't handle objects...?"); + } + else { + //something is... er... broken. + throw new exception("arrayToPath{}->internal_iterator(): found unknown data type in path ($array)"); + } + + //decrement the iteration, so methods using it can call it multiple times without worrying about accidentally hitting the limit. + $this->iteration--; + }//end internal_iterator() + //====================================================================================== + + + + + //====================================================================================== + /** + * Will unset the final index in the $path var. I.E. to unset $this->array['x']['y'], + * call unset_data('/x/y') + * + * @param $path (str) path to unset data; The last item in the path will be removed. + */ + public function unset_data($path) { + //explode the path. + $pathArr = $this->explode_path($path); + $removeThis = array_pop($pathArr); + $path = $this->string_from_array($pathArr); + + //retrieve the data... + $myData = $this->get_data($path); + + if(is_array($myData)) { + //now remove the bit of data as requested. + unset($myData[$removeThis]); + //update the path with our new data. + $retval = $this->set_data($path, $myData); + } + else { + //throw a terrible error. + throw new exception("unset_data(): data ($myData) wasn't an array! ($path)"); + } + + return($retval); + }//end unset_data() + //====================================================================================== + + + + //====================================================================================== + /** + * Performs all the work of exploding the path and fixing it. + * + * @param $path <string> Path to work with. + * @return <array> PASS: array contains exploded path. + */ + public function explode_path($path) { + $path = preg_replace('/\/\//', '/', $path); + $path = $this->fix_path($path); + $retval = explode('/', $path); + + //if the initial index is blank, just remove it. + if($retval[0] == '' || strlen($retval[0]) < 1) { + //it was blank! KILL IT! + $checkItOut = array_shift($retval); + } + + return($retval); + }//end explode_path() + //====================================================================================== + + + + //====================================================================================== + public function reload_data($array) { + //call the constructor on it, and pass along the CURRENT prefix, so it doesn't get reset. + $this->__construct($array); + }//end reload_data() + //====================================================================================== + + + + //====================================================================================== + private function string_from_array(array $array) { + $retval = ""; + foreach($array as $index) { + if(strlen($retval)) { + $retval .= "/". $index; + } + else { + $retval = $index; + } + } + return($retval); + }//end string_from_array() + //====================================================================================== + +}//end arrayToPath{} + +?> Added: releases/1.2/lib/cs-arrayToPath/tests/example_test.php =================================================================== --- releases/1.2/lib/cs-arrayToPath/tests/example_test.php (rev 0) +++ releases/1.2/lib/cs-arrayToPath/tests/example_test.php 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,19 @@ +<?php +/* + * Created on Jan 25, 2009 + * + * FILE INFORMATION: + * + * $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk/tests/example_test.php $ + * $Id: example_test.php 23 2009-01-25 21:25:10Z crazedsanity $ + * $LastChangedDate: 2009-01-25 15:25:10 -0600 (Sun, 25 Jan 2009) $ + * $LastChangedBy: crazedsanity $ + * $LastChangedRevision: 23 $ + */ + + +require_once(dirname(__FILE__) .'/testOfA2P.php'); + +$test = &new TestOfA2P(); +$test->run(new HtmlReporter()) +?> Added: releases/1.2/lib/cs-arrayToPath/tests/testOfA2P.php =================================================================== --- releases/1.2/lib/cs-arrayToPath/tests/testOfA2P.php (rev 0) +++ releases/1.2/lib/cs-arrayToPath/tests/testOfA2P.php 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,75 @@ +<?php +/* + * Created on Jan 25, 2009 + * + * FILE INFORMATION: + * + * $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk/tests/testOfA2P.php $ + * $Id: testOfA2P.php 25 2009-01-25 23:17:49Z crazedsanity $ + * $LastChangedDate: 2009-01-25 17:17:49 -0600 (Sun, 25 Jan 2009) $ + * $LastChangedBy: crazedsanity $ + * $LastChangedRevision: 25 $ + */ + +require_once(dirname(__FILE__) .'/../cs_arrayToPath.class.php'); + +class testOfA2P extends UnitTestCase { + + //------------------------------------------------------------------------- + function setUp() { + $this->a2p = new cs_arrayToPath(array()); + $this->gfObj = new cs_globalFunctions; + }//end setUp() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + function tearDown() { + }//end tearDown() + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + function test_basics() { + //make sure nothing is in the object initialially. + $this->assertEqual(array(), $this->a2p->get_data()); + + $newData = array( + 'look at me' => '23dasdvcv3q3qeedasd' + ); + $this->a2p->reload_data($newData); + $this->assertNotEqual(array(), $this->a2p->get_data()); + + + //load a complex array & test to ensure the returned value is the same. + $newData = array( + 'x' => array( + 'y' => array( + 'z' => array( + 'fiNal' => 'asdfadsfadfadsfasdf' + ) + ), + '_y_' => null, + '-' => null + ), + 'a nother path2 Stuff -+=~!@#$' + ); + $this->a2p->reload_data($newData); + $this->assertEqual($newData, $this->a2p->get_data()); + $this->assertEqual($newData['x']['y']['z']['fiNal'], $this->a2p->get_data('/x/y/z/fiNal')); + + $this->a2p->set_data('/x/y/z/fiNal', null); + $this->assertNotEqual($this->a2p->get_data('/x/y/z/fiNal'), $newData['x']['y']['z']['fiNal']); + + //ensure paths with dots are ok. + $this->assertEqual($this->a2p->get_data('/x/y/z/fiNal'), $this->a2p->get_data('/x/y/z/g/q/x/../../../fiNal')); + + //make sure extra slashes are okay. + $this->assertEqual($this->a2p->get_data('/x/y/z/fiNal'), $this->a2p->get_data('/x/y//z///fiNal//')); + }//end test_basics() + //------------------------------------------------------------------------- + +}//end testOfA2P{} +?> Added: releases/1.2/lib/cs-content/CREDITS =================================================================== --- releases/1.2/lib/cs-content/CREDITS (rev 0) +++ releases/1.2/lib/cs-content/CREDITS 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,3 @@ + +Lead Developer: Dan Falconer (cra...@us...) + Added: releases/1.2/lib/cs-content/LICENSE =================================================================== --- releases/1.2/lib/cs-content/LICENSE (rev 0) +++ releases/1.2/lib/cs-content/LICENSE 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,291 @@ +NOTE: a full HTML version of this license can be found at: +http://www.opensource.org/licenses/gpl-license.php + +It has been reproduced below without any HTML. +========================================================================== + +The GNU General Public License (GPL) + +Version 2, June 1991 + + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS Added: releases/1.2/lib/cs-content/README.txt =================================================================== --- releases/1.2/lib/cs-content/README.txt (rev 0) +++ releases/1.2/lib/cs-content/README.txt 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,5 @@ +Documentation is now located at: +[https://cs-content.svn.sourceforge.net/svnroot/cs-content/documentation]. It +has been moved to avoid unnecessarily large downloads. + +$Id: README.txt 267 2008-04-29 15:27:28Z crazedsanity $ \ No newline at end of file Added: releases/1.2/lib/cs-content/VERSION =================================================================== --- releases/1.2/lib/cs-content/VERSION (rev 0) +++ releases/1.2/lib/cs-content/VERSION 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,5 @@ +## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file. + +VERSION: 1.0-ALPHA7 +PROJECT: cs-content +$HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/1.0/VERSION $ \ No newline at end of file Added: releases/1.2/lib/cs-content/abstract/cs_content.abstract.class.php =================================================================== --- releases/1.2/lib/cs-content/abstract/cs_content.abstract.class.php (rev 0) +++ releases/1.2/lib/cs-content/abstract/cs_content.abstract.class.php 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,36 @@ +<?php +/* + * Created on Jan 29, 2009 + * + * FILE INFORMATION: + * + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/1.0/abstract/cs_content.abstract.class.php $ + * $Id: cs_content.abstract.class.php 335 2009-01-29 21:25:58Z crazedsanity $ + * $LastChangedDate: 2009-01-29 15:25:58 -0600 (Thu, 29 Jan 2009) $ + * $LastChangedBy: crazedsanity $ + * $LastChangedRevision: 335 $ + */ + +require_once(dirname(__FILE__) ."/../../cs-versionparse/cs_version.abstract.class.php"); + + +abstract class cs_contentAbstract extends cs_versionAbstract { + + //------------------------------------------------------------------------- + function __construct($makeGfObj=true) { + $this->set_version_file_location(dirname(__FILE__) . '/../VERSION'); + $this->get_version(); + $this->get_project(); + + if($makeGfObj === true) { + //make a cs_globalFunctions{} object. + require_once(dirname(__FILE__) ."/../cs_globalFunctions.class.php"); + $this->gfObj = new cs_globalFunctions(); + } + }//end __construct() + //------------------------------------------------------------------------- + + + +} +?> \ No newline at end of file Added: releases/1.2/lib/cs-content/abstract/cs_phpDB.abstract.class.php =================================================================== --- releases/1.2/lib/cs-content/abstract/cs_phpDB.abstract.class.php (rev 0) +++ releases/1.2/lib/cs-content/abstract/cs_phpDB.abstract.class.php 2009-02-06 20:57:19 UTC (rev 944) @@ -0,0 +1,166 @@ +<?php +/* + * Created on Jan 29, 2009 + * + * FILE INFORMATION: + * + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/1.0/abstract/cs_phpDB.abstract.class.php $ + * $Id: cs_phpDB.abstract.class.php 330 2009-01-29 19:44:01Z crazedsanity $ + * $LastChangedDate: 2009-01-29 13:44:01 -0600 (Thu, 29 Jan 2009) $ + * $LastChangedBy: crazedsanity $ + * $LastChangedRevision: 330 $ + */ + +abstract class cs_phpDBAbstract { + + /** 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; + + + + //Define some abstract methods so they MUST be provided in order for things to work. + abstract public function set_db_info(array $params); + abstract public function close(); + abstract public function connect(array $dbParams=NULL, $forceNewConnection=FALSE); + abstract public function exec($query); + abstract public function errorMsg($setMessage=null, $logError=null); + abstract public function fobject(); + abstract public function farray(); + abstract public function farray_fieldnames($index=null, $numbered=null,$unsetIndex=1); + abstr... [truncated message content] |