Changeset 1582
- Timestamp:
- 10/31/08 01:45:27 (2 months ago)
- Files:
-
- trunk/CHANGELOG (modified) (2 diffs)
- trunk/codebase/includes/classes/PEAR/Auth.php (added)
- trunk/codebase/includes/classes/PEAR/Auth/Anonymous.php (modified) (7 diffs)
- trunk/codebase/includes/classes/PEAR/Auth/Container.php (deleted)
- trunk/codebase/includes/classes/PEAR/Auth/Controller.php (modified) (16 diffs)
- trunk/codebase/includes/classes/PEAR/Auth/HTTP.php (deleted)
- trunk/codebase/includes/classes/PEAR/Auth/PrefManager.php (deleted)
- trunk/codebase/includes/classes/PEAR/Auth/RADIUS.php (deleted)
- trunk/codebase/includes/classes/PEAR/Auth/SASL.php (deleted)
- trunk/codebase/includes/classes/PEAR/Container (added)
- trunk/codebase/includes/classes/PEAR/Container.php (added)
- trunk/codebase/includes/classes/PEAR/Container/Array.php (added)
- trunk/codebase/includes/classes/PEAR/Container/DB.php (added)
- trunk/codebase/includes/classes/PEAR/Container/DBLite.php (added)
- trunk/codebase/includes/classes/PEAR/Container/File.php (added)
- trunk/codebase/includes/classes/PEAR/Container/IMAP.php (added)
- trunk/codebase/includes/classes/PEAR/Container/KADM5.php (added)
- trunk/codebase/includes/classes/PEAR/Container/LDAP.php (added)
- trunk/codebase/includes/classes/PEAR/Container/MDB.php (added)
- trunk/codebase/includes/classes/PEAR/Container/MDB2.php (added)
- trunk/codebase/includes/classes/PEAR/Container/Multiple.php (added)
- trunk/codebase/includes/classes/PEAR/Container/NetVPOPMaild.php (added)
- trunk/codebase/includes/classes/PEAR/Container/PEAR.php (added)
- trunk/codebase/includes/classes/PEAR/Container/POP3.php (added)
- trunk/codebase/includes/classes/PEAR/Container/RADIUS.php (added)
- trunk/codebase/includes/classes/PEAR/Container/SAP.php (added)
- trunk/codebase/includes/classes/PEAR/Container/SMBPasswd.php (added)
- trunk/codebase/includes/classes/PEAR/Container/SOAP.php (added)
- trunk/codebase/includes/classes/PEAR/Container/SOAP5.php (added)
- trunk/codebase/includes/classes/PEAR/Container/vpopmail.php (added)
- trunk/codebase/includes/classes/PEAR/DB/DataObject.php (modified) (23 diffs)
- trunk/codebase/includes/classes/PEAR/DB/DataObject/Generator.php (modified) (8 diffs)
- trunk/codebase/includes/classes/PEAR/Date.php (modified) (42 diffs)
- trunk/codebase/includes/classes/PEAR/Date/Calc.php (modified) (88 diffs)
- trunk/codebase/includes/classes/PEAR/Date/Human.php (modified) (9 diffs)
- trunk/codebase/includes/classes/PEAR/Date/Span.php (modified) (38 diffs)
- trunk/codebase/includes/classes/PEAR/Date/TimeZone.php (modified) (25 diffs)
- trunk/codebase/includes/classes/PEAR/MDB2.php (modified) (13 diffs)
- trunk/codebase/includes/classes/PEAR/MDB2/Driver/Datatype/Common.php (modified) (7 diffs)
- trunk/codebase/includes/classes/PEAR/MDB2/Driver/Function/Common.php (modified) (10 diffs)
- trunk/codebase/includes/classes/PEAR/MDB2/Driver/Manager/Common.php (modified) (13 diffs)
- trunk/codebase/includes/classes/PEAR/MDB2/Driver/Native/Common.php (modified) (1 diff)
- trunk/codebase/includes/classes/PEAR/MDB2/Driver/Reverse/Common.php (modified) (6 diffs)
- trunk/codebase/includes/classes/PEAR/Mail.php (modified) (7 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/Queue.php (added)
- trunk/codebase/includes/classes/PEAR/Mail/Queue/Body.php (modified) (16 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/Queue/Container.php (modified) (5 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/Queue/Container/creole.php (added)
- trunk/codebase/includes/classes/PEAR/Mail/Queue/Container/db.php (modified) (16 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/Queue/Container/mdb.php (modified) (15 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/Queue/Container/mdb2.php (modified) (18 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/RFC822.php (modified) (2 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/mail.php (modified) (6 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/mock.php (added)
- trunk/codebase/includes/classes/PEAR/Mail/sendmail.php (modified) (5 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/smtp.php (modified) (14 diffs)
- trunk/codebase/includes/classes/PEAR/Mail/smtpmx.php (added)
- trunk/codebase/includes/classes/PEAR/Net/SMTP.php (modified) (15 diffs)
- trunk/codebase/includes/classes/PEAR/Net/Socket.php (modified) (13 diffs)
- trunk/codebase/includes/classes/PEAR/PEAR (added)
- trunk/codebase/includes/classes/PEAR/PEAR.php (modified) (5 diffs)
- trunk/codebase/includes/classes/PEAR/PEAR/FixPHP5PEARWarnings.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CHANGELOG
r1580 r1582 3 3 Version 4.0.2.2 4 4 =============== 5 AUTHOR: Paul Rogers <paul@omnium.net.au> 6 DATE: 31/10/2008 7 - Updated PEAR, and PEAR packages. Part of [#319] 8 - Packages updated include: 9 - PEAR Core 10 - Auth 11 - Date 12 - DB 13 - DB_DataObject 14 - Mail 15 - Mail_MIME 16 - Mail_Queue 17 - MDB2 18 - Net_SMTP 19 - Net_Socket 20 5 21 AUTHOR: Tim Neill <tim@omnium.net.au> 6 22 DATE: 30/10/2008 … … 27 43 text nodes with the parser. This was mostly done to allow for prettier 28 44 <embed> style tags for the youtube tag. It will also allow for "sprintf" 29 to be applied to the content captured inside tags. 45 to be applied to the content captured inside tags. Part of [#331] 30 46 31 47 trunk/codebase/includes/classes/PEAR/Auth/Anonymous.php
r1381 r1582 19 19 * @copyright 2001-2006 The PHP Group 20 20 * @license http://www.php.net/license/3_01.txt PHP License 3.01 21 * @version CVS: $Id: Anonymous.php,v 1. 5 2006/03/02 06:53:08aashley Exp $21 * @version CVS: $Id: Anonymous.php,v 1.6 2007/06/12 03:11:26 aashley Exp $ 22 22 * @link http://pear.php.net/package/Auth 23 23 * @since File available since Release 1.3.0 … … 31 31 /** 32 32 * Anonymous Authentication 33 * 34 * This class provides anonymous authentication if username and password 33 * 34 * This class provides anonymous authentication if username and password 35 35 * were not supplied 36 36 * … … 41 41 * @copyright 2001-2006 The PHP Group 42 42 * @license http://www.php.net/license/3_01.txt PHP License 3.01 43 * @version Release: 1. 5.0 File: $Revision: 1.5$43 * @version Release: 1.6.1 File: $Revision: 1.6 $ 44 44 * @link http://pear.php.net/package/Auth 45 45 * @since Class available since Release 1.3.0 46 46 */ 47 class Auth_Anonymous extends Auth 47 class Auth_Anonymous extends Auth 48 48 { 49 49 … … 66 66 // }}} 67 67 // {{{ Auth_Anonymous() [constructor] 68 68 69 69 /** 70 70 * Pass all parameters to Parent Auth class 71 * 71 * 72 72 * Set up the storage driver. 73 73 * … … 88 88 // }}} 89 89 // {{{ login() 90 90 91 91 /** 92 92 * Login function 93 * 93 * 94 94 * If no username & password is passed then login as the username 95 95 * provided in $this->anonymous_username else call standard login() … … 101 101 */ 102 102 function login() { 103 if ( $this->allow_anonymous 104 && empty($this->username) 103 if ( $this->allow_anonymous 104 && empty($this->username) 105 105 && empty($this->password) ) { 106 106 $this->setAuth($this->anonymous_username); … … 116 116 // }}} 117 117 // {{{ forceLogin() 118 118 119 119 /** 120 120 * Force the user to login trunk/codebase/includes/classes/PEAR/Auth/Controller.php
r1381 r1582 19 19 * @copyright 2001-2006 The PHP Group 20 20 * @license http://www.php.net/license/3_01.txt PHP License 3.01 21 * @version CVS: $Id: Controller.php,v 1.1 0 2006/03/02 06:53:08aashley Exp $21 * @version CVS: $Id: Controller.php,v 1.11 2007/06/12 03:11:26 aashley Exp $ 22 22 * @link http://pear.php.net/package/Auth 23 23 * @since File available since Release 1.3.0 … … 25 25 26 26 /** 27 * Controlls access to a group of php access 28 * and redirects to a predefined login page as 27 * Controlls access to a group of php access 28 * and redirects to a predefined login page as 29 29 * needed 30 30 * … … 47 47 * if( $authController->isAuthorised() ){ 48 48 * $authController->redirectBack(); 49 * } 49 * } 50 50 * </code> 51 51 * … … 55 55 * @copyright 2001-2006 The PHP Group 56 56 * @license http://www.php.net/license/3_01.txt PHP License 3.01 57 * @version Release: 1. 5.0 File: $Revision: 1.10$57 * @version Release: 1.6.1 File: $Revision: 1.11 $ 58 58 * @link http://pear.php.net/package/Auth 59 59 * @since Class available since Release 1.3.0 … … 64 64 // {{{ properties 65 65 66 /** 66 /** 67 67 * The Auth instance this controller is managing 68 68 * … … 70 70 */ 71 71 var $auth = null; 72 72 73 73 /** 74 74 * The login URL … … 76 76 * */ 77 77 var $login = null; 78 78 79 79 /** 80 80 * The default index page to use when the caller page is not set 81 81 * 82 * @var string 82 * @var string 83 83 */ 84 84 var $default = null; 85 86 /** 87 * If this is set to true after a succesfull login the 88 * Auth_Controller::redirectBack() is invoked automatically 85 86 /** 87 * If this is set to true after a succesfull login the 88 * Auth_Controller::redirectBack() is invoked automatically 89 89 * 90 90 * @var boolean … … 94 94 // }}} 95 95 // {{{ Auth_Controller() [constructor] 96 96 97 97 /** 98 98 * Constructor … … 122 122 // }}} 123 123 // {{{ setAutoRedirectBack() 124 125 /** 124 125 /** 126 126 * Enables auto redirection when login is done 127 * 127 * 128 128 * @param bool Sets the autoRedirectBack flag to this 129 129 * @see Auth_Controller::autoRedirectBack … … 137 137 // }}} 138 138 // {{{ redirectBack() 139 139 140 140 /** 141 141 * Redirects Back to the calling page … … 147 147 // If redirectback go there 148 148 // else go to the default page 149 149 150 150 $returnUrl = $this->auth->getAuthData('returnUrl'); 151 151 if(!$returnUrl) { 152 152 $returnUrl = $this->_defaultPage; 153 153 } 154 154 155 155 // Add some entropy to the return to make it unique 156 156 // avoind problems with cached pages and proxies … … 163 163 if($this->auth->status != '') { 164 164 $url .= '&authstatus='.$this->auth->status; 165 } 165 } 166 166 header('Location:'.$returnUrl); 167 167 print("You could not be redirected to <a href=\"$returnUrl\">$returnUrl</a>"); … … 170 170 // }}} 171 171 // {{{ redirectLogin() 172 172 173 173 /** 174 174 * Redirects to the login Page if not authorised 175 * 175 * 176 176 * put return page on the query or in auth 177 177 * … … 181 181 { 182 182 // Go to the login Page 183 183 184 184 // For Auth, put some check to avoid infinite redirects, this should at least exclude 185 185 // the login page 186 186 187 187 $url = $this->_loginPage; 188 188 if(strpos($url, '?') === false) { … … 205 205 // }}} 206 206 // {{{ start() 207 207 208 208 /** 209 209 * Starts the Auth Procedure … … 227 227 // Logged on and on login page 228 228 if(strstr($_SERVER['PHP_SELF'], $this->_loginPage) && $this->auth->checkAuth()){ 229 $this->autoRedirectBack ? 229 $this->autoRedirectBack ? 230 230 $this->redirectBack() : 231 231 null ; 232 232 } 233 233 } 234 235 234 235 236 236 } 237 237 238 238 // }}} 239 239 // {{{ isAuthorised() 240 240 241 241 /** 242 242 * Checks is the user is logged on trunk/codebase/includes/classes/PEAR/DB/DataObject.php
r1287 r1582 16 16 * @copyright 1997-2006 The PHP Group 17 17 * @license http://www.php.net/license/3_0.txt PHP License 3.0 18 * @version CVS: $Id: DataObject.php,v 1.43 2 2007/07/09 08:55:50alan_k Exp $18 * @version CVS: $Id: DataObject.php,v 1.439 2008/01/30 02:14:06 alan_k Exp $ 19 19 * @link http://pear.php.net/package/DB_DataObject 20 20 */ … … 236 236 * @var string 237 237 */ 238 var $_DB_DataObject_version = "1.8. 7";238 var $_DB_DataObject_version = "1.8.8"; 239 239 240 240 /** … … 389 389 { 390 390 global $_DB_DATAOBJECT; 391 if ( !isset($this->_query)) {391 if ($this->_query === false) { 392 392 $this->raiseError( 393 393 "You cannot do two queries on the same object (copy it before finding)", … … 572 572 $this->debug("{$this->__table} DONE", "fetchrow",2); 573 573 } 574 if ( isset($this->_query) && empty($_DB_DATAOBJECT['CONFIG']['keep_query_after_fetch'])) {575 unset($this->_query);574 if (($this->_query !== false) && empty($_DB_DATAOBJECT['CONFIG']['keep_query_after_fetch'])) { 575 $this->_query = false; 576 576 } 577 577 return true; … … 592 592 function whereAdd($cond = false, $logic = 'AND') 593 593 { 594 595 if (!isset($this->_query)) { 594 // for PHP5.2.3 - there is a bug with setting array properties of an object. 595 $_query = $this->_query; 596 597 if (!isset($this->_query) || ($_query === false)) { 596 598 return $this->raiseError( 597 599 "You cannot do two queries on the same object (clone it before finding)", … … 601 603 if ($cond === false) { 602 604 $r = $this->_query['condition']; 603 $this->_query['condition'] = ''; 605 $_query['condition'] = ''; 606 $this->_query = $_query; 604 607 return preg_replace('/^\s+WHERE\s+/','',$r); 605 608 } … … 608 611 return $this->raiseError("WhereAdd: No Valid Arguments", DB_DATAOBJECT_ERROR_INVALIDARGS); 609 612 } 610 $r = $this->_query['condition']; 611 if ($this->_query['condition']) { 612 $this->_query['condition'] .= " {$logic} ( {$cond} )"; 613 $r = $_query['condition']; 614 if ($_query['condition']) { 615 $_query['condition'] .= " {$logic} ( {$cond} )"; 616 $this->_query = $_query; 613 617 return $r; 614 618 } 615 $this->_query['condition'] = " WHERE ( {$cond} ) "; 619 $_query['condition'] = " WHERE ( {$cond} ) "; 620 $this->_query = $_query; 616 621 return $r; 617 622 } … … 630 635 function orderBy($order = false) 631 636 { 632 if ( !isset($this->_query)) {637 if ($this->_query === false) { 633 638 $this->raiseError( 634 639 "You cannot do two queries on the same object (copy it before finding)", … … 665 670 function groupBy($group = false) 666 671 { 667 if ( !isset($this->_query)) {672 if ($this->_query === false) { 668 673 $this->raiseError( 669 674 "You cannot do two queries on the same object (copy it before finding)", … … 700 705 function having($having = false) 701 706 { 702 if ( !isset($this->_query)) {707 if ($this->_query === false) { 703 708 $this->raiseError( 704 709 "You cannot do two queries on the same object (copy it before finding)", … … 741 746 function limit($a = null, $b = null) 742 747 { 743 if ( !isset($this->_query)) {748 if ($this->_query === false) { 744 749 $this->raiseError( 745 750 "You cannot do two queries on the same object (copy it before finding)", … … 784 789 function selectAdd($k = null) 785 790 { 786 if ( !isset($this->_query)) {791 if ($this->_query === false) { 787 792 $this->raiseError( 788 793 "You cannot do two queries on the same object (copy it before finding)", … … 826 831 global $_DB_DATAOBJECT; 827 832 828 if ( !isset($this->_query)) {833 if ($this->_query === false) { 829 834 $this->raiseError( 830 835 "You cannot do two queries on the same object (copy it before finding)", … … 1059 1064 $mssql_key = $DB->$method("SELECT @@IDENTITY"); 1060 1065 if (PEAR::isError($mssql_key)) { 1061 $this->raiseError($ r);1066 $this->raiseError($mssql_key); 1062 1067 return false; 1063 1068 } … … 1067 1072 case 'pgsql': 1068 1073 if (!$seq) { 1069 $seq = $DB->getSequenceName( $this->__table);1074 $seq = $DB->getSequenceName(strtolower($this->__table)); 1070 1075 } 1071 $pgsql_key = $DB->getOne("SELECT currval('".$seq . "')"); 1076 $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver']; 1077 $method = ($db_driver == 'DB') ? 'getOne' : 'queryOne'; 1078 $pgsql_key = $DB->$method("SELECT currval('".$seq . "')"); 1079 1072 1080 1073 1081 if (PEAR::isError($pgsql_key)) { 1074 $this->raiseError($ r);1082 $this->raiseError($pgsql_key); 1075 1083 return false; 1076 1084 } … … 1145 1153 1146 1154 1147 $original_query = isset($this->_query) ? $this->_query : null;1155 $original_query = $this->_query; 1148 1156 1149 1157 $items = isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table]) ? … … 1359 1367 1360 1368 // don't delete without a condition 1361 if ( isset($this->_query) && $this->_query['condition']) {1369 if (($this->_query !== false) && $this->_query['condition']) { 1362 1370 1363 1371 $table = ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table); … … 1494 1502 1495 1503 $t = clone($this); 1504 $items = $t->table(); 1496 1505 1497 1506 $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']); 1498 1507 1499 $items = $t->table();1508 1500 1509 if (!isset($t->_query)) { 1501 1510 $this->raiseError( … … 2036 2045 // we need to get the new improved tabledata sorted out first. 2037 2046 2038 if ( in_array($dbtype , array( 'mysql', 'mysqli', 'mssql', 'ifx')) &&2047 if ( in_array($dbtype , array('psql', 'mysql', 'mysqli', 'mssql', 'ifx')) && 2039 2048 ($table[$usekey] & DB_DATAOBJECT_INT) && 2040 2049 isset($realkeys[$usekey]) && ($realkeys[$usekey] == 'N') … … 2228 2237 require_once 'DB.php'; 2229 2238 if ($db_options) { 2230 $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = DB::connect($dsn,$db_options);2239 $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = &DB::connect($dsn,$db_options); 2231 2240 } else { 2232 $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = DB::connect($dsn);2241 $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = &DB::connect($dsn); 2233 2242 } 2234 2243 … … 2238 2247 // this allows the setings of compatibility on MDB2 2239 2248 $db_options = PEAR::getStaticProperty('MDB2','options'); 2240 $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = MDB2::connect($dsn,$db_options); 2249 $db_options = is_array($db_options) ? $db_options : array(); 2250 $db_options['portability'] = isset($db_options['portability'] ) 2251 ? $db_options['portability'] : MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE; 2252 $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5] = &MDB2::connect($dsn,$db_options); 2241 2253 2242 2254 } … … 2431 2443 2432 2444 // if we dont have query vars.. - reset them. 2433 if ( !isset($this->_query)) {2445 if ($this->_query === false) { 2434 2446 $x = new DB_DataObject; 2435 2447 $this->_query= $x->_query; … … 3286 3298 $obj->whereAdd("{$joinAs}.{$kSql} = 0"); 3287 3299 } 3288 if ( !isset($this->_query)) {3300 if ($this->_query === false) { 3289 3301 $this->raiseError( 3290 3302 "joinAdd can not be run from a object that has had a query run on it, trunk/codebase/includes/classes/PEAR/DB/DataObject/Generator.php
r1287 r1582 16 16 * @copyright 1997-2006 The PHP Group 17 17 * @license http://www.php.net/license/3_0.txt PHP License 3.0 18 * @version CVS: $Id: Generator.php,v 1.1 36 2007/07/12 02:57:04alan_k Exp $18 * @version CVS: $Id: Generator.php,v 1.141 2008/01/30 02:29:39 alan_k Exp $ 19 19 * @link http://pear.php.net/package/DB_DataObject 20 20 */ … … 257 257 } 258 258 } 259 $quotedTable = !empty($options['quote_identifiers ']) ?259 $quotedTable = !empty($options['quote_identifiers_tableinfo']) ? 260 260 $__DB->quoteIdentifier($table) : $table; 261 261 … … 354 354 fclose($fh); 355 355 $perms = file_exists($file) ? fileperms($file) : 0755; 356 rename($tmpname, $file); 356 // windows can fail doing this. - not a perfect solution but otherwise it's getting really kludgy.. 357 358 if (!@rename($tmpname, $file)) { 359 unlink($file); 360 rename($tmpname, $file); 361 } 357 362 chmod($file,$perms); 358 363 //$ret = $this->_newConfig->writeInput($file,false); … … 445 450 fclose($fh); 446 451 $perms = file_exists($file) ? fileperms($file) : 0755; 447 rename($tmpname, $file); 452 // windows can fail doing this. - not a perfect solution but otherwise it's getting really kludgy.. 453 if (!@rename($tmpname, $file)) { 454 unlink($file); 455 rename($tmpname, $file); 456 } 448 457 chmod($file, $perms); 449 458 } … … 600 609 "** Please submit a bug, describe what type you expect this **\n". 601 610 "** column to be **\n". 611 "** ---------POSSIBLE FIX / WORKAROUND -------------------------**\n". 612 "** Try using MDB2 as the backend - eg set the config option **\n". 613 "** db_driver = MDB2 **\n". 602 614 "*****************************************************************\n"; 603 615 $write_ini = false; … … 776 788 fclose($fh); 777 789 $perms = file_exists($outfilename) ? fileperms($outfilename) : 0755; 778 rename($tmpname, $outfilename); 790 791 // windows can fail doing this. - not a perfect solution but otherwise it's getting really kludgy.. 792 if (!@rename($tmpname, $outfilename)) { 793 unlink($outfilename); 794 rename($tmpname, $outfilename); 795 } 796 779 797 chmod($outfilename, $perms); 780 798 } … … 985 1003 $class_rewrite = 'DB_DataObject'; 986 1004 $options = &PEAR::getStaticProperty('DB_DataObject','options'); 987 if ( !($class_rewrite = @$options['generator_class_rewrite'])) {1005 if (empty($options['generator_class_rewrite']) || !($class_rewrite = $options['generator_class_rewrite'])) { 988 1006 $class_rewrite = 'DB_DataObject'; 989 1007 } … … 993 1011 994 1012 $input = preg_replace( 995 '/(\n|\r\n)class\s*[a-z0-9_]+\s*extends\s*' .$class_rewrite . '\s* \{(\n|\r\n)/si',1013 '/(\n|\r\n)class\s*[a-z0-9_]+\s*extends\s*' .$class_rewrite . '\s*(\n|\r\n)\{(\n|\r\n)/si', 996 1014 "\nclass {$this->classname} extends {$this->_extends} \n{\n", 997 1015 $input); trunk/codebase/includes/classes/PEAR/Date.php
r1287 r1582 7 7 * Generic date handling class for PEAR 8 8 * 9 * Generic date handling class for PEAR. Attempts to be time zone aware10 * t hrough the Date::TimeZone class. Supports several operations from11 * Date::Calc on Date objects.9 * Handles time zones and changes from local standard to local Summer 10 * time (daylight-saving time) through the Date_TimeZone class. 11 * Supports several operations from Date_Calc on Date objects. 12 12 * 13 13 * PHP versions 4 and 5 … … 15 15 * LICENSE: 16 16 * 17 * Copyright (c) 1997-2006 Baba Buehler, Pierre-Alain Joye 17 * Copyright (c) 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman 18 * Wandayandi, C.A. Woodcock 18 19 * All rights reserved. 19 20 * … … 39 40 * @author Pierre-Alain Joye <pajoye@php.net> 40 41 * @author Firman Wandayandi <firman@php.net> 41 * @copyright 1997-2006 Baba Buehler, Pierre-Alain Joye 42 * @author C.A. Woodcock <c01234@netcomuk.co.uk> 43 * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock 42 44 * @license http://www.opensource.org/licenses/bsd-license.php 43 45 * BSD License 44 * @version CVS: $Id: Date.php,v 1. 41 2006/11/22 00:28:03 firmanExp $46 * @version CVS: $Id: Date.php,v 1.89 2008/03/23 18:34:16 c01234 Exp $ 45 47 * @link http://pear.php.net/package/Date 46 48 */ 47 49 50 48 51 // }}} 49 52 // {{{ Error constants 53 54 define('DATE_ERROR_INVALIDDATE', 1); 55 define('DATE_ERROR_INVALIDTIME', 2); 56 define('DATE_ERROR_INVALIDTIMEZONE', 3); 57 define('DATE_ERROR_INVALIDDATEFORMAT', 4); 58 define('DATE_ERROR_INVALIDFORMATSTRING', 5); 59 60 61 // }}} 50 62 // {{{ Includes 51 63 64 require_once 'PEAR.php'; 65 52 66 /** 53 * Load Date_TimeZone .67 * Load Date_TimeZone 54 68 */ 55 69 require_once 'Date/TimeZone.php'; 56 70 57 71 /** 58 * Load Date_Calc .72 * Load Date_Calc 59 73 */ 60 74 require_once 'Date/Calc.php'; 61 75 62 76 /** 63 * Load Date_Span .77 * Load Date_Span 64 78 */ 65 79 require_once 'Date/Span.php'; 66 80 81 67 82 // }}} 68 // {{{ Constants 69 70 // {{{ Output formats Pass this to getDate(). 83 // {{{ General constants 84 85 /** 86 * Whether to capture the micro-time (in microseconds) by default 87 * in calls to 'Date::setNow()'. Note that this makes a call to 88 * 'gettimeofday()', which may not work on all systems. 89 * 90 * @since Constant available since Release 1.5.0 91 */ 92 define('DATE_CAPTURE_MICROTIME_BY_DEFAULT', false); 93 94 /** 95 * Whether to correct, by adding the local Summer time offset, the 96 * specified time if it falls in the 'skipped hour' (encountered 97 * when the clocks go forward). 98 * 99 * N.B. if specified as 'false', and if a time zone that adjusts 100 * for Summer time is specified, then an object of this class will 101 * be set to a semi-invalid state if an invalid time is set. That 102 * is, an error will not be returned, unless the user then calls 103 * a function, directly or indirectly, that accesses the time 104 * part of the object. So, for example, if the user calls: 105 * 106 * <code>$date_object->format2('HH.MI.SS')</code> or: 107 * <code>$date->object->addSeconds(30)</code>, 108 * 109 * an error will be returned if the time is invalid. However, 110 * if the user calls: 111 * 112 * <code>$date->object->addDays(1)</code>, 113 * 114 * for example, such that the time is no longer invalid, then the 115 * object will no longer be in this invalid state. This behaviour 116 * is intended to minimize unexpected errors when a user uses the 117 * class to do addition with days only, and does not intend to 118 * access the time. 119 * 120 * Of course, this constant will be unused if the user chooses to 121 * work in UTC or a time zone without Summer time, in which case 122 * this situation will never arise. 123 * 124 * This constant is set to 'true' by default for backwards-compatibility 125 * reasons, however, you are recommended to set it to 'false'. Note that the 126 * behaviour is not intended to match that of previous versions of the class 127 * in terms of ignoring the Summer time offset when making calculations which 128 * involve dates in both standard and Summer time - this was recognized as a 129 * bug - but in terms of returning a PEAR error object when the user sets the 130 * object to an invalid date (i.e. a time in the hour which is skipped when 131 * the clocks go forwards, which in Europe would be a time such as 01.30). 132 * Backwards compatibility here means that the behaviour is the same as it 133 * used to be, less the bug. 134 * 135 * Note that this problem is not an issue for the user if: 136 * 137 * (a) the user uses a time zone that does not observe Summer time, e.g. UTC 138 * (b) the user never accesses the time, that is, he never makes a call to 139 * Date::getHour() or Date::format("%H"), for example, even if he sets 140 * the time to something invalid 141 * (c) the user sets DATE_CORRECTINVALIDTIME_DEFAULT to true 142 * 143 * @since Constant available since Release 1.5.0 144 */ 145 define('DATE_CORRECTINVALIDTIME_DEFAULT', true); 146 147 /** 148 * Whether to validate dates (i.e. day-month-year, ignoring the time) by 149 * disallowing invalid dates (e.g. 31st February) being set by the following 150 * functions: 151 * 152 * Date::setYear() 153 * Date::setMonth() 154 * Date::setDay() 155 * 156 * If the constant is set to 'true', then the date will be checked (by 157 * default), and if invalid, an error will be returned with the Date object 158 * left unmodified. 159 * 160 * This constant is set to 'false' by default for backwards-compatibility 161 * reasons, however, you are recommended to set it to 'true'. 162 * 163 * Note that setHour(), setMinute(), setSecond() and setPartSecond() 164 * allow an invalid date/time to be set regardless of the value of this 165 * constant. 166 * 167 * @since Constant available since Release 1.5.0 168 */ 169 define('DATE_VALIDATE_DATE_BY_DEFAULT', false); 170 171 /** 172 * Whether, by default, to accept times including leap seconds (i.e. '23.59.60') 173 * when setting the date/time, and whether to count leap seconds in the 174 * following functions: 175 * 176 * Date::addSeconds() 177 * Date::subtractSeconds() 178 * Date_Calc::addSeconds() 179 * Date::round() 180 * Date::roundSeconds() 181 * 182 * This constant is set to 'false' by default for backwards-compatibility 183 * reasons, however, you are recommended to set it to 'true'. 184 * 185 * Note that this constant does not affect Date::addSpan() and 186 * Date::subtractSpan() which will not count leap seconds in any case. 187 * 188 * @since Constant available since Release 1.5.0 189 */ 190 define('DATE_COUNT_LEAP_SECONDS', false); 191 192 193 // }}} 194 // {{{ Output format constants (used in 'Date::getDate()') 71 195 72 196 /** … … 100 224 define('DATE_FORMAT_UNIXTIME', 5); 101 225 102 // }}}103 226 104 227 // }}} … … 108 231 * Generic date handling class for PEAR 109 232 * 110 * Generic date handling class for PEAR. Attempts to be time zone aware 111 * through the Date::TimeZone class. Supports several operations from 112 * Date::Calc on Date objects. 233 * Supports time zones with the Date_TimeZone class. Supports several 234 * operations from Date_Calc on Date objects. 113 235 * 114 * @author Baba Buehler <baba@babaz.com> 115 * @author Pierre-Alain Joye <pajoye@php.net> 116 * @author Firman Wandayandi <firman@php.net> 117 * @copyright 1997-2006 Baba Buehler, Pierre-Alain Joye 118 * @license http://www.opensource.org/licenses/bsd-license.php 119 * BSD License 120 * @version Release: 1.4.7 121 * @link http://pear.php.net/package/Date 236 * Note to developers: the class stores the local time and date in the 237 * local standard time. That is, it does not store the time as the 238 * local Summer time when and if the time zone is in Summer time. It 239 * is much easier to store local standard time and remember to offset 240 * it when the user requests it. 241 * 242 * @category Date and Time 243 * @package Date 244 * @author Baba Buehler <baba@babaz.com> 245 * @author Pierre-Alain Joye <pajoye@php.net> 246 * @author Firman Wandayandi <firman@php.net> 247 * @author C.A. Woodcock <c01234@netcomuk.co.uk> 248 * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock 249 * @license http://www.opensource.org/licenses/bsd-license.php 250 * BSD License 251 * @version Release: 1.5.0a1 252 * @link http://pear.php.net/package/Date 122 253 */ 123 254 class Date 124 255 { 256 125 257 // {{{ Properties 126 258 127 259 /** 128 * the year 129 * @var int 260 * The year 261 * 262 * @var int 263 * @access private 264 * @since Property available since Release 1.0 130 265 */ 131 266 var $year; 132 267 133 268 /** 134 * the month 135 * @var int 269 * The month 270 * 271 * @var int 272 * @access private 273 * @since Property available since Release 1.0 136 274 */ 137 275 var $month; 138 276 139 277 /** 140 * the day 141 * @var int 278 * The day 279 * 280 * @var int 281 * @access private 282 * @since Property available since Release 1.0 142 283 */ 143 284 var $day; 144 285 145 286 /** 146 * the hour 147 * @var int 287 * The hour 288 * 289 * @var int 290 * @access private 291 * @since Property available since Release 1.0 148 292 */ 149 293 var $hour; 150 294 151 295 /** 152 * the minute 153 * @var int 296 * The minute 297 * 298 * @var int 299 * @access private 300 * @since Property available since Release 1.0 154 301 */ 155 302 var $minute; 156 303 157 304 /** 158 * the second 159 * @var int&nb
