Fixed bug #15047 Remove trailing whitespaces in front of EOL (Thanks to Nikolas Hagel...
authorSteffen Kamper <info@sk-typo3.de>
Fri, 9 Jul 2010 07:34:38 +0000 (07:34 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Fri, 9 Jul 2010 07:34:38 +0000 (07:34 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8145 709f56b5-9817-0410-a4d7-c38de5d9e867

270 files changed:
ChangeLog
t3lib/class.t3lib_admin.php
t3lib/class.t3lib_beuserauth.php
t3lib/class.t3lib_browsetree.php
t3lib/class.t3lib_iconworks.php
t3lib/class.t3lib_install.php
t3lib/class.t3lib_loadmodules.php
t3lib/class.t3lib_parsehtml.php
t3lib/class.t3lib_sqlparser.php
t3lib/class.t3lib_stdgraphic.php
t3lib/class.t3lib_treeview.php
t3lib/class.t3lib_tsparser_ext.php
t3lib/class.t3lib_userauthgroup.php
typo3/alt_doc.php
typo3/browse_links.php
typo3/class.filelistfoldertree.php
typo3/classes/class.workspaceselector.php
typo3/mod/user/ws/index.php
typo3/sysext/adodb/adodb/adodb-active-record.inc.php
typo3/sysext/adodb/adodb/adodb-csvlib.inc.php
typo3/sysext/adodb/adodb/adodb-datadict.inc.php
typo3/sysext/adodb/adodb/adodb-error.inc.php
typo3/sysext/adodb/adodb/adodb-errorpear.inc.php
typo3/sysext/adodb/adodb/adodb-exceptions.inc.php
typo3/sysext/adodb/adodb/adodb-iterator.inc.php
typo3/sysext/adodb/adodb/adodb-lib.inc.php
typo3/sysext/adodb/adodb/adodb-memcache.lib.inc.php
typo3/sysext/adodb/adodb/adodb-pager.inc.php
typo3/sysext/adodb/adodb/adodb-pear.inc.php
typo3/sysext/adodb/adodb/adodb-time.inc.php
typo3/sysext/adodb/adodb/adodb.inc.php
typo3/sysext/adodb/adodb/contrib/toxmlrpc.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-access.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-db2.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-firebird.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-generic.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-ibase.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-informix.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-mssql.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-mssqlnative.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-mysql.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-oci8.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-postgres.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-sapdb.inc.php
typo3/sysext/adodb/adodb/datadict/datadict-sybase.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-access.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-ado.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-ado5.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-ado_access.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-ado_mssql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-borland_ibase.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-csv.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-db2.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-db2oci.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-fbsql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-firebird.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-ibase.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-informix.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-informix72.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-ldap.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mssql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mssql_n.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mssqlnative.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mssqlpo.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mysql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mysqli.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mysqlpo.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-mysqlt.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-oci8.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-oci805.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-oci8po.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-odbc.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-odbc_db2.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-odbc_mssql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-odbc_oracle.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-oracle.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-pdo.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-pdo_mssql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-pdo_mysql.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-pdo_oci.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-pdo_sqlite.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-postgres.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-postgres64.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-postgres7.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-postgres8.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-proxy.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-sapdb.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-sqlite.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-sqlitepo.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-sybase_ase.inc.php
typo3/sysext/adodb/adodb/drivers/adodb-vfp.inc.php
typo3/sysext/adodb/adodb/lang/adodb-esperanto.inc.php
typo3/sysext/adodb/adodb/lang/adodb-it.inc.php
typo3/sysext/adodb/adodb/lang/adodb-pt-br.inc.php
typo3/sysext/belog/mod/index.php
typo3/sysext/cms/tslib/class.tslib_feuserauth.php
typo3/sysext/cms/web_info/class.tx_cms_webinfo_lang.php
typo3/sysext/css_styled_content/ext_localconf.php
typo3/sysext/dbal/class.tx_dbal_autoloader.php
typo3/sysext/dbal/class.tx_dbal_installtool.php
typo3/sysext/dbal/class.ux_t3lib_db.php
typo3/sysext/dbal/class.ux_t3lib_sqlparser.php
typo3/sysext/dbal/lib/class.tx_dbal_tsparserext.php
typo3/sysext/dbal/tests/BaseTestCase.php
typo3/sysext/dbal/tests/FakeDbConnection.php
typo3/sysext/dbal/tests/dbGeneralTest.php
typo3/sysext/dbal/tests/dbMssqlTest.php
typo3/sysext/dbal/tests/dbOracleTest.php
typo3/sysext/dbal/tests/dbPostgresqlTest.php
typo3/sysext/dbal/tests/fixtures/mssql.config.php
typo3/sysext/dbal/tests/fixtures/oci8.config.php
typo3/sysext/dbal/tests/fixtures/postgresql.config.php
typo3/sysext/dbal/tests/sqlParserGeneralTest.php
typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php
typo3/sysext/extbase/Classes/Dispatcher.php
typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php
typo3/sysext/extbase/Classes/DomainObject/AbstractEntity.php
typo3/sysext/extbase/Classes/DomainObject/AbstractValueObject.php
typo3/sysext/extbase/Classes/MVC/Controller/Arguments.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidActionName.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidArgumentName.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidArgumentType.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidArgumentValue.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidController.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidControllerName.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidExtensionName.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidMarker.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidOrNoRequestHash.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidRequestMethod.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidRequestType.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidTemplateResource.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidUriPattern.php
typo3/sysext/extbase/Classes/MVC/Exception/InvalidViewHelper.php
typo3/sysext/extbase/Classes/MVC/Exception/NoSuchAction.php
typo3/sysext/extbase/Classes/MVC/Exception/NoSuchArgument.php
typo3/sysext/extbase/Classes/MVC/Exception/NoSuchController.php
typo3/sysext/extbase/Classes/MVC/Exception/StopAction.php
typo3/sysext/extbase/Classes/MVC/Exception/UnsupportedRequestType.php
typo3/sysext/extbase/Classes/MVC/Web/Request.php
typo3/sysext/extbase/Classes/MVC/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/MVC/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Classes/Object/Exception.php
typo3/sysext/extbase/Classes/Object/Exception/CannotReconstituteObject.php
typo3/sysext/extbase/Classes/Object/Exception/InvalidClass.php
typo3/sysext/extbase/Classes/Object/Exception/InvalidObject.php
typo3/sysext/extbase/Classes/Object/Exception/InvalidObjectConfiguration.php
typo3/sysext/extbase/Classes/Object/Exception/ObjectAlreadyRegistered.php
typo3/sysext/extbase/Classes/Object/Exception/UnknownClass.php
typo3/sysext/extbase/Classes/Object/Exception/UnknownInterface.php
typo3/sysext/extbase/Classes/Object/Exception/UnknownObject.php
typo3/sysext/extbase/Classes/Object/Exception/UnresolvedDependencies.php
typo3/sysext/extbase/Classes/Object/Exception/WrongScope.php
typo3/sysext/extbase/Classes/Object/ManagerInterface.php
typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/Exception/CleanStateNotMemorized.php
typo3/sysext/extbase/Classes/Persistence/Exception/InvalidClass.php
typo3/sysext/extbase/Classes/Persistence/Exception/InvalidNumberOfConstraints.php
typo3/sysext/extbase/Classes/Persistence/Exception/InvalidPropertyType.php
typo3/sysext/extbase/Classes/Persistence/Exception/MissingBackend.php
typo3/sysext/extbase/Classes/Persistence/Exception/TooDirty.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnexpectedTypeException.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnknownObject.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedMethod.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedOrder.php
typo3/sysext/extbase/Classes/Persistence/Exception/UnsupportedRelation.php
typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php
typo3/sysext/extbase/Classes/Persistence/Manager.php
typo3/sysext/extbase/Classes/Persistence/Mapper/ColumnMap.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMap.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapFactory.php
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Persistence/ObjectMonitoringInterface.php
typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
typo3/sysext/extbase/Classes/Persistence/QOM/Constraint.php
typo3/sysext/extbase/Classes/Persistence/QOM/Selector.php
typo3/sysext/extbase/Classes/Persistence/QOM/Statement.php
typo3/sysext/extbase/Classes/Persistence/Query.php
typo3/sysext/extbase/Classes/Persistence/QueryFactory.php
typo3/sysext/extbase/Classes/Persistence/QuerySettingsInterface.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Persistence/Storage/BackendInterface.php
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php
typo3/sysext/extbase/Classes/Persistence/Typo3QuerySettings.php
typo3/sysext/extbase/Classes/Property/Exception/FormatNotSupported.php
typo3/sysext/extbase/Classes/Property/Exception/InvalidDataType.php
typo3/sysext/extbase/Classes/Property/Exception/InvalidFormat.php
typo3/sysext/extbase/Classes/Property/Exception/InvalidProperty.php
typo3/sysext/extbase/Classes/Property/Exception/InvalidSource.php
typo3/sysext/extbase/Classes/Property/Exception/InvalidTarget.php
typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php
typo3/sysext/extbase/Classes/Utility/ClassLoader.php
typo3/sysext/extbase/Classes/Utility/ExtbaseRequirementsCheck.php
typo3/sysext/extbase/Classes/Utility/TypeHandling.php
typo3/sysext/extbase/Classes/Validation/Validator/AbstractObjectValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/AlphanumericValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/DateTimeValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/EmailAddressValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/FloatValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/IntegerValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/NotEmptyValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/NumberRangeValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/NumberValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/ObjectValidatorInterface.php
typo3/sysext/extbase/Classes/Validation/Validator/RawValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/RegularExpressionValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/StringLengthValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/StringValidator.php
typo3/sysext/extbase/Classes/Validation/Validator/ValidatorInterface.php
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php
typo3/sysext/extbase/Tests/DomainObject/AbstractEntity_testcase.php
typo3/sysext/extbase/Tests/Fixtures/Entity.php
typo3/sysext/extbase/Tests/MVC/Controller/AbstractController_testcase.php
typo3/sysext/extbase/Tests/MVC/Controller/Arguments_testcase.php
typo3/sysext/extbase/Tests/MVC/Web/RequestTest.php
typo3/sysext/extbase/Tests/Persistence/Mapper/DataMapFactory_testcase.php
typo3/sysext/extbase/Tests/Persistence/ObjectStorage_testcase.php
typo3/sysext/extbase/Tests/Persistence/Query_testcase.php
typo3/sysext/extbase/Tests/Persistence/Storage/Typo3DbBackend_testcase.php
typo3/sysext/extbase/Tests/Reflection/Service_testcase.php
typo3/sysext/extbase/Tests/Security/Channel/RequestHashService_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/AlphanumericValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/ConjunctionValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/DateTimeValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/EmailAddressValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/FloatValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/GenericObjectValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/IntegerValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/NotEmptyValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/NumberRangeValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/NumberValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/RawValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/RegularExpressionValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/Validator/StringLengthValidator_testcase.php
typo3/sysext/extbase/Tests/Validation/ValidatorResolver_testcase.php
typo3/sysext/extbase/ext_tables.php
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php
typo3/sysext/fluid/Classes/Core/Parser/Configuration.php
typo3/sysext/fluid/Classes/Core/Parser/Interceptor/Escape.php
typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php
typo3/sysext/fluid/Classes/View/TemplateView.php
typo3/sysext/fluid/Classes/ViewHelpers/DebugViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/EscapeViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Form/CheckboxViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Link/ExternalViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Uri/ExternalViewHelper.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/TemplateParserTest.php
typo3/sysext/fluid/Tests/Unit/View/TemplateViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/AbstractFormFieldViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/PrintfViewHelperTest.php
typo3/sysext/impexp/app/index.php
typo3/sysext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/install/updates/class.tx_coreupdates_compressionlevel.php
typo3/sysext/install/updates/class.tx_coreupdates_statictemplates.php
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
typo3/sysext/saltedpasswords/sv1/class.tx_saltedpasswords_sv1.php
typo3/sysext/saltedpasswords/tests/tx_saltedpasswords_salts_blowfishTest.php
typo3/sysext/scheduler/class.tx_scheduler.php
typo3/sysext/scheduler/tests/tx_scheduler_croncmdTest.php
typo3/sysext/setup/mod/index.php
typo3/sysext/sys_action/ext_tables.php
typo3/sysext/t3editor/classes/class.tx_t3editor.php
typo3/sysext/taskcenter/task/conf.php
typo3/sysext/tstemplate/ts/index.php
typo3/sysext/tstemplate_info/class.tx_tstemplateinfo.php
typo3/sysext/version/cm1/index.php
typo3/sysext/wizard_crpages/class.tx_wizardcrpages_webfunc_2.php
typo3/wizard_forms.php
typo3/wizard_tsconfig.php

index ad01a49..e7b83bd 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2010-07-09  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #15047 Remove trailing whitespaces in front of EOL (Thanks to Nikolas Hagelstein)
+       * Fixed bug #15045: Trailing newlines after php closing tag. (Thanks to Nikolas Hagelstein)
 
 2010-07-08  Susanne Moog  <typo3@susanne-moog.de>
 
index 739fbba..b919ffc 100644 (file)
@@ -652,7 +652,7 @@ class t3lib_admin {
                global $TCA;
                foreach ($theArray as $table => $dbArr) {
                        if ($TCA[$table])       {
-                               $idlist = array_keys($dbArr); 
+                               $idlist = array_keys($dbArr);
 
                                $theList = implode(',',$idlist);
                                if ($theList)   {
index 874f8c0..7a99ab6 100644 (file)
@@ -376,7 +376,7 @@ class t3lib_beUserAuth extends t3lib_userAuthGroup {
         *      + backend user is a regular user and adminOnly is not defined
         *      + backend user is an admin user
         *      + backend user is used in CLI context and adminOnly is explicitely set to "2"
-        * 
+        *
         * @return      boolean         Whether a backend user is allowed to access the backend
         */
        protected function isUserAllowedToLogin() {
index 9c969d8..52af3c0 100644 (file)
@@ -183,7 +183,7 @@ class t3lib_browseTree extends t3lib_treeView {
                                                        </span>';
                }
                return $str;
-       }               
+       }
 }
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php'])       {
index beea02d..ea0dc71 100644 (file)
@@ -797,7 +797,7 @@ final class t3lib_iconWorks {
                                if ($row['module']) {
                                        $recordType[4] = 'contains-' . $row['module'];
                                }
-                       } 
+                       }
 
                        if (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
                                foreach ($recordType AS $key => $type) {
@@ -824,7 +824,7 @@ final class t3lib_iconWorks {
                krsort($recordType);
                foreach ($recordType as $record) {
                        if (in_array($record, $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
-                               return self::getSpriteIconClasses($record); 
+                               return self::getSpriteIconClasses($record);
                        }
                }
                return self::getSpriteIconClasses('status-status-icon-missing');
index 4140cd0..548a87e 100644 (file)
@@ -126,7 +126,7 @@ class t3lib_install {
         * @param       array           $line_array     the localconf.php file exploded into an array by linebreaks. (see writeToLocalconf_control())
         * @param       string          $variable       The variable name to find and substitute. This string must match the first part of a trimmed line in the line-array. Matching is done backwards so the last appearing line will be substituted.
         * @param       string          $value          Is the value to be insert for the variable
-        * @param       boolean         $quoteValue     Whether the given value should be quoted before being written 
+        * @param       boolean         $quoteValue     Whether the given value should be quoted before being written
         * @return      void
         * @see writeToLocalconf_control()
         */
index 7df3440..2f265ea 100644 (file)
@@ -133,9 +133,9 @@ class t3lib_loadModules {
                        //
                $this->absPathArray = $modulesArray['_PATHS'];
                unset($modulesArray['_PATHS']);
-                       // unset the array for calling external backend module dispatchers in typo3/mod.php 
+                       // unset the array for calling external backend module dispatchers in typo3/mod.php
                unset($modulesArray['_dispatcher']);
-                       // unset the array for calling backend modules based on external backend module dispatchers in typo3/mod.php 
+                       // unset the array for calling backend modules based on external backend module dispatchers in typo3/mod.php
                unset($modulesArray['_configuration']);
 
                        /*
index a0e5f7e..eaa0969 100644 (file)
@@ -1075,7 +1075,7 @@ class t3lib_parsehtml     {
         * @access private
         */
        function prefixRelPath($prefix, $srcVal, $suffix = '') {
-                       // Only prefix if it's not an absolute URL or 
+                       // Only prefix if it's not an absolute URL or
                        // only a link to a section within the page.
                if (substr($srcVal, 0, 1) != '/' && substr($srcVal, 0, 1) != '#') {
                        $urlParts = parse_url($srcVal);
index 52a09d4..1f0f2f3 100644 (file)
@@ -681,7 +681,7 @@ class t3lib_sqlparser {
 
        /**
         * Parsing TRUNCATE TABLE query
-        * 
+        *
         * @param       string          SQL string starting with TRUNCATE TABLE
         * @return      mixed           Returns array with components of TRUNCATE TABLE query on success, otherwise an error message string.
         */
@@ -810,7 +810,7 @@ class t3lib_sqlparser {
                                                        // Otherwise, look for regular fieldname:
                                                if (($fieldName = $this->nextPart($parseString, '^([[:alnum:]\*._]+)(,|[[:space:]]+)')) !== '') {
                                                        $stack[$pnt]['type'] = 'field';
-       
+
                                                                // Explode fieldname into field and table:
                                                        $tableField = explode('.',$fieldName,2);
                                                        if (count($tableField)==2)      {
@@ -881,7 +881,7 @@ class t3lib_sqlparser {
                if (!preg_match('/^when[[:space:]]+/i', $parseString)) {
                        $value = $this->getValue($parseString);
                        if (!(isset($value[1]) || is_numeric($value[0]))) {
-                               $result['case_field'] = $value[0]; 
+                               $result['case_field'] = $value[0];
                        } else {
                                $result['case_value'] = $value;
                        }
@@ -1075,7 +1075,7 @@ class t3lib_sqlparser {
                                                        return $this->parseError('No comma found as expected in parseWhereClause()');
                                                }
                                                if ($fieldName = $this->nextPart($parseString, '^([[:alnum:]\*._]+)[[:space:]]*')) {
+
                                                                // Parse field name into field and table:
                                                        $tableField = explode('.', $fieldName, 2);
                                                        if (count($tableField) == 2) {
@@ -1089,7 +1089,7 @@ class t3lib_sqlparser {
                                                        return $this->parseError('No field name found as expected in parseWhereClause()', $parseString);
                                                }
                                                if ($this->nextPart($parseString, '^(,)')) {
-                                                       $stack[$level][$pnt[$level]]['func']['pos'] = $this->getValue($parseString); 
+                                                       $stack[$level][$pnt[$level]]['func']['pos'] = $this->getValue($parseString);
                                                }
                                                if (!$this->nextPart($parseString, '^([)])')) {
                                                        return $this->parseError('No ) parenthesis at end of function');
@@ -1098,7 +1098,7 @@ class t3lib_sqlparser {
                                                $stack[$level][$pnt[$level]]['func']['type'] = $this->nextPart($parseString, '^(IFNULL)[[:space:]]*');
                                                $parseString = trim(substr($parseString, 1));   // Strip of "("
                                                if ($fieldName = $this->nextPart($parseString, '^([[:alnum:]\*._]+)[[:space:]]*')) {
+
                                                                // Parse field name into field and table:
                                                        $tableField = explode('.', $fieldName, 2);
                                                        if (count($tableField) == 2) {
@@ -1143,7 +1143,7 @@ class t3lib_sqlparser {
                                                } else {
                                                        return $this->parseError('No field name found as expected in parseWhereClause()', $parseString);
                                                }
-               
+
                                                        // See if the value is calculated:
                                                $stack[$level][$pnt[$level]]['calc'] = $this->nextPart($parseString, '^(' . $calcOperators . ')');
                                                if (strlen($stack[$level][$pnt[$level]]['calc'])) {
@@ -1163,7 +1163,7 @@ class t3lib_sqlparser {
                                                        }
                                                }
                                        }
-       
+
                                                // Find "comparator":
                                        $stack[$level][$pnt[$level]]['comparator'] = $this->nextPart($parseString, '^(<=|>=|<|>|=|!=|NOT[[:space:]]+IN|IN|NOT[[:space:]]+LIKE|LIKE|IS[[:space:]]+NOT|IS|BETWEEN|NOT[[:space]]+BETWEEN)');
                                        if (strlen($stack[$level][$pnt[$level]]['comparator'])) {
@@ -1752,7 +1752,7 @@ class t3lib_sqlparser {
 
        /**
         * Compiles a TRUNCATE TABLE statement from components array
-        * 
+        *
         * @param       array           Array of SQL query components
         * @return      string          SQL TRUNCATE TABLE query
         * @see parseTRUNCATETABLE()
@@ -1944,7 +1944,7 @@ class t3lib_sqlparser {
                                } else {
 
                                        if (isset($v['func']) && $v['func']['type'] === 'LOCATE') {
-                                               $output .= ' ' . trim($v['modifier']) . ' LOCATE('; 
+                                               $output .= ' ' . trim($v['modifier']) . ' LOCATE(';
                                                $output .= $v['func']['substr'][1] . $v['func']['substr'][0] . $v['func']['substr'][1];
                                                $output .= ', ' . ($v['func']['table'] ? $v['func']['table'] . '.' : '') . $v['func']['field'];
                                                $output .= isset($v['func']['pos']) ? ', ' . $v['func']['pos'][0] : '';
@@ -1955,10 +1955,10 @@ class t3lib_sqlparser {
                                                $output .= ', ' . $v['func']['default'][1] . $this->compileAddslashes($v['func']['default'][0]) . $v['func']['default'][1];
                                                $output .= ')';
                                        } else {
-                                               
+
                                                        // Set field/table with modifying prefix if any:
                                                $output .= ' ' . trim($v['modifier'] . ' ' . ($v['table'] ? $v['table'] . '.' : '') . $v['field']);
-       
+
                                                        // Set calculation, if any:
                                                if ($v['calc']) {
                                                        $output .= $v['calc'] . $v['calc_value'][1] . $this->compileAddslashes($v['calc_value'][0]) . $v['calc_value'][1];
@@ -1972,7 +1972,7 @@ class t3lib_sqlparser {
                                                        // Detecting value type; list or plain:
                                                if (t3lib_div::inList('NOTIN,IN', strtoupper(str_replace(array(' ', TAB, CR, LF), '', $v['comparator'])))) {
                                                        if (isset($v['subquery'])) {
-                                                               $output .= ' (' . $this->compileSELECT($v['subquery']) . ')';   
+                                                               $output .= ' (' . $this->compileSELECT($v['subquery']) . ')';
                                                        } else {
                                                                $valueBuffer = array();
                                                                foreach ($v['value'] as $realValue) {
index 55a8d66..10c7003 100644 (file)
 /**
  * Class contains a bunch of cool functions for manipulating graphics with GDlib/Freetype and ImageMagick
  * VERY OFTEN used with gifbuilder that extends this class and provides a TypoScript API to using these functions
- * 
+ *
  * With TYPO3 4.4 GDlib 1.x support was dropped, also an option from config_default.php:
  * $TYPO3_CONF_VARS['GFX']['gdlib_2'] = 0,     // String/Boolean. Set this if you are using the new GDlib 2.0.1+. If you don't set this flag and still use GDlib2, you might encounter strange behaviours like black images etc. This feature might take effect only if ImageMagick is installed and working as well! You can also use the value "no_imagecopyresized_fix" - in that case it will NOT try to fix a known issue where "imagecopyresized" does not work correctly.
  *
@@ -259,7 +259,7 @@ class t3lib_stdGraphic      {
                        $this->im_version_4 = true;
                }
 
-                       // When GIFBUILDER gets used in truecolor mode 
+                       // When GIFBUILDER gets used in truecolor mode
                        // No colors parameter if we generate truecolor images.
                if ($this->png_truecolor) {
                        $this->cmds['png'] = '';
@@ -3010,7 +3010,7 @@ class t3lib_stdGraphic    {
 
 
        /**
-        * Creates a new GD image resource. 
+        * Creates a new GD image resource.
         * Wrapper for imagecreate(truecolor) depended if GD2 is used.
         * This function however got obsolete, as PHP now recommends to use
         * imagecreatetruecolor() only.
@@ -3022,7 +3022,7 @@ class t3lib_stdGraphic    {
         */
        function imagecreate($w, $h) {
                t3lib_div::logDeprecatedFunction();
-               
+
                return imagecreatetruecolor($w, $h);
        }
 
index d012ae5..d568a07 100644 (file)
@@ -661,7 +661,7 @@ class t3lib_treeView {
                                'title' => ($this->showDefaultTitleAttribute ? 'UID: ' . $row['uid'] : $this->getTitleAttrib($row)),
                                'class' => 'c-recIcon'
                        ));
-               
+
                }
 
                return $this->wrapIcon($icon,$row);
index 99c2c2e..b0b77d6 100644 (file)
@@ -599,8 +599,8 @@ class t3lib_tsparser_ext extends t3lib_TStemplate   {
                        $alttext = '[' . $row['templateID'] . ']';
                        $alttext .= $row['pid'] ? ' - ' . t3lib_BEfunc::getRecordPath($row['pid'], $GLOBALS['SOBE']->perms_clause, 20) : '';
 
-                       $icon = (substr($row['templateID'],0,3) == 'sys' ? 
-                                               t3lib_iconWorks::getSpriteIconForRecord('sys_template', $row, array('title' => $alttext)) 
+                       $icon = (substr($row['templateID'],0,3) == 'sys' ?
+                                               t3lib_iconWorks::getSpriteIconForRecord('sys_template', $row, array('title' => $alttext))
                                                : t3lib_iconWorks::getSpriteIcon('mimetypes-x-content-template-static', array('title' => $alttext))
                                        );
                        if (in_array($row['templateID'], $this->clearList_const) || in_array($row['templateID'], $this->clearList_setup)) {
index bae6c18..b420aa8 100644 (file)
@@ -1568,7 +1568,7 @@ class t3lib_userAuthGroup extends t3lib_userAuth {
         */
        function checkWorkspace($wsRec,$fields='uid,title,adminusers,members,reviewers,publish_access,stagechg_notification')   {
                $retVal = FALSE;
-               
+
                        // Show draft workspace only if it's enabled in version extension
                if (t3lib_extMgm::isLoaded('version')) {
                        $versionExtConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['version']);
@@ -1576,15 +1576,15 @@ class t3lib_userAuthGroup extends t3lib_userAuth {
                                if (!is_array($wsRec)) {
                                        if ((string) $wsRec === '-1') {
                                                return FALSE;
-                                       } 
+                                       }
                                } else {
                                        if ((string) $wsRec['uid'] === '-1') {
                                                return FALSE;
-                                       } 
+                                       }
                                }
-                       } 
-               } 
-               
+                       }
+               }
+
                        // If not array, look up workspace record:
                if (!is_array($wsRec))  {
                        switch((string)$wsRec)  {
index 009bafd..300bb5d 100644 (file)
@@ -862,7 +862,7 @@ class SC_alt_doc {
 
                        // CLOSE button:
                $buttons['close'] = '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '">' .
-                                       t3lib_iconWorks::getSpriteIcon('actions-document-close') . 
+                                       t3lib_iconWorks::getSpriteIcon('actions-document-close') .
                                '</a>';
 
 
@@ -874,7 +874,7 @@ class SC_alt_doc {
                                if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'],'disableDelete')) {
                                        $aOnClick = 'return deleteRecord(\''.$this->firstEl['table'].'\',\''.$this->firstEl['uid'].'\',unescape(\''.rawurlencode($this->retUrl).'\'));';
                                        $buttons['delete'] = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'" title="' . $LANG->getLL('deleteItem', TRUE) . '">' .
-                                                       t3lib_iconWorks::getSpriteIcon('actions-edit-delete') . 
+                                                       t3lib_iconWorks::getSpriteIcon('actions-edit-delete') .
                                                        '</a>';
                                }
 
@@ -884,13 +884,13 @@ class SC_alt_doc {
                                        $aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&revert=ALL_FIELDS&sumUp=-1&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
                                        $buttons['undo'] = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"'.
                                                ' title="' . htmlspecialchars(sprintf($LANG->getLL('undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' .
-                                                       t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . 
+                                                       t3lib_iconWorks::getSpriteIcon('actions-edit-undo') .
                                                '</a>';
                                }
                                if ($this->getNewIconMode($this->firstEl['table'],'showHistory'))       {
                                        $aOnClick = 'window.location.href=\'show_rechis.php?element='.rawurlencode($this->firstEl['table'].':'.$this->firstEl['uid']).'&returnUrl='.rawurlencode($this->R_URI).'\'; return false;';
                                        $buttons['history'] = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
-                                                       t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . 
+                                                       t3lib_iconWorks::getSpriteIcon('actions-document-history-open') .
                                                '</a>';
                                }
 
index d0359ef..b7f0a2e 100644 (file)
@@ -144,7 +144,7 @@ class SC_browse_links {
                if ($tempDBmount) {
                        $altMountPoints = $tempDBmount;
                }
-               
+
                if ($altMountPoints) {
                        $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
                        $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
index 048b6ec..d485c00 100644 (file)
@@ -339,8 +339,8 @@ class filelistFolderTree extends t3lib_folderTree {
 
                                // Add tree:
                        $treeArr = array_merge($treeArr, $this->tree);
-                       
-                               // if this is an AJAX call, don't run through all mounts, only 
+
+                               // if this is an AJAX call, don't run through all mounts, only
                                // show the expansion of the current one, not the rest of the mounts
                        if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
                                break;
@@ -416,7 +416,7 @@ class filelistFolderTree extends t3lib_folderTree {
                                } else {
                                        $type = 'readonly';
                                        $overlays= array('status-overlay-locked'=>array());
-                                       
+
                                }
 
                                if($webpath == 'web') {
index e5574ab..3538fe0 100644 (file)
@@ -190,7 +190,7 @@ class WorkspaceSelector implements backend_toolbarItem {
                ));
 
                $workspaceMenu[] = '<a href="#" class="toolbar-item">' .
-                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-workspace', array('title' => $title)) . 
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-workspace', array('title' => $title)) .
                                '</a>';
                $workspaceMenu[] = '<ul class="toolbar-item-menu" style="display: none;">';
 
index a9d366d..8cec38b 100755 (executable)
@@ -160,7 +160,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                        ),
                        'expandSubElements' => '',
                );
-               
+
                if($this->showDraftWorkspace === TRUE) {
                        $this->MOD_MENU['display'][-1] = '[' . $LANG->getLL('shortcut_offlineWS') . ']';
                }
index 55a89bb..5bfbd61 100644 (file)
@@ -3,16 +3,16 @@
 
 @version V5.10 10 Nov 2009   (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
   Latest version is available at http://adodb.sourceforge.net
-  Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
+
+  Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence.
-  
+
   Active Record implementation. Superset of Zend Framework's.
-  
+
   Version 0.92
-  
-  See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord 
+
+  See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord
        for info on Ruby on Rails Active Record implementation
 */
 
@@ -44,30 +44,30 @@ class ADODB_Active_Table {
 
 // $db = database connection
 // $index = name of index - can be associative, for an example see
-//    http://phplens.com/lens/lensforum/msgs.php?id=17790 
+//    http://phplens.com/lens/lensforum/msgs.php?id=17790
 // returns index into $_ADODB_ACTIVE_DBS
 function ADODB_SetDatabaseAdapter(&$db, $index=false)
 {
        global $_ADODB_ACTIVE_DBS;
-       
+
                foreach($_ADODB_ACTIVE_DBS as $k => $d) {
                        if (PHP_VERSION >= 5) {
                                if ($d->db === $db) return $k;
                        } else {
-                               if ($d->db->_connectionID === $db->_connectionID && $db->database == $d->db->database) 
+                               if ($d->db->_connectionID === $db->_connectionID && $db->database == $d->db->database)
                                        return $k;
                        }
                }
-               
+
                $obj = new ADODB_Active_DB();
                $obj->db = $db;
                $obj->tables = array();
-               
+
                if ($index == false) $index = sizeof($_ADODB_ACTIVE_DBS);
 
-               
+
                $_ADODB_ACTIVE_DBS[$index] = $obj;
-               
+
                return sizeof($_ADODB_ACTIVE_DBS)-1;
 }
 
@@ -75,8 +75,8 @@ function ADODB_SetDatabaseAdapter(&$db, $index=false)
 class ADODB_Active_Record {
        static $_changeNames = true; // dynamically pluralize table names
        static $_quoteNames = false;
-       
-       static $_foreignSuffix = '_id'; // 
+
+       static $_foreignSuffix = '_id'; //
        var $_dbat; // associative index pointing to ADODB_Active_DB eg. $ADODB_Active_DBS[_dbat]
        var $_table; // tablename, if set in class definition then use it as table name
        var $_tableat; // associative index pointing to ADODB_Active_Table, eg $ADODB_Active_DBS[_dbat]->tables[$this->_tableat]
@@ -95,29 +95,29 @@ class ADODB_Active_Record {
        }
 
        // should be static
-       static function SetDatabaseAdapter(&$db, $index=false) 
+       static function SetDatabaseAdapter(&$db, $index=false)
        {
                return ADODB_SetDatabaseAdapter($db, $index);
        }
-       
-       
+
+
        public function __set($name, $value)
        {
                $name = str_replace(' ', '_', $name);
                $this->$name = $value;
        }
-       
+
        // php5 constructor
        function __construct($table = false, $pkeyarr=false, $db=false)
        {
        global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS;
-       
+
                if ($db == false && is_object($pkeyarr)) {
                        $db = $pkeyarr;
                        $pkeyarr = false;
                }
-               
-               if (!$table) { 
+
+               if (!$table) {
                        if (!empty($this->_table)) $table = $this->_table;
                        else $table = $this->_pluralize(get_class($this));
                }
@@ -135,13 +135,13 @@ class ADODB_Active_Record {
 
                $this->UpdateActiveTable($pkeyarr);
        }
-       
+
        function __wakeup()
        {
                $class = get_class($this);
                new $class;
        }
-       
+
        function _pluralize($table)
        {
                if (!ADODB_Active_Record::$_changeNames) return $table;
@@ -152,26 +152,26 @@ class ADODB_Active_Record {
                $lastc2 = substr($ut,$len-2);
                switch ($lastc) {
                case 'S':
-                       return $table.'es';     
+                       return $table.'es';
                case 'Y':
                        return substr($table,0,$len-1).'ies';
-               case 'X':       
+               case 'X':
                        return $table.'es';
-               case 'H': 
+               case 'H':
                        if ($lastc2 == 'CH' || $lastc2 == 'SH')
                                return $table.'es';
                default:
                        return $table.'s';
                }
        }
-       
+
        // CFR Lamest singular inflector ever - @todo Make it real!
        // Note: There is an assumption here...and it is that the argument's length >= 4
        function _singularize($tables)
        {
-       
+
                if (!ADODB_Active_Record::$_changeNames) return $table;
-       
+
                $ut = strtoupper($tables);
                $len = strlen($tables);
                if($ut[$len-1] != 'S')
@@ -203,14 +203,14 @@ class ADODB_Active_Record {
                $table->_hasMany[$foreignRef] = $ar;
        #       $this->$foreignRef = $this->_hasMany[$foreignRef]; // WATCHME Removed assignment by ref. to please __get()
        }
-       
+
        // use when you don't want ADOdb to auto-pluralize tablename
        static function TableHasMany($table, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
        {
                $ar = new ADODB_Active_Record($table);
                $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
        }
-       
+
        // use when you don't want ADOdb to auto-pluralize tablename
        static function TableKeyHasMany($table, $tablePKey, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
        {
@@ -218,8 +218,8 @@ class ADODB_Active_Record {
                $ar = new ADODB_Active_Record($table,$tablePKey);
                $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
        }
-       
-       
+
+
        // use when you want ADOdb to auto-pluralize tablename for you. Note that the class must already be defined.
        // e.g. class Person will generate relationship for table Persons
        static function ClassHasMany($parentclass, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
@@ -227,7 +227,7 @@ class ADODB_Active_Record {
                $ar = new $parentclass();
                $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
        }
-       
+
 
        function belongsTo($foreignRef,$foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
        {
@@ -238,24 +238,24 @@ class ADODB_Active_Record {
                $ar->parentKey = $parentKey;
                $ar->UpdateActiveTable();
                $ar->foreignKey = ($foreignKey) ? $foreignKey : $foreignRef.ADODB_Active_Record::$_foreignSuffix;
-               
+
                $table =& $this->TableInfo();
                $table->_belongsTo[$foreignRef] = $ar;
        #       $this->$foreignRef = $this->_belongsTo[$foreignRef];
        }
-       
+
        static function ClassBelongsTo($class, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
        {
                $ar = new $class();
                $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
        }
-       
+
        static function TableBelongsTo($table, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
        {
                $ar = new ADOdb_Active_Record($table);
                $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
        }
-       
+
        static function TableKeyBelongsTo($table, $tablePKey, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
        {
                if (!is_array($tablePKey)) $tablePKey = array($tablePKey);
@@ -266,8 +266,8 @@ class ADODB_Active_Record {
 
        /**
         * __get Access properties - used for lazy loading
-        * 
-        * @param mixed $name 
+        *
+        * @param mixed $name
         * @access protected
         * @return mixed
         */
@@ -275,9 +275,9 @@ class ADODB_Active_Record {
        {
                return $this->LoadRelations($name, '', -1, -1);
        }
-       
+
        /**
-        * @param string $name 
+        * @param string $name
         * @param string $whereOrderBy : eg. ' AND field1 = value ORDER BY field2'
         * @param offset
         * @param limit
@@ -289,12 +289,12 @@ class ADODB_Active_Record {
                $table = $this->TableInfo();
                if ($limit >= 0) $extras['limit'] = $limit;
                if ($offset >= 0) $extras['offset'] = $offset;
-               
-               if (strlen($whereOrderBy)) 
+
+               if (strlen($whereOrderBy))
                        if (!preg_match('/^[ \n\r]*AND/i',$whereOrderBy))
                                if (!preg_match('/^[ \n\r]*ORDER[ \n\r]/i',$whereOrderBy))
                                        $whereOrderBy = 'AND '.$whereOrderBy;
-                               
+
                if(!empty($table->_belongsTo[$name]))
                {
                        $obj = $table->_belongsTo[$name];
@@ -305,7 +305,7 @@ class ADODB_Active_Record {
                        {
                                if ($obj->parentKey) $key = $obj->parentKey;
                                else $key = reset($table->keys);
-                               
+
                                $arrayOfOne = $obj->Find($key.'='.$this->$columnName.' '.$whereOrderBy,false,false,$extras);
                                if ($arrayOfOne) {
                                        $this->$name = $arrayOfOne[0];
@@ -314,7 +314,7 @@ class ADODB_Active_Record {
                        }
                }
                if(!empty($table->_hasMany[$name]))
-               {       
+               {
                        $obj = $table->_hasMany[$name];
                        $key = reset($table->keys);
                        $id = @$this->$key;
@@ -327,11 +327,11 @@ class ADODB_Active_Record {
                        $this->$name = $objs;
                        return $objs;
                }
-               
+
                return array();
        }
        //////////////////////////////////
-       
+
        // update metadata
        function UpdateActiveTable($pkeys=false,$forceUpdate=false)
        {
@@ -347,7 +347,7 @@ class ADODB_Active_Record {
 
                        $tobj = $tables[$tableat];
                        foreach($tobj->flds as $name => $fld) {
-                       if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value)) 
+                       if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value))
                                $this->$name = $fld->default_value;
                        else
                                $this->$name = null;
@@ -361,11 +361,11 @@ class ADODB_Active_Record {
                        @flock($fp, LOCK_SH);
                        $acttab = unserialize(fread($fp,100000));
                        fclose($fp);
-                       if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(rand()) % 16) > time()) { 
+                       if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(rand()) % 16) > time()) {
                                // abs(rand()) randomizes deletion, reducing contention to delete/refresh file
                                // ideally, you should cache at least 32 secs
                                $activedb->tables[$table] = $acttab;
-                               
+
                                //if ($db->debug) ADOConnection::outp("Reading cached active record file: $fname");
                                return;
                        } else if ($db->debug) {
@@ -374,18 +374,18 @@ class ADODB_Active_Record {
                }
                $activetab = new ADODB_Active_Table();
                $activetab->name = $table;
-               
+
                $save = $ADODB_FETCH_MODE;
                $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
                if ($db->fetchMode !== false) $savem = $db->SetFetchMode(false);
-               
+
                $cols = $db->MetaColumns($table);
-               
+
                if (isset($savem)) $db->SetFetchMode($savem);
                $ADODB_FETCH_MODE = $save;
-               
+
                if (!$cols) {
-                       $this->Error("Invalid table name: $table",'UpdateActiveTable'); 
+                       $this->Error("Invalid table name: $table",'UpdateActiveTable');
                        return false;
                }
                $fld = reset($cols);
@@ -395,17 +395,17 @@ class ADODB_Active_Record {
                                foreach($cols as $name => $fld) {
                                        if (!empty($fld->primary_key)) $pkeys[] = $name;
                                }
-                       } else  
+                       } else
                                $pkeys = $this->GetPrimaryKeys($db, $table);
                }
                if (empty($pkeys)) {
                        $this->Error("No primary key found for table $table",'UpdateActiveTable');
                        return false;
                }
-               
+
                $attr = array();
                $keys = array();
-               
+
                switch($ADODB_ASSOC_CASE) {
                case 0:
                        foreach($cols as $name => $fldobj) {
@@ -420,18 +420,18 @@ class ADODB_Active_Record {
                                $keys[strtolower($name)] = strtolower($name);
                        }
                        break;
-                       
-               case 1: 
+
+               case 1:
                        foreach($cols as $name => $fldobj) {
                                $name = strtoupper($name);
-               
+
                 if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value))
                     $this->$name = $fldobj->default_value;
                 else
                                        $this->$name = null;
                                $attr[$name] = $fldobj;
                        }
-                       
+
                        foreach($pkeys as $k => $name) {
                                $keys[strtoupper($name)] = strtoupper($name);
                        }
@@ -439,7 +439,7 @@ class ADODB_Active_Record {
                default:
                        foreach($cols as $name => $fldobj) {
                                $name = ($fldobj->name);
-                
+
                 if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value))
                     $this->$name = $fldobj->default_value;
                 else
@@ -451,7 +451,7 @@ class ADODB_Active_Record {
                        }
                        break;
                }
-               
+
                $activetab->keys = $keys;
                $activetab->flds = $attr;
 
@@ -463,58 +463,58 @@ class ADODB_Active_Record {
                }
                if (isset($activedb->tables[$table])) {
                        $oldtab = $activedb->tables[$table];
-               
+
                        if ($oldtab) $activetab->_belongsTo = $oldtab->_belongsTo;
                        if ($oldtab) $activetab->_hasMany = $oldtab->_hasMany;
                }
                $activedb->tables[$table] = $activetab;
        }
-       
+
        function GetPrimaryKeys(&$db, $table)
        {
                return $db->MetaPrimaryKeys($table);
        }
-       
-       // error handler for both PHP4+5. 
+
+       // error handler for both PHP4+5.
        function Error($err,$fn)
        {
        global $_ADODB_ACTIVE_DBS;
-       
+
                $fn = get_class($this).'::'.$fn;
                $this->_lasterr = $fn.': '.$err;
-               
+
                if ($this->_dbat < 0) $db = false;
                else {
                        $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
                        $db = $activedb->db;
                }
-               
-               if (function_exists('adodb_throw')) {   
+
+               if (function_exists('adodb_throw')) {
                        if (!$db) adodb_throw('ADOdb_Active_Record', $fn, -1, $err, 0, 0, false);
                        else adodb_throw($db->databaseType, $fn, -1, $err, 0, 0, $db);
                } else
                        if (!$db || $db->debug) ADOConnection::outp($this->_lasterr);
-               
+
        }
-       
+
        // return last error message
        function ErrorMsg()
        {
                if (!function_exists('adodb_throw')) {
                        if ($this->_dbat < 0) $db = false;
                        else $db = $this->DB();
-               
+
                        // last error could be database error too
                        if ($db && $db->ErrorMsg()) return $db->ErrorMsg();
                }
                return $this->_lasterr;
        }
-       
-       function ErrorNo() 
+
+       function ErrorNo()
        {
                if ($this->_dbat < 0) return -9999; // no database connection...
                $db = $this->DB();
-               
+
                return (int) $db->ErrorNo();
        }
 
@@ -523,7 +523,7 @@ class ADODB_Active_Record {
        function DB()
        {
        global $_ADODB_ACTIVE_DBS;
-       
+
                if ($this->_dbat < 0) {
                        $false = false;
                        $this->Error("No database connection set: use ADOdb_Active_Record::SetDatabaseAdaptor(\$db)", "DB");
@@ -533,7 +533,7 @@ class ADODB_Active_Record {
                $db = $activedb->db;
                return $db;
        }
-       
+
        // retrieve ADODB_Active_Table
        function &TableInfo()
        {
@@ -542,8 +542,8 @@ class ADODB_Active_Record {
                $table = $activedb->tables[$this->_tableat];
                return $table;
        }
-       
-       
+
+
        // I have an ON INSERT trigger on a table that sets other columns in the table.
        // So, I find that for myTable, I want to reload an active record after saving it. -- Malcolm Cook
        function Reload()
@@ -554,21 +554,21 @@ class ADODB_Active_Record {
                return($this->Load($where));
        }
 
-       
+
        // set a numeric array (using natural table field ordering) as object properties
        function Set(&$row)
        {
        global $ACTIVE_RECORD_SAFETY;
-       
+
                $db = $this->DB();
-               
+
                if (!$row) {
-                       $this->_saved = false;          
+                       $this->_saved = false;
                        return false;
                }
-               
+
                $this->_saved = true;
-               
+
                $table = $this->TableInfo();
                if ($ACTIVE_RECORD_SAFETY && sizeof($table->flds) != sizeof($row)) {
             # <AP>
@@ -587,7 +587,7 @@ class ADODB_Active_Record {
                }
         else
                        $keys = array_keys($row);
-                       
+
         # <AP>
         reset($keys);
         $this->_original = array();
@@ -601,7 +601,7 @@ class ADODB_Active_Record {
         # </AP>
                return true;
        }
-       
+
        // get last inserted id for INSERT
        function LastInsertID(&$db,$fieldname)
        {
@@ -609,14 +609,14 @@ class ADODB_Active_Record {
                        $val = $db->Insert_ID($this->_table,$fieldname);
                else
                        $val = false;
-                       
+
                if (is_null($val) || $val === false) {
                        // this might not work reliably in multi-user environment
                        return $db->GetOne("select max(".$fieldname.") from ".$this->_table);
                }
                return $val;
        }
-       
+
        // quote data in where clause
        function doquote(&$db, $val,$t)
        {
@@ -624,15 +624,15 @@ class ADODB_Active_Record {
                case 'D':
                case 'T':
                        if (empty($val)) return 'null';
-               
+
                case 'B':
                case 'N':
                case 'C':
                case 'X':
                        if (is_null($val)) return 'null';
-                       
-                       if (strlen($val)>1 && 
-                               (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")) { 
+
+                       if (strlen($val)>1 &&
+                               (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")) {
                                return $db->qstr($val);
                                break;
                        }
@@ -641,13 +641,13 @@ class ADODB_Active_Record {
                        break;
                }
        }
-       
+
        // generate where clause for an UPDATE/SELECT
        function GenWhere(&$db, &$table)
        {
                $keys = $table->keys;
                $parr = array();
-               
+
                foreach($keys as $k) {
                        $f = $table->flds[$k];
                        if ($f) {
@@ -656,48 +656,48 @@ class ADODB_Active_Record {
                }
                return implode(' and ', $parr);
        }
-       
-       
+
+
        function _QName($n,$db=false)
        {
                if (!ADODB_Active_Record::$_quoteNames) return $n;
                if (!$db) $db = $this->DB(); if (!$db) return false;
                return $db->nameQuote.$n.$db->nameQuote;
        }
-       
+
        //------------------------------------------------------------ Public functions below
-       
+
        function Load($where=null,$bindarr=false)
        {
        global $ADODB_FETCH_MODE;
-       
+
                $db = $this->DB(); if (!$db) return false;
                $this->_where = $where;
-               
+
                $save = $ADODB_FETCH_MODE;
                $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
                if ($db->fetchMode !== false) $savem = $db->SetFetchMode(false);
-               
+
                $qry = "select * from ".$this->_table;
 
                if($where) {
                        $qry .= ' WHERE '.$where;
                }
                $row = $db->GetRow($qry,$bindarr);
-               
+
                if (isset($savem)) $db->SetFetchMode($savem);
                $ADODB_FETCH_MODE = $save;
-               
+
                return $this->Set($row);
        }
-       
+
        # useful for multiple record inserts
        # see http://phplens.com/lens/lensforum/msgs.php?id=17795
        function Reset()
        {
         $this->_where=null;
-        $this->_saved = false; 
-        $this->_lasterr = false; 
+        $this->_saved = false;
+        $this->_lasterr = false;
         $this->_original = false;
         $vars=get_object_vars($this);
         foreach($vars as $k=>$v){
@@ -708,24 +708,24 @@ class ADODB_Active_Record {
         $this->foreignName=strtolower(get_class($this));
         return true;
     }
-       
+
        // false on error
        function Save()
        {
                if ($this->_saved) $ok = $this->Update();
                else $ok = $this->Insert();
-               
+
                return $ok;
        }
-       
-       
+
+
        // false on error
        function Insert()
        {
                $db = $this->DB(); if (!$db) return false;
                $cnt = 0;
                $table = $this->TableInfo();
-               
+
                $valarr = array();
                $names = array();
                $valstr = array();
@@ -739,7 +739,7 @@ class ADODB_Active_Record {
                                $cnt += 1;
                        }
                }
-               
+
                if (empty($names)){
                        foreach($table->flds as $name=>$fld) {
                                $valarr[] = null;
@@ -750,7 +750,7 @@ class ADODB_Active_Record {
                }
                $sql = 'INSERT INTO '.$this->_table."(".implode(',',$names).') VALUES ('.implode(',',$valstr).')';
                $ok = $db->Execute($sql,$valarr);
-               
+
                if ($ok) {
                        $this->_saved = true;
                        $autoinc = false;
@@ -765,23 +765,23 @@ class ADODB_Active_Record {
                                $this->$k = $this->LastInsertID($db,$k);
                        }
                }
-               
+
                $this->_original = $valarr;
                return !empty($ok);
        }
-       
+
        function Delete()
        {
                $db = $this->DB(); if (!$db) return false;
                $table = $this->TableInfo();
-               
+
                $where = $this->GenWhere($db,$table);
                $sql = 'DELETE FROM '.$this->_table.' WHERE '.$where;
                $ok = $db->Execute($sql);
-               
+
                return $ok ? true : false;
        }
-       
+
        // returns an array of active record objects
        function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
        {
@@ -789,17 +789,17 @@ class ADODB_Active_Record {
                $arr = $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr,$extra);
                return $arr;
        }
-       
+
        // returns 0 on error, 1 on update, 2 on insert
        function Replace()
        {
        global $ADODB_ASSOC_CASE;
-               
+
                $db = $this->DB(); if (!$db) return false;
                $table = $this->TableInfo();
-               
+
                $pkey = $table->keys;
-               
+
                foreach($table->flds as $name=>$fld) {
                        $val = $this->$name;
                        /*
@@ -815,24 +815,24 @@ class ADODB_Active_Record {
                        if (is_null($val) && !empty($fld->auto_increment)) {
                continue;
             }
-                       
+
                        if (is_array($val)) continue;
-                       
+
                        $t = $db->MetaType($fld->type);
                        $arr[$name] = $this->doquote($db,$val,$t);
                        $valarr[] = $val;
                }
-               
+
                if (!is_array($pkey)) $pkey = array($pkey);
-               
-               
-               if ($ADODB_ASSOC_CASE == 0) 
+
+
+               if ($ADODB_ASSOC_CASE == 0)
                        foreach($pkey as $k => $v)
                                $pkey[$k] = strtolower($v);
-               elseif ($ADODB_ASSOC_CASE == 1) 
+               elseif ($ADODB_ASSOC_CASE == 1)
                        foreach($pkey as $k => $v)
                                $pkey[$k] = strtoupper($v);
-                               
+
                $ok = $db->Replace($this->_table,$arr,$pkey);
                if ($ok) {
                        $this->_saved = true; // 1= update 2=insert
@@ -849,9 +849,9 @@ class ADODB_Active_Record {
                                        $this->$k = $this->LastInsertID($db,$k);
                                }
                        }
-                       
+
                        $this->_original = $valarr;
-               } 
+               }
                return $ok;
        }
 
@@ -860,14 +860,14 @@ class ADODB_Active_Record {
        {
                $db = $this->DB(); if (!$db) return false;
                $table = $this->TableInfo();
-               
+
                $where = $this->GenWhere($db, $table);
-               
+
                if (!$where) {
                        $this->error("Where missing for table $table", "Update");
                        return false;
                }
-               $valarr = array(); 
+               $valarr = array();
                $neworig = array();
                $pairs = array();
                $i = -1;
@@ -876,10 +876,10 @@ class ADODB_Active_Record {
                        $i += 1;
                        $val = $this->$name;
                        $neworig[] = $val;
-                       
-                       if (isset($table->keys[$name]) || is_array($val)) 
+
+                       if (isset($table->keys[$name]) || is_array($val))
                                continue;
-                       
+
                        if (is_null($val)) {
                                if (isset($fld->not_null) && $fld->not_null) {
                                        if (isset($fld->default_value) && strlen($fld->default_value)) continue;
@@ -889,16 +889,16 @@ class ADODB_Active_Record {
                                        }
                                }
                        }
-                       
+
                        if (isset($this->_original[$i]) && $val == $this->_original[$i]) {
                                continue;
-                       }                       
+                       }
                        $valarr[] = $val;
                        $pairs[] = $this->_QName($name,$db).'='.$db->Param($cnt);
                        $cnt += 1;
                }
-               
-               
+
+
                if (!$cnt) return -1;
                $sql = 'UPDATE '.$this->_table." SET ".implode(",",$pairs)." WHERE ".$where;
                $ok = $db->Execute($sql,$valarr);
@@ -908,14 +908,14 @@ class ADODB_Active_Record {
                }
                return 0;
        }
-       
+
        function GetAttributeNames()
        {
                $table = $this->TableInfo();
                if (!$table) return false;
                return array_keys($table->flds);
        }
-       
+
 };
 
 function adodb_GetActiveRecordsClass(&$db, $class, $table,$whereOrderBy,$bindarr, $primkeyArr,
@@ -923,10 +923,10 @@ function adodb_GetActiveRecordsClass(&$db, $class, $table,$whereOrderBy,$bindarr
 {
 global $_ADODB_ACTIVE_DBS;
 
-       
+
        $save = $db->SetFetchMode(ADODB_FETCH_NUM);
        $qry = "select * from ".$table;
-       
+
        if (!empty($whereOrderBy))
                $qry .= ' WHERE '.$whereOrderBy;
        if(isset($extra['limit']))
@@ -947,13 +947,13 @@ global $_ADODB_ACTIVE_DBS;
                $rows = $db->GetAll($qry,$bindarr);
 
        $db->SetFetchMode($save);
-       
+
        $false = false;
-       
-       if ($rows === false) {  
+
+       if ($rows === false) {
                return $false;
        }
-       
+
 
        if (!class_exists($class)) {
                $db->outp_throw("Unknown class $class in GetActiveRecordsClass()",'GetActiveRecordsClass');
@@ -967,7 +967,7 @@ global $_ADODB_ACTIVE_DBS;
        $arrRef = array();
        $bTos = array(); // Will store belongTo's indices if any
        foreach($rows as $row) {
-       
+
                $obj = new $class($table,$primkeyArr,$db);
                if ($obj->ErrorNo()){
                        $db->_errorMsg = $obj->ErrorMsg();
@@ -975,7 +975,7 @@ global $_ADODB_ACTIVE_DBS;
                }
                $obj->Set($row);
                $arr[] = $obj;
-       } // foreach($rows as $row) 
+       } // foreach($rows as $row)
 
        return $arr;
 }
index 7b1c9e1..874c478 100644 (file)
@@ -6,19 +6,19 @@ if (!defined('ADODB_DIR')) die();
 global $ADODB_INCLUDED_CSV;
 $ADODB_INCLUDED_CSV = 1;
 
-/* 
+/*
 
   V5.10 10 Nov 2009   (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
-  Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
-  the BSD license will take precedence. See License.txt. 
+  Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
+  the BSD license will take precedence. See License.txt.
   Set tabs to 4 for best viewing.
-  
+
   Latest version is available at http://adodb.sourceforge.net
-  
-  Library for CSV serialization. This is used by the csv/proxy driver and is the 
-  CacheExecute() serialization format. 
-  
+
+  Library for CSV serialization. This is used by the csv/proxy driver and is the
+  CacheExecute() serialization format.
+
   ==== NOTE ====
   Format documented at http://php.weblogs.com/ADODB_CSV
   ==============
@@ -34,61 +34,61 @@ $ADODB_INCLUDED_CSV = 1;
        function _rs2serialize(&$rs,$conn=false,$sql='')
        {
                $max = ($rs) ? $rs->FieldCount() : 0;
-               
+
                if ($sql) $sql = urlencode($sql);
                // metadata setup
-               
+
                if ($max <= 0 || $rs->dataProvider == 'empty') { // is insert/update/delete
                        if (is_object($conn)) {
                                $sql .= ','.$conn->Affected_Rows();
                                $sql .= ','.$conn->Insert_ID();
                        } else
                                $sql .= ',,';
-                       
+
                        $text = "====-1,0,$sql\n";
                        return $text;
                }
                $tt = ($rs->timeCreated) ? $rs->timeCreated : time();
-               
+
                ## changed format from ====0 to ====1
                $line = "====1,$tt,$sql\n";
-               
+
                if ($rs->databaseType == 'array') {
                        $rows = $rs->_array;
                } else {
                        $rows = array();
-                       while (!$rs->EOF) {     
+                       while (!$rs->EOF) {
                                $rows[] = $rs->fields;
                                $rs->MoveNext();
-                       } 
+                       }
                }
-               
+
                for($i=0; $i < $max; $i++) {
                        $o = $rs->FetchField($i);
                        $flds[] = $o;
                }
-       
+
                $savefetch = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : $rs->fetchMode;
                $class = $rs->connection->arrayClass;
                $rs2 = new $class();
                $rs2->timeCreated = $rs->timeCreated; # memcache fix
                $rs2->sql = $rs->sql;
-               $rs2->oldProvider = $rs->dataProvider; 
+               $rs2->oldProvider = $rs->dataProvider;
                $rs2->InitArrayFields($rows,$flds);
                $rs2->fetchMode = $savefetch;
                return $line.serialize($rs2);
        }
 
-       
+
 /**
-* Open CSV file and convert it into Data. 
+* Open CSV file and convert it into Data.
 *
 * @param url           file/ftp/http url
 * @param err           returns the error message
 * @param timeout       dispose if recordset has been alive for $timeout secs
 *
 * @return              recordset, or false if error occured. If no
-*                      error occurred in sql INSERT/UPDATE/DELETE, 
+*                      error occurred in sql INSERT/UPDATE/DELETE,
 *                      empty recordset is returned
 */
        function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
@@ -103,7 +103,7 @@ $ADODB_INCLUDED_CSV = 1;
                @flock($fp, LOCK_SH);
                $arr = array();
                $ttl = 0;
-               
+
                if ($meta = fgetcsv($fp, 32000, ",")) {
                        // check if error message
                        if (strncmp($meta[0],'****',4) === 0) {
@@ -113,10 +113,10 @@ $ADODB_INCLUDED_CSV = 1;
                        }
                        // check for meta data
                        // $meta[0] is -1 means return an empty recordset
-                       // $meta[1] contains a time 
-       
+                       // $meta[1] contains a time
+
                        if (strncmp($meta[0], '====',4) === 0) {
-                       
+
                                if ($meta[0] == "====-1") {
                                        if (sizeof($meta) < 5) {
                                                $err = "Corrupt first line for format -1";
@@ -124,12 +124,12 @@ $ADODB_INCLUDED_CSV = 1;
                                                return $false;
                                        }
                                        fclose($fp);
-                                       
+
                                        if ($timeout > 0) {
                                                $err = " Illegal Timeout $timeout ";
                                                return $false;
                                        }
-                                       
+
                                        $rs = new $rsclass($val=true);
                                        $rs->fields = array();
                                        $rs->timeCreated = $meta[1];
@@ -137,9 +137,9 @@ $ADODB_INCLUDED_CSV = 1;
                                        $rs->_numOfFields = 0;
                                        $rs->sql = urldecode($meta[2]);
                                        $rs->affectedrows = (integer)$meta[3];
-                                       $rs->insertid = $meta[4];       
+                                       $rs->insertid = $meta[4];
                                        return $rs;
-                               } 
+                               }
                        # Under high volume loads, we want only 1 thread/process to _write_file
                        # so that we don't have 50 processes queueing to write the same data.
                        # We use probabilistic timeout, ahead of time.
@@ -149,7 +149,7 @@ $ADODB_INCLUDED_CSV = 1;
                        # -1 sec after timeout give processes 1/4 chance of timing out
                        # +0 sec after timeout, give processes 100% chance of timing out
                                if (sizeof($meta) > 1) {
-                                       if($timeout >0){ 
+                                       if($timeout >0){
                                                $tdiff = (integer)( $meta[1]+$timeout - time());
                                                if ($tdiff <= 2) {
                                                        switch($tdiff) {
@@ -161,7 +161,7 @@ $ADODB_INCLUDED_CSV = 1;
                                                                        return $false;
                                                                }
                                                                break;
-                                                       case 2: 
+                                                       case 2:
                                                                if ((rand() & 15) == 0) {
                                                                        fclose($fp);
                                                                        $err = "Timeout 2";
@@ -175,12 +175,12 @@ $ADODB_INCLUDED_CSV = 1;
                                                                        return $false;
                                                                }
                                                                break;
-                                                       default: 
+                                                       default:
                                                                fclose($fp);
                                                                $err = "Timeout 0";
                                                                return $false;
                                                        } // switch
-                                                       
+
                                                } // if check flush cache
                                        }// (timeout>0)
                                        $ttl = $meta[1];
@@ -190,7 +190,7 @@ $ADODB_INCLUDED_CSV = 1;
                                if ($meta[0] === '====1') {
                                        // slurp in the data
                                        $MAXSIZE = 128000;
-                                       
+
                                        $text = fread($fp,$MAXSIZE);
                                        if (strlen($text)) {
                                                while ($txt = fread($fp,$MAXSIZE)) {
@@ -206,7 +206,7 @@ $ADODB_INCLUDED_CSV = 1;
                                        }
                                        return $rs;
                                }
-                               
+
                                $meta = false;
                                $meta = fgetcsv($fp, 32000, ",");
                                if (!$meta) {
@@ -236,15 +236,15 @@ $ADODB_INCLUDED_CSV = 1;
                        $err = "Recordset had unexpected EOF 2";
                        return $false;
                }
-               
+
                // slurp in the data
                $MAXSIZE = 128000;
-               
+
                $text = '';
                while ($txt = fread($fp,$MAXSIZE)) {
                        $text .= $txt;
                }
-                       
+
                fclose($fp);
                @$arr = unserialize($text);
                //var_dump($arr);
@@ -258,18 +258,18 @@ $ADODB_INCLUDED_CSV = 1;
                $rs->InitArrayFields($arr,$flds);
                return $rs;
        }
-       
+
 
        /**
        * Save a file $filename and its $contents (normally for caching) with file locking
        * Returns true if ok, false if fopen/fwrite error, 0 if rename error (eg. file is locked)
        */
        function adodb_write_file($filename, $contents,$debug=false)
-       { 
+       {
        # http://www.php.net/bugs.php?id=9203 Bug that flock fails on Windows
        # So to simulate locking, we assume that rename is an atomic operation.
-       # First we delete $filename, then we create a $tempfile write to it and 
-       # rename to the desired $filename. If the rename works, then we successfully 
+       # First we delete $filename, then we create a $tempfile write to it and
+       # rename to the desired $filename. If the rename works, then we successfully
        # modified the file exclusively.
        # What a stupid need - having to simulate locking.
        # Risks:
@@ -279,14 +279,14 @@ $ADODB_INCLUDED_CSV = 1;
        # 4. another process creates $filename between unlink() and rename() -- ok, rename() fails and  cache updated
                if (strncmp(PHP_OS,'WIN',3) === 0) {
                        // skip the decimal place
-                       $mtime = substr(str_replace(' ','_',microtime()),2); 
+                       $mtime = substr(str_replace(' ','_',microtime()),2);
                        // getmypid() actually returns 0 on Win98 - never mind!
                        $tmpname = $filename.uniqid($mtime).getmypid();
                        if (!($fd = @fopen($tmpname,'w'))) return false;
                        if (fwrite($fd,$contents)) $ok = true;
                        else $ok = false;
                        fclose($fd);
-                       
+
                        if ($ok) {
                                @chmod($tmpname,0644);
                                // the tricky moment
@@ -312,7 +312,7 @@ $ADODB_INCLUDED_CSV = 1;
                        if ($debug)ADOConnection::outp( " Failed acquiring lock for $filename<br>\n");
                        $ok = false;
                }
-       
+
                return $ok;
        }
 ?>
\ No newline at end of file
index 19500ca..607f6b8 100644 (file)
@@ -2,14 +2,14 @@
 
 /**
   V5.10 10 Nov 2009   (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
-  Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
+  Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence.
-       
+
   Set tabs to 4 for best viewing.
+
        DOCUMENTATION:
-       
+
                See adodb/tests/test-datadict.php for docs and examples.
 */
 
@@ -42,13 +42,13 @@ if (!function_exists('ctype_alnum')) {
 /**
        Parse arguments, treat "text" (text) and 'text' as quotation marks.
        To escape, use "" or '' or ))
-       
+
        Will read in "abc def" sans quotes, as: abc def
        Same with 'abc def'.
        However if `abc def`, then will read in as `abc def`
-       
+
        @param endstmtchar    Character that indicates end of statement
-       @param tokenchars     Include the following characters in tokens apart from A-Z and 0-9 
+       @param tokenchars     Include the following characters in tokens apart from A-Z and 0-9
        @returns 2 dimensional array containing parsed tokens.
 */
 function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
@@ -62,7 +62,7 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
        $max = strlen($args);
        $quoted = false;
        $tokarr = array();
-       
+
        while ($pos < $max) {
                $ch = substr($args,$pos,1);
                switch($ch) {
@@ -77,17 +77,17 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
                                }
                                break;
                        }
-                       
+
                        $tokarr[] = $ch;
                        break;
-               
+
                case '`':
                        if ($intoken) $tokarr[] = $ch;
                case '(':
-               case ')':       
+               case ')':
                case '"':
                case "'":
-                       
+
                        if ($intoken) {
                                if (empty($endquote)) {
                                        $tokens[$stmtno][] = implode('',$tokarr);
@@ -109,9 +109,9 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
                                        }
                                } else
                                        $tokarr[] = $ch;
-                                       
+
                        }else {
-                       
+
                                if ($ch == '(') $endquote = ')';
                                else $endquote = $ch;
                                $quoted = true;
@@ -120,27 +120,27 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
                                if ($ch == '`') $tokarr[] = '`';
                        }
                        break;
-                       
+
                default:
-                       
+
                        if (!$intoken) {
                                if ($ch == $endstmtchar) {
                                        $stmtno += 1;
                                        $tokens[$stmtno] = array();
                                        break;
                                }
-                       
+
                                $intoken = true;
                                $quoted = false;
                                $endquote = false;
                                $tokarr = array();
-       
+
                        }
-                       
+
                        if ($quoted) $tokarr[] = $ch;
                        else if (ctype_alnum($ch) || strpos($tokenchars,$ch) !== false) $tokarr[] = $ch;
                        else {
-                               if ($ch == $endstmtchar) {                      
+                               if ($ch == $endstmtchar) {
                                        $tokens[$stmtno][] = implode('',$tokarr);
                                        $stmtno += 1;
                                        $tokens[$stmtno] = array();
@@ -156,7 +156,7 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
                $pos += 1;
        }
        if ($intoken) $tokens[$stmtno][] = implode('',$tokarr);
-       
+
        return $tokens;
 }
 
@@ -165,7 +165,7 @@ class ADODB_DataDict {
        var $connection;
        var $debug = false;
        var $dropTable = 'DROP TABLE %s';
-       var $renameTable = 'RENAME TABLE %s TO %s'; 
+       var $renameTable = 'RENAME TABLE %s TO %s';
        var $dropIndex = 'DROP INDEX %s';
        var $addCol = ' ADD';
        var $alterCol = ' ALTER COLUMN';
@@ -180,43 +180,43 @@ class ADODB_DataDict {
        var $invalidResizeTypes4 = array('CLOB','BLOB','TEXT','DATE','TIME'); // for changetablesql
        var $blobSize = 100;    /// any varchar/char field this size or greater is treated as a blob
                                                        /// in other words, we use a text area for editting.
-       
+
        function GetCommentSQL($table,$col)
        {
                return false;
        }
-       
+
        function SetCommentSQL($table,$col,$cmt)
        {
                return false;
        }
-       
+
        function MetaTables()
        {
                if (!$this->connection->IsConnected()) return array();
                return $this->connection->MetaTables();
        }
-       
+
        function MetaColumns($tab, $upper=true, $schema=false)
        {
                if (!$this->connection->IsConnected()) return array();
                return $this->connection->MetaColumns($this->TableName($tab), $upper, $schema);
        }
-       
+
        function MetaPrimaryKeys($tab,$owner=false,$intkey=false)
        {
                if (!$this->connection->IsConnected()) return array();
                return $this->connection->MetaPrimaryKeys($this->TableName($tab), $owner, $intkey);
        }
-       
+
        function MetaIndexes($table, $primary = false, $owner = false)
        {
                if (!$this->connection->IsConnected()) return array();
                return $this->connection->MetaIndexes($this->TableName($table), $primary, $owner);
        }
-       
+
        function MetaType($t,$len=-1,$fieldobj=false)
-       {               
+       {
                static $typeMap = array(
                'VARCHAR' => 'C',
                'VARCHAR2' => 'C',
@@ -263,7 +263,7 @@ class ADODB_DataDict {
                'TIMESTAMP WITHOUT TIME ZONE' => 'T', // postgresql
                ##
                'BOOL' => 'L',
-               'BOOLEAN' => 'L', 
+               'BOOLEAN' => 'L',
                'BIT' => 'L',
                'L' => 'L',
                ##
@@ -296,21 +296,21 @@ class ADODB_DataDict {
                'NUM' => 'N',
                'NUMERIC' => 'N',
                'MONEY' => 'N',
-               
+
                ## informix 9.2
-               'SQLINT' => 'I', 
-               'SQLSERIAL' => 'I', 
-               'SQLSMINT' => 'I', 
-               'SQLSMFLOAT' => 'N', 
-               'SQLFLOAT' => 'N', 
-               'SQLMONEY' => 'N', 
-               'SQLDECIMAL' => 'N', 
-               'SQLDATE' => 'D', 
-               'SQLVCHAR' => 'C', 
-               'SQLCHAR' => 'C', 
-               'SQLDTIME' => 'T', 
-               'SQLINTERVAL' => 'N', 
-               'SQLBYTES' => 'B', 
+               'SQLINT' => 'I',
+               'SQLSERIAL' => 'I',
+               'SQLSMINT' => 'I',
+               'SQLSMFLOAT' => 'N',
+               'SQLFLOAT' => 'N',
+               'SQLMONEY' => 'N',
+               'SQLDECIMAL' => 'N',
+               'SQLDATE' => 'D',
+               'SQLVCHAR' => 'C',
+               'SQLCHAR' => 'C',
+               'SQLDTIME' => 'T',
+               'SQLINTERVAL' => 'N',
+               'SQLBYTES' => 'B',
                'SQLTEXT' => 'X',
                 ## informix 10
                "SQLINT8" => 'I8',
@@ -320,7 +320,7 @@ class ADODB_DataDict {
                "SQLLVARCHAR" => 'X',
                "SQLBOOL" => 'L'
                );
-               
+
                if (!$this->connection->IsConnected()) {
                        $t = strtoupper($t);
                        if (isset($typeMap[$t])) return $typeMap[$t];
@@ -328,36 +328,36 @@ class ADODB_DataDict {
                }
                return $this->connection->MetaType($t,$len,$fieldobj);
        }
-       
+
        function NameQuote($name = NULL,$allowBrackets=false)
        {
                if (!is_string($name)) {
                        return FALSE;
                }
-               
+
                $name = trim($name);
-               
+
                if ( !is_object($this->connection) ) {
                        return $name;
                }
-               
+
                $quote = $this->connection->nameQuote;
-               
+
                // if name is of the form `name`, quote it
                if ( preg_match('/^`(.+)`$/', $name, $matches) ) {
                        return $quote . $matches[1] . $quote;
                }
-               
+
                // if name contains special characters, quote it
                $regex = ($allowBrackets) ? $this->nameRegexBrackets : $this->nameRegex;
-               
+
                if ( !preg_match('/^[' . $regex . ']+$/', $name) ) {
                        return $quote . $name . $quote;
                }
-               
+
                return $name;
        }
-       
+
        function TableName($name)
        {
                if ( $this->schema ) {
@@ -365,7 +365,7 @@ class ADODB_DataDict {
                }
                return $this->NameQuote($name);
        }
-       
+
        // Executes the sql array returned by GetTableSQL and GetIndexSQL
        function ExecuteSQLArray($sql, $continueOnError = true)
        {
@@ -373,7 +373,7 @@ class ADODB_DataDict {
                $conn = $this->connection;
                $saved = $conn->debug;
                foreach($sql as $line) {
-                       
+
                        if ($this->debug) $conn->debug = true;
                        $ok = $conn->Execute($line);
                        $conn->debug = $saved;
@@ -385,43 +385,43 @@ class ADODB_DataDict {
                }
                return $rez;
        }
-       
+
        /**
                Returns the actual type given a character code.
-               
+
                C:  varchar
                X:  CLOB (character large object) or largest varchar size if CLOB is not supported
                C2: Multibyte varchar
                X2: Multibyte CLOB
-               
+
                B:  BLOB (binary large object)
-               
+
                D:  Date
-               T:  Date-time 
+               T:  Date-time
                L:  Integer field suitable for storing booleans (0 or 1)
                I:  Integer
                F:  Floating point number
                N:  Numeric or decimal number
        */
-       
+
        function ActualType($meta)
        {
                return $meta;
        }
-       
+
        function CreateDatabase($dbname,$options=false)
        {
                $options = $this->_Options($options);
                $sql = array();
-               
+
                $s = 'CREATE DATABASE ' . $this->NameQuote($dbname);
                if (isset($options[$this->upperName]))
                        $s .= ' '.$options[$this->upperName];
-               
+
                $sql[] = $s;
                return $sql;
        }
-       
+
        /*
         Generates the SQL to create index. Returns an array of sql strings.
        */
@@ -430,25 +430,25 @@ class ADODB_DataDict {
                if (!is_array($flds)) {
                        $flds = explode(',',$flds);
                }
-               
+
                foreach($flds as $key => $fld) {
                        # some indexes can use partial fields, eg. index first 32 chars of "name" with NAME(32)
                        $flds[$key] = $this->NameQuote($fld,$allowBrackets=true);
                }
-               
+
                return $this->_IndexSQL($this->NameQuote($idxname), $this->TableName($tabname), $flds, $this->_Options($idxoptions));
        }
-       
+
        function DropIndexSQL ($idxname, $tabname = NULL)
        {
                return array(sprintf($this->dropIndex, $this->NameQuote($idxname), $this->TableName($tabname)));
        }
-       
+
        function SetSchema($schema)
        {
                $this->schema = $schema;
        }
-       
+
        function AddColumnSQL($tabname, $flds)
        {
                $tabname = $this->TableName ($tabname);
@@ -468,7 +468,7 @@ class ADODB_DataDict {
                }
                return $sql;
        }
-       
+
        /**
         * Change the definition of one column
         *
@@ -500,7 +500,7 @@ class ADODB_DataDict {
                }
                return $sql;
        }
-       
+
        /**
         * Rename one column
         *
@@ -523,7 +523,7 @@ class ADODB_DataDict {
                }
                return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def));
        }
-               
+
        /**
         * Drop one column
         *
@@ -546,17 +546,17 @@ class ADODB_DataDict {
                }
                return $sql;
        }
-       
+
        function DropTableSQL($tabname)
        {
                return array (sprintf($this->dropTable, $this->TableName($tabname)));
        }
-       
+
        function RenameTableSQL($tabname,$newname)
        {
                return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname)));
-       }       
-       
+       }
+
        /**
         Generate the SQL to create table. Returns an array of sql strings.
        */
@@ -565,11 +565,11 @@ class ADODB_DataDict {
                list($lines,$pkey,$idxs) = $this->_GenFields($flds, true);
                // genfields can return FALSE at times
                if ($lines == null) $lines = array();
-               
+
                $taboptions = $this->_Options($tableoptions);
                $tabname = $this->TableName ($tabname);
                $sql = $this->_TableSQL($tabname,$lines,$pkey,$taboptions);
-               
+
                // ggiunta - 2006/10/12 - KLUDGE:
         // if we are on autoincrement, and table options includes REPLACE, the
         // autoincrement sequence has already been dropped on table creation sql, so
@@ -579,7 +579,7 @@ class ADODB_DataDict {
                unset($taboptions['REPLACE']);
                $tsql = $this->_Triggers($tabname,$taboptions);
                foreach($tsql as $s) $sql[] = $s;
-               
+
                if (is_array($idxs)) {
                        foreach($idxs as $idx => $idxdef) {
                                $sql_idxs = $this->CreateIndexSql($idx, $tabname,  $idxdef['cols'], $idxdef['opts']);
@@ -589,7 +589,7 @@ class ADODB_DataDict {
 
                return $sql;
        }
-       
+
        function _GenFields($flds,$widespacing=false)
        {
                if (is_string($flds)) {
@@ -606,7 +606,7 @@ class ADODB_DataDict {
                                                $f1['INDEX'] = '';
                                                // fall through intentionally
                                        case 'CONSTRAINT':
-                                       case 'DEFAULT': 
+                                       case 'DEFAULT':
                                                $hasparam = $token;
                                                break;
                                        default:
@@ -631,7 +631,7 @@ class ADODB_DataDict {
                                $hasparam = false;
 
                                $flds[] = $f1;
-                               
+
                        }
                }
                $this->autoIncrement = false;
@@ -640,7 +640,7 @@ class ADODB_DataDict {
                $idxs = array();
                foreach($flds as $fld) {
                        $fld = _array_change_key_case($fld);
-                       
+
                        $fname = false;
                        $fdefault = false;
                        $fautoinc = false;
@@ -656,20 +656,20 @@ class ADODB_DataDict {
                        $funsigned = false;
                        $findex = '';
                        $funiqueindex = false;
-                       
+
                        //-----------------
                        // Parse attributes
                        foreach($fld as $attr => $v) {
                                if ($attr == 2 && is_numeric($v)) $attr = 'SIZE';
                                else if (is_numeric($attr) && $attr > 1 && !is_numeric($v)) $attr = strtoupper($v);
-                               
+
                                switch($attr) {
                                case '0':
                                case 'NAME':    $fname = $v; break;
                                case '1':
                                case 'TYPE':    $ty = $v; $ftype = $this->ActualType(strtoupper($v)); break;
-                               
-                               case 'SIZE':    
+
+                               case 'SIZE':
                                                                $dotat = strpos($v,'.'); if ($dotat === false) $dotat = strpos($v,',');
                                                                if ($dotat === false) $fsize = $v;
                                                                else {
@@ -695,33 +695,33 @@ class ADODB_DataDict {
                                case 'UNIQUE': $funiqueindex = true; break;
                                } //switch
                        } // foreach $fld
-                       
+
                        //--------------------
                        // VALIDATE FIELD INFO
                        if (!strlen($fname)) {
                                if ($this->debug) ADOConnection::outp("Undefined NAME");
                                return false;
                        }
-                       
+
                        $fid = strtoupper(preg_replace('/^`(.+)`$/', '$1', $fname));
                        $fname = $this->NameQuote($fname);
-                       
+
                        if (!strlen($ftype)) {
                                if ($this->debug) ADOConnection::outp("Undefined TYPE for field '$fname'");
                                return false;
                        } else {
                                $ftype = strtoupper($ftype);
                        }
-                       
+
                        $ftype = $this->_GetSize($ftype, $ty, $fsize, $fprec);
-                       
+
                        if ($ty == 'X' || $ty == 'X2' || $ty == 'B') $fnotnull = false; // some blob types do not accept nulls
-                       
+
                        if ($fprimary) $pkey[] = $fname;
-                       
+
                        // some databases do not allow blobs to have defaults
                        if ($ty == 'X') $fdefault = false;
-                       
+
                        // build list of indexes
                        if ($findex != '') {
                                if (array_key_exists($findex, $idxs)) {
@@ -758,7 +758,7 @@ class ADODB_DataDict {
                                        $fdefault = $this->connection->sysDate;
                                }
                        } else if ($fdefault !== false && !$fnoquote) {
-                               if ($ty == 'C' or $ty == 'X' or 
+                               if ($ty == 'C' or $ty == 'X' or
                                        ( substr($fdefault,0,1) != "'" && !is_numeric($fdefault))) {
 
                                        if (($ty == 'D' || $ty == 'T') && strtolower($fdefault) != 'null') {
@@ -773,27 +773,27 @@ class ADODB_DataDict {
                                                }
                                        }
                                        else
-                                       if (strlen($fdefault) != 1 && substr($fdefault,0,1) == ' ' && substr($fdefault,strlen($fdefault)-1) == ' ') 
+                                       if (strlen($fdefault) != 1 && substr($fdefault,0,1) == ' ' && substr($fdefault,strlen($fdefault)-1) == ' ')
                                                $fdefault = trim($fdefault);
                                        else if (strtolower($fdefault) != 'null')
                                                $fdefault = $this->connection->qstr($fdefault);
                                }
                        }
                        $suffix = $this->_CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned);
-                       
+
                        // add index creation
                        if ($widespacing) $fname = str_pad($fname,24);
-                       
+
                         // check for field names appearing twice
             if (array_key_exists($fid, $lines)) {
                 ADOConnection::outp("Field '$fname' defined twice");
             }
-                       
+
                        $lines[$fid] = $fname.' '.$ftype.$suffix;
-                       
+
                        if ($fautoinc) $this->autoIncrement = true;
                } // foreach $flds
-               
+
                return array($lines,$pkey,$idxs);
        }
 
@@ -811,56 +811,56 @@ class ADODB_DataDict {
                }
                return $ftype;
        }
-       
-       
+
+
        // return string must begin with space
        function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
-       {       
+       {
                $suffix = '';
                if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
                if ($fnotnull) $suffix .= ' NOT NULL';
                if ($fconstraint) $suffix .= ' '.$fconstraint;
                return $suffix;
        }
-       
+
        function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
        {
                $sql = array();
-               
+
                if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
                        $sql[] = sprintf ($this->dropIndex, $idxname);
                        if ( isset($idxoptions['DROP']) )
                                return $sql;
                }
-               
+
                if ( empty ($flds) ) {
                        return $sql;
                }
-               
+
                $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : '';
-       
+
                $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' ';
-               
+
                if ( isset($idxoptions[$this->upperName]) )
                        $s .= $idxoptions[$this->upperName];
-               
+
                if ( is_array($flds) )
                        $flds = implode(', ',$flds);
                $s .= '(' . $flds . ')';
                $sql[] = $s;
-               
+
                return $sql;
        }
-       
+
        function _DropAutoIncrement($tabname)
        {
                return false;
        }
-       
+
        function _TableSQL($tabname,$lines,$pkey,$tableoptions)
        {
                $sql = array();
-               
+
                if (isset($tableoptions['REPLACE']) || isset ($tableoptions['DROP'])) {
                        $sql[] = sprintf($this->dropTable,$tabname);
                        if ($this->autoIncrement) {
@@ -877,19 +877,19 @@ class ADODB_DataDict {
                        $s .= ",\n                 PRIMARY KEY (";
                        $s .= implode(", ",$pkey).")";
                }
-               if (isset($tableoptions['CONSTRAINTS'])) 
+               if (isset($tableoptions['CONSTRAINTS']))
                        $s .= "\n".$tableoptions['CONSTRAINTS'];
-               
-               if (isset($tableoptions[$this->upperName.'_CONSTRAINTS'])) 
+
+               if (isset($tableoptions[$this->upperName.'_CONSTRAINTS']))
                        $s .= "\n".$tableoptions[$this->upperName.'_CONSTRAINTS'];
-               
+
                $s .= "\n)";
                if (isset($tableoptions[$this->upperName])) $s .= $tableoptions[$this->upperName];
                $sql[] = $s;
-               
+
                return $sql;
        }
-       
+
        /**
                GENERATE TRIGGERS IF NEEDED
                used when table has auto-incrementing field that is emulated using triggers
@@ -898,7 +898,7 @@ class ADODB_DataDict {
        {
                return array();
        }
-       
+
        /**
                Sanitize options, so that array elements with no keys are promoted to keys
        */
@@ -912,34 +912,34 @@ class ADODB_DataDict {
                }
                return $newopts;
        }
-       
+
        /**
        "Florian Buzin [ easywe ]" <florian.buzin#easywe.de>
-       
+
        This function changes/adds new fields to your table. You don't
        have to know if the col is new or not. It will check on its own.
        */
        function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false)
        {
        global $ADODB_FETCH_MODE;
-       
+
                $save = $ADODB_FETCH_MODE;
                $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
                if ($this->connection->fetchMode !== false) $savem = $this->connection->SetFetchMode(false);
-               
+
                // check table exists
                $save_handler = $this->connection->raiseErrorFn;
                $this->connection->raiseErrorFn = '';
                $cols = $this->MetaColumns($tablename);
                $this->connection->raiseErrorFn = $save_handler;
-               
+
                if (isset($savem)) $this->connection->SetFetchMode($savem);
                $ADODB_FETCH_MODE = $save;
-               
-               if ( empty($cols)) { 
+
+               if ( empty($cols)) {
                        return $this->CreateTableSQL($tablename, $flds, $tableoptions);
                }
-               
+
                if (is_array($flds)) {
                // Cycle through the update fields, comparing
                // existing fields to fields to update.
@@ -952,9 +952,9 @@ class ADODB_DataDict {
                                        $obj = $cols[$k];
                                        if (isset($obj->not_null) && $obj->not_null)
                                                $v = str_replace('NOT NULL','',$v);
-                                       if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT'])) 
+                                       if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT']))
                                            $v = str_replace('AUTOINCREMENT','',$v);
-                                       
+
                                        $c = $cols[$k];
                                        $ml = $c->max_length;
                                        $mt = $this->MetaType($c->type,$ml);
@@ -965,11 +965,11 @@ class ADODB_DataDict {
                                        }
                                } else {
                                        $holdflds[$k] = $v;
-                               }               
+                               }
                        }
                        $flds = $holdflds;
                }
-       
+
 
                // already exists, alter table instead
                list($lines,$pkey,$idxs) = $this->_GenFields($flds);
@@ -980,26 +980,26 @@ class ADODB_DataDict {
 
                foreach ( $lines as $id => $v ) {
                        if ( isset($cols[$id]) && is_object($cols[$id]) ) {
-                       
+
                                $flds = Lens_ParseArgs($v,',');
-                               
+
                                //  We are trying to change the size of the field, if not allowed, simply ignore the request.
                                // $flds[1] holds the type, $flds[2] holds the size -postnuke addition
                                if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4)
                                 && (isset($flds[0][2]) && is_numeric($flds[0][2]))) {
                                        if ($this->debug) ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1]));
                                        #echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>";
-                                       continue;        
+                                       continue;
                                }
                                $sql[] = $alter . $this->alterCol . ' ' . $v;
                        } else {
                                $sql[] = $alter . $this->addCol . ' ' . $v;
                        }
                }
-               
+
                if ($dropOldFlds) {
                        foreach ( $cols as $id => $v )
-                           if ( !isset($lines[$id]) ) 
+                           if ( !isset($lines[$id]) )
                                        $sql[] = $alter . $this->dropCol . ' ' . $v->name;
                }
                return $sql;
index ae0b9e3..a749b2a 100644 (file)
@@ -1,12 +1,12 @@
 <?php
-/** 
+/**
  * @version V5.06 16 Oct 2008  (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
- * Released under both BSD license and Lesser GPL library license. 
- * Whenever there is any discrepancy between the two licenses, 
- * the BSD license will take precedence. 
+ * Released under both BSD license and Lesser GPL library license.
+ * Whenever there is any discrepancy between the two licenses,
+ * the BSD license will take precedence.
  *
  * Set tabs to 4 for best viewing.
- * 
+ *
  * The following code is adapted from the PEAR DB error handling code.
  * Portions (c)1997-2002 The PHP Group.
  */
@@ -59,27 +59,27 @@ function adodb_error($provider,$dbType,$errno)
 {
        //var_dump($errno);
        if (is_numeric($errno) && $errno == 0) return 0;
-       switch($provider) { 
+       switch($provider) {
        case 'mysql': $map = adodb_error_mysql(); break;
-       
+
        case 'oracle':
        case 'oci8': $map = adodb_error_oci8(); break;
-       
+
        case 'ibase': $map = adodb_error_ibase(); break;
-       
+
        case 'odbc': $map = adodb_error_odbc(); break;
-       
+
        case 'mssql':
        case 'sybase': $map = adodb_error_mssql(); break;
-       
+
        case 'informix': $map = adodb_error_ifx(); break;
-       
+
        case 'postgres': return adodb_error_pg($errno); break;
-       
+
        case 'sqlite': return $map = adodb_error_sqlite(); break;
        default:
                return DB_ERROR;
-       }       
+       }
        //print_r($map);
        //var_dump($errno);
        if (isset($map[$errno])) return $map[$errno];
@@ -99,7 +99,7 @@ function adodb_error_pg($errormsg)
             '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/i' => DB_ERROR_NOSUCHFIELD,
             '/parser: parse error at or near \"/i'   => DB_ERROR_SYNTAX,
             '/referential integrity violation/i'     => DB_ERROR_CONSTRAINT,
-                       '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i'     
+                       '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i'
                                 => DB_ERROR_ALREADY_EXISTS
         );
        reset($error_regexps);
@@ -111,7 +111,7 @@ function adodb_error_pg($errormsg)
     // Fall back to DB_ERROR if there was no mapping.
     return DB_ERROR;
 }
-       
+
 function adodb_error_odbc()
 {
 static $MAP = array(
@@ -169,7 +169,7 @@ static $MAP = array(
             -923 => DB_ERROR_CONNECT_FAILED,
             -924 => DB_ERROR_CONNECT_FAILED
         );
-               
+
                return $MAP;
 }
 
@@ -187,7 +187,7 @@ static $MAP = array(
             '-1210'   => DB_ERROR_INVALID_DATE,
             '-1212'   => DB_ERROR_INVALID_DATE
        );
-          
+
           return $MAP;
 }
 
@@ -206,7 +206,7 @@ static $MAP = array(
             2291 => DB_ERROR_CONSTRAINT,
             2449 => DB_ERROR_CONSTRAINT
         );
-          
+
        return $MAP;
 }
 
@@ -216,7 +216,7 @@ static $MAP = array(
                  208 => DB_ERROR_NOSUCHTABLE,
           2601 => DB_ERROR_ALREADY_EXISTS
        );
-          
+
        return $MAP;
 }
 
@@ -225,7 +225,7 @@ function adodb_error_sqlite()
 static $MAP = array(
                  1 => DB_ERROR_SYNTAX
        );
-          
+
        return $MAP;
 }
 
@@ -252,7 +252,7 @@ static $MAP = array(
                    2002 => DB_ERROR_CONNECT_FAILED,
                        2005 => DB_ERROR_CONNECT_FAILED
        );
-          
+
        return $MAP;
 }
 ?>
\ No newline at end of file
index d1e2eb9..0904a4b 100644 (file)
@@ -1,14 +1,14 @@
 <?php
-/** 
+/**
  * @version V5.06 16 Oct 2008  (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
- * Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
-  the BSD license will take precedence. 
+ * Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
+  the BSD license will take precedence.
  *
  * Set tabs to 4 for best viewing.
- * 
+ *
  * Latest version is available at http://php.weblogs.com
- * 
+ *
 */
 include_once('PEAR.php');
 
@@ -34,7 +34,7 @@ global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
 *
 * @param $dbms         the RDBMS you are connecting to
 * @param $fn           the name of the calling function (in uppercase)
-* @param $errno                the native error number from the database 
+* @param $errno                the native error number from the database
 * @param $errmsg       the native error msg from the database
 * @param $p1           $fn specific parameter - see below
 * @param $P2           $fn specific parameter - see below
@@ -42,35 +42,35 @@ global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
 function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
 {
 global $ADODB_Last_PEAR_Error;
-       
+
        if (error_reporting() == 0) return; // obey @ protocol
        switch($fn) {
        case 'EXECUTE':
                $sql = $p1;
                $inputparams = $p2;
-               
+
                $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
                break;
-               
+
        case 'PCONNECT':
        case 'CONNECT':
                $host = $p1;
                $database = $p2;
-               
+
                $s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, '$database')";
                break;
-               
+
        default:
                $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
                break;
        }
-       
+
        $class = ADODB_PEAR_ERROR_CLASS;
        $ADODB_Last_PEAR_Error = new $class($s, $errno,
                $GLOBALS['_PEAR_default_error_mode'],
-               $GLOBALS['_PEAR_default_error_options'], 
+               $GLOBALS['_PEAR_default_error_options'],
                $errmsg);
-               
+
        //print "<p>!$s</p>";
 }
 
@@ -84,5 +84,5 @@ global $ADODB_Last_PEAR_Error;
 
        return $ADODB_Last_PEAR_Error;
 }
-               
+
 ?>
\ No newline at end of file
index b444706..999f060 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 
-if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); 
+if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
 define('ADODB_ERROR_HANDLER','adodb_throw');
 
 class ADODB_Exception extends Exception {
@@ -24,7 +24,7 @@ var $sql = '';
 var $params = '';
 var $host = '';
 var $database = '';
-       
+
        function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
        {
                switch($fn) {
@@ -33,7 +33,7 @@ var $database = '';
                        $this->params = $p2;
                        $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n";
                        break;
-       
+
                case 'PCONNECT':
                case 'CONNECT':
                        $user = $thisConnection->user;
@@ -43,7 +43,7 @@ var $database = '';
                        $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
                        break;
                }
-       
+
                $this->dbms = $dbms;
                if ($thisConnection) {
                        $this->host = $thisConnection->host;
@@ -51,7 +51,7 @@ var $database = '';
                }
                $this->fn = $fn;
                $this->msg = $errmsg;
-                               
+
                if (!is_numeric($errno)) $errno = -1;
                parent::__construct($s,$errno);
        }
@@ -71,7 +71,7 @@ var $database = '';
 function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
 {
 global $ADODB_EXCEPTION;
-       
+
        if (error_reporting() == 0) return; // obey @ protocol
        if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION;
        else $errfn = 'ADODB_EXCEPTION';
index 0ecea26..7ccef13 100644 (file)
@@ -2,27 +2,27 @@
 
 /*
   V5.10 10 Nov 2009   (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
-  Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
+  Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence.
-  
+
   Set tabs to 4.
-  
-  Declares the ADODB Base Class for PHP5 "ADODB_BASE_RS", and supports iteration with 
+
+  Declares the ADODB Base Class for PHP5 "ADODB_BASE_RS", and supports iteration with
   the ADODB_Iterator class.
-  
+
                $rs = $db->Execute("select * from adoxyz");
                foreach($rs as $k => $v) {
                        echo $k; print_r($v); echo "<br>";
                }
-               
-               
+
+
        Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
-       
-       
+
+
        Moved to adodb.inc.php to improve performance.
  */
+
 
 
 
index 4bd09a6..8bc362f 100644 (file)
@@ -9,15 +9,15 @@ if (!defined('ADODB_DIR')) die();
 global $ADODB_INCLUDED_LIB;
 $ADODB_INCLUDED_LIB = 1;
 
-/* 
+/*
  @version V5.06 16 Oct 2008  (c) 2000-2009 John Lim (jlim\@natsoft.com.my). All rights reserved.
-  Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
-  the BSD license will take precedence. See License.txt. 
+  Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
+  the BSD license will take precedence. See License.txt.
   Set tabs to 4 for best viewing.
-  
-  Less commonly used functions are placed here to reduce size of adodb.inc.php. 
-*/ 
+
+  Less commonly used functions are placed here to reduce size of adodb.inc.php.
+*/
 
 function adodb_strip_order_by($sql)
 {
@@ -39,7 +39,7 @@ function adodb_strip_order_by($sql)
                        }
                        $sql = substr($sql,0,$at).substr($sql,$i);
                } else
-                       $sql = str_replace($arr[0], '', $sql); 
+                       $sql = str_replace($arr[0], '', $sql);
        return $sql;
  }
 
@@ -55,8 +55,8 @@ function adodb_probetypes(&$array,&$types,$probe=8)
        $types = array();
        if ($probe > sizeof($array)) $max = sizeof($array);
        else $max = $probe;
-       
-       
+
+
        for ($j=0;$j < $max; $j++) {
                $row = $array[$j];
                if (!$row) break;
@@ -65,16 +65,16 @@ function adodb_probetypes(&$array,&$types,$probe=8)
                        $i += 1;
 
                        if (isset($types[$i]) && $types[$i]=='C') continue;
-                       
+
                        //print " ($i ".$types[$i]. "$v) ";
                        $v = trim($v);
-                       
+
                        if (!preg_match('/^[+-]{0,1}[0-9\.]+$/',$v)) {
                                $types[$i] = 'C'; // once C, always C
-                               
+
                                continue;
                        }
-                       if ($j == 0) { 
+                       if ($j == 0) {
                        // If empty string, we presume is character
                        // test for integer for 1st row only
                        // after that it is up to testing other rows to prove
@@ -84,19 +84,19 @@ function adodb_probetypes(&$array,&$types,$probe=8)
                                else  $types[$i] = 'I';
                                continue;
                        }
-                       
+
                        if (strpos($v,'.') !== false) $types[$i] = 'N';
-                       
+
                }
        }
-       
+
 }
 
 function  adodb_transpose(&$arr, &$newarr, &$hdr, &$fobjs)
 {
        $oldX = sizeof(reset($arr));
-       $oldY = sizeof($arr);   
-       
+       $oldY = sizeof($arr);
+
        if ($hdr) {
                $startx = 1;
                $hdr = array('Fields');
@@ -112,14 +112,14 @@ function  adodb_transpose(&$arr, &$newarr, &$hdr, &$fobjs)
                        $newarr[] = array($o->name);
                } else
                        $newarr[] = array();
-                       
+
                for ($y = 0; $y < $oldY; $y++) {
                        $newarr[$x-$startx][] = $arr[$y][$x];
                }
        }
 }
 
-// Force key to upper. 
+// Force key to upper.
 // See also http://www.php.net/manual/en/function.array-change-key-case.php
 function _array_change_key_case($an_array)
 {
@@ -139,7 +139,7 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
                if (count($fieldArray) == 0) return 0;
                $first = true;
                $uSet = '';
-               
+
                if (!is_array($keyCol)) {
                        $keyCol = array($keyCol);
                }
@@ -152,14 +152,14 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
                                $fieldArray[$k] = $v;
                        }
                        if (in_array($k,$keyCol)) continue; // skip UPDATE if is key
-                       
+
                        if ($first) {
-                               $first = false;                 
+                               $first = false;
                                $uSet = "$k=$v";
                        } else
                                $uSet .= ",$k=$v";
                }
-               
+
                $where = false;
                foreach ($keyCol as $v) {
                        if (isset($fieldArray[$v])) {
@@ -167,24 +167,24 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
                                else $where = $v.'='.$fieldArray[$v];
                        }
                }
-               
+
                if ($uSet && $where) {
                        $update = "UPDATE $table SET $uSet WHERE $where";
 
                        $rs = $zthis->Execute($update);
-                       
-                       
+
+
                        if ($rs) {
                                if ($zthis->poorAffectedRows) {
                                /*
-                                The Select count(*) wipes out any errors that the update would have returned. 
+                                The Select count(*) wipes out any errors that the update would have returned.
                                http://phplens.com/lens/lensforum/msgs.php?id=5696
                                */
                                        if ($zthis->ErrorNo()<>0) return 0;
-                                       
+
                                # affected_rows == 0 if update field values identical to old values
-                               # for mysql - which is silly. 
-                       
+                               # for mysql - which is silly.
+
                                        $cnt = $zthis->GetOne("select count(*) from $table where $where");
                                        if ($cnt > 0) return 1; // record already exists
                                } else {
@@ -193,22 +193,22 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
                        } else
                                return 0;
                }
-               
+
        //      print "<p>Error=".$this->ErrorNo().'<p>';
                $first = true;
                foreach($fieldArray as $k => $v) {
                        if ($has_autoinc && in_array($k,$keyCol)) continue; // skip autoinc col
-                       
+
                        if ($first) {
-                               $first = false;                 
+                               $first = false;
                                $iCols = "$k";
                                $iVals = "$v";
                        } else {
                                $iCols .= ",$k";
                                $iVals .= ",$v";
-                       }                               
+                       }
                }
-               $insert = "INSERT INTO $table ($iCols) VALUES ($iVals)"; 
+               $insert = "INSERT INTO $table ($iCols) VALUES ($iVals)";
                $rs = $zthis->Execute($insert);
                return ($rs) ? 2 : 0;
 }
@@ -225,9 +225,9 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
                if (!strpos($name,'[]')) $name .= '[]';
        } else if ($size) $attr = ' size="'.$size.'"';
        else $attr ='';
-       
+
        $s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
-       if ($blank1stItem) 
+       if ($blank1stItem)
                if (is_string($blank1stItem))  {
                        $barr = explode(':',$blank1stItem);
                        if (sizeof($barr) == 1) $barr[] = '';
@@ -236,7 +236,7 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
 
        if ($zthis->FieldCount() > 1) $hasvalue=true;
        else $compareFields0 = true;
-       
+
        $value = '';
     $optgroup = null;
     $firstgroup = true;
@@ -256,12 +256,12 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
                                $zval2 = rtrim(next($zthis->fields));
                }
                $selected = ($compareFields0) ? $zval : $zval2;
-               
+
         $group = '';
                if ($fieldsize > 2) {
             $group = rtrim($zthis->fields[2]);
         }
-/* 
+/*
         if ($optgroup != $group) {
             $optgroup = $group;
             if ($firstgroup) {
@@ -273,25 +273,25 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
             }
                }
 */
-               if ($hasvalue) 
+               if ($hasvalue)
                        $value = " value='".htmlspecialchars($zval2)."'";
-               
+
                if (is_array($defstr))  {
-                       
-                       if (in_array($selected,$defstr)) 
+
+                       if (in_array($selected,$defstr))
                                $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
-                       else 
+                       else
                                $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
                }
                else {
-                       if (strcasecmp($selected,$defstr)==0) 
+                       if (strcasecmp($selected,$defstr)==0)
                                $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
                        else
                                $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
                }
                $zthis->MoveNext();
        } // while
-       
+
     // closing last optgroup
     if($optgroup != null) {
         $s .= "\n</optgroup>";
@@ -311,9 +311,9 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
                if (!strpos($name,'[]')) $name .= '[]';
        } else if ($size) $attr = ' size="'.$size.'"';
        else $attr ='';
-       
+
        $s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
-       if ($blank1stItem) 
+       if ($blank1stItem)
                if (is_string($blank1stItem))  {
                        $barr = explode(':',$blank1stItem);
                        if (sizeof($barr) == 1) $barr[] = '';
@@ -322,7 +322,7 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
 
        if ($zthis->FieldCount() > 1) $hasvalue=true;
        else $compareFields0 = true;
-       
+
        $value = '';
     $optgroup = null;
     $firstgroup = true;
@@ -342,12 +342,12 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
                                $zval2 = rtrim(next($zthis->fields));
                }
                $selected = ($compareFields0) ? $zval : $zval2;
-               
+
         $group = '';
                if (isset($zthis->fields[2])) {
             $group = rtrim($zthis->fields[2]);
         }
+
         if ($optgroup != $group) {
             $optgroup = $group;
             if ($firstgroup) {
@@ -358,26 +358,26 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
                 $s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
             }
                }
-       
-               if ($hasvalue) 
+
+               if ($hasvalue)
                        $value = " value='".htmlspecialchars($zval2)."'";
-               
+
                if (is_array($defstr))  {
-                       
-                       if (in_array($selected,$defstr)) 
+
+                       if (in_array($selected,$defstr))
                                $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
-                       else 
+                       else
                                $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
                }
                else {
-                       if (strcasecmp($selected,$defstr)==0) 
+                       if (strcasecmp($selected,$defstr)==0)
                                $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
                        else
                                $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
                }
                $zthis->MoveNext();
        } // while
-       
+
     // closing last optgroup
     if($optgroup != null) {
         $s .= "\n</optgroup>";
@@ -389,34 +389,34 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
 /*
        Count the number of records this sql statement will return by using
        query rewriting heuristics...
-       
+
        Does not work with UNIONs, except with postgresql and oracle.
-       
+
        Usage:
-       
+
        $conn->Connect(...);
        $cnt = _adodb_getcount($conn, $sql);
-       
+
 */
-function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0) 
+function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
 {
        $qryRecs = 0;
-       
-        if (!empty($zthis->_nestedSQL) || preg_match("/^\s*SELECT\s+DISTINCT/is", $sql) || 
-               preg_match('/\s+GROUP\s+BY\s+/is',$sql) || 
+
+        if (!empty($zthis->_nestedSQL) || preg_match("/^\s*SELECT\s+DISTINCT/is", $sql) ||
+               preg_match('/\s+GROUP\s+BY\s+/is',$sql) ||
                preg_match('/\s+UNION\s+/is',$sql)) {
-               
+
                $rewritesql = adodb_strip_order_by($sql);
-               
+
                // ok, has SELECT DISTINCT or GROUP BY so see if we can use a table alias
                // but this is only supported by oracle and postgresql...
                if ($zthis->dataProvider == 'oci8') {
                        // Allow Oracle hints to be used for query optimization, Chris Wrye
                        if (preg_match('#/\\*+.*?\\*\\/#', $sql, $hint)) {
-                               $rewritesql = "SELECT ".$hint[0]." COUNT(*) FROM (".$rewritesql.")"; 
+                               $rewritesql = "SELECT ".$hint[0]." COUNT(*) FROM (".$rewritesql.")";
                        } else
-                               $rewritesql = "SELECT COUNT(*) FROM (".$rewritesql.")"; 
-                       
+                               $rewritesql = "SELECT COUNT(*) FROM (".$rewritesql.")";
+
                } else if (strncmp($zthis->databaseType,'postgres',8) == 0 || strncmp($zthis->databaseType,'mysql',5) == 0)  {
                        $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_";
                } else {
@@ -426,20 +426,20 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
                // now replace SELECT ... FROM with SELECT COUNT(*) FROM
                $rewritesql = preg_replace(
                                        '/^\s*SELECT\s.*\s+FROM\s/Uis','SELECT COUNT(*) FROM ',$sql);
-               // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails 
+               // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails
                // with mssql, access and postgresql. Also a good speedup optimization - skips sorting!
                // also see http://phplens.com/lens/lensforum/msgs.php?id=12752
                $rewritesql = adodb_strip_order_by($rewritesql);
        }
-       
+
        if (isset($rewritesql) && $rewritesql != $sql) {
                if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
-                
+
                if ($secs2cache) {
                        // we only use half the time of secs2cache because the count can quickly
                        // become inaccurate if new records are added
                        $qryRecs = $zthis->CacheGetOne($secs2cache/2,$rewritesql,$inputarr);
-                       
+
                } else {
                        $qryRecs = $zthis->GetOne($rewritesql,$inputarr);
                }
@@ -447,20 +447,20 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
        }
        //--------------------------------------------
        // query rewrite failed - so try slower way...
-       
-       
+
+
        // strip off unneeded ORDER BY if no UNION
        if (preg_match('/\s*UNION\s*/is', $sql)) $rewritesql = $sql;
-       else $rewritesql = $rewritesql = adodb_strip_order_by($sql); 
-       
+       else $rewritesql = $rewritesql = adodb_strip_order_by($sql);
+
        if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
-               
+
        $rstest = $zthis->Execute($rewritesql,$inputarr);
        if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
-       
+
        if ($rstest) {
                        $qryRecs = $rstest->RecordCount();
-               if ($qryRecs == -1) { 
+               if ($qryRecs == -1) {
                global $ADODB_EXTENSION;
                // some databases will return -1 on MoveLast() - change to MoveNext()
                        if ($ADODB_EXTENSION) {
@@ -483,53 +483,53 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
 /*
        Code originally from "Cornel G" <conyg@fx.ro>
 
-       This code might not work with SQL that has UNION in it  
-       
+       This code might not work with SQL that has UNION in it
+
        Also if you are using CachePageExecute(), there is a strong possibility that
        data will get out of synch. use CachePageExecute() only with tables that
        rarely change.
 */
-function _adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, 
-                                               $inputarr=false, $secs2cache=0) 
+function _adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page,
+                                               $inputarr=false, $secs2cache=0)
 {
        $atfirstpage = false;
        $atlastpage = false;
        $lastpageno=1;
 
-       // If an invalid nrows is supplied, 
+       // If an invalid nrows is supplied,
        // we assume a default value of 10 rows per page
        if (!isset($nrows) || $nrows <= 0) $nrows = 10;
 
        $qryRecs = false; //count records for no offset
-       
+
        $qryRecs = _adodb_getcount($zthis,$sql,$inputarr,$secs2cache);
        $lastpageno = (int) ceil($qryRecs / $nrows);
        $zthis->_maxRecordCount = $qryRecs;
-       
 
 
-       // ***** Here we check whether $page is the last page or 
-       // whether we are trying to retrieve 
+
+       // ***** Here we check whether $page is the last page or
+       // whether we are trying to retrieve
        // a page number greater than the last page number.
        if ($page >= $lastpageno) {
                $page = $lastpageno;
                $atlastpage = true;
        }
-       
+
        // If page number <= 1, then we are at the first page
-       if (empty($page) || $page <= 1) {       
+       if (empty($page) || $page <= 1) {
                $page = 1;
                $atfirstpage = true;
        }
-       
+
        // We get the data we want
        $offset = $nrows * ($page-1);
-       if ($secs2cache > 0) 
+       if ($secs2cache > 0)
                $rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
-       else 
+       else
                $rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
 
-       
+
        // Before returning the RecordSet, we set the pagination properties we need
        if ($rsreturn) {
                $rsreturn->_maxRecordCount = $qryRecs;
@@ -543,19 +543,19 @@ function _adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page,
 }
 
 // Iv├ín Oliva version
-function _adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0) 
+function _adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0)
 {
 
        $atfirstpage = false;
        $atlastpage = false;
-       
+
        if (!isset($page) || $page <= 1) {      // If page number <= 1, then we are at the first page
                $page = 1;
                $atfirstpage = true;
        }
        if ($nrows <= 0) $nrows = 10;   // If an invalid nrows is supplied, we assume a default value of 10 rows per page
-       
-       // ***** Here we check whether $page is the last page or whether we are trying to retrieve a page number greater than 
+
+       // ***** Here we check whether $page is the last page or whether we are trying to retrieve a page number greater than
        // the last page number.
        $pagecounter = $page + 1;
        $pagecounteroffset = ($pagecounter * $nrows) - $nrows;
@@ -577,12 +577,12 @@ function _adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr
                if ($page == 1) $atfirstpage = true;    // We have to do this again in case the last page is the same as the first
                        //... page, that is, the recordset has only 1 page.
        }
-       
+
        // We get the data we want
        $offset = $nrows * ($page-1);
        if ($secs2cache > 0) $rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
        else $rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
-       
+
        // Before returning the RecordSet, we set the pagination properties we need
        if ($rsreturn) {
                $rsreturn->rowsPerPage = $nrows;
@@ -601,13 +601,13 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                        printf(ADODB_BAD_RS,'GetUpdateSQL');
                        return false;
                }
-       
+
                $fieldUpdatedCount = 0;
                $arrFields = _array_change_key_case($arrFields);
 
                $hasnumeric = isset($rs->fields[0]);
                $setFields = '';
-               
+
                // Loop through all of the fields in the recordset
                for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) {
                        // Get the field from the recordset
@@ -617,19 +617,19 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                        // of the fields passed in then process.
                        $upperfname = strtoupper($field->name);
                        if (adodb_key_exists($upperfname,$arrFields,$force)) {
-                               
+
                                // If the existing field value in the recordset
                                // is different from the value passed in then
                                // go ahead and append the field name and new value to
                                // the update query.
-                               
+
                                if ($hasnumeric) $val = $rs->fields[$i];
                                else if (isset($rs->fields[$upperfname])) $val = $rs->fields[$upperfname];
                                else if (isset($rs->fields[$field->name])) $val =  $rs->fields[$field->name];
                                else if (isset($rs->fields[strtolower($upperfname)])) $val =  $rs->fields[strtolower($upperfname)];
                                else $val = '';
-                               
-                       
+
+
                                if ($forceUpdate || strcmp($val, $arrFields[$upperfname])) {
                                        // Set the counter for the number of fields that will be updated.
                                        $fieldUpdatedCount++;
@@ -637,18 +637,18 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                                        // Based on the datatype of the field
                                        // Format the value properly for the database
                                        $type = $rs->MetaType($field->type);
-                                               
+
 
                                        if ($type == 'null') {
                                                $type = 'C';
                                        }
-                                       
+
                                        if ((strpos($upperfname,' ') !== false) || ($ADODB_QUOTE_FIELDNAMES))
                                                $fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote;
                                        else
                                                $fnameq = $upperfname;
-                                       
-                                       
+
+
                 // is_null requires php 4.0.4
                 //********************************************************//
                 if (is_null($arrFields[$upperfname])
@@ -666,7 +666,7 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                             //Set null
                             $setFields .= $field->name . " = null, ";
                         break;
-                                                       
+
                         case 2:
                             //Set empty
                             $arrFields[$upperfname] = "";
@@ -685,7 +685,7 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                 //********************************************************//
                 } else {
                                                //we do this so each driver can customize the sql for
-                                               //DB specific column types. 
+                                               //DB specific column types.
                                                //Oracle needs BLOB types to be handled with a returning clause
                                                //postgres has special needs as well
                                                $setFields .= _adodb_column_sql($zthis, 'U', $type, $upperfname, $fnameq,
@@ -706,7 +706,7 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                        // Get the full where clause excluding the word "WHERE" from
                        // the existing query.
                        preg_match('/\sWHERE\s(.*)/is', $rs->sql, $whereClause);
-                       
+
                        $discard = false;
                        // not a good hack, improvements?
                        if ($whereClause) {
@@ -717,12 +717,12 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
                                else preg_match('/\s.*(\) WHERE .*)/is', $whereClause[1], $discard); # see http://sourceforge.net/tracker/index.php?func=detail&aid=1379638&group_id=42718&atid=433976
                        } else
                                $whereClause = array(false,false);
-                               
+
                        if ($discard)
                                $whereClause[1] = substr($whereClause[1], 0, strlen($whereClause[1]) - strlen($discard[1]));
-                       
+
                        $sql = 'UPDATE '.$tableName.' SET '.substr($setFields, 0, -2);
-                       if (strlen($whereClause[1]) > 0) 
+                       if (strlen($whereClause[1]) > 0)
                                $sql .= ' WHERE '.$whereClause[1];
 
                        return $sql;
@@ -749,8 +749,8 @@ function adodb_key_exists($key, &$arr,$force=2)
  * There is a special case of this function for the oci8 driver.
  * The proper way to handle an insert w/ a blob in oracle requires
  * a returning clause with bind variables and a descriptor blob.
- * 
- * 
+ *
+ *
  */
 function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false,$force=2)
 {
@@ -765,19 +765,19 @@ static $cacheCols;
        $recordSet = null;
        $arrFields = _array_change_key_case($arrFields);
        $fieldInsertedCount = 0;
-       
+
        if (is_string($rs)) {
                //ok we have a table name
                //try and get the column info ourself.
-               $tableName = $rs;                       
-       
+               $tableName = $rs;
+
                //we need an object for the recordSet
                //because we have to call MetaType.
                //php can't do a $rsclass::MetaType()
                $rsclass = $zthis->rsPrefix.$zthis->databaseType;
                $recordSet = new $rsclass(-1,$zthis->fetchMode);
                $recordSet->connection = $zthis;
-               
+
                if (is_string($cacheRS) && $cacheRS == $rs) {
                        $columns = $cacheCols;
                } else {
@@ -789,21 +789,21 @@ static $cacheCols;
                if (isset($rs->insertSig) && is_integer($cacheRS) && $cacheRS == $rs->insertSig) {
                        $columns = $cacheCols;
                } else {
-                       for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) 
+                       for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++)
                                $columns[] = $rs->FetchField($i);
                        $cacheRS = $cacheSig;
                        $cacheCols = $columns;
                        $rs->insertSig = $cacheSig++;
                }
                $recordSet = $rs;
-       
+
        } else {
                printf(ADODB_BAD_RS,'GetInsertSQL');
                return false;
        }
 
        // Loop through all of the fields in the recordset
-       foreach( $columns as $field ) { 
+       foreach( $columns as $field ) {
                $upperfname = strtoupper($field->name);
                if (adodb_key_exists($upperfname,$arrFields,$force)) {
                        $bad = false;
@@ -811,9 +811,9 @@ static $cacheCols;
                                $fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote;
                        else
                                $fnameq = $upperfname;
-                       
+
                        $type = $recordSet->MetaType($field->type);
-                       
+
             /********************************************************/
             if (is_null($arrFields[$upperfname])
                 || (empty($arrFields[$upperfname]) && strlen($arrFields[$upperfname]) == 0)
@@ -825,11 +825,11 @@ static $cacheCols;
                         case 0: // we must always set null if missing
                                                        $bad = true;
                                                        break;
-                                                       
+
                         case 1:
                             $values  .= "null, ";
                         break;
-               
+
                         case 2:
                             //Set empty
                             $arrFields[$upperfname] = "";
@@ -839,7 +839,7 @@ static $cacheCols;
                                                default:
                         case 3:
                             //Set the value that was given in array, so you can give both null and empty values
-                                                       if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === $zthis->null2null) { 
+                                                       if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === $zthis->null2null) {
                                                                $values  .= "null, ";
                                                        } else {
                                        $values .= _adodb_column_sql($zthis, 'I', $type, $upperfname, $fnameq, $arrFields, $magicq);
@@ -850,18 +850,18 @@ static $cacheCols;
             /*********************************************************/
                        } else {
                                //we do this so each driver can customize the sql for
-                               //DB specific column types. 
+                               //DB specific column types.
                                //Oracle needs BLOB types to be handled with a returning clause
                                //postgres has special needs as well
                                $values .= _adodb_column_sql($zthis, 'I', $type, $upperfname, $fnameq,
                                                                                           $arrFields, $magicq);
                        }
-                       
+
                        if ($bad) continue;
                        // Set the counter for the number of fields that will be inserted.
                        $fieldInsertedCount++;
-                       
-                       
+
+
                        // Get the name of the fields to insert
                        $fields .= $fnameq . ", ";
                }
@@ -870,15 +870,15 @@ static $cacheCols;
 
        // If there were any inserted fields then build the rest of the insert query.
        if ($fieldInsertedCount <= 0)  return false;
-       
+
        // Get the table name from the existing query.
        if (!$tableName) {
                if (!empty($rs->tableName)) $tableName = $rs->tableName;
                else if (preg_match("/FROM\s+".ADODB_TABLE_REGEX."/is", $rs->sql, $tableName))
                        $tableName = $tableName[1];
-               else 
+               else
                        return false;
-       }               
+       }
 
        // Strip off the comma and space on the end of both the fields
        // and their values.
@@ -895,20 +895,20 @@ static $cacheCols;
  * the update/sql which is generated by GetInsertSQL and GetUpdateSQL.
  * It handles the string construction of 1 column -> sql string based on
  * the column type.  We want to do 'safe' handling of BLOBs
- * 
+ *
  * @param string the type of sql we are trying to create
- *                'I' or 'U'. 
- * @param string column data type from the db::MetaType() method  
+ *                'I' or 'U'.
+ * @param string column data type from the db::MetaType() method
  * @param string the column name
  * @param array the column value
- * 
+ *
  * @return string
- * 
+ *
  */
-function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFields, $magicq) 
+function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFields, $magicq)
 {
     $sql = '';
-    
+
     // Based on the datatype of the field
     // Format the value properly for the database
     switch($type) {
@@ -916,7 +916,7 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFie
         //in order to handle Blobs correctly, we need
         //to do some magic for Oracle
 
-        //we need to create a new descriptor to handle 
+        //we need to create a new descriptor to handle
         //this properly
         if (!empty($zthis->hasReturningInto)) {
             if ($action == 'I') {
@@ -933,7 +933,7 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFie
                 $sql = 'empty_blob(), ';
             } else {
                 $sql = $fnameq. '=empty_blob(), ';
-            }            
+            }
         } else {
             //this is to maintain compatibility
             //with older adodb versions.
@@ -949,7 +949,7 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFie
         //to avoid conflicts w/ dupes.
        if (!empty($zthis->hasReturningInto)) {
             if ($action == 'I') {
-                $sql = ':xx'.$fname.'xx, ';                
+                $sql = ':xx'.$fname.'xx, ';
             } else {
                 $sql = $fnameq.'=:xx'.$fname.'xx, ';
             }
@@ -961,18 +961,18 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFie
             //this is to maintain compatibility
             //with older adodb versions.
             $sql = _adodb_column_sql($zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq,false);
-        }            
+        }
         break;
-        
+
     default:
         $sql = _adodb_column_sql($zthis, $action, $type, $fname, $fnameq,  $arrFields, $magicq,false);
         break;
     }
-    
+
     return $sql;
-}    
-       
-function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq, $recurse=true) 
+}
+
+function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq, $recurse=true)
 {
 
        if ($recurse) {
@@ -982,10 +982,10 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields,
                        break;
                case 'oci8':
                        return _adodb_column_sql_oci8($zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq);
-                       
+
                }
        }
-               
+
        switch($type) {
                case "C":
                case "X":
@@ -1000,7 +1000,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields,
                case "T":
                        $val = $zthis->DBTimeStamp($arrFields[$fname]);
                        break;
-                       
+
                case "N":
                    $val = $arrFields[$fname];
                        if (!is_numeric($val)) $val = str_replace(',', '.', (float)$val);
@@ -1019,10 +1019,10 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields,
        }
 
        if ($action == 'I') return $val . ", ";
-       
-       
+
+
        return $fnameq . "=" . $val  . ", ";
-       
+
 }
 
 
@@ -1045,7 +1045,7 @@ function _adodb_debug_execute(&$zthis, $sql, $inputarr)
        */
        // check if running from browser or command-line
        $inBrowser = isset($_SERVER['HTTP_USER_AGENT']);
-       
+
        $dbt = $zthis->databaseType;
        if (isset($zthis->dsnType)) $dbt .= '-'.$zthis->dsnType;
        if ($inBrowser) {
@@ -1063,31 +1063,31 @@ function _adodb_debug_execute(&$zthis, $sql, $inputarr)
        }
 
        $qID = $zthis->_query($sql,$inputarr);
-       
-       /* 
+
+       /*
                Alexios Fakios notes that ErrorMsg() must be called before ErrorNo() for mssql
                because ErrorNo() calls Execute('SELECT @ERROR'), causing recursion
        */
-       if ($zthis->databaseType == 'mssql') { 
+       if ($zthis->databaseType == 'mssql') {
        // ErrorNo is a slow function call in mssql, and not reliable in PHP 4.0.6
-       
+
                if($emsg = $zthis->ErrorMsg()) {
                        if ($err = $zthis->ErrorNo()) {
-                               if ($zthis->debug === -99) 
+                               if ($zthis->debug === -99)
                                        ADOConnection::outp( "<hr>\n($dbt): ".htmlspecialchars($sqlTxt)." &nbsp; $ss\n<hr>\n",false);
-               
+
                                ADOConnection::outp($err.': '.$emsg);
                        }
                }
        } else if (!$qID) {
-       
-               if ($zthis->debug === -99) 
+
+               if ($zthis->debug === -99)
                                if ($inBrowser) ADOConnection::outp( "<hr>\n($dbt): ".htmlspecialchars($sqlTxt)." &nbsp; $ss\n<hr>\n",false);
                                else ADOConnection::outp("-----<hr>\n($dbt): ".$sqlTxt."$ss\n-----<hr>\n",false);
-                               
+
                ADOConnection::outp($zthis->ErrorNo() .': '. $zthis->ErrorMsg());
        }
-       
+
        if ($zthis->debug === 99) _adodb_backtrace(true,9999,2);
        return $qID;
 }
@@ -1096,27 +1096,27 @@ function _adodb_debug_execute(&$zthis, $sql, $inputarr)
 function _adodb_backtrace($printOrArr=true,$levels=9999,$skippy=0,$ishtml=null)
 {
        if (!function_exists('debug_backtrace')) return '';
-        
+
        if ($ishtml === null) $html =  (isset($_SERVER['HTTP_USER_AGENT']));
        else $html = $ishtml;
-       
+
        $fmt =  ($html) ? "</font><font color=#808080 size=-1> %% line %4d, file: <a href=\"file:/%s\">%s</a></font>" : "%% line %4d, file: %s";
 
        $MAXSTRLEN = 128;
 
        $s = ($html) ? '<pre align=left>' : '';
-       
+
        if (is_array($printOrArr)) $traceArr = $printOrArr;
        else $traceArr = debug_backtrace();
        array_shift($traceArr);
        array_shift($traceArr);
        $tabs = sizeof($traceArr)-2;
-       
+
        foreach ($traceArr as $arr) {
                if ($skippy) {$skippy -= 1; continue;}
                $levels -= 1;
                if ($levels < 0) break;
-               
+
                $args = array();
                for ($i=0; $i < $tabs; $i++) $s .=  ($html) ? ' &nbsp; ' : "\t";
                $tabs -= 1;
@@ -1136,30 +1136,30 @@ function _adodb_backtrace($printOrArr=true,$levels=9999,$skippy=0,$ishtml=null)
                        }
                }
                $s .= $arr['function'].'('.implode(', ',$args).')';
-               
-               
+
+
                $s .= @sprintf($fmt, $arr['line'],$arr['file'],basename($arr['file']));
-                       
+
                $s .= "\n";
-       }       
+       }
        if ($html) $s .= '</pre>';
        if ($printOrArr) print $s;
-       
+
        return $s;
 }
 /*
-function _adodb_find_from($sql) 
+function _adodb_find_from($sql)
 {
 
        $sql = str_replace(array("\n","\r"), ' ', $sql);
        $charCount = strlen($sql);
-       
+
        $inString = false;
        $quote = '';
        $parentheseCount = 0;
        $prevChars = '';
        $nextChars = '';
-       
+
 
        for($i = 0; $i < $charCount; $i++) {
 
index dad4c38..b7844f0 100644 (file)
@@ -9,18 +9,18 @@ $ADODB_INCLUDED_MEMCACHE = 1;
 global $ADODB_INCLUDED_CSV;
 if (empty($ADODB_INCLUDED_CSV)) include(ADODB_DIR.'/adodb-csvlib.inc.php');
 
-/* 
+/*
 
   V5.06 16 Oct 2008  (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
-  Released under both BSD license and Lesser GPL library license. 
-  Whenever there is any discrepancy between the two licenses, 
-  the BSD license will take precedence. See License.txt. 
+  Released under both BSD license and Lesser GPL library license.
+  Whenever there is any discrepancy between the two licenses,
+  the BSD license will take precedence. See License.txt.
   Set tabs to 4 for best viewing.
-  
+
   Latest version is available at http://adodb.sourceforge.net
 
 Usage:
-  
+
 $db = NewADOConnection($driver);
 $db->memCache = true; /// should we use memCache instead of caching in files
 $db->memCacheHost = array($ip1, $ip2, $ip3);
@@ -29,32 +29,32 @@ $db->memCacheCompress = false; /// Use 'true' to store the item compressed (uses
 
 $db->Connect(...);
 $db->CacheExecute($sql);
-  
+
   Note the memcache class is shared by all connections, is created during the first call to Connect/PConnect.
-  
+
   Class instance is stored in $ADODB_CACHE
 */
 
        class ADODB_Cache_MemCache {
                var $createdir = false; // create caching directory structure?
-               
+
                //-----------------------------
                // memcache specific variables
-               
+
                var $hosts;     // array of hosts
                var $port = 11211;
                var $compress = false; // memcache compression with zlib
-               
+
                var $_connected = false;
                var $_memcache = false;
-               
+
                function ADODB_Cache_MemCache(&$obj)
                {
                        $this->hosts = $obj->memCacheHost;
                        $this->port = $obj->memCachePort;
                        $this->compress = $obj->memCacheCompress;
                }
-               
+
                // implement as lazy connection. The connection only occurs on CacheExecute call
                function connect(&$err)
                {
@@ -64,9 +64,9 @@ $db->CacheExecute($sql);
                        }
 
                        $memcache = new MemCache;
-                       
+
                        if (!is_array($this->hosts)) $this->hosts = array($this->hosts);
-               
+
                        $failcnt = 0;
                        foreach($this->hosts as $host) {
                                if (!@$memcache->addServer($host,$this->port,true)) {
@@ -81,7 +81,7 @@ $db->CacheExecute($sql);
                        $this->_memcache = $memcache;
                        return true;
                }
-               
+
                // returns true or false. true if successful save
                function writecache($filename, $contents, $debug, $secs2cache)
                {
@@ -90,43 +90,43 @@ $db->CacheExecute($sql);
                                if (!$this->connect($err) && $debug) ADOConnection::outp($err);
                        }
                        if (!$this->_memcache) return false;
-                       
+
                        if (!$this->_memcache->set($filename, $contents, $this->compress, $secs2cache)) {
                                if ($debug) ADOConnection::outp(" Failed to save data at the memcached server!<br>\n");
                                return false;
                        }
-                       
+
                        return true;
                }
-               
+
                // returns a recordset
                function readcache($filename, &$err, $secs2cache, $rsClass)
                {
                        $false = false;
                        if (!$this->_connected) $this->connect($err);
                        if (!$this->_memcache) return $false;
-                       
+
                        $rs = $this->_memcache->get($filename);
                        if (!$rs) {
                                $err = 'Item with such key doesn\'t exists on the memcached server.';
                                return $false;
                        }
-                       
+
                        // hack, should actually use _csv2rs
                        $rs = explode("\n", $rs);
             unset($rs[0]);
             $rs = join("\n", $rs);
                        $rs = unserialize($rs);
                        if (! is_object($rs)) {
-                               $err = 'Unable to unserialize $rs';             
+                               $err = 'Unable to unserialize $rs';
                                return $false;
                        }
                        if ($rs->timeCreated == 0) return $rs; // apparently have been reports that timeCreated was set to 0 somewhere
-                       
+
                        $tdiff = intval($rs->timeCreated+$secs2cache - time());
                        if ($tdiff <= 2) {
                                switch($tdiff) {
-                                       case 2: 
+                                       case 2:
                                                if ((rand() & 15) == 0) {
                                                        $err = "Timeout 2";
                                                        return $false;
@@ -138,14 +138,14 @@ $db->CacheExecute($sql);
                                                        return $false;
                                                }
                                                break;
-                                       default: 
+                                       default:
                                                $err = "Timeout 0";
                                                return $false;
                                }
                        }
                        return $rs;
                }
-               
+
                function flushall($debug=false)
                {
                        if (!$this->_connected) {
@@ -153,35 +153,35 @@ $db->CacheExecute($sql);
                                if (!$this->connect($err) && $debug) ADOConnection::outp($err);
                        }
                        if (!$this->_memcache) return false;
-                       
+
                        $del = $this->_memcache->flush();
-                       
-                       if ($debug) 
+
+                       if ($debug)
                                if (!$del) ADOConnection::outp("flushall: failed!<br>\n");
                                else ADOConnection::outp("flushall: succeeded!<br>\n");
-                               
+
                        return $del;
                }
-               
+
                function flushcache($filename, $debug=false)
                {
                        if (!$this->_connected) {
                                $err = '';
-                               if (!$this->connect($err) && $debug) ADOConnection::outp($err); 
-                       } 
+                               if (!$this->connect($err) && $debug) ADOConnection::outp($err);
+                       }
                        if (!$this->_memcache) return false;
-  
+
                        $del = $this->_memcache->delete($filename);
-                       
-                       if ($debug) 
+
+                       if ($debug)
                                if (!$del) ADOConnection::outp("flushcache: $key entry doesn't exist on memcached server!<br>\n");
                                else ADOConnection::outp("flushcache: $key entry flushed from memcached server!<br>\n");
-                               
+
                        return $del;
                }
-               
+
                // not used for memcache
-               function createdir($dir, $hash) 
+               function createdir($dir, $hash)
                {
                        return true;
                }
index cbf2945..51099e7 100644 (file)
@@ -2,21 +2,21 @@
 
 /*
        V5.10 10 Nov 2009   (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
-         Released under both BSD license and Lesser GPL library license. 
-         Whenever there is any discrepancy between the two licenses, 
-         the BSD license will take precedence. 
+         Released under both BSD license and Lesser GPL library license.
+         Whenever there is any discrepancy between the two licenses,
+         the BSD license will take precedence.
          Set tabs to 4 for best viewing.
 
-       This class provides recordset pagination with 
-       First/Prev/Next/Last links. 
-       
+       This class provides recordset pagination with
+       First/Prev/Next/Last links.
+
        Feel free to modify this class for your own use as
-       it is very basic. To learn how to use it, see the 
+       it is very basic. To learn how to use it, see the
        example in adodb/tests/testpaging.php.
-       
+
        "Pablo Costa" <pablo@cbsp.com.br> implemented Render_PageLinks().
-       
-       Please note, this class is entirely unsupported, 
+
+       Please note, this class is entirely unsupported,
        and no free support requests except for bug reports
        will be entertained by the author.
 
@@ -29,10 +29,10 @@ class ADODB_Pager {
        var $curr_page; // current page number before Render() called, calculated in constructor
        var $rows;              // number of rows per page
     var $linksPerPage=10; // number of links per page in navigation bar
-    var $showPageLinks; 
+    var $showPageLinks;
 
        var $gridAttributes = 'width=100% border=1 bgcolor=white';
-       
+
        // Localize text strings here
        var $first = '<code>|&lt;</code>';
        var $prev = '<code>&lt;&lt;</code>';
@@ -45,39 +45,39 @@ class ADODB_Pager {
        var $page = 'Page';
        var $linkSelectedColor = 'red';
        var $cache = 0;  #secs to cache with CachePageExecute()
-       
+
        //----------------------------------------------
        // constructor
        //
        // $db  adodb connection object
        // $sql sql statement
-       // $id  optional id to identify which pager, 
-       //              if you have multiple on 1 page. 
+       // $id  optional id to identify which pager,
+       //              if you have multiple on 1 page.
        //              $id should be only be [a-z0-9]*
        //
        function ADODB_Pager(&$db,$sql,$id = 'adodb', $showPageLinks = false)
        {
        global $PHP_SELF;
-       
+
                $curr_page = $id.'_curr_page';
                if (!empty($PHP_SELF)) $PHP_SELF = htmlspecialchars($_SERVER['PHP_SELF']); // htmlspecialchars() to prevent XSS attacks
-               
+
                $this->sql = $sql;
                $this->id = $id;
                $this->db = $db;
                $this->showPageLinks = $showPageLinks;
-               
-               $next_page = $id.'_next_page';  
-               
+
+               $next_page = $id.'_next_page';
+
                if (isset($_GET[$next_page])) {
                        $_SESSION[$curr_page] = (integer) $_GET[$next_page];
                }
                if (empty($_SESSION[$curr_page])) $_SESSION[$curr_page] = 1; ## at first page
-               
+
                $this->curr_page = $_SESSION[$curr_page];
-               
+
        }
-       
+
        //---------------------------
        // Display link to first page
        function Render_First($anchor=true)
@@ -85,51 +85,51 @@ class ADODB_Pager {
        global $PHP_SELF;
                if ($anchor) {
        ?>
-               <a href="<?php echo $PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a> &nbsp; 
+               <a href="<?php echo $PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a> &nbsp;
        <?php
                } else {
                        print "$this->first &nbsp; ";
                }
        }
-       
+
        //--------------------------
        // Display link to next page
        function render_next($anchor=true)
        {
        global $PHP_SELF;
-       
+
                if ($anchor) {
                ?>
-               <a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php echo $this->next;?></a> &nbsp; 
+               <a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php echo $this->next;?></a> &nbsp;
                <?php
                } else {
                        print "$this->next &nbsp; ";
                }
        }
-       
+
        //------------------
        // Link to last page
-       // 
+       //
        // for better performance with large recordsets, you can set
        // $this->db->pageExecuteCountRows = false, which disables
        // last page counting.
        function render_last($anchor=true)
        {
        global $PHP_SELF;
-       
+
                if (!$this->db->pageExecuteCountRows) return;
-               
+
                if ($anchor) {
                ?>
-                       <a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo $this->last;?></a> &nbsp; 
+                       <a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo $this->last;?></a> &nbsp;
                <?php
                } else {
                        print "$this->last &nbsp; ";
                }
        }
-       
+
        //---------------------------------------------------
-       // original code by "Pablo Costa" <pablo@cbsp.com.br> 
+       // original code by "Pablo Costa" <pablo@cbsp.com.br>
         function render_pagelinks()
         {
         global $PHP_SELF;
@@ -146,21 +146,21 @@ class ADODB_Pager {
             $end = $start+$linksperpage-1;
                        $link = $this->id . "_next_page";
             if($end > $pages) $end = $pages;
-                       
-                       
+
+
                        if ($this->startLinks && $start > 1) {
                                $pos = $start - 1;
                                $numbers .= "<a href=$PHP_SELF?$link=$pos>$this->startLinks</a>  ";
-            } 
-                       
+            }
+
                        for($i=$start; $i <= $end; $i++) {
                 if ($this->rs->AbsolutePage() == $i)
                     $numbers .= "<font color=$this->linkSelectedColor><strong>$i</strong></font>  ";
-                else 
+                else
                      $numbers .= "<a href=$PHP_SELF?$link=$i>$i</a>  ";
-            
+
             }
-                       if ($this->moreLinks && $end < $pages) 
+                       if ($this->moreLinks && $end < $pages)
                                $numbers .= "<a href=$PHP_SELF?$link=$i>$this->moreLinks</a>  ";
             print $numbers . ' &nbsp; ';
         }
@@ -170,13 +170,13 @@ class ADODB_Pager {
        global $PHP_SELF;
                if ($anchor) {
        ?>
-               <a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php echo $this->prev;?></a> &nbsp; 
-       <?php 
+               <a href="<?php echo $PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php echo $this->prev;?></a> &nbsp;
+       <?php
                } else {
                        print "$this->prev &nbsp; ";
                }
        }
-       
+
        //--------------------------------------------------------
        // Simply rendering of grid. You should override this for
        // better control over the format of the grid
@@ -193,7 +193,7 @@ class ADODB_Pager {
                ob_end_clean();
                return $s;
        }
-       
+
        //-------------------------------------------------------
        // Navigation bar
        //
@@ -222,7 +222,7 @@ class ADODB_Pager {
                ob_end_clean();
                return $s;
        }
-       
+
        //-------------------
        // This is the footer
        function RenderPageCount()
@@ -233,17 +233,17 @@ class ADODB_Pager {
                if ($this->curr_page > $lastPage) $this->curr_page = 1;
                return "<font size=-1>$this->page ".$this->curr_page."/".$lastPage."</font>";
        }
-       
+
        //-----------------------------------
        // Call this class to draw everything.
        function Render($rows=10)
        {
        global $ADODB_COUNTRECS;
-       
+
                $this->rows = $rows;
-               
+
                if ($this->db->dataProvider == 'informix') $this->db->cursorType = IFX_SCROLL;
-               
+
                $savec = $ADODB_COUNTRECS;
                if ($this->db->pageExecuteCountRows) $ADODB_COUNTRECS = true;
                if ($this->cache)
@@ -251,27 +251,27 @@ class ADODB_Pager {
                else
                        $rs = $this->db->PageExecute($this->sql,$rows,$this->curr_page);
                $ADODB_COUNTRECS = $savec;
-               
+
                $this->rs = $rs;
                if (!$rs) {
                        print "<h3>Query failed: $this->sql</h3>";
                        return;
                }
-               
-               if (!$rs->EOF && (!$rs->AtFirstPage() || !$rs->AtLastPage())) 
+
+               if (!$rs->EOF && (!$rs->AtFirstPage() || !$rs->AtLastPage()))
                        $header = $this->RenderNav();
                else
                        $header = "&nbsp;";
-               
+
                $grid = $this->RenderGrid();
                $footer = $this->RenderPageCount();
-               
+
                $this->RenderLayout($header,$grid,$footer);
-               
+
                $rs->Close();
                $this->rs = false;
        }
-       
+
        //------------------------------------------------------
        // override this to control overall layout and formating
        function RenderLayout($header,$grid,$footer,$attributes='border=1 bgcolor=beige')
index 6563704..7e196e2 100644 (file)
@@ -1,12 +1,12 @@
 <?php
-/** 
+/**
  * @version V5.06 16 Oct 2008  (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
- * Released under both BSD license and Lesser GPL library license. 
- * Whenever there is any discrepancy between the two licenses, 
- * the BSD license will take precedence. 
+ * Released under both BSD license and Lesser GPL library license.
+ * Whenever there is any discrepancy between the two licenses,
+ * the BSD license will take precedence.
  *
  * Set tabs to 4 for best viewing.
- * 
+ *
  * PEAR DB Emulation Layer for ADODB.
  *
  * The following code is modelled on PEAR DB code by Stig Bakken <ssb@fast.no>                                                            |
@@ -15,7 +15,7 @@
 
  /*
  We support:
+
  DB_Common
  ---------
        query - returns PEAR_Error on error
        quote
        nextID
        disconnect
-       
+
        getOne
        getAssoc
        getRow
        getCol
        getAll
-       
+
  DB_Result
  ---------
        numRows - returns -1 if not supported
@@ -42,7 +42,7 @@
        fetchRows - does not support passing of fetchmode
        free
  */
+
 define('ADODB_PEAR',dirname(__FILE__));
 include_once "PEAR.php";
 include_once ADODB_PEAR."/adodb-errorpear.inc.php";
@@ -183,10 +183,10 @@ class DB
 
                if (isset($dsninfo['socket'])) $dsninfo['hostspec'] .= ':'.$dsninfo['socket'];
                else if (isset($dsninfo['port'])) $dsninfo['hostspec'] .= ':'.$dsninfo['port'];
-               
+
                if($persist) $ok = $obj->PConnect($dsninfo['hostspec'], $dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
                else  $ok = $obj->Connect($dsninfo['hostspec'], $dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
-               
+
                if (!$ok) $obj = ADODB_PEAR_Error();
                return $obj;
        }
@@ -212,7 +212,7 @@ class DB
        {
                if (!is_object($value)) return false;
                $class = strtolower(get_class($value));
-               return $class == 'pear_error' || is_subclass_of($value, 'pear_error') || 
+               return $class == 'pear_error' || is_subclass_of($value, 'pear_error') ||
                                $class == 'db_error' || is_subclass_of($value, 'db_error');
        }
 
index f36c6d5..2541273 100644 (file)
@@ -4,33 +4,33 @@ ADOdb Date Library, part of the ADOdb abstraction library
 Download: http://phplens.com/phpeverywhere/
 
 PHP native date functions use integer timestamps for computations.
-Because of this, dates are restricted to the years 1901-2038 on Unix 
-and 1970-2038 on Windows due to integer overflow for dates beyond 
-those years. This library overcomes these limitations by replacing the 
-native function's signed integers (normally 32-bits) with PHP floating 
+Because of this, dates are restricted to the years 1901-2038 on Unix
+and 1970-2038 on Windows due to integer overflow for dates beyond
+those years. This library overcomes these limitations by replacing the
+native function's signed integers (normally 32-bits) with PHP floating
 point numbers (normally 64-bits).
 
 Dates from 100 A.D. to 3000 A.D. and later
 have been tested. The minimum is 100 A.D. as <100 will invoke the
-2 => 4 digit year conversion. The maximum is billions of years in the 
-future, but this is a theoretical limit as the computation of that year 
+2 => 4 digit year conversion. The maximum is billions of years in the
+future, but this is a theoretical limit as the computation of that year
 would take too long with the current implementation of adodb_mktime().
 
 This library replaces native functions as follows:
 
-<pre>  
+<pre>
        getdate()  with  adodb_getdate()
-       date()     with  adodb_date() 
+       date()     with  adodb_date()
        gmdate()   with  adodb_gmdate()
        mktime()   with  adodb_mktime()
        gmmktime() with  adodb_gmmktime()
        strftime() with  adodb_strftime()
        strftime() with  adodb_gmstrftime()
 </pre>
-       
+
 The parameters are identical, except that adodb_date() accepts a subset
-of date()'s field formats. Mktime() will convert from local time to GMT, 
-and date() will convert from GMT to local time, but daylight savings is 
+of date()'s field formats. Mktime() will convert from local time to GMT,
+and date() will convert from GMT to local time, but daylight savings is
 not handled currently.
 
 This library is independant of the rest of ADOdb, and can be used
@@ -39,25 +39,25 @@ as standalone code.
 PERFORMANCE
 
 For high speed, this library uses the native date functions where
-possible, and only switches to PHP code when the dates fall outside 
+possible, and only switches to PHP code when the dates fall outside
 the 32-bit signed integer range.
 
 GREGORIAN CORRECTION
 
-Pope Gregory shortened October of A.D. 1582 by ten days. Thursday, 
-October 4, 1582 (Julian) was followed immediately by Friday, October 15, 
-1582 (Gregorian). 
+Pope Gregory shortened October of A.D. 1582 by ten days. Thursday,
+October 4, 1582 (Julian) was followed immediately by Friday, October 15,
+1582 (Gregorian).
 
 Since 0.06, we handle this correctly, so:
 
-adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582) 
+adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582)
        == 24 * 3600 (1 day)
 
 =============================================================================
 
 COPYRIGHT
 
-(c) 2003-2005 John Lim and released under BSD-style license except for code by 
+(c) 2003-2005 John Lim and released under BSD-style license except for code by
 jackbbs, which includes adodb_mktime, adodb_get_gmt_diff, adodb_is_leap_year
 and originally found at http://www.php.net/manual/en/function.mktime.php
 
@@ -77,10 +77,10 @@ FUNCTION DESCRIPTIONS
 ** FUNCTION adodb_getdate($date=false)
 
 Returns an array containing date information, as getdate(), but supports
-dates greater than 1901 to 2038. The local date/time format is derived from a 
-heuristic the first time adodb_getdate is called. 
-        
-        
+dates greater than 1901 to 2038. The local date/time format is derived from a
+heuristic the first time adodb_getdate is called.
+
+
 ** FUNCTION adodb_date($fmt, $timestamp = false)
 
 Convert a timestamp to a formatted local date. If $timestamp is not defined, the
@@ -90,45 +90,45 @@ outside the 1901 to 2038 range.
 The format fields that adodb_date supports:
 
 <pre>
-       a - "am" or "pm" 
-       A - "AM" or "PM" 
-       d - day of the month, 2 digits with leading zeros; i.e. "01" to "31" 
-       D - day of the week, textual, 3 letters; e.g. "Fri" 
-       F - month, textual, long; e.g. "January" 
-       g - hour, 12-hour format without leading zeros; i.e. "1" to "12" 
-       G - hour, 24-hour format without leading zeros; i.e. "0" to "23" 
-       h - hour, 12-hour format; i.e. "01" to "12" 
-       H - hour, 24-hour format; i.e. "00" to "23" 
-       i - minutes; i.e. "00" to "59" 
-       j - day of the month without leading zeros; i.e. "1" to "31" 
-       l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"  
-       L - boolean for whether it is a leap year; i.e. "0" or "1" 
-       m - month; i.e. "01" to "12" 
-       M - month, textual, 3 letters; e.g. "Jan" 
-       n - month without leading zeros; i.e. "1" to "12" 
-       O - Difference to Greenwich time in hours; e.g. "+0200" 
-       Q - Quarter, as in 1, 2, 3, 4 
-       r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" 
-       s - seconds; i.e. "00" to "59" 
-       S - English ordinal suffix for the day of the month, 2 characters; 
-                               i.e. "st", "nd", "rd" or "th" 
+       a - "am" or "pm"
+       A - "AM" or "PM"
+       d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
+       D - day of the week, textual, 3 letters; e.g. "Fri"
+       F - month, textual, long; e.g. "January"
+       g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
+       G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
+       h - hour, 12-hour format; i.e. "01" to "12"
+       H - hour, 24-hour format; i.e. "00" to "23"
+       i - minutes; i.e. "00" to "59"
+       j - day of the month without leading zeros; i.e. "1" to "31"
+       l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"
+       L - boolean for whether it is a leap year; i.e. "0" or "1"
+       m - month; i.e. "01" to "12"
+       M - month, textual, 3 letters; e.g. "Jan"
+       n - month without leading zeros; i.e. "1" to "12"
+       O - Difference to Greenwich time in hours; e.g. "+0200"
+       Q - Quarter, as in 1, 2, 3, 4
+       r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200"
+       s - seconds; i.e. "00" to "59"
+       S - English ordinal suffix for the day of the month, 2 characters;
+                               i.e. "st", "nd", "rd" or "th"
        t - number of days in the given month; i.e. "28" to "31"
-       T - Timezone setting of this machine; e.g. "EST" or "MDT" 
-       U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)  
-       w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) 
-       Y - year, 4 digits; e.g. "1999" 
-       y - year, 2 digits; e.g. "99" 
-       z - day of the year; i.e. "0" to "365" 
-       Z - timezone offset in seconds (i.e. "-43200" to "43200"). 
-                               The offset for timezones west of UTC is always negative, 
-                               and for those east of UTC is always positive. 
+       T - Timezone setting of this machine; e.g. "EST" or "MDT"
+       U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
+       w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
+       Y - year, 4 digits; e.g. "1999"
+       y - year, 2 digits; e.g. "99"
+       z - day of the year; i.e. "0" to "365"
+       Z - timezone offset in seconds (i.e. "-43200" to "43200").
+                               The offset for timezones west of UTC is always negative,
+                               and for those east of UTC is always positive.
 </pre>
 
 Unsupported:
 <pre>
-       B - Swatch Internet time 
+       B - Swatch Internet time
        I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
-       W - ISO-8601 week number of year, weeks starting on Monday 
+       W - ISO-8601 week number of year, weeks starting on Monday
 
 </pre>
 
@@ -138,7 +138,7 @@ Same as adodb_date, but 2nd parameter accepts iso date, eg.
 
   adodb_date2('d-M-Y H:i','2003-12-25 13:01:34');
 
-  
+
 ** FUNCTION adodb_gmdate($fmt, $timestamp = false)
 
 Convert a timestamp to a formatted GMT date. If $timestamp is not defined, the
@@ -163,7 +163,7 @@ Convert a timestamp to a formatted GMT date.
 
 ** FUNCTION adodb_strftime($fmt, $timestamp = false)
 
-Convert a timestamp to a formatted local date. Internally converts $fmt into 
+Convert a timestamp to a formatted local date. Internally converts $fmt into
 adodb_date format, then echo result.
 
 For best results, you can define the local date format yourself. Define a global
@@ -171,56 +171,56 @@ variable $ADODB_DATE_LOCALE which is an array, 1st element is date format using
 adodb_date syntax, and 2nd element is the time format, also in adodb_date syntax.
 
     eg. $ADODB_DATE_LOCALE = array('d/m/Y','H:i:s');
-       
+
        Supported format codes:
 
 <pre>
-       %a - abbreviated weekday name according to the current locale 
-       %A - full weekday name according to the current locale 
-       %b - abbreviated month name according to the current locale 
-       %B - full month name according to the current locale 
-       %c - preferred date and time representation for the current locale 
-       %d - day of the month as a decimal number (range 01 to 31) 
-       %D - same as %m/%d/%y 
-       %e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31') 
+       %a - abbreviated weekday name according to the current locale
+       %A - full weekday name according to the current locale
+       %b - abbreviated month name according to the current locale
+       %B - full month name according to the current locale
+       %c - preferred date and time representation for the current locale
+       %d - day of the month as a decimal number (range 01 to 31)
+       %D - same as %m/%d/%y
+       %e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
        %h - same as %b
-       %H - hour as a decimal number using a 24-hour clock (range 00 to 23) 
-       %I - hour as a decimal number using a 12-hour clock (range 01 to 12) 
-       %m - month as a decimal number (range 01 to 12) 
-       %M - minute as a decimal number 
-       %n - newline character 
-       %p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale 
-       %r - time in a.m. and p.m. notation 
-       %R - time in 24 hour notation 
-       %S - second as a decimal number 
-       %t - tab character 
-       %T - current time, equal to %H:%M:%S 
-       %x - preferred date representation for the current locale without the time 
-       %X - preferred time representation for the current locale without the date 
-       %y - year as a decimal number without a century (range 00 to 99) 
-       %Y - year as a decimal number including the century 
-       %Z - time zone or name or abbreviation 
-       %% - a literal `%' character 
-</pre> 
+       %H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+       %I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+       %m - month as a decimal number (range 01 to 12)
+       %M - minute as a decimal number
+       %n - newline character
+       %p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale
+       %r - time in a.m. and p.m. notation
+       %R - time in 24 hour notation
+       %S - second as a decimal number
+       %t - tab character
+       %T - current time, equal to %H:%M:%S
+       %x - preferred date representation for the current locale without the time
+       %X - preferred time representation for the current locale without the date
+       %y - year as a decimal number without a century (range 00 to 99)
+       %Y - year as a decimal number including the century
+       %Z - time zone or name or abbreviation
+       %% - a literal `%' character
+</pre>
 
        Unsupported codes:
 <pre>
-       %C - century number (the year divided by 100 and truncated to an integer, range 00 to 99) 
-       %g - like %G, but without the century. 
-       %G - The 4-digit year corresponding to the ISO week number (see %V). 
-            This has the same format and value as %Y, except that if the ISO week number belongs 
-                to the previous or next year, that year is used instead. 
-       %j - day of the year as a decimal number (range 001 to 366) 
-       %u - weekday as a decimal number [1,7], with 1 representing Monday 
-       %U - week number of the current year as a decimal number, starting 
-           with the first Sunday as the first day of the first week 
-       %V - The ISO 8601:1988 week number of the current year as a decimal number, 
-            range 01 to 53, where week 1 is the first week that has at least 4 days in the 
-                current year, and with Monday as the first day of the week. (Use %G or %g for 
-                the year component that corresponds to the week number for the specified timestamp.) 
-       %w - day of the week as a decimal, Sunday being 0 
-       %W - week number of the current year as a decimal number, starting with the 
-            first Monday as the first day of the first week 
+       %C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+       %g - like %G, but without the century.
+       %G - The 4-digit year corresponding to the ISO week number (see %V).
+            This has the same format and value as %Y, except that if the ISO week number belongs
+                to the previous or next year, that year is used instead.
+       %j - day of the year as a decimal number (range 001 to 366)
+       %u - weekday as a decimal number [1,7], with 1 representing Monday
+       %U - week number of the current year as a decimal number, starting
+           with the first Sunday as the first day of the first week
+       %V - The ISO 8601:1988 week number of the current year as a decimal number,
+            range 01 to 53, where week 1 is the first week that has at least 4 days in the
+                current year, and with Monday as the first day of the week. (Use %G or %g for
+                the year component that corresponds to the week number for the specified timestamp.)
+       %w - day of the week as a decimal, Sunday being 0
+       %W - week number of the current year as a decimal number, starting with the
+            first Monday as the first day of the first week
 </pre>
 
 =============================================================================
@@ -230,10 +230,10 @@ NOTES
 Useful url for generating test timestamps:
        http://www.4webhelp.net/us/timestamp.php
 
-Possible future optimizations include 
+Possible future optimizations include
 
-a. Using an algorithm similar to Plauger's in "The Standard C Library" 
-(page 428, xttotm.c _Ttotm() function). Plauger's algorithm will not 
+a. Using an algorithm similar to Plauger's in "The Standard C Library"
+(page 428, xttotm.c _Ttotm() function). Plauger's algorithm will not
 work outside 32-bit signed range, so i decided not to implement it.
 
 b. Implement daylight savings, which looks awfully complicated, see
@@ -246,24 +246,24 @@ CHANGELOG
 * Bug in 0.32 fix for hour handling. Fixed.
 
 - 1 Feb 2008 0.32
-* Now adodb_mktime(0,0,0,12+$m,20,2040) works properly. 
+* Now adodb_mktime(0,0,0,12+$m,20,2040) works properly.
 
 - 10 Jan 2008 0.31
 * Now adodb_mktime(0,0,0,24,1,2037) works correctly.
 
 - 15 July 2007 0.30
-Added PHP 5.2.0 compatability fixes. 
+Added PHP 5.2.0 compatability fixes.
  * gmtime behaviour for 1970 has changed. We use the actual date if it is between 1970 to 2038 to get the
  * timezone, otherwise we use the current year as the baseline to retrieve the timezone.
- * Also the timezone's in php 5.2.* support historical data better, eg. if timezone today was +8, but 
+ * Also the timezone's in php 5.2.* support historical data better, eg. if timezone today was +8, but
    in 1970 it was +7:30, then php 5.2 return +7:30, while this library will use +8.
- * 
+ *
+
 - 19 March 2006 0.24
 Changed strftime() locale detection, because some locales prepend the day of week to the date when %c is used.
 
 - 10 Feb 2006 0.23
-PHP5 compat: when we detect PHP5, the RFC2822 format for gmt 0000hrs is changed from -0000 to +0000. 
+PHP5 compat: when we detect PHP5, the RFC2822 format for gmt 0000hrs is changed from -0000 to +0000.
        In PHP4, we will still use -0000 for 100% compat with PHP4.
 
 - 08 Sept 2005 0.22
@@ -277,7 +277,7 @@ Added support for negative months in adodb_mktime().
 Added limited strftime/gmstrftime support. x10 improvement in performance of adodb_date().
 
 - 21 Dec 2004 0.17
-In adodb_getdate(), the timestamp was accidentally converted to gmt when $is_gmt is false. 
+In adodb_getdate(), the timestamp was accidentally converted to gmt when $is_gmt is false.
 Also adodb_mktime(0,0,0) did not work properly. Both fixed thx Mauro.
 
 - 17 Nov 2004 0.16
@@ -286,7 +286,7 @@ Removed intval typecast in adodb_mktime() for secs, allowing:
 Suggested by Ryan.
 
 - 18 July 2004 0.15
-All params in adodb_mktime were formerly compulsory. Now only the hour, min, secs is compulsory. 
+All params in adodb_mktime were formerly compulsory. Now only the hour, min, secs is compulsory.
 This brings it more in line with mktime (still not identical).
 
 - 23 June 2004 0.14
@@ -304,21 +304,21 @@ function adodb_daylight_sv(&$arr, $is_gmt)
        if ($m == 6 || $m == 7) $arr['hours'] += 1;
 }
 
-This is only called by adodb_date() and not by adodb_mktime(). 
+This is only called by adodb_date() and not by adodb_mktime().
 
 The format of $arr is
-Array ( 
-   [seconds] => 0 
-   [minutes] => 0 
-   [hours] => 0 
+Array (
+   [seconds] => 0
+   [minutes] => 0
+   [hours] => 0
    [mday] => 1      # day of month, eg 1st day of the month
    [mon] => 2       # month (eg. Feb)
-   [year] => 2102 
+   [year] => 2102
    [yday] => 31     # days in current year
    [leap] =>        # true if leap year
    [ndays] => 28    # no of days in current month
-   ) 
-   
+   )
+
 
 - 28 Apr 2004 0.13
 Fixed adodb_date to properly support $is_gmt. Thx to Dimitar Angelov.
@@ -327,11 +327,11 @@ Fixed adodb_date to properly support $is_gmt. Thx to Dimitar Angelov.
 Fixed month calculation error in adodb_date. 2102-June-01 appeared as 2102-May-32.
 
 - 26 Oct 2003 0.11
-Because of daylight savings problems (some systems apply daylight savings to 
+Because of daylight savings problems (some systems apply daylight savings to
 January!!!), changed adodb_get_gmt_diff() to ignore daylight savings.
 
 - 9 Aug 2003 0.10
-Fixed bug with dates after 2038. 
+Fixed bug with dates after 2038.
 See http://phplens.com/lens/lensforum/msgs.php?id=6980
 
 - 1 July 2003 0.09
@@ -361,14 +361,14 @@ Day overflow for less than one month's days is supported.
 
 - 28 Jan 2003 0.04
 
-Gregorian correction handled. In PHP5, we might throw an error if 
+Gregorian correction handled. In PHP5, we might throw an error if
 mktime uses invalid dates around 5-14 Oct 1582. Released with ADOdb 3.10.
 Added limbo 5-14 Oct 1582 check, when we set to 15 Oct 1582.
 
 - 27 Jan 2003 0.03
 
 Fixed some more month problems due to gmt issues. Added constant ADODB_DATE_VERSION.
-Fixed calculation of days since start of year for <1970. 
+Fixed calculation of days since start of year for <1970.
 
 - 27 Jan 2003 0.02
 
@@ -391,13 +391,13 @@ define('ADODB_DATE_VERSION',0.33);
 $ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2);
 
 /*
-       This code was originally for windows. But apparently this problem happens 
+       This code was originally for windows. But apparently this problem happens
        also with Linux, RH 7.3 and later!
-       
+
        glibc-2.2.5-34 and greater has been changed to return -1 for dates <
        1970.  This used to work.  The problem exists with RedHat 7.3 and 8.0
        echo (mktime(0, 0, 0, 1, 1, 1960));  // prints -1
-       
+
        References:
         http://bugs.php.net/bug.php?id=20048&edit=2
         http://lists.debian.org/debian-glibc/2002/debian-glibc-200205/msg00010.html
@@ -423,74 +423,74 @@ function adodb_date_test_strftime($fmt)
 {
        $s1 = strftime($fmt);
        $s2 = adodb_strftime($fmt);
-       
+
        if ($s1 == $s2) return true;
-       
+
        echo "error for $fmt,  strftime=$s1, adodb=$s2<br>";
        return false;
 }
 
 /**
         Test Suite
-*/     
+*/
 function adodb_date_test()
 {
-       
+
        for ($m=-24; $m<=24; $m++)
                echo "$m :",adodb_date('d-m-Y',adodb_mktime(0,0,0,1+$m,20,2040)),"<br>";
-       
+
        error_reporting(E_ALL);
        print "<h4>Testing adodb_date and adodb_mktime. version=".ADODB_DATE_VERSION.' PHP='.PHP_VERSION."</h4>";
        @set_time_limit(0);
        $fail = false;
-       
+
        // This flag disables calling of PHP native functions, so we can properly test the code
        if (!defined('ADODB_TEST_DATES')) define('ADODB_TEST_DATES',1);
-       
+
        $t = time();
-       
-       
+
+
        $fmt = 'Y-m-d H:i:s';
        echo '<pre>';
        echo 'adodb: ',adodb_date($fmt,$t),'<br>';
        echo 'php  : ',date($fmt,$t),'<br>';
        echo '</pre>';
-       
+
        adodb_date_test_strftime('%Y %m %x %X');
        adodb_date_test_strftime("%A %d %B %Y");
        adodb_date_test_strftime("%H %M S");
-       
+
        $t = adodb_mktime(0,0,0);
        if (!(adodb_date('Y-m-d') == date('Y-m-d'))) print 'Error in '.adodb_mktime(0,0,0).'<br>';
-       
+
        $t = adodb_mktime(0,0,0,6,1,2102);
        if (!(adodb_date('Y-m-d',$t) == '2102-06-01')) print 'Error in '.adodb_date('Y-m-d',$t).'<br>';
-       
+
        $t = adodb_mktime(0,0,0,2,1,2102);
        if (!(adodb_date('Y-m-d',$t) == '2102-02-01')) print 'Error in '.adodb_date('Y-m-d',$t).'<br>';
-       
-       
+
+
        print "<p>Testing gregorian <=> julian conversion<p>";
        $t = adodb_mktime(0,0,0,10,11,1492);
        //http://www.holidayorigins.com/html/columbus_day.html - Friday check
        if (!(adodb_date('D Y-m-d',$t) == 'Fri 1492-10-11')) print 'Error in Columbus landing<br>';
-       
+
        $t = adodb_mktime(0,0,0,2,29,1500);
        if (!(adodb_date('Y-m-d',$t) == '1500-02-29')) print 'Error in julian leap years<br>';
-       
+
        $t = adodb_mktime(0,0,0,2,29,1700);
        if (!(adodb_date('Y-m-d',$t) == '1700-03-01')) print 'Error in gregorian leap years<br>';
-       
+
        print  adodb_mktime(0,0,0,10,4,1582).' ';
        print adodb_mktime(0,0,0,10,15,1582);
        $diff = (adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582));
        if ($diff != 3600*24) print " <strong>Error in gregorian correction = ".($diff/3600/24)." days </strong><br>";
-               
+
        print " 15 Oct 1582, Fri=".(adodb_dow(1582,10,15) == 5 ? 'Fri' : '<strong>Error</strong>')."<br>";
        print " 4 Oct 1582, Thu=".(adodb_dow(1582,10,4) == 4 ? 'Thu' : '<strong>Error</strong>')."<br>";
-       
+
        print "<p>Testing overflow<p>";
-       
+
        $t = adodb_mktime(0,0,0,3,33,1965);
        if (!(adodb_date('Y-m-d',$t) == '1965-04-02')) print 'Error in day overflow 1 <br>';
        $t = adodb_mktime(0,0,0,4,33,1971);
@@ -503,7 +503,7 @@ function adodb_date_test()
        if (!(adodb_date('Y-m-d',$t) == '1966-02-01')) print 'Error in day overflow 5 '.adodb_date('Y-m-d',$t).' <br>';
        $t = adodb_mktime(0,0,0,13,3,1965);
        if (!(adodb_date('Y-m-d',$t) == '1966-01-03')) print 'Error in mth overflow 1 <br>';
-       
+
        print "Testing 2-digit => 4-digit year conversion<p>";
        if (adodb_year_digit_check(00) != 2000) print "Err 2-digit 2000<br>";
        if (adodb_year_digit_check(10) != 2010) print "Err 2-digit 2010<br>";
@@ -512,10 +512,10 @@ function adodb_date_test()
        if (adodb_year_digit_check(40) != 1940) print "Err 2-digit 1940<br>";
        if (adodb_year_digit_check(50) != 1950) print "Err 2-digit 1950<br>";
        if (adodb_year_digit_check(90) != 1990) print "Err 2-digit 1990<br>";
-       
+
        // Test string formating
        print "<p>Testing date formating</p>";
-       
+
        $fmt = '\d\a\t\e T Y-m-d H:i:s a A d D F g G h H i j l L m M n O \R\F\C2822 r s t U w y Y z Z 2003';
        $s1 = date($fmt,0);
        $s2 = adodb_date($fmt,0);
@@ -538,12 +538,12 @@ function adodb_date_test()
                                        break;
                                }
                        }
-                       print "<strong>Error date(): $ts<br><pre> 
+                       print "<strong>Error date(): $ts<br><pre>
 &nbsp; \"$s1\" (date len=".strlen($s1).")
 &nbsp; \"$s2\" (adodb_date len=".strlen($s2).")</strong></pre><br>";
                        $fail = true;
                }
-               
+
                $a1 = getdate($ts);
                $a2 = adodb_getdate($ts);
                $rez = array_diff($a1,$a2);
@@ -556,7 +556,7 @@ function adodb_date_test()
                        $fail = true;
                }
        }
-       
+
        // Test generation of dates outside 1901-2038
        print "<p>Testing random dates between 100 and 4000</p>";
        adodb_date_test_date(100,1);
@@ -564,7 +564,7 @@ function adodb_date_test()
                $y1 = 100+rand(0,1970-100);
                $m = rand(1,12);
                adodb_date_test_date($y1,$m);
-               
+
                $y1 = 3000-rand(0,3000-1970);
                adodb_date_test_date($y1,$m);
        }
@@ -575,7 +575,7 @@ function adodb_date_test()
        $offset = 36000+rand(10000,60000);
        $max = 365*$yrs*86400;
        $lastyear = 0;
-       
+
        // we generate a timestamp, convert it to a date, and convert it back to a timestamp
        // and check if the roundtrip broke the original timestamp value.
        print "Testing $start to ".($start+$yrs).", or $max seconds, offset=$offset: ";
@@ -602,58 +602,58 @@ function adodb_date_test()
 }
 
 /**
-       Returns day of week, 0 = Sunday,... 6=Saturday. 
+       Returns day of week, 0 = Sunday,... 6=Saturday.
        Algorithm from PEAR::Date_Calc
 */
 function adodb_dow($year, $month, $day)
 {
 /*
-Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and 
-proclaimed that from that time onwards 3 days would be dropped from the calendar 
+Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and
+proclaimed that from that time onwards 3 days would be dropped from the calendar
 every 400 years.
 
-Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October&nb