diff --git a/composer.json b/composer.json index 43604ee38..b835decff 100644 --- a/composer.json +++ b/composer.json @@ -27,12 +27,13 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { + "php": ">=5.6", "laravel/framework": "5.4.*", "luracast/restler": "^3.0", "bshaffer/oauth2-server-php": "v1.0", - "colosa/pmUI": "release/3.2.3-dev", - "colosa/MichelangeloFE": "release/3.2.3-dev", - "colosa/pmdynaform": "release/3.2.3-dev", + "colosa/pmUI": "release/3.2.4-dev", + "colosa/MichelangeloFE": "release/3.2.4-dev", + "colosa/pmdynaform": "release/3.2.4-dev", "google/apiclient": "1.1.6", "dapphp/securimage": "^3.6", "psr/log":"1.0.0", @@ -43,9 +44,11 @@ "pear/archive_tar": "1.4.*", "pear/console_getopt": "1.4.*", "TYPO3/class-alias-loader": "^1.0", - "ralouphie/getallheaders": "^2.0" + "ralouphie/getallheaders": "^2.0", + "smarty/smarty": "2.6.30" }, "require-dev": { + "fzaninotto/faker": "^1.7", "guzzle/guzzle": "~3.1.1", "phpunit/phpunit": "~5.7", "lmc/steward": "^2.2", @@ -59,7 +62,8 @@ "ProcessMaker\\": "workflow/engine/src" }, "psr-4": { - "Maveriks\\": "framework/src/Maveriks/" + "Maveriks\\": "framework/src/Maveriks/", + "Tests\\": "tests/" }, "classmap": [ "gulliver/system/", @@ -68,7 +72,6 @@ "workflow/engine/classes/", "workflow/engine/controllers/", "workflow/engine/includes/", - "thirdparty/smarty/libs/Smarty.class.php", "thirdparty/jsmin/jsmin.php", "thirdparty/pear", "thirdparty/html2ps_pdf", @@ -79,7 +82,6 @@ "files": [ "gulliver/includes/inc.ajax.php", "gulliver/includes/smarty_plugins/function.pmos.php", - "thirdparty/pear/PEAR.php", "thirdparty/pake/pakeFunction.php", "thirdparty/HTMLPurifier/HTMLPurifier.auto.php", "workflow/engine/classes/class.pmFunctions.php", diff --git a/composer.lock b/composer.lock index 19a726d6e..afbf635f3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "41742709993d30b70991d5277781b2d8", + "content-hash": "f3bce83c3f2a3d02dfff261dd88a5072", "packages": [ { "name": "bshaffer/oauth2-server-php", @@ -51,14 +51,14 @@ }, { "name": "colosa/MichelangeloFE", - "version": "dev-release/3.2.3", + "version": "dev-release/3.2.4", "source": { "type": "git", "url": "git@bitbucket.org:colosa/michelangelofe.git", - "reference": "a44fbc3e9d0c9c1ce1f0e7697cedc809f8a3a220" + "reference": "1780c624132004aa13d80882937f61527adafad5" }, "require": { - "colosa/pmui": "release/3.2.3-dev" + "colosa/pmui": "release/3.2.4-dev" }, "type": "library", "description": "ProcessMaker Michelangelo Front End", @@ -66,15 +66,15 @@ "keywords": [ "js app ProcessMaker" ], - "time": "2018-04-27T20:10:38+00:00" + "time": "2018-05-04T18:33:23+00:00" }, { "name": "colosa/pmDynaform", - "version": "dev-release/3.2.3", + "version": "dev-release/3.2.4", "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmdynaform.git", - "reference": "fa6a9eb4520a090aaf50e46c90e49596b0794f04" + "reference": "d22d2d185cac311fb803e0b6891160804091bac1" }, "type": "library", "description": "JS Library to render ProcessMaker Dynaforms", @@ -82,11 +82,11 @@ "keywords": [ "js lib ProcessMaker Dynaforms" ], - "time": "2018-04-16T15:41:04+00:00" + "time": "2018-04-23T18:36:59+00:00" }, { "name": "colosa/pmUI", - "version": "dev-release/3.2.3", + "version": "dev-release/3.2.4", "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmui.git", @@ -102,21 +102,21 @@ }, { "name": "dapphp/securimage", - "version": "3.6.5", + "version": "3.6.7", "source": { "type": "git", "url": "https://github.com/dapphp/securimage.git", - "reference": "3f5a84fd80b1a35d58332896c944142713a7e802" + "reference": "1ecb884797c66e01a875c058def46c85aecea45b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dapphp/securimage/zipball/3f5a84fd80b1a35d58332896c944142713a7e802", - "reference": "3f5a84fd80b1a35d58332896c944142713a7e802", + "url": "https://api.github.com/repos/dapphp/securimage/zipball/1ecb884797c66e01a875c058def46c85aecea45b", + "reference": "1ecb884797c66e01a875c058def46c85aecea45b", "shasum": "" }, "require": { "ext-gd": "*", - "php": ">=5.2.0" + "php": ">=5.4" }, "suggest": { "ext-pdo": "For database storage support", @@ -131,7 +131,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], "authors": [ { @@ -142,10 +142,12 @@ "description": "PHP CAPTCHA Library", "homepage": "https://www.phpcaptcha.org", "keywords": [ + "Forms", + "anti-spam", "captcha", "security" ], - "time": "2016-12-04T17:45:57+00:00" + "time": "2018-03-09T06:07:41+00:00" }, { "name": "doctrine/inflector", @@ -216,21 +218,25 @@ }, { "name": "erusev/parsedown", - "version": "1.6.3", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", "shasum": "" }, "require": { + "ext-mbstring": "*", "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, "type": "library", "autoload": { "psr-0": { @@ -254,7 +260,7 @@ "markdown", "parser" ], - "time": "2017-05-14T14:47:48+00:00" + "time": "2018-03-08T01:11:30+00:00" }, { "name": "geshi/geshi", @@ -262,12 +268,12 @@ "source": { "type": "git", "url": "https://github.com/GeSHi/geshi-1.0.git", - "reference": "ec918ac67f6d3e9008e1d41c4d22610a96f78755" + "reference": "ed9f49a7c7a195f6ed2bc864f5ce03b990b5867d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/ec918ac67f6d3e9008e1d41c4d22610a96f78755", - "reference": "ec918ac67f6d3e9008e1d41c4d22610a96f78755", + "url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/ed9f49a7c7a195f6ed2bc864f5ce03b990b5867d", + "reference": "ed9f49a7c7a195f6ed2bc864f5ce03b990b5867d", "shasum": "" }, "require-dev": { @@ -294,7 +300,7 @@ ], "description": "Generic Syntax Highlighter", "homepage": "http://qbnz.com/highlighter/", - "time": "2017-07-30T00:08:49+00:00" + "time": "2018-03-09T20:04:39+00:00" }, { "name": "google/apiclient", @@ -328,7 +334,7 @@ "src/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "Apache-2.0" ], @@ -470,16 +476,16 @@ }, { "name": "league/flysystem", - "version": "1.0.41", + "version": "1.0.45", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "f400aa98912c561ba625ea4065031b7a41e5a155" + "reference": "a99f94e63b512d75f851b181afcdf0ee9ebef7e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f400aa98912c561ba625ea4065031b7a41e5a155", - "reference": "f400aa98912c561ba625ea4065031b7a41e5a155", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a99f94e63b512d75f851b181afcdf0ee9ebef7e6", + "reference": "a99f94e63b512d75f851b181afcdf0ee9ebef7e6", "shasum": "" }, "require": { @@ -490,12 +496,13 @@ }, "require-dev": { "ext-fileinfo": "*", - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^2.2", - "phpunit/phpunit": "~4.8" + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7" }, "suggest": { "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", @@ -549,7 +556,7 @@ "sftp", "storage" ], - "time": "2017-08-06T17:41:04+00:00" + "time": "2018-05-07T08:44:23+00:00" }, { "name": "libchart/libchart", @@ -577,7 +584,7 @@ ], "authors": [ { - "name": "Jean-Marc Tr??meaux", + "name": "Jean-Marc Trémeaux", "homepage": "http://naku.dohcrew.com/", "role": "Developer" }, @@ -603,12 +610,12 @@ "source": { "type": "git", "url": "https://github.com/Luracast/Restler.git", - "reference": "cd0c21b4f7c0a99261ad618e90a5263483e78007" + "reference": "188968f6a15796077350f1be9c461f8d02c559a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Luracast/Restler/zipball/cd0c21b4f7c0a99261ad618e90a5263483e78007", - "reference": "cd0c21b4f7c0a99261ad618e90a5263483e78007", + "url": "https://api.github.com/repos/Luracast/Restler/zipball/188968f6a15796077350f1be9c461f8d02c559a8", + "reference": "188968f6a15796077350f1be9c461f8d02c559a8", "shasum": "" }, "require": { @@ -674,7 +681,7 @@ "rest", "server" ], - "time": "2017-01-11T03:42:36+00:00" + "time": "2018-03-16T05:08:02+00:00" }, { "name": "monolog/monolog", @@ -756,7 +763,7 @@ }, { "name": "mtdowling/cron-expression", - "version": "v1.2.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/mtdowling/cron-expression.git", @@ -800,35 +807,30 @@ }, { "name": "nesbot/carbon", - "version": "1.22.1", + "version": "1.27.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc" + "reference": "ef81c39b67200dcd7401c24363dcac05ac3a4fe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc", - "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ef81c39b67200dcd7401c24363dcac05ac3a4fe9", + "reference": "ef81c39b67200dcd7401c24363dcac05ac3a4fe9", "shasum": "" }, "require": { - "php": ">=5.3.0", - "symfony/translation": "~2.6 || ~3.0" + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "~4.0 || ~5.0" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.23-dev" - } - }, "autoload": { "psr-4": { - "Carbon\\": "src/Carbon/" + "": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -849,20 +851,20 @@ "datetime", "time" ], - "time": "2017-01-16T07:55:07+00:00" + "time": "2018-04-23T09:02:57+00:00" }, { "name": "paragonie/random_compat", - "version": "v2.0.10", + "version": "v2.0.12", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d" + "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/258c89a6b97de7dfaf5b8c7607d0478e236b04fb", + "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb", "shasum": "" }, "require": { @@ -897,7 +899,7 @@ "pseudorandom", "random" ], - "time": "2017-03-13T16:27:32+00:00" + "time": "2018-04-04T21:24:14+00:00" }, { "name": "pear/archive_tar", @@ -1244,16 +1246,16 @@ }, { "name": "ramsey/uuid", - "version": "3.7.0", + "version": "3.7.3", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "0ef23d1b10cf1bc576e9d865a7e9c47982c5715e" + "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/0ef23d1b10cf1bc576e9d865a7e9c47982c5715e", - "reference": "0ef23d1b10cf1bc576e9d865a7e9c47982c5715e", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76", + "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76", "shasum": "" }, "require": { @@ -1264,17 +1266,15 @@ "rhumsaa/uuid": "self.version" }, "require-dev": { - "apigen/apigen": "^4.1", - "codeception/aspect-mock": "^1.0 | ^2.0", + "codeception/aspect-mock": "^1.0 | ~2.0.0", "doctrine/annotations": "~1.2.0", "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", "ircmaxell/random-lib": "^1.1", "jakub-onderka/php-parallel-lint": "^0.9.0", - "mockery/mockery": "^0.9.4", + "mockery/mockery": "^0.9.9", "moontoast/math": "^1.1", "php-mock/php-mock-phpunit": "^0.3|^1.1", - "phpunit/phpunit": "^4.7|>=5.0 <5.4", - "satooshi/php-coveralls": "^0.6.1", + "phpunit/phpunit": "^4.7|^5.0", "squizlabs/php_codesniffer": "^2.3" }, "suggest": { @@ -1322,20 +1322,71 @@ "identifier", "uuid" ], - "time": "2017-08-04T13:39:04+00:00" + "time": "2018-01-20T00:28:24+00:00" }, { - "name": "swiftmailer/swiftmailer", - "version": "v5.4.8", + "name": "smarty/smarty", + "version": "v2.6.30", "source": { "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517" + "url": "https://github.com/smarty-php/smarty.git", + "reference": "c5c9d6514ceaf15fe35345886668726829560f93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/9a06dc570a0367850280eefd3f1dc2da45aef517", - "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/c5c9d6514ceaf15fe35345886668726829560f93", + "reference": "c5c9d6514ceaf15fe35345886668726829560f93", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "classmap": [ + "libs/Smarty.class.php", + "libs/Smarty_Compiler.class.php", + "libs/Config_File.class.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Monte Ohrt", + "email": "monte@ohrt.com" + }, + { + "name": "Uwe Tews", + "email": "uwe.tews@googlemail.com" + } + ], + "description": "Smarty - the compiling PHP template engine", + "homepage": "http://www.smarty.net", + "keywords": [ + "templating" + ], + "time": "2016-07-19T18:31:12+00:00" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7ffc1ea296ed14bf8260b6ef11b80208dbadba91", + "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91", "shasum": "" }, "require": { @@ -1370,54 +1421,55 @@ } ], "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.org", + "homepage": "https://swiftmailer.symfony.com", "keywords": [ "email", "mail", "mailer" ], - "time": "2017-05-01T15:54:03+00:00" + "time": "2018-01-23T07:37:21+00:00" }, { "name": "symfony/console", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d6596cb5022b6a0bd940eae54a1de78646a5fda6" + "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d6596cb5022b6a0bd940eae54a1de78646a5fda6", - "reference": "d6596cb5022b6a0bd940eae54a1de78646a5fda6", + "url": "https://api.github.com/repos/symfony/console/zipball/5b1fdfa8eb93464bcc36c34da39cedffef822cdf", + "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1444,20 +1496,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-08-27T14:52:21+00:00" + "time": "2018-04-30T01:22:56+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "c5f5263ed231f164c58368efbce959137c7d9488" + "reference": "519a80d7c1d95c6cc0b67f686d15fe27c6910de0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/c5f5263ed231f164c58368efbce959137c7d9488", - "reference": "c5f5263ed231f164c58368efbce959137c7d9488", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/519a80d7c1d95c6cc0b67f686d15fe27c6910de0", + "reference": "519a80d7c1d95c6cc0b67f686d15fe27c6910de0", "shasum": "" }, "require": { @@ -1466,7 +1518,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1483,7 +1535,7 @@ ], "authors": [ { - "name": "Jean-Fran??ois Simon", + "name": "Jean-François Simon", "email": "jeanfrancois.simon@sensiolabs.com" }, { @@ -1497,20 +1549,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-03-19T22:32:39+00:00" }, { "name": "symfony/debug", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "084d804fe35808eb2ef596ec83d85d9768aa6c9d" + "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/084d804fe35808eb2ef596ec83d85d9768aa6c9d", - "reference": "084d804fe35808eb2ef596ec83d85d9768aa6c9d", + "url": "https://api.github.com/repos/symfony/debug/zipball/1b95888cfd996484527cb41e8952d9a5eaf7454f", + "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f", "shasum": "" }, "require": { @@ -1521,12 +1573,12 @@ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1553,20 +1605,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-08-27T14:52:21+00:00" + "time": "2018-04-30T16:53:52+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "54ca9520a00386f83bca145819ad3b619aaa2485" + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54ca9520a00386f83bca145819ad3b619aaa2485", - "reference": "54ca9520a00386f83bca145819ad3b619aaa2485", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", "shasum": "" }, "require": { @@ -1577,10 +1629,10 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1589,7 +1641,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1616,20 +1668,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-04-06T07:35:25+00:00" }, { "name": "symfony/finder", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e" + "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", - "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", + "url": "https://api.github.com/repos/symfony/finder/zipball/bd14efe8b1fabc4de82bf50dce62f05f9a102433", + "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433", "shasum": "" }, "require": { @@ -1638,7 +1690,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1665,33 +1717,34 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-04-04T05:07:11+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "14bacad23a4f075bfd3fd456755236cb261320e3" + "reference": "edc43b1a50402bb06b5111eb86b275c87a93e373" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/14bacad23a4f075bfd3fd456755236cb261320e3", - "reference": "14bacad23a4f075bfd3fd456755236cb261320e3", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/edc43b1a50402bb06b5111eb86b275c87a93e373", + "reference": "edc43b1a50402bb06b5111eb86b275c87a93e373", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0" + "symfony/expression-language": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1718,56 +1771,58 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-08-10T07:07:06+00:00" + "time": "2018-04-30T01:05:13+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "1c1717d28904744dc9a9f6a9d97a8b9bed1680e9" + "reference": "280fcedbcb3dabcc467a9c1734054af61928fe4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1c1717d28904744dc9a9f6a9d97a8b9bed1680e9", - "reference": "1c1717d28904744dc9a9f6a9d97a8b9bed1680e9", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/280fcedbcb3dabcc467a9c1734054af61928fe4f", + "reference": "280fcedbcb3dabcc467a9c1734054af61928fe4f", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3" + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^3.4.4|^4.0.4" }, "conflict": { "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", + "symfony/dependency-injection": "<3.4.5|<4.0.5,>=4", "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "^3.4.5|^4.0.5", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" }, "suggest": { "symfony/browser-kit": "", - "symfony/class-loader": "", "symfony/config": "", "symfony/console": "", "symfony/dependency-injection": "", @@ -1777,7 +1832,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1804,20 +1859,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2017-08-28T22:35:03+00:00" + "time": "2018-04-30T19:27:02+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "3296adf6a6454a050679cde90f95350ad604b171" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", "shasum": "" }, "require": { @@ -1829,7 +1884,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -1863,20 +1918,79 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2018-04-26T10:06:28+00:00" }, { - "name": "symfony/process", - "version": "v3.3.8", + "name": "symfony/polyfill-php70", + "version": "v1.8.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", + "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-04-26T10:06:28+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "4b7d64e852886319e93ddfdecff0d744ab87658b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/4b7d64e852886319e93ddfdecff0d744ab87658b", + "reference": "4b7d64e852886319e93ddfdecff0d744ab87658b", "shasum": "" }, "require": { @@ -1885,7 +1999,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1912,39 +2026,39 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-04-03T05:22:50+00:00" }, { "name": "symfony/routing", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "970326dcd04522e1cd1fe128abaee54c225e27f9" + "reference": "9deb375986f5d1f37283d8386716d26985a0f4b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/970326dcd04522e1cd1fe128abaee54c225e27f9", - "reference": "970326dcd04522e1cd1fe128abaee54c225e27f9", + "url": "https://api.github.com/repos/symfony/routing/zipball/9deb375986f5d1f37283d8386716d26985a0f4b6", + "reference": "9deb375986f5d1f37283d8386716d26985a0f4b6", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "conflict": { - "symfony/config": "<2.8", + "symfony/config": "<3.3.1", "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" + "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/common": "~2.2", "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" + "symfony/config": "^3.3.1|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", @@ -1957,7 +2071,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1990,20 +2104,20 @@ "uri", "url" ], - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-04-12T09:01:03+00:00" }, { "name": "symfony/translation", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "add53753d978f635492dfe8cd6953f6a7361ef90" + "reference": "d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/add53753d978f635492dfe8cd6953f6a7361ef90", - "reference": "add53753d978f635492dfe8cd6953f6a7361ef90", + "url": "https://api.github.com/repos/symfony/translation/zipball/d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c", + "reference": "d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c", "shasum": "" }, "require": { @@ -2012,23 +2126,26 @@ }, "conflict": { "symfony/config": "<2.8", - "symfony/yaml": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "^2.8.18|^3.2.5", - "symfony/yaml": "~3.3" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { - "psr/log": "To use logging capability in translator", + "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2055,20 +2172,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-04-30T01:22:56+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "89fcb5a73e0ede2be2512234c4e40457bb22b35f" + "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/89fcb5a73e0ede2be2512234c4e40457bb22b35f", - "reference": "89fcb5a73e0ede2be2512234c4e40457bb22b35f", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e6545672d8c9ce70dd472adc2f8b03155a46f73", + "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73", "shasum": "" }, "require": { @@ -2084,12 +2201,13 @@ }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", "ext-symfony_debug": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2123,33 +2241,33 @@ "debug", "dump" ], - "time": "2017-08-27T14:52:21+00:00" + "time": "2018-04-26T12:42:15+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b" + "reference": "0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", - "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757", + "reference": "0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757", "shasum": "" }, "require": { - "php": "^5.5 || ^7", - "symfony/css-selector": "^2.7|~3.0" + "php": "^5.5 || ^7.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.8|5.1.*" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -2170,7 +2288,7 @@ ], "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", - "time": "2016-09-20T12:50:39+00:00" + "time": "2017-11-27T11:13:29+00:00" }, { "name": "typo3/class-alias-loader", @@ -2284,16 +2402,16 @@ "packages-dev": [ { "name": "beberlei/assert", - "version": "v2.7.6", + "version": "v2.9.5", "source": { "type": "git", "url": "https://github.com/beberlei/assert.git", - "reference": "8726e183ebbb0169cb6cb4832e22ebd355524563" + "reference": "c07fe163d6a3b3e4b1275981ec004397954afa89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beberlei/assert/zipball/8726e183ebbb0169cb6cb4832e22ebd355524563", - "reference": "8726e183ebbb0169cb6cb4832e22ebd355524563", + "url": "https://api.github.com/repos/beberlei/assert/zipball/c07fe163d6a3b3e4b1275981ec004397954afa89", + "reference": "c07fe163d6a3b3e4b1275981ec004397954afa89", "shasum": "" }, "require": { @@ -2302,7 +2420,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.1.1", - "phpunit/phpunit": "^4|^5" + "phpunit/phpunit": "^4.8.35|^5.7" }, "type": "library", "autoload": { @@ -2335,40 +2453,41 @@ "assertion", "validation" ], - "time": "2017-05-04T02:00:24+00:00" + "time": "2018-04-16T11:18:27+00:00" }, { "name": "behat/behat", - "version": "v3.3.1", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/Behat/Behat.git", - "reference": "44a58c1480d6144b2dc2c2bf02b9cef73c83840d" + "reference": "d60b161bff1b95ec4bb80bb8cb210ccf890314c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/44a58c1480d6144b2dc2c2bf02b9cef73c83840d", - "reference": "44a58c1480d6144b2dc2c2bf02b9cef73c83840d", + "url": "https://api.github.com/repos/Behat/Behat/zipball/d60b161bff1b95ec4bb80bb8cb210ccf890314c2", + "reference": "d60b161bff1b95ec4bb80bb8cb210ccf890314c2", "shasum": "" }, "require": { - "behat/gherkin": "^4.4.4", + "behat/gherkin": "^4.5.1", "behat/transliterator": "^1.2", - "container-interop/container-interop": "^1.1", + "container-interop/container-interop": "^1.2", "ext-mbstring": "*", "php": ">=5.3.3", - "symfony/class-loader": "~2.1||~3.0", - "symfony/config": "~2.3||~3.0", - "symfony/console": "~2.5||~3.0", - "symfony/dependency-injection": "~2.1||~3.0", - "symfony/event-dispatcher": "~2.1||~3.0", - "symfony/translation": "~2.3||~3.0", - "symfony/yaml": "~2.1||~3.0" + "psr/container": "^1.0", + "symfony/class-loader": "~2.1||~3.0||~4.0", + "symfony/config": "~2.3||~3.0||~4.0", + "symfony/console": "~2.5||~3.0||~4.0", + "symfony/dependency-injection": "~2.1||~3.0||~4.0", + "symfony/event-dispatcher": "~2.1||~3.0||~4.0", + "symfony/translation": "~2.3||~3.0||~4.0", + "symfony/yaml": "~2.1||~3.0||~4.0" }, "require-dev": { "herrera-io/box": "~1.6.1", - "phpunit/phpunit": "~4.5", - "symfony/process": "~2.5|~3.0" + "phpunit/phpunit": "^4.8.36|^6.3", + "symfony/process": "~2.5|~3.0|~4.0" }, "suggest": { "behat/mink-extension": "for integration with Mink testing framework", @@ -2417,7 +2536,7 @@ "symfony", "testing" ], - "time": "2017-05-15T16:49:16+00:00" + "time": "2017-11-27T10:37:56+00:00" }, { "name": "behat/gherkin", @@ -2773,30 +2892,33 @@ }, { "name": "facebook/webdriver", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/facebook/php-webdriver.git", - "reference": "eadb0b7a7c3e6578185197fd40158b08c3164c83" + "reference": "86b5ca2f67173c9d34340845dd690149c886a605" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/eadb0b7a7c3e6578185197fd40158b08c3164c83", - "reference": "eadb0b7a7c3e6578185197fd40158b08c3164c83", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/86b5ca2f67173c9d34340845dd690149c886a605", + "reference": "86b5ca2f67173c9d34340845dd690149c886a605", "shasum": "" }, "require": { "ext-curl": "*", "ext-zip": "*", - "php": "^5.5 || ~7.0", - "symfony/process": "^2.8 || ^3.1" + "php": "^5.6 || ~7.0", + "symfony/process": "^2.8 || ^3.1 || ^4.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", + "guzzle/guzzle": "^3.4.1", + "php-coveralls/php-coveralls": "^1.0.2", "php-mock/php-mock-phpunit": "^1.1", - "phpunit/phpunit": "4.6.* || ~5.0", - "satooshi/php-coveralls": "^1.0", - "squizlabs/php_codesniffer": "^2.6" + "phpunit/phpunit": "^5.7", + "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", + "squizlabs/php_codesniffer": "^2.6", + "symfony/var-dumper": "^3.3 || ^4.0" }, "type": "library", "extra": { @@ -2821,7 +2943,7 @@ "selenium", "webdriver" ], - "time": "2017-04-28T14:54:49+00:00" + "time": "2017-11-15T11:08:09+00:00" }, { "name": "florianwolters/component-core-stringutils", @@ -2963,6 +3085,56 @@ ], "time": "2013-06-29T12:35:22+00:00" }, + { + "name": "fzaninotto/faker", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", + "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.0 || ^5.0", + "squizlabs/php_codesniffer": "^1.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2017-08-15T16:48:10+00:00" + }, { "name": "graphp/algorithms", "version": "v0.8.1", @@ -2996,7 +3168,7 @@ ], "authors": [ { - "name": "Christian L??ck", + "name": "Christian Lück", "email": "christian@lueck.tv" } ], @@ -3015,7 +3187,7 @@ }, { "name": "guzzle/guzzle", - "version": "3.1.2", + "version": "v3.1.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", @@ -3025,10 +3197,86 @@ "type": "zip", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7901ea7d27373d0cc85eac6f6694e4c2ced90a26", "reference": "7901ea7d27373d0cc85eac6f6694e4c2ced90a26", - "shasum": "25bc38119541c151c455c3140b4dc388d7ec4187" + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.2", + "symfony/event-dispatcher": ">=2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/common": "*", + "monolog/monolog": "1.*", + "phpunit/phpunit": "3.7.*", + "symfony/class-loader": "*", + "zend/zend-cache1": "1.12", + "zend/zend-log1": "1.12", + "zendframework/zend-cache": "2.0.*", + "zendframework/zend-log": "2.0.*" }, "type": "library", - "abandoned": "guzzlehttp/guzzle" + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle\\Tests": "tests/", + "Guzzle": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "abandoned": "guzzlehttp/guzzle", + "time": "2013-01-28T00:07:40+00:00" }, { "name": "instaclick/php-webdriver", @@ -3091,16 +3339,16 @@ }, { "name": "lmc/steward", - "version": "2.2.1", + "version": "2.3.3", "source": { "type": "git", "url": "https://github.com/lmc-eu/steward.git", - "reference": "3d2b203a8576b074a829b639563322dcb53a2668" + "reference": "f40db91e7378a373ada4505932d8ba2d8a4ea04a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lmc-eu/steward/zipball/3d2b203a8576b074a829b639563322dcb53a2668", - "reference": "3d2b203a8576b074a829b639563322dcb53a2668", + "url": "https://api.github.com/repos/lmc-eu/steward/zipball/f40db91e7378a373ada4505932d8ba2d8a4ea04a", + "reference": "f40db91e7378a373ada4505932d8ba2d8a4ea04a", "shasum": "" }, "require": { @@ -3112,10 +3360,10 @@ "facebook/webdriver": "^1.4.0", "florianwolters/component-util-singleton": "0.3.2", "graphp/algorithms": "^0.8.1", - "nette/reflection": "^2.3.2", + "nette/reflection": "^2.4.2", "ondram/ci-detector": "^2.1", "php": "^5.6 || ~7.0", - "phpunit/phpunit": "^5.7", + "phpunit/phpunit": "^5.7.11", "symfony/console": "^3.3.0", "symfony/event-dispatcher": "~3.0", "symfony/filesystem": "~3.0", @@ -3127,8 +3375,8 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", + "php-coveralls/php-coveralls": "^1.0.2", "php-mock/php-mock-phpunit": "~1.0", - "satooshi/php-coveralls": "^1.0", "squizlabs/php_codesniffer": "^2.4.1", "symfony/var-dumper": "^3.2" }, @@ -3155,6 +3403,12 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "LMC s.r.o.", + "homepage": "https://github.com/lmc-eu" + } + ], "description": "Steward - makes Selenium WebDriver + PHPUnit testing easy and robust", "keywords": [ "phpunit", @@ -3162,41 +3416,44 @@ "testing", "webdriver" ], - "time": "2017-06-05T23:56:28+00:00" + "time": "2018-03-12T00:56:44+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -3204,20 +3461,20 @@ "object", "object graph" ], - "time": "2017-04-12T18:52:22+00:00" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "nette/caching", - "version": "v2.5.5", + "version": "v2.5.8", "source": { "type": "git", "url": "https://github.com/nette/caching.git", - "reference": "997d3b9868840da8b51f27565bfe1a8210e94620" + "reference": "7fba7c7ab2585fafb7b31152f2595e1551120555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/caching/zipball/997d3b9868840da8b51f27565bfe1a8210e94620", - "reference": "997d3b9868840da8b51f27565bfe1a8210e94620", + "url": "https://api.github.com/repos/nette/caching/zipball/7fba7c7ab2585fafb7b31152f2595e1551120555", + "reference": "7fba7c7ab2585fafb7b31152f2595e1551120555", "shasum": "" }, "require": { @@ -3264,7 +3521,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "??? Nette Caching: library with easy-to-use API and many cache backends.", + "description": "⏱ Nette Caching: library with easy-to-use API and many cache backends.", "homepage": "https://nette.org", "keywords": [ "cache", @@ -3273,7 +3530,7 @@ "nette", "sqlite" ], - "time": "2017-08-18T15:20:18+00:00" + "time": "2018-03-21T11:04:32+00:00" }, { "name": "nette/finder", @@ -3397,16 +3654,16 @@ }, { "name": "nette/utils", - "version": "v2.4.8", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "f1584033b5af945b470533b466b81a789d532034" + "reference": "183069866dc477fcfbac393ed486aaa6d93d19a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/f1584033b5af945b470533b466b81a789d532034", - "reference": "f1584033b5af945b470533b466b81a789d532034", + "url": "https://api.github.com/repos/nette/utils/zipball/183069866dc477fcfbac393ed486aaa6d93d19a5", + "reference": "183069866dc477fcfbac393ed486aaa6d93d19a5", "shasum": "" }, "require": { @@ -3430,12 +3687,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/loader.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3454,7 +3714,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "???? Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", "homepage": "https://nette.org", "keywords": [ "array", @@ -3472,7 +3732,7 @@ "utility", "validation" ], - "time": "2017-08-20T17:32:29+00:00" + "time": "2018-05-02T17:16:08+00:00" }, { "name": "ondram/ci-detector", @@ -3507,7 +3767,7 @@ ], "authors": [ { - "name": "Ond??ej Machulda", + "name": "Ondřej Machulda", "email": "ondrej.machulda@gmail.com" } ], @@ -3529,16 +3789,16 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -3579,26 +3839,26 @@ "reflection", "static analysis" ], - "time": "2015-12-27T11:43:31+00:00" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.2.2", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.3.0", + "php": "^5.6 || ^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -3624,20 +3884,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-08T06:39:58+00:00" + "time": "2017-11-10T14:09:06+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.3.0", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { @@ -3671,32 +3931,32 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-06-03T08:32:36+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.6", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" }, "type": "library", "extra": { @@ -3734,7 +3994,7 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2018-04-18T13:57:24+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3801,16 +4061,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -3844,7 +4104,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -3938,16 +4198,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.11", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -3983,20 +4243,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27T10:12:30+00:00" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.21", + "version": "5.7.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db" + "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b91adfb64264ddec5a2dee9851f354aa66327db", - "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", "shasum": "" }, "require": { @@ -4020,8 +4280,8 @@ "sebastian/global-state": "^1.1", "sebastian/object-enumerator": "~2.0", "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", - "symfony/yaml": "~2.1|~3.0" + "sebastian/version": "^1.0.6|^2.0.1", + "symfony/yaml": "~2.1|~3.0|~4.0" }, "conflict": { "phpdocumentor/reflection-docblock": "3.0.2" @@ -4065,7 +4325,7 @@ "testing", "xunit" ], - "time": "2017-06-21T08:11:54+00:00" + "time": "2018-02-01T05:50:59+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4690,16 +4950,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.0.2", + "version": "3.2.3", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51" + "reference": "4842476c434e375f9d3182ff7b89059583aa8b27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/c7594a88ae75401e8f8d0bd4deb8431b39045c51", - "reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4842476c434e375f9d3182ff7b89059583aa8b27", + "reference": "4842476c434e375f9d3182ff7b89059583aa8b27", "shasum": "" }, "require": { @@ -4709,7 +4969,7 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ "bin/phpcs", @@ -4737,27 +4997,27 @@ "phpcs", "standards" ], - "time": "2017-07-18T01:12:32+00:00" + "time": "2018-02-20T21:35:23+00:00" }, { "name": "symfony/class-loader", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "9c69968ce57924e9e93550895cd2b0477edf0e19" + "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/9c69968ce57924e9e93550895cd2b0477edf0e19", - "reference": "9c69968ce57924e9e93550895cd2b0477edf0e19", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/e63c12699822bb3b667e7216ba07fbcc3a3e203e", + "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, "require-dev": { - "symfony/finder": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0|~4.0", "symfony/polyfill-apcu": "~1.1" }, "suggest": { @@ -4766,7 +5026,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -4793,34 +5053,35 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/config", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "6ac0cc1f047c1dbc058fc25b7a4d91b068ed4488" + "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/6ac0cc1f047c1dbc058fc25b7a4d91b068ed4488", - "reference": "6ac0cc1f047c1dbc058fc25b7a4d91b068ed4488", + "url": "https://api.github.com/repos/symfony/config/zipball/7c2a9d44f4433863e9bca682e7f03609234657f9", + "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0" + "symfony/filesystem": "~2.8|~3.0|~4.0" }, "conflict": { "symfony/dependency-injection": "<3.3", "symfony/finder": "<3.3" }, "require-dev": { - "symfony/dependency-injection": "~3.3", - "symfony/finder": "~3.3", - "symfony/yaml": "~3.0" + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -4828,7 +5089,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -4855,20 +5116,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-08-03T08:59:45+00:00" + "time": "2018-03-19T22:32:39+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "2ac658972626c75cbde7b0067c84b988170a6907" + "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/2ac658972626c75cbde7b0067c84b988170a6907", - "reference": "2ac658972626c75cbde7b0067c84b988170a6907", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54ff9d78b56429f9a1ac12e60bfb6d169c0468e3", + "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3", "shasum": "" }, "require": { @@ -4876,17 +5137,18 @@ "psr/container": "^1.0" }, "conflict": { - "symfony/config": "<3.3.1", + "symfony/config": "<3.3.7", "symfony/finder": "<3.3", - "symfony/yaml": "<3.3" + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" }, "provide": { "psr/container-implementation": "1.0" }, "require-dev": { - "symfony/config": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/yaml": "~3.3" + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "symfony/config": "", @@ -4898,7 +5160,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -4925,20 +5187,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-08-28T22:20:37+00:00" + "time": "2018-04-29T14:04:08+00:00" }, { "name": "symfony/filesystem", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb" + "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b32a0e5f928d0fa3d1dd03c78d020777e50c10cb", - "reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/253a4490b528597aa14d2bf5aeded6f5e5e4a541", + "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541", "shasum": "" }, "require": { @@ -4947,7 +5209,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -4974,20 +5236,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-02-22T10:48:49+00:00" }, { "name": "symfony/options-resolver", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6" + "reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ee4e22978fe885b54ee5da8c7964f0a5301abfb6", - "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/f3109a6aedd20e35c3a33190e932c2b063b7b50e", + "reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e", "shasum": "" }, "require": { @@ -4996,7 +5258,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -5028,20 +5290,20 @@ "configuration", "options" ], - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-11T07:56:07+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb" + "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/9a5610a8d6a50985a7be485c0ba745c22607beeb", - "reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/eb17cfa072cab26537ac37e9c4ece6c0361369af", + "reference": "eb17cfa072cab26537ac37e9c4ece6c0361369af", "shasum": "" }, "require": { @@ -5050,7 +5312,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -5077,27 +5339,30 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-02-17T14:55:25+00:00" }, { "name": "symfony/yaml", - "version": "v3.3.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0" + "reference": "033cfa61ef06ee0847e056e530201842b6e926c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1d8c2a99c80862bdc3af94c1781bf70f86bccac0", - "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "url": "https://api.github.com/repos/symfony/yaml/zipball/033cfa61ef06ee0847e056e530201842b6e926c3", + "reference": "033cfa61ef06ee0847e056e530201842b6e926c3", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, + "conflict": { + "symfony/console": "<3.4" + }, "require-dev": { - "symfony/console": "~2.8|~3.0" + "symfony/console": "~3.4|~4.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -5105,7 +5370,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -5132,20 +5397,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-04-08T08:21:29+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { @@ -5182,20 +5447,20 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2018-01-29T19:49:41+00:00" }, { "name": "wimg/php-compatibility", - "version": "8.0.1", + "version": "8.1.0", "source": { "type": "git", "url": "https://github.com/wimg/PHPCompatibility.git", - "reference": "4c4385fb891dff0501009670f988d4fe36785249" + "reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4c4385fb891dff0501009670f988d4fe36785249", - "reference": "4c4385fb891dff0501009670f988d4fe36785249", + "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e", + "reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e", "shasum": "" }, "require": { @@ -5209,7 +5474,7 @@ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1" + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3" }, "type": "phpcodesniffer-standard", "autoload": { @@ -5234,7 +5499,7 @@ "phpcs", "standards" ], - "time": "2017-08-07T19:39:05+00:00" + "time": "2017-12-27T21:58:38+00:00" } ], "aliases": [], @@ -5247,6 +5512,8 @@ }, "prefer-stable": true, "prefer-lowest": false, - "platform": [], + "platform": { + "php": ">=5.6" + }, "platform-dev": [] } diff --git a/config/app.php b/config/app.php index 69bf9504e..a1b753afc 100644 --- a/config/app.php +++ b/config/app.php @@ -6,6 +6,7 @@ use Illuminate\View\ViewServiceProvider; return [ 'name' => env('APP_NAME', 'ProcessMaker'), + 'url' => env('APP_URL', 'http://localhost'), 'env' => env('APP_ENV', 'production'), 'debug' => env('APP_DEBUG', false), 'log' => env('APP_LOG', 'single'), @@ -16,6 +17,8 @@ return [ FilesystemServiceProvider::class, CacheServiceProvider::class, ViewServiceProvider::class, + \Illuminate\Database\DatabaseServiceProvider::class, + ], 'aliases' => [ diff --git a/config/database.php b/config/database.php new file mode 100644 index 000000000..fa9a2db5c --- /dev/null +++ b/config/database.php @@ -0,0 +1,75 @@ + env('DB_CONNECTION', 'workflow'), + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ + 'connections' => [ + 'workflow' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'workflow'), + 'username' => env('DB_USERNAME', 'workflow'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'strict' => true, + 'engine' => null, + ] + ], + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ + 'migrations' => 'migrations', + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer set of commands than a typical key-value systems + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ + 'redis' => [ + 'client' => 'predis', + 'default' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => 0, + ], + ], +]; \ No newline at end of file diff --git a/database/factories/DbSourceFactory.php b/database/factories/DbSourceFactory.php new file mode 100644 index 000000000..ac4ebe6cc --- /dev/null +++ b/database/factories/DbSourceFactory.php @@ -0,0 +1,31 @@ +define(\ProcessMaker\Model\DbSource::class, function(Faker $faker) { + + /** + * @todo Determine if we need more base columns populated + */ + $dbName = $faker->word; + return [ + 'DBS_UID' => G::generateUniqueID(), + 'PRO_UID' => function() { + return factory(\ProcessMaker\Model\Process::class)->create()->PRO_UID; + }, + 'DBS_TYPE' => 'mysql', + 'DBS_SERVER' => $faker->localIpv4, + 'DBS_DATABASE_NAME' => $faker->word, + 'DBS_USERNAME' => $faker->userName, + /** + * @todo WHY figure out there's a magic value to the encryption here + */ + 'DBS_PASSWORD' => \G::encrypt( $faker->password, $dbName) . "_2NnV3ujj3w", + 'DBS_PORT' => $faker->numberBetween(1000, 9000), + 'DBS_ENCODE' => 'utf8', // @todo Perhaps grab this from our definitions in DbConnections + 'DBS_CONNECTION_TYPE' => 'NORMAL', // @todo Determine what this value means + 'DBS_TNS' => null // @todo Determine what this value means + ]; +}); \ No newline at end of file diff --git a/database/factories/ProcessFactory.php b/database/factories/ProcessFactory.php new file mode 100644 index 000000000..d8a60d371 --- /dev/null +++ b/database/factories/ProcessFactory.php @@ -0,0 +1,17 @@ +define(\ProcessMaker\Model\Process::class, function(Faker $faker) { + + /** + * @todo Determine if we need more base columns populated + */ + return [ + 'PRO_UID' => G::generateUniqueID(), + 'PRO_TITLE' => $faker->sentence(3), + 'PRO_DESCRIPTION' => $faker->paragraph(3) + ]; +}); \ No newline at end of file diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php index 18e3600b1..b5969bf94 100644 --- a/gulliver/bin/tasks/pakeGulliver.php +++ b/gulliver/bin/tasks/pakeGulliver.php @@ -29,7 +29,6 @@ use ProcessMaker\Plugins\PluginRegistry; - pake_desc('gulliver version'); pake_task('version', 'project_exists'); @@ -58,7 +57,7 @@ pake_task('propel-build-crud', 'project_exists'); /*----------------------------------********---------------------------------*/ pake_desc("check standard code\n args: "); -pake_task('check-standard-code', 'project_exists' ); +pake_task('check-standard-code', 'project_exists'); /*----------------------------------********---------------------------------*/ /** @@ -66,429 +65,450 @@ pake_task('check-standard-code', 'project_exists' ); * access public */ -function run_version($task, $args) { - printf("Gulliver version %s\n", pakeColor::colorize(trim(file_get_contents(PATH_GULLIVER . 'VERSION')), 'INFO')); - exit(0); +function run_version($task, $args) +{ + printf("Gulliver version %s\n", pakeColor::colorize(trim(file_get_contents(PATH_GULLIVER . 'VERSION')), 'INFO')); + exit(0); } -function isUTF8($str) { - if( $str === mb_convert_encoding(mb_convert_encoding($str, "UTF-32", "UTF-8"), "UTF-8", "UTF-32") ) { - return true; - } else { - return false; - } +function isUTF8($str) +{ + if ($str === mb_convert_encoding(mb_convert_encoding($str, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) { + return true; + } else { + return false; + } } -function strip_quotes($text) { - if( ! isUTF8($text) ) - $text = utf8_encode($text); - return str_replace('"', "", $text); +function strip_quotes($text) +{ + if (! isUTF8($text)) { + $text = utf8_encode($text); + } + return str_replace('"', "", $text); } // function for the prompt data read in windows -function prompt_win($text) { - - print $text; - flush(); - ob_flush(); - $read = trim(fgets(STDIN)); - return $read; - +function prompt_win($text) +{ + print $text; + flush(); + ob_flush(); + $read = trim(fgets(STDIN)); + return $read; } -function prompt($text) { - - if( ! (PHP_OS == "WINNT") ) { - printf("$text%s ", pakeColor::colorize(':', 'INFO')); - # 4092 max on win32 fopen +function prompt($text) +{ + if (! (PHP_OS == "WINNT")) { + printf("$text%s ", pakeColor::colorize(':', 'INFO')); + # 4092 max on win32 fopen - //$fp=fopen("php://stdin", "r"); - $fp = fopen("/dev/tty", "r"); - $in = fgets($fp, 4094); - fclose($fp); + //$fp=fopen("php://stdin", "r"); + $fp = fopen("/dev/tty", "r"); + $in = fgets($fp, 4094); + fclose($fp); - # strip newline - (PHP_OS == "WINNT") ? ($read = str_replace("\r\n", "", $in)) : ($read = str_replace("\n", "", $in)); - } else { - $read = prompt_win($text); - } + # strip newline + (PHP_OS == "WINNT") ? ($read = str_replace("\r\n", "", $in)) : ($read = str_replace("\n", "", $in)); + } else { + $read = prompt_win($text); + } - return $read; + return $read; } -function query_sql_file($file, $connection) { - $report = array ( +function query_sql_file($file, $connection) +{ + $report = array( 'SQL_FILE' => $file, - 'errors' => array (), + 'errors' => array(), 'querys' => 0 ); - $content = @fread(@fopen($file, "rt"), @filesize($file)); - if( ! $content ) { - $report['errors'] = "Error reading SQL"; + $content = @fread(@fopen($file, "rt"), @filesize($file)); + if (! $content) { + $report['errors'] = "Error reading SQL"; + return $report; + } + $ret = array(); + for ($i = 0; $i < strlen($content) - 1; $i ++) { + if ($content[$i] == ";") { + if ($content[$i + 1] == "\n") { + $ret[] = substr($content, 0, $i); + $content = substr($content, $i + 1); + $i = 0; + } + } + } + $report['querys'] = count($ret); + foreach ($ret as $qr) { + $re = mysqli_query($connection, $qr); + if (! $re) { + $report['errors'][] = "Query error: " . mysqli_error($connection); + } + } return $report; - } - $ret = array (); - for( $i = 0; $i < strlen($content) - 1; $i ++ ) { - if( $content[$i] == ";" ) { - if( $content[$i + 1] == "\n" ) { - $ret[] = substr($content, 0, $i); - $content = substr($content, $i + 1); - $i = 0; - } - } - } - $report['querys'] = count($ret); - foreach( $ret as $qr ) { - $re = @mysql_query($qr, $connection); - if( ! $re ) { - $report['errors'][] = "Query error: " . mysql_error(); - } - } - return $report; } -function createPngLogo($filePng, $text) { - $im = imagecreatetruecolor(162, 50); - $orange = imagecolorallocate($im, 140, 120, 0); - $white = imagecolorallocate($im, 255, 255, 255); - $black = imagecolorallocate($im, 0, 0, 0); - $grey = imagecolorallocate($im, 100, 100, 100); - $yellow = imagecolorallocatealpha($im, 255, 255, 10, 95); - $red = imagecolorallocatealpha($im, 255, 10, 10, 95); - $blue = imagecolorallocatealpha($im, 10, 10, 255, 95); - $transparent = imagecolorallocatealpha($im, 0, 0, 0, 127); +function createPngLogo($filePng, $text) +{ + $im = imagecreatetruecolor(162, 50); + $orange = imagecolorallocate($im, 140, 120, 0); + $white = imagecolorallocate($im, 255, 255, 255); + $black = imagecolorallocate($im, 0, 0, 0); + $grey = imagecolorallocate($im, 100, 100, 100); + $yellow = imagecolorallocatealpha($im, 255, 255, 10, 95); + $red = imagecolorallocatealpha($im, 255, 10, 10, 95); + $blue = imagecolorallocatealpha($im, 10, 10, 255, 95); + $transparent = imagecolorallocatealpha($im, 0, 0, 0, 127); - imagefill($im, 0, 0, $white); - imagestring($im, 4, 50, 14, $text, $orange); + imagefill($im, 0, 0, $white); + imagestring($im, 4, 50, 14, $text, $orange); - // drawing 3 overlapped circle - imagefilledellipse($im, 25, 20, 27, 25, $yellow); - imagefilledellipse($im, 15, 30, 27, 25, $red); - imagefilledellipse($im, 30, 30, 27, 25, $blue); + // drawing 3 overlapped circle + imagefilledellipse($im, 25, 20, 27, 25, $yellow); + imagefilledellipse($im, 15, 30, 27, 25, $red); + imagefilledellipse($im, 30, 30, 27, 25, $blue); - imagefill($im, 0, 0, $transparent); - imagesavealpha($im, true); - imagepng($im, $filePng); - - $aux = explode(PATH_SEP, $filePng); - $auxName = $aux[count($aux) - 2] . PATH_SEP . $aux[count($aux) - 1]; - $iSize = filesize($filePng); - printf("saved %s bytes in file %s [%s]\n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($auxName, 'INFO'), pakeColor::colorize($aux[count($aux) - 1], 'INFO')); + imagefill($im, 0, 0, $transparent); + imagesavealpha($im, true); + imagepng($im, $filePng); + $aux = explode(PATH_SEP, $filePng); + $auxName = $aux[count($aux) - 2] . PATH_SEP . $aux[count($aux) - 1]; + $iSize = filesize($filePng); + printf("saved %s bytes in file %s [%s]\n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($auxName, 'INFO'), pakeColor::colorize($aux[count($aux) - 1], 'INFO')); } -function run_generate_unit_test_class($task, $args) { - //the class filename in the first argument - $class = $args[0]; +function run_generate_unit_test_class($task, $args) +{ + //the class filename in the first argument + $class = $args[0]; + + //try to find the class in classes directory + $classFilename = PATH_CORE . 'classes' . PATH_SEP . 'class.' . $args[0] . '.php'; + if (file_exists($classFilename)) { + printf("class found in %s \n", pakeColor::colorize($classFilename, 'INFO')); + } else { + printf("class %s not found \n", pakeColor::colorize($class, 'ERROR')); + exit(0); + } + + include('test' . PATH_SEP . 'bootstrap' . PATH_SEP . 'unit.php'); + + + require_once($classFilename); + + $unitFilename = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . 'unitTest.tpl'; + + $smarty = new Smarty(); + + $smarty->template_dir = PATH_GULLIVER . 'bin' . PATH_SEP . 'tasks'; + $smarty->compile_dir = PATH_SMARTY_C; + $smarty->cache_dir = PATH_SMARTY_CACHE; + $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs'; + + printf("using unit file in %s \n", pakeColor::colorize($unitFilename, 'INFO')); + $smarty->assign('className', ucwords($class)); + $smarty->assign('classFile', $class); + + //get the method list + $reflect = new ReflectionClass($class); + $methods = array(); + $testItems = 0; + foreach ($reflect->getMethods() as $reflectmethod) { + $params = ''; + foreach ($reflectmethod->getParameters() as $key => $row) { + if ($params != '') { + $params .= ', '; + } + $params .= '$' . $row->name; + } + $testItems ++; + $methods[$reflectmethod->getName()] = $params; + } + + $smarty->assign('methods', $methods); + $smarty->assign('testItems', (count($methods) * 2) + 3); + $smarty->assign('cantMethods', count($methods)); + // $smarty->assign('llave', '{' ); + + + // fetch smarty output + $content = $smarty->fetch($unitFilename); + + //saving the content in the output file + if (defined('MAIN_POFILE') && MAIN_POFILE != '') { + $unitFilename = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . MAIN_POFILE . PATH_SEP . 'class' . ucwords($class) . 'Test.php'; + } else { + $unitFilename = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'class' . ucwords($class) . 'Test.php'; + } + printf("creating unit file in %s \n", pakeColor::colorize($unitFilename, 'INFO')); + $fp = fopen($unitFilename, 'w'); + fprintf($fp, $content); + fclose($fp); - //try to find the class in classes directory - $classFilename = PATH_CORE . 'classes' . PATH_SEP . 'class.' . $args[0] . '.php'; - if( file_exists($classFilename) ) - printf("class found in %s \n", pakeColor::colorize($classFilename, 'INFO')); - else { - printf("class %s not found \n", pakeColor::colorize($class, 'ERROR')); exit(0); - } - - include ('test' . PATH_SEP . 'bootstrap' . PATH_SEP . 'unit.php'); - - - require_once ($classFilename); - - $unitFilename = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . 'unitTest.tpl'; - - $smarty = new Smarty(); - - $smarty->template_dir = PATH_GULLIVER . 'bin' . PATH_SEP . 'tasks'; - $smarty->compile_dir = PATH_SMARTY_C; - $smarty->cache_dir = PATH_SMARTY_CACHE; - $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs'; - - printf("using unit file in %s \n", pakeColor::colorize($unitFilename, 'INFO')); - $smarty->assign('className', ucwords($class)); - $smarty->assign('classFile', $class); - - //get the method list - $reflect = new ReflectionClass($class); - $methods = array (); - $testItems = 0; - foreach( $reflect->getMethods() as $reflectmethod ) { - $params = ''; - foreach( $reflectmethod->getParameters() as $key => $row ) { - if( $params != '' ) - $params .= ', '; - $params .= '$' . $row->name; - } - $testItems ++; - $methods[$reflectmethod->getName()] = $params; - } - - $smarty->assign('methods', $methods); - $smarty->assign('testItems', (count($methods) * 2) + 3); - $smarty->assign('cantMethods', count($methods)); - // $smarty->assign('llave', '{' ); - - - // fetch smarty output - $content = $smarty->fetch($unitFilename); - - //saving the content in the output file - if( defined('MAIN_POFILE') && MAIN_POFILE != '' ) - $unitFilename = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . MAIN_POFILE . PATH_SEP . 'class' . ucwords($class) . 'Test.php'; - else - $unitFilename = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'class' . ucwords($class) . 'Test.php'; - printf("creating unit file in %s \n", pakeColor::colorize($unitFilename, 'INFO')); - $fp = fopen($unitFilename, 'w'); - fprintf($fp, $content); - fclose($fp); - - exit(0); } -function convertPhpName($f) { - $upper = true; - $res = ''; - for( $i = 0; $i < strlen($f); $i ++ ) { - $car = substr($f, $i, 1); - if( $car == '_' ) - $upper = true; - else { - if( $upper ) { - $res .= strtoupper($car); - $upper = false; - } else - $res .= strtolower($car); +function convertPhpName($f) +{ + $upper = true; + $res = ''; + for ($i = 0; $i < strlen($f); $i ++) { + $car = substr($f, $i, 1); + if ($car == '_') { + $upper = true; + } else { + if ($upper) { + $res .= strtoupper($car); + $upper = false; + } else { + $res .= strtolower($car); + } + } } - } - return $res; + return $res; } -function copyPluginFile($tplName, $fName, $class) { - $pluginOutDirectory = PATH_OUTTRUNK . "plugins" . PATH_SEP . $class . PATH_SEP; - $pluginFilename = $pluginOutDirectory . $fName; +function copyPluginFile($tplName, $fName, $class) +{ + $pluginOutDirectory = PATH_OUTTRUNK . "plugins" . PATH_SEP . $class . PATH_SEP; + $pluginFilename = $pluginOutDirectory . $fName; - $fileTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; - $content = file_get_contents($fileTpl); - $iSize = file_put_contents($pluginFilename, $content); - printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO')); + $fileTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; + $content = file_get_contents($fileTpl); + $iSize = file_put_contents($pluginFilename, $content); + printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO')); } function savePluginFile($fName, $tplName, $class, $tableName, $fields = null, $utf8 = false) { - $pluginOutDirectory = PATH_OUTTRUNK . "plugins" . PATH_SEP . $class . PATH_SEP; - $pluginFilename = $pluginOutDirectory . $fName; + $pluginOutDirectory = PATH_OUTTRUNK . "plugins" . PATH_SEP . $class . PATH_SEP; + $pluginFilename = $pluginOutDirectory . $fName; - $pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; - $template = new TemplatePower($pluginTpl); - $template->prepare(); - $template->assign('className', $class); - $template->assign('tableName', $tableName); - $template->assign('menuId', 'ID_' . strtoupper($class)); + $pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; + $template = new TemplatePower($pluginTpl); + $template->prepare(); + $template->assign('className', $class); + $template->assign('tableName', $tableName); + $template->assign('menuId', 'ID_' . strtoupper($class)); - if( is_array($fields) ) { - foreach( $fields as $block => $data ) { - $template->gotoBlock("_ROOT"); - if( is_array($data) ) - foreach( $data as $rowId => $row ) { - $template->newBlock($block); - foreach( $row as $key => $val ) - $template->assign($key, $val); + if (is_array($fields)) { + foreach ($fields as $block => $data) { + $template->gotoBlock("_ROOT"); + if (is_array($data)) { + foreach ($data as $rowId => $row) { + $template->newBlock($block); + foreach ($row as $key => $val) { + $template->assign($key, $val); + } + } + } else { + $template->assign($block, $data); + } } - else - $template->assign($block, $data); } - } - $content = $template->getOutputContent(); - $iSize = file_put_contents($pluginFilename, $content); + $content = $template->getOutputContent(); + $iSize = file_put_contents($pluginFilename, $content); if ($utf8) { //add BOM utf-8 - $fp = fopen($pluginFilename,"wb"); - fwrite($fp,pack("CCC",0xef,0xbb,0xbf) . $content); + $fp = fopen($pluginFilename, "wb"); + fwrite($fp, pack("CCC", 0xef, 0xbb, 0xbf) . $content); fclose($fp); } - printf("saved %s bytes in file %s [%s]\n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($fName, 'INFO'), pakeColor::colorize($tplName, 'INFO')); + printf("saved %s bytes in file %s [%s]\n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($fName, 'INFO'), pakeColor::colorize($tplName, 'INFO')); } -function run_generate_crud($task, $args) { - ini_set('display_errors', 'on'); - ini_set('error_reporting', E_ERROR); +function run_generate_crud($task, $args) +{ + ini_set('display_errors', 'on'); + ini_set('error_reporting', E_ERROR); - // the environment for poedit always is Development - define('G_ENVIRONMENT', G_DEV_ENV); + // the environment for poedit always is Development + define('G_ENVIRONMENT', G_DEV_ENV); - //the class filename in the first argument - if( ! isset($args[0]) ) { - printf("Error: %s\n", pakeColor::colorize('you must specify a valid classname ', 'ERROR')); - exit(0); - } - $class = $args[0]; - //second parameter is the table name, by default is the same classname in uppercase. - $tableName = isset($args[1]) ? $args[1] : strtoupper($class); + //the class filename in the first argument + if (! isset($args[0])) { + printf("Error: %s\n", pakeColor::colorize('you must specify a valid classname ', 'ERROR')); + exit(0); + } + $class = $args[0]; + //second parameter is the table name, by default is the same classname in uppercase. + $tableName = isset($args[1]) ? $args[1] : strtoupper($class); - //try to find the class in classes directory - $classFilename = PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . $args[0] . '.php'; - if( file_exists($classFilename) ) - printf("class found in %s \n", pakeColor::colorize($classFilename, 'INFO')); - else { - printf("class %s not found \n", pakeColor::colorize($class, 'ERROR')); - exit(0); - } + //try to find the class in classes directory + $classFilename = PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . $args[0] . '.php'; + if (file_exists($classFilename)) { + printf("class found in %s \n", pakeColor::colorize($classFilename, 'INFO')); + } else { + printf("class %s not found \n", pakeColor::colorize($class, 'ERROR')); + exit(0); + } - require_once ($classFilename); + require_once($classFilename); - Propel::init(PATH_CORE . "config/databases.php"); + Propel::init(PATH_CORE . "config/databases.php"); - $configuration = Propel::getConfiguration(); - $connectionDSN = $configuration['datasources']['workflow']['connection']; - printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); + $configuration = Propel::getConfiguration(); + $connectionDSN = $configuration['datasources']['workflow']['connection']; + printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); - $dirs = explode(PATH_SEP, PATH_HOME); - print_r($dirs); - $projectName = $dirs[count($dirs) - 1]; + $dirs = explode(PATH_SEP, PATH_HOME); + print_r($dirs); + $projectName = $dirs[count($dirs) - 1]; - // if ( strlen ( trim( $projectName) ) == 0 ) { - // printf("Project name not found \n", pakeColor::colorize( $class, 'ERROR')); - // exit (0); - // } + // if ( strlen ( trim( $projectName) ) == 0 ) { + // printf("Project name not found \n", pakeColor::colorize( $class, 'ERROR')); + // exit (0); + // } - // printf("using Project Name %s \n", pakeColor::colorize( $projectName, 'INFO')); + // printf("using Project Name %s \n", pakeColor::colorize( $projectName, 'INFO')); - // $pluginDirectory = PATH_PLUGINS . $class; - // $pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $class; - // - // G::verifyPath ( $pluginOutDirectory, true ); - // G::verifyPath ( $pluginOutDirectory. PATH_SEP . $class, $pluginDirectory ); + // $pluginDirectory = PATH_PLUGINS . $class; + // $pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $class; + // + // G::verifyPath ( $pluginOutDirectory, true ); + // G::verifyPath ( $pluginOutDirectory. PATH_SEP . $class, $pluginDirectory ); - //G::verifyPath ( $pluginDirectory, true ); + //G::verifyPath ( $pluginDirectory, true ); - // //main php file - // savePluginFile ( $class . '.php', 'pluginMainFile', $class, $tableName ); + // //main php file + // savePluginFile ( $class . '.php', 'pluginMainFile', $class, $tableName ); - //menu - savePluginFile($class . PATH_SEP . 'menu' . $class . '.php', 'pluginMenu', $class, $tableName); + //menu + savePluginFile($class . PATH_SEP . 'menu' . $class . '.php', 'pluginMenu', $class, $tableName); - //default list - savePluginFile($class . PATH_SEP . $class . 'List.php', 'pluginList', $class, $tableName); + //default list + savePluginFile($class . PATH_SEP . $class . 'List.php', 'pluginList', $class, $tableName); - //parse the schema file in order to get Table definition - $schemaFile = PATH_CORE . 'config' . PATH_SEP . 'schema.xml'; - $xmlContent = file_get_contents($schemaFile); - $s = simplexml_load_file($schemaFile); + //parse the schema file in order to get Table definition + $schemaFile = PATH_CORE . 'config' . PATH_SEP . 'schema.xml'; + $xmlContent = file_get_contents($schemaFile); + $s = simplexml_load_file($schemaFile); - //default xmlform - //load the $fields array with fields data for an xmlform. - $fields = array (); - foreach( $s->table as $key => $table ) { - if( $table['name'] == $tableName ) - foreach( $table->column as $kc => $column ) { - //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; - //print "\n"; - $maxlength = $column['size']; - $size = ($maxlength > 60) ? 60 : $maxlength; - $type = $column['type']; - $field = array ( + //default xmlform + //load the $fields array with fields data for an xmlform. + $fields = array(); + foreach ($s->table as $key => $table) { + if ($table['name'] == $tableName) { + foreach ($table->column as $kc => $column) { + //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; + //print "\n"; + $maxlength = $column['size']; + $size = ($maxlength > 60) ? 60 : $maxlength; + $type = $column['type']; + $field = array( 'name' => $column['name'], 'type' => $type, 'size' => $size, 'maxlength' => $maxlength ); - $fields['fields'][] = $field; - } - } - savePluginFile($class . PATH_SEP . $class . '.xml', 'pluginXmlform', $class, $tableName, $fields); + $fields['fields'][] = $field; + } + } + } + savePluginFile($class . PATH_SEP . $class . '.xml', 'pluginXmlform', $class, $tableName, $fields); - die(); - //xmlform for list - //load the $fields array with fields data for PagedTable xml. - $fields = array (); - $primaryKey = ''; - foreach( $s->table as $key => $table ) { - if( $table['name'] == $tableName ) - foreach( $table->column as $kc => $column ) { - //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; - //print "\n"; - $size = ($column['size'] > 30) ? 30 : $column['size']; - $type = $column['type']; - if( $column['primaryKey'] ) - if( $primaryKey == '' ) - $primaryKey .= '@@' . $column['name']; - else - $primaryKey .= '|@@' . $column['name']; + die(); + //xmlform for list + //load the $fields array with fields data for PagedTable xml. + $fields = array(); + $primaryKey = ''; + foreach ($s->table as $key => $table) { + if ($table['name'] == $tableName) { + foreach ($table->column as $kc => $column) { + //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; + //print "\n"; + $size = ($column['size'] > 30) ? 30 : $column['size']; + $type = $column['type']; + if ($column['primaryKey']) { + if ($primaryKey == '') { + $primaryKey .= '@@' . $column['name']; + } else { + $primaryKey .= '|@@' . $column['name']; + } + } - $field = array ( + $field = array( 'name' => $column['name'], 'type' => $type, 'size' => $size ); - $fields['fields'][] = $field; - } - } - $fields['primaryKey'] = $primaryKey; - savePluginFile($class . PATH_SEP . $class . 'List.xml', 'pluginXmlformList', $class, $tableName, $fields); + $fields['fields'][] = $field; + } + } + } + $fields['primaryKey'] = $primaryKey; + savePluginFile($class . PATH_SEP . $class . 'List.xml', 'pluginXmlformList', $class, $tableName, $fields); - //default edit - $fields = array (); - $index = 0; - $keylist = ''; - foreach( $s->table as $key => $table ) { - if( $table['name'] == $tableName ) - foreach( $table->column as $kc => $column ) { - $name = $column['name']; - $phpName = convertPhpName($name); - $field = array ( + //default edit + $fields = array(); + $index = 0; + $keylist = ''; + foreach ($s->table as $key => $table) { + if ($table['name'] == $tableName) { + foreach ($table->column as $kc => $column) { + $name = $column['name']; + $phpName = convertPhpName($name); + $field = array( 'name' => $name, 'phpName' => $phpName, 'index' => $index ++ ); - if( $column['primaryKey'] ) { - if( $keylist == '' ) - $keylist .= '$' . $phpName; - else - $keylist .= ', $' . $phpName; - $fields['keys'][] = $field; - //$index++; + if ($column['primaryKey']) { + if ($keylist == '') { + $keylist .= '$' . $phpName; + } else { + $keylist .= ', $' . $phpName; + } + $fields['keys'][] = $field; + //$index++; + } + $fields['fields'][] = $field; + $fields['fields2'][] = $field; + } } - $fields['fields'][] = $field; - $fields['fields2'][] = $field; - } - } - $fields['keylist'] = $keylist; - savePluginFile($class . PATH_SEP . $class . 'Edit.php', 'pluginEdit', $class, $tableName, $fields); - savePluginFile($class . PATH_SEP . $class . 'Save.php', 'pluginSave', $class, $tableName, $fields); + } + $fields['keylist'] = $keylist; + savePluginFile($class . PATH_SEP . $class . 'Edit.php', 'pluginEdit', $class, $tableName, $fields); + savePluginFile($class . PATH_SEP . $class . 'Save.php', 'pluginSave', $class, $tableName, $fields); - if( ! PHP_OS == "WINNT" ) { - printf("creting symlinks %s \n", pakeColor::colorize($pluginDirectory, 'INFO')); - symlink($pluginOutDirectory . PATH_SEP . $class . '.php', PATH_PLUGINS . $class . '.php'); - symlink($pluginOutDirectory . PATH_SEP . $class, $pluginDirectory); - } - exit(0); + if (! PHP_OS == "WINNT") { + printf("creting symlinks %s \n", pakeColor::colorize($pluginDirectory, 'INFO')); + symlink($pluginOutDirectory . PATH_SEP . $class . '.php', PATH_PLUGINS . $class . '.php'); + symlink($pluginOutDirectory . PATH_SEP . $class, $pluginDirectory); + } + exit(0); } -function addTarFolder($tar, $pathBase, $pluginHome) { - $aux = explode(PATH_SEP, $pathBase); - //print $aux[count($aux) -2 ] . "\n"; - if( $aux[count($aux) - 2] == '.svn' ) - return; - - if( $handle = opendir($pathBase) ) { - while( false !== ($file = readdir($handle)) ) { - if( is_file($pathBase . $file) ) { - //print "file $file \n"; - $tar->addModify($pathBase . $file, '', $pluginHome); - } - if( is_dir($pathBase . $file) && $file != '..' && $file != '.' ) { - //print "dir $pathBase$file \n"; - addTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome); - } +function addTarFolder($tar, $pathBase, $pluginHome) +{ + $aux = explode(PATH_SEP, $pathBase); + //print $aux[count($aux) -2 ] . "\n"; + if ($aux[count($aux) - 2] == '.svn') { + return; + } + + if ($handle = opendir($pathBase)) { + while (false !== ($file = readdir($handle))) { + if (is_file($pathBase . $file)) { + //print "file $file \n"; + $tar->addModify($pathBase . $file, '', $pluginHome); + } + if (is_dir($pathBase . $file) && $file != '..' && $file != '.') { + //print "dir $pathBase$file \n"; + addTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome); + } + } + closedir($handle); } - closedir($handle); - } } function run_pack_plugin($task, $args) @@ -544,158 +564,160 @@ function run_pack_plugin($task, $args) printf("Filesize %s Kb \n", pakeColor::colorize($filesize, 'INFO')); } -function run_new_plugin($task, $args) { - ini_set('display_errors', 'on'); - ini_set('error_reporting', E_ERROR); +function run_new_plugin($task, $args) +{ + ini_set('display_errors', 'on'); + ini_set('error_reporting', E_ERROR); - // the environment for poedit always is Development - define('G_ENVIRONMENT', G_DEV_ENV); + // the environment for poedit always is Development + define('G_ENVIRONMENT', G_DEV_ENV); - //the plugin name in the first argument - if( ! isset($args[0]) ) { - printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR')); - exit(0); - } - $pluginName = $args[0]; + //the plugin name in the first argument + if (! isset($args[0])) { + printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR')); + exit(0); + } + $pluginName = $args[0]; - Propel::init(PATH_CORE . "config/databases.php"); - $configuration = Propel::getConfiguration(); - $connectionDSN = $configuration['datasources']['workflow']['connection']; - printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); + Propel::init(PATH_CORE . "config/databases.php"); + $configuration = Propel::getConfiguration(); + $connectionDSN = $configuration['datasources']['workflow']['connection']; + printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); - $pluginDirectory = PATH_PLUGINS . $pluginName; - $pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName; - $pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName . PATH_SEP . $pluginName; + $pluginDirectory = PATH_PLUGINS . $pluginName; + $pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName; + $pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName . PATH_SEP . $pluginName; - //verify if plugin exists, and then ask for overwrite - $pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php'; - if( is_file($pluginClassFilename) ) { - printf("The plugin %s exists in this file %s \n", pakeColor::colorize($pluginName, 'ERROR'), pakeColor::colorize($pluginClassFilename, 'INFO')); - $overwrite = strtolower(prompt('Do you want to create a new plugin? [Y/n]')); - if( $overwrite == 'n' ) - die(); - } + //verify if plugin exists, and then ask for overwrite + $pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php'; + if (is_file($pluginClassFilename)) { + printf("The plugin %s exists in this file %s \n", pakeColor::colorize($pluginName, 'ERROR'), pakeColor::colorize($pluginClassFilename, 'INFO')); + $overwrite = strtolower(prompt('Do you want to create a new plugin? [Y/n]')); + if ($overwrite == 'n') { + die(); + } + } - printf("creating plugin directory %s \n", pakeColor::colorize($pluginOutDirectory, 'INFO')); + printf("creating plugin directory %s \n", pakeColor::colorize($pluginOutDirectory, 'INFO')); - G::verifyPath($pluginOutDirectory, true); - G::verifyPath($pluginHome . PATH_SEP . 'classes', true); - G::verifyPath($pluginHome . PATH_SEP . 'public_html', true); - G::verifyPath($pluginHome . PATH_SEP . 'config', true); - G::verifyPath($pluginHome . PATH_SEP . 'data', true); + G::verifyPath($pluginOutDirectory, true); + G::verifyPath($pluginHome . PATH_SEP . 'classes', true); + G::verifyPath($pluginHome . PATH_SEP . 'public_html', true); + G::verifyPath($pluginHome . PATH_SEP . 'config', true); + G::verifyPath($pluginHome . PATH_SEP . 'data', true); - //config - savePluginFile($pluginName . PATH_SEP . "setup.xml", "pluginSetup.xml", $pluginName, $pluginName); - savePluginFile($pluginName . PATH_SEP . "messageShow.xml", "pluginMessageShow.xml", $pluginName, $pluginName); - savePluginFile($pluginName . PATH_SEP . 'config' . PATH_SEP . 'schema.xml', 'pluginSchema.xml', $pluginName, $pluginName); - savePluginFile($pluginName . PATH_SEP . 'config' . PATH_SEP . 'propel.ini', 'pluginPropel.ini', $pluginName, $pluginName); - savePluginFile($pluginName . PATH_SEP . 'config' . PATH_SEP . 'propel.mysql.ini', 'pluginPropel.mysql.ini', $pluginName, $pluginName); + //config + savePluginFile($pluginName . PATH_SEP . "setup.xml", "pluginSetup.xml", $pluginName, $pluginName); + savePluginFile($pluginName . PATH_SEP . "messageShow.xml", "pluginMessageShow.xml", $pluginName, $pluginName); + savePluginFile($pluginName . PATH_SEP . 'config' . PATH_SEP . 'schema.xml', 'pluginSchema.xml', $pluginName, $pluginName); + savePluginFile($pluginName . PATH_SEP . 'config' . PATH_SEP . 'propel.ini', 'pluginPropel.ini', $pluginName, $pluginName); + savePluginFile($pluginName . PATH_SEP . 'config' . PATH_SEP . 'propel.mysql.ini', 'pluginPropel.mysql.ini', $pluginName, $pluginName); - //create a logo to use instead the Workspace logo - $changeLogo = strtolower(prompt('Change system logo [y/N]')); + //create a logo to use instead the Workspace logo + $changeLogo = strtolower(prompt('Change system logo [y/N]')); - $fields = array (); - $fields['phpClassName'] = $pluginName; - if( $changeLogo == 'y' ) { - $filePng = $pluginHome . PATH_SEP . 'public_html' . PATH_SEP . $pluginName . '.png'; - createPngLogo($filePng, $pluginName); - $fields['changeLogo'][] = array ( + $fields = array(); + $fields['phpClassName'] = $pluginName; + if ($changeLogo == 'y') { + $filePng = $pluginHome . PATH_SEP . 'public_html' . PATH_SEP . $pluginName . '.png'; + createPngLogo($filePng, $pluginName); + $fields['changeLogo'][] = array( 'className' => $pluginName ); - } + } - //Menu - $menu = strtolower(prompt('Create an example Page [Y/n]')); - $swMenu = 0; + //Menu + $menu = strtolower(prompt('Create an example Page [Y/n]')); + $swMenu = 0; - if( $menu == 'y' ) { - $fields['menu'][] = array ( + if ($menu == 'y') { + $fields['menu'][] = array( 'className' => $pluginName ); - savePluginFile($pluginName . PATH_SEP . 'menu' . $pluginName . '.php', 'pluginMenu', $pluginName, $pluginName, $fields, true); + savePluginFile($pluginName . PATH_SEP . 'menu' . $pluginName . '.php', 'pluginMenu', $pluginName, $pluginName, $fields, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.php", "pluginApplication.php", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.html", "pluginApplication.html", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.js", "pluginApplication.js", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "ApplicationAjax.php", "pluginApplicationAjax.php", $pluginName, $pluginName); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.php", "pluginApplication.php", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.html", "pluginApplication.html", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.js", "pluginApplication.js", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "ApplicationAjax.php", "pluginApplicationAjax.php", $pluginName, $pluginName); - $swMenu = 1; - } + $swMenu = 1; + } - //Menu cases - $menuCases = strtolower(prompt("Create new option in the menu of cases [Y/n]")); + //Menu cases + $menuCases = strtolower(prompt("Create new option in the menu of cases [Y/n]")); - if($menuCases == "y") { - $fields["menuCases"][] = array ( + if ($menuCases == "y") { + $fields["menuCases"][] = array( "className" => $pluginName ); - savePluginFile($pluginName . PATH_SEP . "menuCases" . $pluginName . ".php", "pluginMenuCases", $pluginName, $pluginName, $fields, true); + savePluginFile($pluginName . PATH_SEP . "menuCases" . $pluginName . ".php", "pluginMenuCases", $pluginName, $pluginName, $fields, true); - if ($swMenu == 0) { - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.php", "pluginApplication.php", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.html", "pluginApplication.html", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.js", "pluginApplication.js", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "ApplicationAjax.php", "pluginApplicationAjax.php", $pluginName, $pluginName, null, true); + if ($swMenu == 0) { + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.php", "pluginApplication.php", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.html", "pluginApplication.html", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application.js", "pluginApplication.js", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "ApplicationAjax.php", "pluginApplicationAjax.php", $pluginName, $pluginName, null, true); + } + + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application2.php", "pluginApplication2.php", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application2.html", "pluginApplication2.html", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application2.js", "pluginApplication2.js", $pluginName, $pluginName, null, true); + + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application3.php", "pluginApplication3.php", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application3.html", "pluginApplication3.html", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . $pluginName . "Application3.js", "pluginApplication3.js", $pluginName, $pluginName, null, true); } - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application2.php", "pluginApplication2.php", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application2.html", "pluginApplication2.html", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application2.js", "pluginApplication2.js", $pluginName, $pluginName, null, true); + //RBAC features + $classNameUpperCase = strtoupper($pluginName); + //Create a new Permission a new role + $newPermission = strtolower(prompt("Create the Role 'PROCESSMAKER_$classNameUpperCase' and \n the Permission 'PM_$classNameUpperCase' [y/N]")); + $swRole = 0; - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application3.php", "pluginApplication3.php", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application3.html", "pluginApplication3.html", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . $pluginName . "Application3.js", "pluginApplication3.js", $pluginName, $pluginName, null, true); - } - - //RBAC features - $classNameUpperCase = strtoupper($pluginName); - //Create a new Permission a new role - $newPermission = strtolower(prompt("Create the Role 'PROCESSMAKER_$classNameUpperCase' and \n the Permission 'PM_$classNameUpperCase' [y/N]")); - $swRole = 0; - - if( $newPermission == 'y' ) { - $fields['createPermission'][] = array ( + if ($newPermission == 'y') { + $fields['createPermission'][] = array( 'className' => $classNameUpperCase ); - $swRole = 1; - } + $swRole = 1; + } - //Redirect - if ($swRole == 1) { - $redirect = strtolower(prompt("Create a Redirect Login for the Role 'PROCESSMAKER_$classNameUpperCase' [y/N]")); - if( $redirect == 'y' ) { - $fields['redirectLogin'][] = array ( + //Redirect + if ($swRole == 1) { + $redirect = strtolower(prompt("Create a Redirect Login for the Role 'PROCESSMAKER_$classNameUpperCase' [y/N]")); + if ($redirect == 'y') { + $fields['redirectLogin'][] = array( 'className' => $classNameUpperCase ); + } } - } - //External step - $externalStep = strtolower(prompt('Create external step for Processmaker [y/N]')); - if( $externalStep == 'y' ) { - $fields['externalStep'][] = array ( + //External step + $externalStep = strtolower(prompt('Create external step for Processmaker [y/N]')); + if ($externalStep == 'y') { + $fields['externalStep'][] = array( 'className' => $pluginName, 'GUID' => G::generateUniqueID() ); - savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "Application.php", "pluginStepApplication.php", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "Application.html", "pluginStepApplication.html", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "Application.js", "pluginStepApplication.js", $pluginName, $pluginName, null, true); - savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "ApplicationAjax.php", "pluginStepApplicationAjax.php", $pluginName, $pluginName, null, true); - } + savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "Application.php", "pluginStepApplication.php", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "Application.html", "pluginStepApplication.html", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "Application.js", "pluginStepApplication.js", $pluginName, $pluginName, null, true); + savePluginFile($pluginName . PATH_SEP . "step" . $pluginName . "ApplicationAjax.php", "pluginStepApplicationAjax.php", $pluginName, $pluginName, null, true); + } - //Dashboards - $dashboard = strtolower(prompt("Create an element for the Processmaker Dashboards [y/N]")); - if ($dashboard == "y") { - $fields["dashboard"][] = array( + //Dashboards + $dashboard = strtolower(prompt("Create an element for the Processmaker Dashboards [y/N]")); + if ($dashboard == "y") { + $fields["dashboard"][] = array( "className" => $pluginName ); - $fields["dashboardAttribute"] = "private \$dashletsUids;"; - $fields["dashboardAttributeValue"] = " + $fields["dashboardAttribute"] = "private \$dashletsUids;"; + $fields["dashboardAttributeValue"] = " \$this->dashletsUids = array( array(\"DAS_UID\" => \"". G::GenerateUniqueId() ."\", \"DAS_CLASS\" => \"dashlet" . $pluginName . "\", @@ -706,197 +728,199 @@ function run_new_plugin($task, $args) { \"DAS_UPDATE_DATE\" => date(\"Y-m-d\")) ); "; - $fields["dashboardSetup"] = "\$this->registerDashlets();"; - $fields["dashboardEnable"] = "\$this->dashletInsert();"; - $fields["dashboardDisable"] = "\$this->dashletDelete();"; + $fields["dashboardSetup"] = "\$this->registerDashlets();"; + $fields["dashboardEnable"] = "\$this->dashletInsert();"; + $fields["dashboardDisable"] = "\$this->dashletDelete();"; - G::verifyPath($pluginHome . PATH_SEP . "views", true); + G::verifyPath($pluginHome . PATH_SEP . "views", true); - savePluginFile($pluginName . PATH_SEP . "classes" . PATH_SEP . "class.dashlet". $pluginName . ".php", "pluginDashletClass.php", $pluginName, $pluginName); - copyPluginFile("pluginDashlet.html", $pluginName . PATH_SEP . "views" . PATH_SEP . "dashlet". $pluginName . ".html", $pluginName, null, true); - } + savePluginFile($pluginName . PATH_SEP . "classes" . PATH_SEP . "class.dashlet". $pluginName . ".php", "pluginDashletClass.php", $pluginName, $pluginName); + copyPluginFile("pluginDashlet.html", $pluginName . PATH_SEP . "views" . PATH_SEP . "dashlet". $pluginName . ".html", $pluginName, null, true); + } - //$report = strtolower(prompt('Create a Report for Processmaker [y/N]')); - //if( $report == 'y' ) { - // $fields['report'][] = array ( - // 'className' => $pluginName - // ); - // savePluginFile($pluginName . PATH_SEP . 'report.xml', 'pluginReport.xml', $pluginName, $pluginName, $fields); - //} + //$report = strtolower(prompt('Create a Report for Processmaker [y/N]')); + //if( $report == 'y' ) { + // $fields['report'][] = array ( + // 'className' => $pluginName + // ); + // savePluginFile($pluginName . PATH_SEP . 'report.xml', 'pluginReport.xml', $pluginName, $pluginName, $fields); + //} - $report = strtolower(prompt('Create a PmFunction Class for extending Processmaker [y/N]')); - if( $report == 'y' ) { - $fields['PmFunction'][] = array ( + $report = strtolower(prompt('Create a PmFunction Class for extending Processmaker [y/N]')); + if ($report == 'y') { + $fields['PmFunction'][] = array( 'className' => $pluginName ); - savePluginFile($pluginName . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php', 'class.pmFunctions.php', $pluginName, $pluginName, $fields); - } + savePluginFile($pluginName . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php', 'class.pmFunctions.php', $pluginName, $pluginName, $fields); + } - //main php file - savePluginFile($pluginName . '.php', 'pluginMainFile', $pluginName, $pluginName, $fields); - savePluginFile($pluginName . PATH_SEP . 'class.' . $pluginName . '.php', 'pluginClass', $pluginName, $pluginName, $fields); + //main php file + savePluginFile($pluginName . '.php', 'pluginMainFile', $pluginName, $pluginName, $fields); + savePluginFile($pluginName . PATH_SEP . 'class.' . $pluginName . '.php', 'pluginClass', $pluginName, $pluginName, $fields); - if( ! PHP_OS == "WINNT" ) { - printf("creating symlinks %s \n", pakeColor::colorize($pluginDirectory, 'INFO')); - symlink($pluginOutDirectory . PATH_SEP . $pluginName . '.php', PATH_PLUGINS . $pluginName . '.php'); - symlink($pluginOutDirectory . PATH_SEP . $pluginName, $pluginDirectory); - } + if (! PHP_OS == "WINNT") { + printf("creating symlinks %s \n", pakeColor::colorize($pluginDirectory, 'INFO')); + symlink($pluginOutDirectory . PATH_SEP . $pluginName . '.php', PATH_PLUGINS . $pluginName . '.php'); + symlink($pluginOutDirectory . PATH_SEP . $pluginName, $pluginDirectory); + } - exit(0); + exit(0); } -function run_create_poedit_file($task, $args) { - // the environment for poedit always is Development - define('G_ENVIRONMENT', G_DEV_ENV); +function run_create_poedit_file($task, $args) +{ + // the environment for poedit always is Development + define('G_ENVIRONMENT', G_DEV_ENV); - //the output language .po file - $lgOutId = isset($args[0]) ? $args[0] : 'en'; - $countryOutId = isset($args[1]) ? strtoupper($args[1]) : 'US'; - $verboseFlag = isset($args[2]) ? $args[2] == true : false; + //the output language .po file + $lgOutId = isset($args[0]) ? $args[0] : 'en'; + $countryOutId = isset($args[1]) ? strtoupper($args[1]) : 'US'; + $verboseFlag = isset($args[2]) ? $args[2] == true : false; - Propel::init(PATH_CORE . "config/databases.php"); - $configuration = Propel::getConfiguration(); - $connectionDSN = $configuration['datasources']['propel']['connection']; - printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); + Propel::init(PATH_CORE . "config/databases.php"); + $configuration = Propel::getConfiguration(); + $connectionDSN = $configuration['datasources']['propel']['connection']; + printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); - printf("checking Language table \n"); - $c = new Criteria(); - $c->add(LanguagePeer::LAN_ENABLED, "1"); - $c->addor(LanguagePeer::LAN_ENABLED, "0"); + printf("checking Language table \n"); + $c = new Criteria(); + $c->add(LanguagePeer::LAN_ENABLED, "1"); + $c->addor(LanguagePeer::LAN_ENABLED, "0"); - $languages = LanguagePeer::doSelect($c); - $langs = array (); - $lgIndex = 0; - $findLang = false; - $langDir = 'english'; - $langId = 'en'; - foreach( $languages as $rowid => $row ) { - $lgIndex ++; - $langs[$row->getLanId()] = $row->getLanName(); - if( $lgOutId != '' && $lgOutId == $row->getLanId() ) { - $findLang = true; - $langDir = strtolower($row->getLanName()); - $langId = $row->getLanId(); + $languages = LanguagePeer::doSelect($c); + $langs = array(); + $lgIndex = 0; + $findLang = false; + $langDir = 'english'; + $langId = 'en'; + foreach ($languages as $rowid => $row) { + $lgIndex ++; + $langs[$row->getLanId()] = $row->getLanName(); + if ($lgOutId != '' && $lgOutId == $row->getLanId()) { + $findLang = true; + $langDir = strtolower($row->getLanName()); + $langId = $row->getLanId(); + } } - } - printf("read %s entries from language table\n", pakeColor::colorize($lgIndex, 'INFO')); + printf("read %s entries from language table\n", pakeColor::colorize($lgIndex, 'INFO')); - printf("checking iso_country table \n"); - $c = new Criteria(); - $c->add(IsoCountryPeer::IC_UID, NULL, Criteria::ISNOTNULL); + printf("checking iso_country table \n"); + $c = new Criteria(); + $c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL); - $countries = IsoCountryPeer::doSelect($c); - $countryIndex = 0; - $findCountry = false; - $countryDir = 'UNITED STATES'; - $countryId = 'US'; - foreach( $countries as $rowid => $row ) { - $countryIndex ++; - if( $countryOutId != '' && $countryOutId == $row->getICUid() ) { - $findCountry = true; - $countryDir = strtoupper($row->getICName()); - $countryId = $row->getICUid(); + $countries = IsoCountryPeer::doSelect($c); + $countryIndex = 0; + $findCountry = false; + $countryDir = 'UNITED STATES'; + $countryId = 'US'; + foreach ($countries as $rowid => $row) { + $countryIndex ++; + if ($countryOutId != '' && $countryOutId == $row->getICUid()) { + $findCountry = true; + $countryDir = strtoupper($row->getICName()); + $countryId = $row->getICUid(); + } } - } - printf("read %s entries from iso_country table\n", pakeColor::colorize($countryIndex, 'INFO')); + printf("read %s entries from iso_country table\n", pakeColor::colorize($countryIndex, 'INFO')); - if( $findLang == false && $lgOutId != '' ) { - printf("%s \n", pakeColor::colorize("'$lgOutId' is not a valid language ", 'ERROR')); - die(); - } else { - printf("language: %s\n", pakeColor::colorize($langDir, 'INFO')); - } - - if( $findCountry == false && $countryOutId != '' ) { - printf("%s \n", pakeColor::colorize("'$countryOutId' is not a valid country ", 'ERROR')); - die(); - } else { - printf("country: [%s] %s\n", pakeColor::colorize($countryId, 'INFO'), pakeColor::colorize($countryDir, 'INFO')); - } - - if( $findCountry && $countryId != '' ) - $poeditOutFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $langDir . PATH_SEP . MAIN_POFILE . '.' . $langId . '_' . $countryId . '.po'; - else - $poeditOutFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $langDir . PATH_SEP . MAIN_POFILE . '.' . $langId . '.po'; - - printf("poedit file: %s\n", pakeColor::colorize($poeditOutFile, 'INFO')); - - $poeditOutPathInfo = pathinfo($poeditOutFile); - G::verifyPath($poeditOutPathInfo['dirname'], true); - $lf = "\n"; - $fp = fopen($poeditOutFile, 'w'); - fprintf($fp, "msgid \"\" \n"); - fprintf($fp, "msgstr \"\" \n"); - fprintf($fp, "\"Project-Id-Version: %s\\n\"\n", PO_SYSTEM_VERSION); - fprintf($fp, "\"POT-Creation-Date: \\n\"\n"); - fprintf($fp, "\"PO-Revision-Date: %s \\n\"\n", date('Y-m-d H:i+0100')); - fprintf($fp, "\"Last-Translator: Fernando Ontiveros\\n\"\n"); - fprintf($fp, "\"Language-Team: Colosa Developers Team \\n\"\n"); - fprintf($fp, "\"MIME-Version: 1.0 \\n\"\n"); - fprintf($fp, "\"Content-Type: text/plain; charset=utf-8 \\n\"\n"); - fprintf($fp, "\"Content-Transfer_Encoding: 8bit\\n\"\n"); - fprintf($fp, "\"X-Poedit-Language: %s\\n\"\n", ucwords($langDir)); - fprintf($fp, "\"X-Poedit-Country: %s\\n\"\n", $countryDir); - fprintf($fp, "\"X-Poedit-SourceCharset: utf-8\\n\"\n"); - - printf("checking translation table\n"); - - $c = new Criteria(); - $c->add(TranslationPeer::TRN_LANG, "en"); - - $translation = TranslationPeer::doSelect($c); - $trIndex = 0; - $trError = 0; - $langIdOut = $langId; //the output language, later we'll include the country too. - - - $arrayLabels = array (); - foreach( $translation as $rowid => $row ) { - $keyid = 'TRANSLATION/' . $row->getTrnCategory() . '/' . $row->getTrnId(); - if( trim($row->getTrnValue()) == '' ) { - printf("warning the key %s is empty.\n", pakeColor::colorize($keyid, 'ERROR')); - $trError ++; + if ($findLang == false && $lgOutId != '') { + printf("%s \n", pakeColor::colorize("'$lgOutId' is not a valid language ", 'ERROR')); + die(); } else { - $trans = TranslationPeer::retrieveByPK($row->getTrnCategory(), $row->getTrnId(), $langIdOut); - if( is_null($trans) ) { - $msgStr = $row->getTrnValue(); - } else { - $msgStr = $trans->getTrnValue(); - } - - $msgid = $row->getTrnValue(); - if( in_array($msgid, $arrayLabels) ) { - $newMsgid = '[' . $row->getTrnCategory() . '/' . $row->getTrnId() . '] ' . $msgid; - printf("duplicated key %s is renamed to %s.\n", pakeColor::colorize($msgid, 'ERROR'), pakeColor::colorize($newMsgid, 'INFO')); - $trError ++; - $msgid = $newMsgid; - } - - $arrayLabels[] = $msgid; - sort($arrayLabels); - - $trIndex ++; - fprintf($fp, "\n"); - fprintf($fp, "#: %s \n", $keyid); - //fprintf ( $fp, "#, php-format \n" ); - fprintf($fp, "# %s \n", strip_quotes($keyid)); - fprintf($fp, "msgid \"%s\" \n", strip_quotes($msgid)); - fprintf($fp, "msgstr \"%s\" \n", strip_quotes($msgStr)); + printf("language: %s\n", pakeColor::colorize($langDir, 'INFO')); } - } - printf("checking xmlform\n"); - printf("using directory %s \n", pakeColor::colorize(PATH_XMLFORM, 'INFO')); + if ($findCountry == false && $countryOutId != '') { + printf("%s \n", pakeColor::colorize("'$countryOutId' is not a valid country ", 'ERROR')); + die(); + } else { + printf("country: [%s] %s\n", pakeColor::colorize($countryId, 'INFO'), pakeColor::colorize($countryDir, 'INFO')); + } - $filter = new InputFilter(); + if ($findCountry && $countryId != '') { + $poeditOutFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $langDir . PATH_SEP . MAIN_POFILE . '.' . $langId . '_' . $countryId . '.po'; + } else { + $poeditOutFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $langDir . PATH_SEP . MAIN_POFILE . '.' . $langId . '.po'; + } - $langIdOut = $langId; //the output language, later we'll include the country too. - $exceptionFields = array ( + printf("poedit file: %s\n", pakeColor::colorize($poeditOutFile, 'INFO')); + + $poeditOutPathInfo = pathinfo($poeditOutFile); + G::verifyPath($poeditOutPathInfo['dirname'], true); + $lf = "\n"; + $fp = fopen($poeditOutFile, 'w'); + fprintf($fp, "msgid \"\" \n"); + fprintf($fp, "msgstr \"\" \n"); + fprintf($fp, "\"Project-Id-Version: %s\\n\"\n", PO_SYSTEM_VERSION); + fprintf($fp, "\"POT-Creation-Date: \\n\"\n"); + fprintf($fp, "\"PO-Revision-Date: %s \\n\"\n", date('Y-m-d H:i+0100')); + fprintf($fp, "\"Last-Translator: Fernando Ontiveros\\n\"\n"); + fprintf($fp, "\"Language-Team: Colosa Developers Team \\n\"\n"); + fprintf($fp, "\"MIME-Version: 1.0 \\n\"\n"); + fprintf($fp, "\"Content-Type: text/plain; charset=utf-8 \\n\"\n"); + fprintf($fp, "\"Content-Transfer_Encoding: 8bit\\n\"\n"); + fprintf($fp, "\"X-Poedit-Language: %s\\n\"\n", ucwords($langDir)); + fprintf($fp, "\"X-Poedit-Country: %s\\n\"\n", $countryDir); + fprintf($fp, "\"X-Poedit-SourceCharset: utf-8\\n\"\n"); + + printf("checking translation table\n"); + + $c = new Criteria(); + $c->add(TranslationPeer::TRN_LANG, "en"); + + $translation = TranslationPeer::doSelect($c); + $trIndex = 0; + $trError = 0; + $langIdOut = $langId; //the output language, later we'll include the country too. + + + $arrayLabels = array(); + foreach ($translation as $rowid => $row) { + $keyid = 'TRANSLATION/' . $row->getTrnCategory() . '/' . $row->getTrnId(); + if (trim($row->getTrnValue()) == '') { + printf("warning the key %s is empty.\n", pakeColor::colorize($keyid, 'ERROR')); + $trError ++; + } else { + $trans = TranslationPeer::retrieveByPK($row->getTrnCategory(), $row->getTrnId(), $langIdOut); + if (is_null($trans)) { + $msgStr = $row->getTrnValue(); + } else { + $msgStr = $trans->getTrnValue(); + } + + $msgid = $row->getTrnValue(); + if (in_array($msgid, $arrayLabels)) { + $newMsgid = '[' . $row->getTrnCategory() . '/' . $row->getTrnId() . '] ' . $msgid; + printf("duplicated key %s is renamed to %s.\n", pakeColor::colorize($msgid, 'ERROR'), pakeColor::colorize($newMsgid, 'INFO')); + $trError ++; + $msgid = $newMsgid; + } + + $arrayLabels[] = $msgid; + sort($arrayLabels); + + $trIndex ++; + fprintf($fp, "\n"); + fprintf($fp, "#: %s \n", $keyid); + //fprintf ( $fp, "#, php-format \n" ); + fprintf($fp, "# %s \n", strip_quotes($keyid)); + fprintf($fp, "msgid \"%s\" \n", strip_quotes($msgid)); + fprintf($fp, "msgstr \"%s\" \n", strip_quotes($msgStr)); + } + } + + printf("checking xmlform\n"); + printf("using directory %s \n", pakeColor::colorize(PATH_XMLFORM, 'INFO')); + + $filter = new InputFilter(); + + $langIdOut = $langId; //the output language, later we'll include the country too. + $exceptionFields = array( 'javascript', 'hidden', 'phpvariable', @@ -908,356 +932,374 @@ function run_create_poedit_file($task, $args) { 'grid' ); - $xmlfiles = pakeFinder::type('file')->name('*.xml')->in(PATH_XMLFORM); - $xmlIndex = 0; - $xmlError = 0; - $fieldsIndexTotal = 0; - $exceptIndexTotal = 0; - foreach( $xmlfiles as $xmlfileComplete ) { - $xmlIndex ++; - $xmlfile = str_replace(PATH_XMLFORM, '', $xmlfileComplete); + $xmlfiles = pakeFinder::type('file')->name('*.xml')->in(PATH_XMLFORM); + $xmlIndex = 0; + $xmlError = 0; + $fieldsIndexTotal = 0; + $exceptIndexTotal = 0; + foreach ($xmlfiles as $xmlfileComplete) { + $xmlIndex ++; + $xmlfile = str_replace(PATH_XMLFORM, '', $xmlfileComplete); - //english version of dynaform - $form = new Form($xmlfile, '', 'en'); - $englishLabel = array (); - foreach( $form->fields as $nodeName => $node ) { - if( trim($node->label) != '' ) - $englishLabel[$node->name] = $node->label; - } - unset($form->fields); - unset($form->tree); - unset($form); - - //in this second pass, we are getting the target language labels - $form = new Form($xmlfile, '', $langIdOut); - $fieldsIndex = 0; - $exceptIndex = 0; - foreach( $form->fields as $nodeName => $node ) { - if( is_object($node) && isset($englishLabel[$node->name]) ) { - $msgid = trim($englishLabel[$node->name]); - $node->label = trim(str_replace(chr(10), '', $node->label)); - } else - $msgid = ''; - if( trim($msgid) != '' && ! in_array($node->type, $exceptionFields) ) { - //$msgid = $englishLabel [ $node->name ]; - $keyid = $xmlfile . '?' . $node->name; - if( in_array($msgid, $arrayLabels) ) { - $newMsgid = '[' . $keyid . '] ' . $msgid; - if( $verboseFlag ) - printf("duplicated key %s is renamed to %s.\n", pakeColor::colorize($msgid, 'ERROR'), pakeColor::colorize($newMsgid, 'INFO')); - $xmlError ++; - $msgid = $newMsgid; - } - - $arrayLabels[] = $msgid; - sort($arrayLabels); - - $comment1 = $xmlfile; - $comment2 = $node->type . ' - ' . $node->name; - fprintf($fp, "\n"); - fprintf($fp, "#: %s \n", $keyid); - // fprintf ( $fp, "#, php-format \n" ); - fprintf($fp, "# %s \n", strip_quotes($comment1)); - fprintf($fp, "# %s \n", strip_quotes($comment2)); - fprintf($fp, "msgid \"%s\" \n", strip_quotes($msgid)); - fprintf($fp, "msgstr \"%s\" \n", strip_quotes($node->label)); - //fprintf ( $fp, "msgstr \"%s\" \n", strip_quotes( utf8_encode( trim($node->label) ) )); - $fieldsIndex ++; - $fieldsIndexTotal ++; - } - - else { - $xmlfile = $filter->xssFilterHard($xmlfile); - $exceptionFields = $filter->xssFilterHard($exceptionFields); - if( is_object($node) && ! in_array($node->type, $exceptionFields) ) { - if( isset($node->value) && strpos($node->value, 'G::LoadTranslation') !== false ) { - $exceptIndex ++; - //print ($node->value); - } else { - $node->name = $filter->xssFilterHard($node->name); - $node->type = $filter->xssFilterHard($node->type); - printf("Error: xmlform %s has no english definition for %s [%s]\n", pakeColor::colorize($xmlfile, 'ERROR'), pakeColor::colorize($node->name, 'INFO'), pakeColor::colorize($node->type, 'INFO')); - $xmlError ++; - } - } else { - $exceptIndex ++; - if( $verboseFlag ){ - $node->name = $filter->xssFilterHard($node->name); - $node->type = $filter->xssFilterHard($node->type); - printf("%s %s in %s\n", $node->type, pakeColor::colorize($node->name, 'INFO'), pakeColor::colorize($xmlfile, 'INFO')); - } - } - } - } - unset($form->fields); - unset($form->tree); - unset($form); - printf("xmlform: %s has %s fields and %s exceptions \n", pakeColor::colorize($xmlfile, 'INFO'), pakeColor::colorize($fieldsIndex, 'INFO'), pakeColor::colorize($exceptIndex, 'INFO')); - $exceptIndexTotal += $exceptIndex; - } - - fclose($fp); - printf("added %s entries from translation table\n", pakeColor::colorize($trIndex, 'INFO')); - printf("added %s entries from %s xmlforms \n", pakeColor::colorize($fieldsIndexTotal, 'INFO'), pakeColor::colorize($xmlIndex, 'INFO')); - - if( $trError > 0 ) { - printf("there are %s errors in tranlation table\n", pakeColor::colorize($trError, 'ERROR')); - } - if( $xmlError > 0 ) { - printf("there are %s errors and %s exceptions in xmlforms\n", pakeColor::colorize($xmlError, 'ERROR'), pakeColor::colorize($exceptIndexTotal, 'ERROR')); - } - - exit(0); - -//to do: leer los html templates -} - -function create_file_from_tpl($tplName, $newFilename, $fields = NULL) { - global $pathHome; - global $projectName; - - $httpdTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; - if( substr($newFilename, 0, 1) == PATH_SEP ) - $httpFilename = $newFilename; - else - $httpFilename = $pathHome . PATH_SEP . $newFilename; - $template = new TemplatePower($httpdTpl); - $template->prepare(); - $template->assignGlobal('pathHome', $pathHome); - $template->assignGlobal('projectName', $projectName); - $template->assignGlobal('rbacProjectName', strtoupper($projectName)); - $template->assignGlobal('siglaProjectName', substr(strtoupper($projectName), 0, 3)); - $template->assignGlobal('propel.output.dir', '{propel.output.dir}'); - - if( is_array($fields) ) { - foreach( $fields as $block => $data ) { - $template->gotoBlock("_ROOT"); - if( is_array($data) ) - foreach( $data as $rowId => $row ) { - $template->newBlock($block); - foreach( $row as $key => $val ) { - if( is_array($val) ) { - // $template->newBlock( $key ); - foreach( $val as $key2 => $val2 ) { - if( is_array($val2) ) { - $template->newBlock($key); - foreach( $val2 as $key3 => $val3 ) - $template->assign($key3, $val3); - } - } - } else - $template->assign($key, $val); - } - } - else - $template->assign($block, $data); - } - } - - $content = $template->getOutputContent(); - $iSize = file_put_contents($httpFilename, $content); - printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO')); -} - -function copy_file_from_tpl($tplName, $newFilename) { - global $pathHome; - global $projectName; - $httpdTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; - $httpFilename = $pathHome . PATH_SEP . $newFilename; - $content = file_get_contents($httpdTpl); - $iSize = file_put_contents($httpFilename, $content); - printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO')); -} - -function copy_file($newFilename) { - global $pathHome; - $httpdTpl = PATH_HOME . $newFilename; - $httpFilename = $pathHome . PATH_SEP . $newFilename; - $content = file_get_contents($httpdTpl); - $iSize = file_put_contents($httpFilename, $content); - printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($newFilename, 'INFO')); -} - -function fieldToLabel($field) { - $aux = substr($field, 4); - $res = $aux[0]; - for( $i = 1; $i < strlen($aux); $i ++ ) { - if( $aux[$i] == '_' ) { - $res .= " " . $aux[++ $i]; - } else - $res .= strtolower($aux[$i]); - } - return $res; -} - -function fieldToLabelOption($field) { - $aux = $field; - $res = $aux[0]; - for( $i = 1; $i < strlen($aux); $i ++ ) { - if( $aux[$i] == '_' ) { - $res .= " " . $aux[++ $i]; - } else - $res .= strtolower($aux[$i]); - } - return $res; -} -function run_propel_build_crud($task, $args) { - ini_set('display_errors', 'on'); - ini_set('error_reporting', E_ERROR); - - // the environment for poedit always is Development - define('G_ENVIRONMENT', G_DEV_ENV); - - printf("Arguments: %s\n", pakeColor::colorize('./gulliver propel-build-crud ', 'INFO')); - - //the class filename in the first argument - if( ! isset($args[0]) ) { - printf("Error: %s\n", pakeColor::colorize('you must specify a valid classname ', 'ERROR')); - exit(0); - } - $class = $args[0]; - $phpClass = $class; - $phpClass[0] = strtolower($phpClass[0]); - - $tableName = $class[0]; - for( $i = 1; $i < strlen($class); $i ++ ) { - if( $class[$i] >= 'a' ) - $tableName .= strtoupper($class[$i]); - else - $tableName .= "_" . $class[$i]; - } - - //second parameter is the table name, by default is the same classname in uppercase. - if( isset($args[1]) ) - $tableName = $args[1]; - - $pluginName = ''; - if( isset($args[2]) ) - $pluginName = $args[2]; - - //try to find the class in classes directory - $classFilename = PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . $args[0] . '.php'; - - //try to find in the plugis directory, assuming there are a class in the plugin - if( $pluginName != '' ) { - $classFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . $args[0] . '.php'; - set_include_path(PATH_PLUGINS . $pluginName . PATH_SEPARATOR . get_include_path()); - printf("using plugin : %s\n", pakeColor::colorize($pluginName, 'ERROR')); - } - - if( file_exists($classFilename) ) - printf("class found in %s \n", pakeColor::colorize($classFilename, 'INFO')); - else { - printf("class %s not found \n", pakeColor::colorize($class, 'ERROR')); - exit(0); - } - printf("TableName : %s \n", pakeColor::colorize($tableName, 'INFO')); - - require_once ($classFilename); - - global $G_ENVIRONMENTS; - $aux = explode(PATH_SEP, PATH_HOME); - $projectName = $aux[count($aux) - 2]; - define('PATH_SHARED', PATH_SEP . 'shared' . PATH_SEP . $projectName . '_data' . PATH_SEP); - - $dbFile = PATH_SHARED . 'sites' . PATH_SEP . $projectName . PATH_SEP . 'db.php'; - if( ! file_exists($dbFile) ) { - $dbFile = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . 'db.php.tpl'; - } - printf("searching db file in : %s \n", pakeColor::colorize($dbFile, 'INFO')); - - $G_ENVIRONMENTS['DEVELOPMENT']['dbfile'] = $dbFile; - Propel::init(PATH_CORE . "config/databases.php"); - - $configuration = Propel::getConfiguration(); - $connectionDSN = $configuration['datasources']['workflow']['connection']; - printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); - - if( $pluginName != '' ) { - $xmlformPath = PATH_PLUGINS . $pluginName . PATH_SEP; - $methodsPath = PATH_PLUGINS . $pluginName . PATH_SEP . $phpClass . PATH_SEP; - $corePath = PATH_PLUGINS . $pluginName . PATH_SEP; - } else { - $xmlformPath = PATH_CORE . 'xmlform' . PATH_SEP . $phpClass . PATH_SEP; - $methodsPath = PATH_CORE . 'methods' . PATH_SEP . $phpClass . PATH_SEP; - $corePath = PATH_CORE; - } - G::mk_dir($xmlformPath); - G::mk_dir($methodsPath); - - $fields['className'] = $class; - $fields['phpClassName'] = $phpClass; - $fields['tableName'] = $tableName; - $fields['projectName'] = $projectName; - - //1. MENU - if( $pluginName == '' ) { - create_file_from_tpl('pluginMenu', PATH_CORE . 'menus' . PATH_SEP . $phpClass . ".php", $fields); - } - //else { - // create_file_from_tpl ( 'pluginMenu', $corePath. $phpClass. ".php", $fields ); - //} - - - //2. si existe menu welcome, aqade la opcion - if( $pluginName == '' ) { - if( ! file_exists(PATH_CORE . 'menus' . PATH_SEP . "welcome.php") ) { - $fp = fopen(PATH_CORE . 'menus' . PATH_SEP . "welcome.php", "w"); - fwrite($fp, "table as $key => $table ) { - if( $table['name'] == $tableName ) - foreach( $table->column as $kc => $column ) { - $valuesOpt = NULL; - if( isset($table->validator) ) { - foreach( $table->validator as $kc => $validator ) { - if( $validator['column'] == $column['name'] ) { - foreach( $validator->rule as $kr => $rule ) { - if( $rule['name'] == 'validValues' ) - $valuesOpt = explode('|', $rule['value']); - } + //english version of dynaform + $form = new Form($xmlfile, '', 'en'); + $englishLabel = array(); + foreach ($form->fields as $nodeName => $node) { + if (trim($node->label) != '') { + $englishLabel[$node->name] = $node->label; } - } } - // print "\033[1;34m "; print_r ( $values); - //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; - //print_r ( $column); print "\n"; - $maxlength = isset($column['size']) ? $column['size'] : 25; - $size = ($maxlength > 60) ? 60 : $maxlength; - $values = NULL; - if( isset($valuesOpt) ) { - $type = 'dropdown'; - foreach( $valuesOpt as $key => $val ) { - $values[] = array ( + unset($form->fields); + unset($form->tree); + unset($form); + + //in this second pass, we are getting the target language labels + $form = new Form($xmlfile, '', $langIdOut); + $fieldsIndex = 0; + $exceptIndex = 0; + foreach ($form->fields as $nodeName => $node) { + if (is_object($node) && isset($englishLabel[$node->name])) { + $msgid = trim($englishLabel[$node->name]); + $node->label = trim(str_replace(chr(10), '', $node->label)); + } else { + $msgid = ''; + } + if (trim($msgid) != '' && ! in_array($node->type, $exceptionFields)) { + //$msgid = $englishLabel [ $node->name ]; + $keyid = $xmlfile . '?' . $node->name; + if (in_array($msgid, $arrayLabels)) { + $newMsgid = '[' . $keyid . '] ' . $msgid; + if ($verboseFlag) { + printf("duplicated key %s is renamed to %s.\n", pakeColor::colorize($msgid, 'ERROR'), pakeColor::colorize($newMsgid, 'INFO')); + } + $xmlError ++; + $msgid = $newMsgid; + } + + $arrayLabels[] = $msgid; + sort($arrayLabels); + + $comment1 = $xmlfile; + $comment2 = $node->type . ' - ' . $node->name; + fprintf($fp, "\n"); + fprintf($fp, "#: %s \n", $keyid); + // fprintf ( $fp, "#, php-format \n" ); + fprintf($fp, "# %s \n", strip_quotes($comment1)); + fprintf($fp, "# %s \n", strip_quotes($comment2)); + fprintf($fp, "msgid \"%s\" \n", strip_quotes($msgid)); + fprintf($fp, "msgstr \"%s\" \n", strip_quotes($node->label)); + //fprintf ( $fp, "msgstr \"%s\" \n", strip_quotes( utf8_encode( trim($node->label) ) )); + $fieldsIndex ++; + $fieldsIndexTotal ++; + } else { + $xmlfile = $filter->xssFilterHard($xmlfile); + $exceptionFields = $filter->xssFilterHard($exceptionFields); + if (is_object($node) && ! in_array($node->type, $exceptionFields)) { + if (isset($node->value) && strpos($node->value, 'G::LoadTranslation') !== false) { + $exceptIndex ++; + //print ($node->value); + } else { + $node->name = $filter->xssFilterHard($node->name); + $node->type = $filter->xssFilterHard($node->type); + printf("Error: xmlform %s has no english definition for %s [%s]\n", pakeColor::colorize($xmlfile, 'ERROR'), pakeColor::colorize($node->name, 'INFO'), pakeColor::colorize($node->type, 'INFO')); + $xmlError ++; + } + } else { + $exceptIndex ++; + if ($verboseFlag) { + $node->name = $filter->xssFilterHard($node->name); + $node->type = $filter->xssFilterHard($node->type); + printf("%s %s in %s\n", $node->type, pakeColor::colorize($node->name, 'INFO'), pakeColor::colorize($xmlfile, 'INFO')); + } + } + } + } + unset($form->fields); + unset($form->tree); + unset($form); + printf("xmlform: %s has %s fields and %s exceptions \n", pakeColor::colorize($xmlfile, 'INFO'), pakeColor::colorize($fieldsIndex, 'INFO'), pakeColor::colorize($exceptIndex, 'INFO')); + $exceptIndexTotal += $exceptIndex; + } + + fclose($fp); + printf("added %s entries from translation table\n", pakeColor::colorize($trIndex, 'INFO')); + printf("added %s entries from %s xmlforms \n", pakeColor::colorize($fieldsIndexTotal, 'INFO'), pakeColor::colorize($xmlIndex, 'INFO')); + + if ($trError > 0) { + printf("there are %s errors in tranlation table\n", pakeColor::colorize($trError, 'ERROR')); + } + if ($xmlError > 0) { + printf("there are %s errors and %s exceptions in xmlforms\n", pakeColor::colorize($xmlError, 'ERROR'), pakeColor::colorize($exceptIndexTotal, 'ERROR')); + } + + exit(0); + + //to do: leer los html templates +} + +function create_file_from_tpl($tplName, $newFilename, $fields = null) +{ + global $pathHome; + global $projectName; + + $httpdTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; + if (substr($newFilename, 0, 1) == PATH_SEP) { + $httpFilename = $newFilename; + } else { + $httpFilename = $pathHome . PATH_SEP . $newFilename; + } + $template = new TemplatePower($httpdTpl); + $template->prepare(); + $template->assignGlobal('pathHome', $pathHome); + $template->assignGlobal('projectName', $projectName); + $template->assignGlobal('rbacProjectName', strtoupper($projectName)); + $template->assignGlobal('siglaProjectName', substr(strtoupper($projectName), 0, 3)); + $template->assignGlobal('propel.output.dir', '{propel.output.dir}'); + + if (is_array($fields)) { + foreach ($fields as $block => $data) { + $template->gotoBlock("_ROOT"); + if (is_array($data)) { + foreach ($data as $rowId => $row) { + $template->newBlock($block); + foreach ($row as $key => $val) { + if (is_array($val)) { + // $template->newBlock( $key ); + foreach ($val as $key2 => $val2) { + if (is_array($val2)) { + $template->newBlock($key); + foreach ($val2 as $key3 => $val3) { + $template->assign($key3, $val3); + } + } + } + } else { + $template->assign($key, $val); + } + } + } + } else { + $template->assign($block, $data); + } + } + } + + $content = $template->getOutputContent(); + $iSize = file_put_contents($httpFilename, $content); + printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO')); +} + +function copy_file_from_tpl($tplName, $newFilename) +{ + global $pathHome; + global $projectName; + $httpdTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; + $httpFilename = $pathHome . PATH_SEP . $newFilename; + $content = file_get_contents($httpdTpl); + $iSize = file_put_contents($httpFilename, $content); + printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO')); +} + +function copy_file($newFilename) +{ + global $pathHome; + $httpdTpl = PATH_HOME . $newFilename; + $httpFilename = $pathHome . PATH_SEP . $newFilename; + $content = file_get_contents($httpdTpl); + $iSize = file_put_contents($httpFilename, $content); + printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($newFilename, 'INFO')); +} + +function fieldToLabel($field) +{ + $aux = substr($field, 4); + $res = $aux[0]; + for ($i = 1; $i < strlen($aux); $i ++) { + if ($aux[$i] == '_') { + $res .= " " . $aux[++ $i]; + } else { + $res .= strtolower($aux[$i]); + } + } + return $res; +} + +function fieldToLabelOption($field) +{ + $aux = $field; + $res = $aux[0]; + for ($i = 1; $i < strlen($aux); $i ++) { + if ($aux[$i] == '_') { + $res .= " " . $aux[++ $i]; + } else { + $res .= strtolower($aux[$i]); + } + } + return $res; +} +function run_propel_build_crud($task, $args) +{ + ini_set('display_errors', 'on'); + ini_set('error_reporting', E_ERROR); + + // the environment for poedit always is Development + define('G_ENVIRONMENT', G_DEV_ENV); + + printf("Arguments: %s\n", pakeColor::colorize('./gulliver propel-build-crud ', 'INFO')); + + //the class filename in the first argument + if (! isset($args[0])) { + printf("Error: %s\n", pakeColor::colorize('you must specify a valid classname ', 'ERROR')); + exit(0); + } + $class = $args[0]; + $phpClass = $class; + $phpClass[0] = strtolower($phpClass[0]); + + $tableName = $class[0]; + for ($i = 1; $i < strlen($class); $i ++) { + if ($class[$i] >= 'a') { + $tableName .= strtoupper($class[$i]); + } else { + $tableName .= "_" . $class[$i]; + } + } + + //second parameter is the table name, by default is the same classname in uppercase. + if (isset($args[1])) { + $tableName = $args[1]; + } + + $pluginName = ''; + if (isset($args[2])) { + $pluginName = $args[2]; + } + + //try to find the class in classes directory + $classFilename = PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . $args[0] . '.php'; + + //try to find in the plugis directory, assuming there are a class in the plugin + if ($pluginName != '') { + $classFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . $args[0] . '.php'; + set_include_path(PATH_PLUGINS . $pluginName . PATH_SEPARATOR . get_include_path()); + printf("using plugin : %s\n", pakeColor::colorize($pluginName, 'ERROR')); + } + + if (file_exists($classFilename)) { + printf("class found in %s \n", pakeColor::colorize($classFilename, 'INFO')); + } else { + printf("class %s not found \n", pakeColor::colorize($class, 'ERROR')); + exit(0); + } + printf("TableName : %s \n", pakeColor::colorize($tableName, 'INFO')); + + require_once($classFilename); + + global $G_ENVIRONMENTS; + $aux = explode(PATH_SEP, PATH_HOME); + $projectName = $aux[count($aux) - 2]; + define('PATH_SHARED', PATH_SEP . 'shared' . PATH_SEP . $projectName . '_data' . PATH_SEP); + + $dbFile = PATH_SHARED . 'sites' . PATH_SEP . $projectName . PATH_SEP . 'db.php'; + if (! file_exists($dbFile)) { + $dbFile = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . 'db.php.tpl'; + } + printf("searching db file in : %s \n", pakeColor::colorize($dbFile, 'INFO')); + + $G_ENVIRONMENTS['DEVELOPMENT']['dbfile'] = $dbFile; + Propel::init(PATH_CORE . "config/databases.php"); + + $configuration = Propel::getConfiguration(); + $connectionDSN = $configuration['datasources']['workflow']['connection']; + printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); + + if ($pluginName != '') { + $xmlformPath = PATH_PLUGINS . $pluginName . PATH_SEP; + $methodsPath = PATH_PLUGINS . $pluginName . PATH_SEP . $phpClass . PATH_SEP; + $corePath = PATH_PLUGINS . $pluginName . PATH_SEP; + } else { + $xmlformPath = PATH_CORE . 'xmlform' . PATH_SEP . $phpClass . PATH_SEP; + $methodsPath = PATH_CORE . 'methods' . PATH_SEP . $phpClass . PATH_SEP; + $corePath = PATH_CORE; + } + G::mk_dir($xmlformPath); + G::mk_dir($methodsPath); + + $fields['className'] = $class; + $fields['phpClassName'] = $phpClass; + $fields['tableName'] = $tableName; + $fields['projectName'] = $projectName; + + //1. MENU + if ($pluginName == '') { + create_file_from_tpl('pluginMenu', PATH_CORE . 'menus' . PATH_SEP . $phpClass . ".php", $fields); + } + //else { + // create_file_from_tpl ( 'pluginMenu', $corePath. $phpClass. ".php", $fields ); + //} + + + //2. si existe menu welcome, aqade la opcion + if ($pluginName == '') { + if (! file_exists(PATH_CORE . 'menus' . PATH_SEP . "welcome.php")) { + $fp = fopen(PATH_CORE . 'menus' . PATH_SEP . "welcome.php", "w"); + fwrite($fp, "table as $key => $table) { + if ($table['name'] == $tableName) { + foreach ($table->column as $kc => $column) { + $valuesOpt = null; + if (isset($table->validator)) { + foreach ($table->validator as $kc => $validator) { + if ($validator['column'] == $column['name']) { + foreach ($validator->rule as $kr => $rule) { + if ($rule['name'] == 'validValues') { + $valuesOpt = explode('|', $rule['value']); + } + } + } + } + } + // print "\033[1;34m "; print_r ( $values); + //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; + //print_r ( $column); print "\n"; + $maxlength = isset($column['size']) ? $column['size'] : 25; + $size = ($maxlength > 60) ? 60 : $maxlength; + $values = null; + if (isset($valuesOpt)) { + $type = 'dropdown'; + foreach ($valuesOpt as $key => $val) { + $values[] = array( 'value' => $val, 'label' => fieldToLabelOption($val) ); - } - } else { - switch( $column['type'] ) { + } + } else { + switch ($column['type']) { case 'TIMESTAMP': $type = 'date'; break; @@ -1267,13 +1309,13 @@ function run_propel_build_crud($task, $args) { default: $type = 'text'; } - } - if( isset($column['label']) ) { - $label = $column['label']; - } else { - $label = fieldToLabel($column['name']); - } - $field = array ( + } + if (isset($column['label'])) { + $label = $column['label']; + } else { + $label = fieldToLabel($column['name']); + } + $field = array( 'name' => $column['name'], 'className' => $class, 'type' => $type, @@ -1282,546 +1324,573 @@ function run_propel_build_crud($task, $args) { 'label' => $label, 'values' => $values ); - $fields['fields'][] = $field; - if( ! $column['primaryKey'] ) { - $fields['onlyFields'][] = $field; - } else { - $fields['keys'][] = $field; + $fields['fields'][] = $field; + if (! $column['primaryKey']) { + $fields['onlyFields'][] = $field; + } else { + $fields['keys'][] = $field; + } + } } - } - } - $fields['className'] = $class; - $fields['phpClassName'] = $phpClass; - $fields['projectName'] = $projectName; - $fields['firstKey'] = $fields['keys'][0]['name']; + } + $fields['className'] = $class; + $fields['phpClassName'] = $phpClass; + $fields['projectName'] = $projectName; + $fields['firstKey'] = $fields['keys'][0]['name']; - $fields['phpFolderName'] = $phpClass; - if( $pluginName != '' ) { - $fields['plugin'][] = array ( + $fields['phpFolderName'] = $phpClass; + if ($pluginName != '') { + $fields['plugin'][] = array( 'pluginName' => $pluginName ); - $fields['phpFolderName'] = $pluginName; - } - create_file_from_tpl('pluginXmlform', $xmlformPath . $phpClass . ".xml", $fields); - create_file_from_tpl('pluginXmlformEdit', $xmlformPath . $phpClass . "Edit.xml", $fields); - create_file_from_tpl('pluginXmlformDelete', $xmlformPath . $phpClass . "Delete.xml", $fields); - create_file_from_tpl('pluginList', $methodsPath . $phpClass . "List.php", $fields); + $fields['phpFolderName'] = $pluginName; + } + create_file_from_tpl('pluginXmlform', $xmlformPath . $phpClass . ".xml", $fields); + create_file_from_tpl('pluginXmlformEdit', $xmlformPath . $phpClass . "Edit.xml", $fields); + create_file_from_tpl('pluginXmlformDelete', $xmlformPath . $phpClass . "Delete.xml", $fields); + create_file_from_tpl('pluginList', $methodsPath . $phpClass . "List.php", $fields); - //xmlform for list - //load the $fields array with fields data for PagedTable xml. - $fields = array (); - $onlyFields = array (); - $primaryKey = ''; - foreach( $s->table as $key => $table ) { - if( $table['name'] == $tableName ) - foreach( $table->column as $kc => $column ) { - //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; - //print "\n"; - $size = ($column['size'] > 40) ? 40 * 3 : $column['size'] * 3; - $type = $column['type']; - $label = fieldToLabel($column['name']); - if( $column['primaryKey'] ) { - if( $primaryKey == '' ) - $primaryKey .= '@!' . $column['name']; - else - $primaryKey .= '|@!' . $column['name']; + //xmlform for list + //load the $fields array with fields data for PagedTable xml. + $fields = array(); + $onlyFields = array(); + $primaryKey = ''; + foreach ($s->table as $key => $table) { + if ($table['name'] == $tableName) { + foreach ($table->column as $kc => $column) { + //print $column['name'] . ' ' .$column['type'] . ' ' .$column['size'] . ' ' .$column['required'] . ' ' .$column['primaryKey']; + //print "\n"; + $size = ($column['size'] > 40) ? 40 * 3 : $column['size'] * 3; + $type = $column['type']; + $label = fieldToLabel($column['name']); + if ($column['primaryKey']) { + if ($primaryKey == '') { + $primaryKey .= '@!' . $column['name']; + } else { + $primaryKey .= '|@!' . $column['name']; + } - if( isset($column['label']) ) { - $label = $column['label']; - } else { - $label = fieldToLabel($column['name']); - } - } + if (isset($column['label'])) { + $label = $column['label']; + } else { + $label = fieldToLabel($column['name']); + } + } - $field = array ( + $field = array( 'name' => $column['name'], 'type' => $type, 'size' => $size, 'label' => $label ); - $fields['fields'][] = $field; - if( ! $column['primaryKey'] ) { - if( $column['type'] != 'LONGVARCHAR' ) - $fields['onlyFields'][] = $field; - } else { - $fields['keys'][] = $field; + $fields['fields'][] = $field; + if (! $column['primaryKey']) { + if ($column['type'] != 'LONGVARCHAR') { + $fields['onlyFields'][] = $field; + } + } else { + $fields['keys'][] = $field; + } + } } - } - } - $fields['primaryKey'] = $primaryKey; - $fields['className'] = $class; - $fields['phpClassName'] = $phpClass; - $fields['phpFolderName'] = $phpClass; - if( $pluginName != '' ) { - $fields['phpFolderName'] = $pluginName; - } - $fields['projectName'] = $projectName; - $fields['tableName'] = $tableName; - create_file_from_tpl('pluginXmlformList', $xmlformPath . $phpClass . "List.xml", $fields); - create_file_from_tpl('pluginXmlformOptions', $xmlformPath . $phpClass . "Options.xml", $fields); + } + $fields['primaryKey'] = $primaryKey; + $fields['className'] = $class; + $fields['phpClassName'] = $phpClass; + $fields['phpFolderName'] = $phpClass; + if ($pluginName != '') { + $fields['phpFolderName'] = $pluginName; + } + $fields['projectName'] = $projectName; + $fields['tableName'] = $tableName; + create_file_from_tpl('pluginXmlformList', $xmlformPath . $phpClass . "List.xml", $fields); + create_file_from_tpl('pluginXmlformOptions', $xmlformPath . $phpClass . "Options.xml", $fields); - //default edit - $fields = array (); - $index = 0; - $keylist = ''; - foreach( $s->table as $key => $table ) { - if( $table['name'] == $tableName ) - foreach( $table->column as $kc => $column ) { - $name = $column['name']; - $phpName = convertPhpName($name); - $field = array ( + //default edit + $fields = array(); + $index = 0; + $keylist = ''; + foreach ($s->table as $key => $table) { + if ($table['name'] == $tableName) { + foreach ($table->column as $kc => $column) { + $name = $column['name']; + $phpName = convertPhpName($name); + $field = array( 'name' => $name, 'phpName' => $phpName, 'index' => $index ++ ); - if( $column['primaryKey'] ) { - if( $keylist == '' ) - $keylist .= '$' . $phpName; - else - $keylist .= ', $' . $phpName; - $fields['keys'][] = $field; + if ($column['primaryKey']) { + if ($keylist == '') { + $keylist .= '$' . $phpName; + } else { + $keylist .= ', $' . $phpName; + } + $fields['keys'][] = $field; + } + $fields['fields'][] = $field; + if (! $column['primaryKey']) { + $fields['onlyFields'][] = $field; + } + $fields['fields2'][] = $field; + } } - $fields['fields'][] = $field; - if( ! $column['primaryKey'] ) { - $fields['onlyFields'][] = $field; - } - $fields['fields2'][] = $field; - } - } - $fields['keylist'] = $keylist; - $fields['phpClassName'] = $phpClass; - $fields['phpFolderName'] = $phpClass; - $fields['className'] = $class; - $fields['tableName'] = $tableName; - $fields['projectName'] = $projectName; - if( $pluginName != '' ) { - $fields['plugin'][] = array ( + } + $fields['keylist'] = $keylist; + $fields['phpClassName'] = $phpClass; + $fields['phpFolderName'] = $phpClass; + $fields['className'] = $class; + $fields['tableName'] = $tableName; + $fields['projectName'] = $projectName; + if ($pluginName != '') { + $fields['plugin'][] = array( 'pluginName' => $pluginName ); - $fields['phpFolderName'] = $pluginName; - } - //savePluginFile ( $class . PATH_SEP . $class . 'Edit.php', 'pluginEdit', $class, $tableName, $fields ); - //savePluginFile ( $class . PATH_SEP . $class . 'Save.php', 'pluginSave', $class, $tableName, $fields ); - create_file_from_tpl('pluginEdit', $methodsPath . $phpClass . "Edit.php", $fields); - create_file_from_tpl('pluginSave', $methodsPath . $phpClass . "Save.php", $fields); - create_file_from_tpl('pluginNew', $methodsPath . $phpClass . "New.php", $fields); - create_file_from_tpl('pluginDelete', $methodsPath . $phpClass . "Delete.php", $fields); - create_file_from_tpl('pluginDeleteExec', $methodsPath . $phpClass . "DeleteExec.php", $fields); + $fields['phpFolderName'] = $pluginName; + } + //savePluginFile ( $class . PATH_SEP . $class . 'Edit.php', 'pluginEdit', $class, $tableName, $fields ); + //savePluginFile ( $class . PATH_SEP . $class . 'Save.php', 'pluginSave', $class, $tableName, $fields ); + create_file_from_tpl('pluginEdit', $methodsPath . $phpClass . "Edit.php", $fields); + create_file_from_tpl('pluginSave', $methodsPath . $phpClass . "Save.php", $fields); + create_file_from_tpl('pluginNew', $methodsPath . $phpClass . "New.php", $fields); + create_file_from_tpl('pluginDelete', $methodsPath . $phpClass . "Delete.php", $fields); + create_file_from_tpl('pluginDeleteExec', $methodsPath . $phpClass . "DeleteExec.php", $fields); - exit(0); + exit(0); } //////////////////////////// backup and restore functions /////////////////////////////////// -function backupAddTarFolder($tar, $pathBase, $pluginHome) { - $empty = true; - print " " . str_replace($pluginHome, '', $pathBase) . "\n"; - if( $handle = opendir($pathBase) ) { - while( false !== ($file = readdir($handle)) ) { - if( is_file($pathBase . $file) ) { - $empty = false; - $tar->addModify(array($pathBase . $file), '', $pluginHome); - } - if( is_dir($pathBase . $file) && $file != '..' && $file != '.' ) { - //print "dir $pathBase$file \n"; - backupAddTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome); - $empty = false; - } +function backupAddTarFolder($tar, $pathBase, $pluginHome) +{ + $empty = true; + print " " . str_replace($pluginHome, '', $pathBase) . "\n"; + if ($handle = opendir($pathBase)) { + while (false !== ($file = readdir($handle))) { + if (is_file($pathBase . $file)) { + $empty = false; + $tar->addModify(array($pathBase . $file), '', $pluginHome); + } + if (is_dir($pathBase . $file) && $file != '..' && $file != '.') { + //print "dir $pathBase$file \n"; + backupAddTarFolder($tar, $pathBase . $file . PATH_SEP, $pluginHome); + $empty = false; + } + } + closedir($handle); + } + if ($empty /*&& $pathBase . $file != $pluginHome */) { + $tar->addModify(array($pathBase . $file), '', $pluginHome); } - closedir($handle); - } - if( $empty /*&& $pathBase . $file != $pluginHome */) { - $tar->addModify(array($pathBase . $file), '', $pluginHome); - } - } -function getSysInfo() { - if( file_exists(PATH_METHODS . 'login/version-pmos.php') ) { - include (PATH_METHODS . 'login/version-pmos.php'); - } else { - define('PM_VERSION', 'Development Version'); - } - - $ipe = explode(" ", $_SERVER['SSH_CONNECTION']); - - if( getenv('HTTP_CLIENT_IP') ) { - $ip = getenv('HTTP_CLIENT_IP'); - } elseif( getenv('HTTP_X_FORWARDED_FOR') ) { - $ip = getenv('HTTP_X_FORWARDED_FOR'); - } else { - $ip = getenv('REMOTE_ADDR'); - } - - /* For distros with the lsb_release, this returns a one-line description of - * the distro name, such as "CentOS release 5.3 (Final)" or "Ubuntu 10.10" - */ - $distro = exec("lsb_release -d -s 2> /dev/null"); - - /* For distros without lsb_release, we look for *release (such as - * redhat-release, gentoo-release, SuSE-release, etc) or *version (such as - * debian_version, slackware-version, etc) - */ - if (empty($distro)) { - foreach (glob("/etc/*release") as $filename) { - $distro = trim(file_get_contents($filename)); - if (!empty($distro)) - break; +function getSysInfo() +{ + if (file_exists(PATH_METHODS . 'login/version-pmos.php')) { + include(PATH_METHODS . 'login/version-pmos.php'); + } else { + define('PM_VERSION', 'Development Version'); } + + $ipe = explode(" ", $_SERVER['SSH_CONNECTION']); + + if (getenv('HTTP_CLIENT_IP')) { + $ip = getenv('HTTP_CLIENT_IP'); + } elseif (getenv('HTTP_X_FORWARDED_FOR')) { + $ip = getenv('HTTP_X_FORWARDED_FOR'); + } else { + $ip = getenv('REMOTE_ADDR'); + } + + /* For distros with the lsb_release, this returns a one-line description of + * the distro name, such as "CentOS release 5.3 (Final)" or "Ubuntu 10.10" + */ + $distro = exec("lsb_release -d -s 2> /dev/null"); + + /* For distros without lsb_release, we look for *release (such as + * redhat-release, gentoo-release, SuSE-release, etc) or *version (such as + * debian_version, slackware-version, etc) + */ if (empty($distro)) { - foreach (glob("/etc/*version") as $filename) { - $distro = trim(file_get_contents($filename)); - if (!empty($distro)) - break; - } + foreach (glob("/etc/*release") as $filename) { + $distro = trim(file_get_contents($filename)); + if (!empty($distro)) { + break; + } + } + if (empty($distro)) { + foreach (glob("/etc/*version") as $filename) { + $distro = trim(file_get_contents($filename)); + if (!empty($distro)) { + break; + } + } + } } - } - /* CentOS returns a string with quotes, remove them! */ - $distro = trim($distro, "\""); + /* CentOS returns a string with quotes, remove them! */ + $distro = trim($distro, "\""); - $distro .= " (" . PHP_OS . ")"; + $distro .= " (" . PHP_OS . ")"; - $Fields = array(); + $Fields = array(); - $Fields['SYSTEM'] = $distro; - $Fields['PHP'] = phpversion(); - $Fields['PM_VERSION'] = PM_VERSION; - $Fields['SERVER_ADDR'] = lookup($ipe[2]); - $Fields['IP'] = lookup($ipe[0]); + $Fields['SYSTEM'] = $distro; + $Fields['PHP'] = phpversion(); + $Fields['PM_VERSION'] = PM_VERSION; + $Fields['SERVER_ADDR'] = lookup($ipe[2]); + $Fields['IP'] = lookup($ipe[0]); - return $Fields; + return $Fields; } /* ** function get_infoOnPM ** information about workspace */ -function get_infoOnPM($workspace) { - $infoPM = array (); +function get_infoOnPM($workspace) +{ + $infoPM = array(); - $Fields = getSysInfo(); + $Fields = getSysInfo(); - $Fields['WORKSPACE_NAME'] = $workspace; + $Fields['WORKSPACE_NAME'] = $workspace; - if( defined("DB_HOST") ) { + if (defined("DB_HOST")) { + $dbNetView = new Net(DB_HOST); + $dbNetView->loginDbServer(DB_USER, DB_PASS); - $dbNetView = new Net(DB_HOST); - $dbNetView->loginDbServer(DB_USER, DB_PASS); - - $dbConns = new DbConnections(''); - $availdb = ''; - foreach( $dbConns->getDbServicesAvailables() as $key => $val ) { - if( $availdb != '' ) - $availdb .= ', '; - $availdb .= $val['name']; - } - try { - $sMySQLVersion = $dbNetView->getDbServerVersion('mysql'); - } catch( Exception $oException ) { - $sMySQLVersion = 'Unknown'; - } - - $Fields['DATABASE'] = $dbNetView->dbName(DB_ADAPTER) . ' (Version ' . $sMySQLVersion . ')'; - $Fields['DATABASE_SERVER'] = DB_HOST; - $Fields['DATABASE_NAME'] = DB_NAME; - $Fields['AVAILABLE_DB'] = $availdb; - } else { - $Fields['DATABASE'] = "Not defined"; - $Fields['DATABASE_SERVER'] = $info_db['adap']; - $Fields['DATABASE_NAME'] = "Not defined"; - $Fields['AVAILABLE_DB'] = "Not defined"; - } - - $info_db = get_DirDB($workspace); - - $Fields['MYSQL_DATA_DIR'] = $info_db['datadir']; - $Fields['PLUGINS_LIST'] = get_plugins(); - $Fields['DB_ADAPTER'] = $info_db['DB_ADAPTER']; - $Fields['DB_HOST'] = $info_db['DB_HOST']; - $Fields['DB_NAME'] = $info_db['DB_NAME']; - $Fields['DB_USER'] = $info_db['DB_USER']; - $Fields['DB_PASS'] = $info_db['DB_PASS']; - $Fields['DB_RBAC_HOST'] = $info_db['DB_RBAC_HOST']; - $Fields['DB_RBAC_NAME'] = $info_db['DB_RBAC_NAME']; - $Fields['DB_RBAC_USER'] = $info_db['DB_RBAC_USER']; - $Fields['DB_RBAC_PASS'] = $info_db['DB_RBAC_PASS']; - $Fields['DB_REPORT_HOST'] = $info_db['DB_REPORT_HOST']; - $Fields['DB_REPORT_NAME'] = $info_db['DB_REPORT_NAME']; - $Fields['DB_REPORT_USER'] = $info_db['DB_REPORT_USER']; - $Fields['DB_REPORT_PASS'] = $info_db['DB_REPORT_PASS']; - - $infoPM = $Fields; - - return $infoPM; - -} - -function printMetadata($fields) { - printf("%20s %s \n", 'Workspace Name', pakeColor::colorize($fields['WORKSPACE_NAME'], 'INFO')); - printf("%20s %s \n", 'System', pakeColor::colorize($fields['SYSTEM'], 'INFO')); - - printf("%20s %s \n", 'ProcessMaker Version', pakeColor::colorize($fields['PM_VERSION'], 'INFO')); - printf("%20s %s \n", 'PHP Version', pakeColor::colorize($fields['PHP'], 'INFO')); - printf("%20s %s \n", 'Server Address', pakeColor::colorize($fields['SERVER_ADDR'], 'INFO')); - printf("%20s %s \n", 'Client IP Address', pakeColor::colorize($fields['IP'], 'INFO')); - - printf("%20s %s \n", 'MySql Version', pakeColor::colorize($fields['DATABASE'], 'INFO')); - printf("%20s %s \n", 'MySql Data Directory', pakeColor::colorize($fields['MYSQL_DATA_DIR'], 'INFO')); - printf("%20s %s \n", 'Available Databases', pakeColor::colorize($fields['AVAILABLE_DB'], 'INFO')); - - printf("%20s %s \n", 'Plugins', pakeColor::colorize('', 'INFO')); - - foreach( $fields['PLUGINS_LIST'] as $k => $v ) { - printf("%20s %s \n", ' -', pakeColor::colorize($v, 'INFO')); - } - - $wfDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_USER'] . ':' . $fields['DB_PASS'] . '@' . $fields['DB_HOST'] . '/' . $fields['DB_NAME']; - $rbDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_RBAC_USER'] . ':' . $fields['DB_RBAC_PASS'] . '@' . $fields['DB_RBAC_HOST'] . '/' . $fields['DB_RBAC_NAME']; - $rpDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_REPORT_USER'] . ':' . $fields['DB_REPORT_PASS'] . '@' . $fields['DB_REPORT_HOST'] . '/' . $fields['DB_REPORT_NAME']; - printf("%20s %s \n", 'Workflow Database', pakeColor::colorize($wfDsn, 'INFO')); - printf("%20s %s \n", 'RBAC Database', pakeColor::colorize($rbDsn, 'INFO')); - printf("%20s %s \n", 'Report Database', pakeColor::colorize($rpDsn, 'INFO')); - -} -function get_plugins() { - $dir = PATH_PLUGINS; - $filesArray = array (); - - if( file_exists($dir) ) { - if( $handle = opendir($dir) ) { - while( false !== ($file = readdir($handle)) ) { - if( ($file != ".") && ($file != "..") && ($file != ".svn") ) { - if( ! strpos($file, ".php") ) { - $filesArray[] = $file; - } + $dbConns = new DbConnections(''); + $availdb = ''; + foreach ($dbConns->getDbServicesAvailables() as $key => $val) { + if ($availdb != '') { + $availdb .= ', '; + } + $availdb .= $val['name']; + } + try { + $sMySQLVersion = $dbNetView->getDbServerVersion('mysql'); + } catch (Exception $oException) { + $sMySQLVersion = 'Unknown'; } - } - closedir($handle); - } - } - sort($filesArray, SORT_STRING); - return $filesArray; -} -function lookup($target) { - global $ntarget; - $msg = $target . ' => '; - //if( eregi('[a-zA-Z]', $target) ) - if( preg_match('[a-zA-Z]', $target) ) //Made compatible to PHP 5.3 - $ntarget = gethostbyname($target); - else - $ntarget = gethostbyaddr($target); - $msg .= $ntarget; - return ($msg); -} - -function run_workspace_backup($task, $args) { - throw new Exception("Gulliver backup is no longer supported, use processmaker command-line instead."); - try { - ini_set('display_errors', 'on'); - ini_set('error_reporting', E_ERROR); - - // the environment for poedit always is Development - define('G_ENVIRONMENT', G_DEV_ENV); - - /* Look for -c and --compress in arguments */ - $compress = array_search('-c', $args); - if ($compress === false) - $compress = array_search('--compress', $args); - if ($compress !== false) { - unset($args[$compress]); - /* We need to reorder the args if we removed the compress switch */ - $args = array_values($args); - $compress = true; - } - - /* Look for -c and --compress in arguments */ - $overwrite = array_search('-o', $args); - if ($overwrite === false) - $overwrite = array_search('--overwrite', $args); - if ($overwrite !== false) { - unset($args[$overwrite]); - /* We need to reorder the args if we removed the compress switch */ - $args = array_values($args); - $overwrite = true; - } - - if (array_search('compress', $args)) { - echo pakeColor::colorize("Compress is no longer an option, check if this is what you want\n", 'ERROR'); - } - - if (count($args) > 2 || count($args) == 0) - throw (new Exception('wrong arguments specified')); - - $workspace = $args[0]; - - /* Use system gzip if not in Windows */ - if ($compress && strtolower(reset(explode(' ',php_uname('s')))) != "windows") { - /* Find the system gzip */ - exec("whereis -b gzip", $whereisGzip); - $gzipPaths = explode(' ', $whereisGzip[0]); - if (isset($gzipPaths[1])) - $gzipPath = $gzipPaths[1]; - if (isset($gzipPath)) - echo "Using system gzip in $gzipPath\n"; - } - - if (isset($args[1])) { - $fileTar = $args[1]; - /* Check if the second argument is an absolute filename. If it is, use - * it as the backup filename. Otherwise, use it as a filename relative - * to the backups directory. This makes migration from previous versions - * easier, which always expects a relative filename, while still accepting - * absolute filenames. - */ - if (dirname($fileTar) == '.') { - printf("Using %s as root. Use an absolute filename to change it.\n", pakeColor::colorize(PATH_TRUNK . 'backups', 'INFO')); - G::mk_dir(PATH_DATA . 'backups'); - $fileTar = PATH_DATA . 'backups' . PATH_SEP . $fileTar . '.tar'; - if ($compress) - $fileTar .= '.gz'; - } - printf("Backing up workspace %s to %s\n", pakeColor::colorize($workspace, 'INFO'), pakeColor::colorize($fileTar, 'INFO')); - if (!$overwrite && file_exists($fileTar)) { - $overwrite = strtolower(prompt('Backup file already exists, do you want to overwrite? [Y/n]')); - if( array_search(trim($overwrite), array("y", "")) === false ) - die(); - $overwrite = true; - } + $Fields['DATABASE'] = $dbNetView->dbName(DB_ADAPTER) . ' (Version ' . $sMySQLVersion . ')'; + $Fields['DATABASE_SERVER'] = DB_HOST; + $Fields['DATABASE_NAME'] = DB_NAME; + $Fields['AVAILABLE_DB'] = $availdb; } else { - G::mk_dir(PATH_DATA . 'backups'); - $fileBase = PATH_DATA . 'backups' . PATH_SEP . $workspace . '.tar'; - $fileTar = $fileBase; - if ($compress) - $fileTar .= '.gz'; - printf("Backing up workspace %s to %s\n", pakeColor::colorize($workspace, 'INFO'), pakeColor::colorize($fileTar, 'INFO')); - /* To avoid confusion, we remove both .tar and .tar.gz */ - if (!$overwrite && (file_exists($fileBase) || file_exists($fileBase.'.gz'))) { - $overwrite = strtolower(prompt('Backup file already exists, do you want to overwrite? [Y/n]')); - if( array_search(trim($overwrite), array("y", "")) === false ) - die(); - $overwrite = true; - } - if (file_exists($fileBase)) - unlink($fileBase); - if (file_exists($fileBase.".gz")) - unlink($fileBase.'.gz'); + $Fields['DATABASE'] = "Not defined"; + $Fields['DATABASE_SERVER'] = $info_db['adap']; + $Fields['DATABASE_NAME'] = "Not defined"; + $Fields['AVAILABLE_DB'] = "Not defined"; } - /* Remove the backup file before backing up. Previous versions didn't do - * this, so backup files would increase indefinetely as new data was - * appended to the tar file instead of replaced. - */ - if (file_exists($fileTar)) - unlink($fileTar); + $info_db = get_DirDB($workspace); - /* If using the system gzip, create the tar using a temporary filename */ - if (isset($gzipPath)) { - $gzipFinal = $fileTar; - $fileTar = tempnam(__FILE__, ''); + $Fields['MYSQL_DATA_DIR'] = $info_db['datadir']; + $Fields['PLUGINS_LIST'] = get_plugins(); + $Fields['DB_ADAPTER'] = $info_db['DB_ADAPTER']; + $Fields['DB_HOST'] = $info_db['DB_HOST']; + $Fields['DB_NAME'] = $info_db['DB_NAME']; + $Fields['DB_USER'] = $info_db['DB_USER']; + $Fields['DB_PASS'] = $info_db['DB_PASS']; + $Fields['DB_RBAC_HOST'] = $info_db['DB_RBAC_HOST']; + $Fields['DB_RBAC_NAME'] = $info_db['DB_RBAC_NAME']; + $Fields['DB_RBAC_USER'] = $info_db['DB_RBAC_USER']; + $Fields['DB_RBAC_PASS'] = $info_db['DB_RBAC_PASS']; + $Fields['DB_REPORT_HOST'] = $info_db['DB_REPORT_HOST']; + $Fields['DB_REPORT_NAME'] = $info_db['DB_REPORT_NAME']; + $Fields['DB_REPORT_USER'] = $info_db['DB_REPORT_USER']; + $Fields['DB_REPORT_PASS'] = $info_db['DB_REPORT_PASS']; + + $infoPM = $Fields; + + return $infoPM; +} + +function printMetadata($fields) +{ + printf("%20s %s \n", 'Workspace Name', pakeColor::colorize($fields['WORKSPACE_NAME'], 'INFO')); + printf("%20s %s \n", 'System', pakeColor::colorize($fields['SYSTEM'], 'INFO')); + + printf("%20s %s \n", 'ProcessMaker Version', pakeColor::colorize($fields['PM_VERSION'], 'INFO')); + printf("%20s %s \n", 'PHP Version', pakeColor::colorize($fields['PHP'], 'INFO')); + printf("%20s %s \n", 'Server Address', pakeColor::colorize($fields['SERVER_ADDR'], 'INFO')); + printf("%20s %s \n", 'Client IP Address', pakeColor::colorize($fields['IP'], 'INFO')); + + printf("%20s %s \n", 'MySql Version', pakeColor::colorize($fields['DATABASE'], 'INFO')); + printf("%20s %s \n", 'MySql Data Directory', pakeColor::colorize($fields['MYSQL_DATA_DIR'], 'INFO')); + printf("%20s %s \n", 'Available Databases', pakeColor::colorize($fields['AVAILABLE_DB'], 'INFO')); + + printf("%20s %s \n", 'Plugins', pakeColor::colorize('', 'INFO')); + + foreach ($fields['PLUGINS_LIST'] as $k => $v) { + printf("%20s %s \n", ' -', pakeColor::colorize($v, 'INFO')); } - $aSerializeData = get_infoOnPM($workspace); + $wfDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_USER'] . ':' . $fields['DB_PASS'] . '@' . $fields['DB_HOST'] . '/' . $fields['DB_NAME']; + $rbDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_RBAC_USER'] . ':' . $fields['DB_RBAC_PASS'] . '@' . $fields['DB_RBAC_HOST'] . '/' . $fields['DB_RBAC_NAME']; + $rpDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_REPORT_USER'] . ':' . $fields['DB_REPORT_PASS'] . '@' . $fields['DB_REPORT_HOST'] . '/' . $fields['DB_REPORT_NAME']; + printf("%20s %s \n", 'Workflow Database', pakeColor::colorize($wfDsn, 'INFO')); + printf("%20s %s \n", 'RBAC Database', pakeColor::colorize($rbDsn, 'INFO')); + printf("%20s %s \n", 'Report Database', pakeColor::colorize($rpDsn, 'INFO')); +} +function get_plugins() +{ + $dir = PATH_PLUGINS; + $filesArray = array(); - $dbFile = PATH_DB . $workspace . PATH_SEP . 'db.php'; - if( ! file_exists($dbFile) ) { - throw (new Exception("Invalid workspace, the db file does not exist, $dbFile")); + if (file_exists($dir)) { + if ($handle = opendir($dir)) { + while (false !== ($file = readdir($handle))) { + if (($file != ".") && ($file != "..") && ($file != ".svn")) { + if (! strpos($file, ".php")) { + $filesArray[] = $file; + } + } + } + closedir($handle); + } } + sort($filesArray, SORT_STRING); + return $filesArray; +} - $dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH)); - $oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]); - try{ - $oDbMaintainer->connect("mysql"); - } catch(Exception $e){ - echo "Problems contacting the database with the administrator user\n"; - echo "The response was: {$e->getMessage()}\n"; - } - - require_once ($dbFile); - - Propel::init(PATH_CORE . "config/databases.php"); - $configuration = Propel::getConfiguration(); - $connectionDSN = $configuration['datasources']['workflow']['connection']; - printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); - - $con = Propel::getConnection('workflow'); - $sql = "show variables like 'datadir'"; - $stmt = $con->createStatement(); - $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - if( ! is_array($row) ) - throw (new Exception("unable to execute query in database")); - $dataDir = $row['Value']; - if( $dataDir[count($dataDir) - 1] == '/' ) - $dataDir = substr($dataDir, count($dataDir) - 1); - - printf("MySQL data dir %s \n", pakeColor::colorize($dataDir, 'INFO')); - - $sql = "SELECT VERSION();"; - $stmt = $con->createStatement(); - $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM); - $rs->next(); - $row = $rs->getRow(); - $mysqlVersion = $row[0]; - $aSerializeData['DATABASE'] = $mysqlVersion; - - //new db restore rotines, by Erik on May 17th, 2010 - //set the temporal directory for all tables into wf, rb, and rp databases - $tmpDir = G::sys_get_temp_dir() . PATH_SEP . 'pmDbBackup' . PATH_SEP; - //create the db maintenance temporal dir - G::mk_dir($tmpDir); - - $fileMetadata = $tmpDir . 'metadata.txt'; - $sMetadata = file_put_contents($fileMetadata, serialize($aSerializeData)); - if ($sMetadata === false) { - throw new Exception("Metadata file could not be written"); - } - - - - $tar = new Archive_Tar($fileTar); - if (!isset($gzipPath)) - $tar->_compress = $compress; - - $pathSharedBase = PATH_DATA . 'sites' . PATH_SEP . $workspace . PATH_SEP; - printf("copying folder: %s \n", pakeColor::colorize($pathSharedBase, 'INFO')); - backupAddTarFolder($tar, $pathSharedBase, PATH_DATA . 'sites'); - - backupAddTarFolder($tar, $fileMetadata, dirname($fileMetadata)); - unlink($fileMetadata); - $aFiles = $tar->listContent(); - - $total = 0; - foreach( $aFiles as $key => $val ) { - // printf( " %6d %s \n", $val['size'], pakeColor::colorize( $val['filename'], 'INFO') ); - $total += $val['size']; - } - - /* If using system gzip, compress the temporary tar to the original - * filename. - */ - if (isset($gzipPath)) { - exec("gzip -c \"$fileTar\" > $gzipFinal", $output, $ret); - if ($ret != 0) { - /* The error message is in stderr, which should be displayed already */ - echo pakeColor::colorize("Error compressing backup", "ERROR") . "\n"; - die(1); - } - unlink($fileTar); - $fileTar = $gzipFinal; - } - - printMetadata($aSerializeData); - printf("%20s %s \n", 'Backup File', pakeColor::colorize($fileTar, 'INFO')); - printf("%20s %s \n", 'Files in Backup', pakeColor::colorize(count($aFiles), 'INFO')); - printf("%20s %s \n", 'Total Filesize', pakeColor::colorize(sprintf("%5.2f MB", $total / 1024 / 1024), 'INFO')); - printf("%20s %s \n", 'Backup Filesize', pakeColor::colorize(sprintf("%5.2f MB", filesize($fileTar) / 1024 / 1024), 'INFO')); - - } catch( Exception $e ) { - printf("Error: %s\n", pakeColor::colorize($e->getMessage(), 'ERROR')); - exit(0); +function lookup($target) +{ + global $ntarget; + $msg = $target . ' => '; + //if( eregi('[a-zA-Z]', $target) ) + if (preg_match('[a-zA-Z]', $target)) { //Made compatible to PHP 5.3 + $ntarget = gethostbyname($target); + } else { + $ntarget = gethostbyaddr($target); } + $msg .= $ntarget; + return ($msg); +} + +function run_workspace_backup($task, $args) +{ + throw new Exception("Gulliver backup is no longer supported, use processmaker command-line instead."); + try { + ini_set('display_errors', 'on'); + ini_set('error_reporting', E_ERROR); + + // the environment for poedit always is Development + define('G_ENVIRONMENT', G_DEV_ENV); + + /* Look for -c and --compress in arguments */ + $compress = array_search('-c', $args); + if ($compress === false) { + $compress = array_search('--compress', $args); + } + if ($compress !== false) { + unset($args[$compress]); + /* We need to reorder the args if we removed the compress switch */ + $args = array_values($args); + $compress = true; + } + + /* Look for -c and --compress in arguments */ + $overwrite = array_search('-o', $args); + if ($overwrite === false) { + $overwrite = array_search('--overwrite', $args); + } + if ($overwrite !== false) { + unset($args[$overwrite]); + /* We need to reorder the args if we removed the compress switch */ + $args = array_values($args); + $overwrite = true; + } + + if (array_search('compress', $args)) { + echo pakeColor::colorize("Compress is no longer an option, check if this is what you want\n", 'ERROR'); + } + + if (count($args) > 2 || count($args) == 0) { + throw (new Exception('wrong arguments specified')); + } + + $workspace = $args[0]; + + /* Use system gzip if not in Windows */ + if ($compress && strtolower(reset(explode(' ', php_uname('s')))) != "windows") { + /* Find the system gzip */ + exec("whereis -b gzip", $whereisGzip); + $gzipPaths = explode(' ', $whereisGzip[0]); + if (isset($gzipPaths[1])) { + $gzipPath = $gzipPaths[1]; + } + if (isset($gzipPath)) { + echo "Using system gzip in $gzipPath\n"; + } + } + + if (isset($args[1])) { + $fileTar = $args[1]; + /* Check if the second argument is an absolute filename. If it is, use + * it as the backup filename. Otherwise, use it as a filename relative + * to the backups directory. This makes migration from previous versions + * easier, which always expects a relative filename, while still accepting + * absolute filenames. + */ + if (dirname($fileTar) == '.') { + printf("Using %s as root. Use an absolute filename to change it.\n", pakeColor::colorize(PATH_TRUNK . 'backups', 'INFO')); + G::mk_dir(PATH_DATA . 'backups'); + $fileTar = PATH_DATA . 'backups' . PATH_SEP . $fileTar . '.tar'; + if ($compress) { + $fileTar .= '.gz'; + } + } + printf("Backing up workspace %s to %s\n", pakeColor::colorize($workspace, 'INFO'), pakeColor::colorize($fileTar, 'INFO')); + if (!$overwrite && file_exists($fileTar)) { + $overwrite = strtolower(prompt('Backup file already exists, do you want to overwrite? [Y/n]')); + if (array_search(trim($overwrite), array("y", "")) === false) { + die(); + } + $overwrite = true; + } + } else { + G::mk_dir(PATH_DATA . 'backups'); + $fileBase = PATH_DATA . 'backups' . PATH_SEP . $workspace . '.tar'; + $fileTar = $fileBase; + if ($compress) { + $fileTar .= '.gz'; + } + printf("Backing up workspace %s to %s\n", pakeColor::colorize($workspace, 'INFO'), pakeColor::colorize($fileTar, 'INFO')); + /* To avoid confusion, we remove both .tar and .tar.gz */ + if (!$overwrite && (file_exists($fileBase) || file_exists($fileBase.'.gz'))) { + $overwrite = strtolower(prompt('Backup file already exists, do you want to overwrite? [Y/n]')); + if (array_search(trim($overwrite), array("y", "")) === false) { + die(); + } + $overwrite = true; + } + if (file_exists($fileBase)) { + unlink($fileBase); + } + if (file_exists($fileBase.".gz")) { + unlink($fileBase.'.gz'); + } + } + + /* Remove the backup file before backing up. Previous versions didn't do + * this, so backup files would increase indefinetely as new data was + * appended to the tar file instead of replaced. + */ + if (file_exists($fileTar)) { + unlink($fileTar); + } + + /* If using the system gzip, create the tar using a temporary filename */ + if (isset($gzipPath)) { + $gzipFinal = $fileTar; + $fileTar = tempnam(__FILE__, ''); + } + + $aSerializeData = get_infoOnPM($workspace); + + $dbFile = PATH_DB . $workspace . PATH_SEP . 'db.php'; + if (! file_exists($dbFile)) { + throw (new Exception("Invalid workspace, the db file does not exist, $dbFile")); + } + + $dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH)); + $oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]); + try { + $oDbMaintainer->connect("mysql"); + } catch (Exception $e) { + echo "Problems contacting the database with the administrator user\n"; + echo "The response was: {$e->getMessage()}\n"; + } + + require_once($dbFile); + + Propel::init(PATH_CORE . "config/databases.php"); + $configuration = Propel::getConfiguration(); + $connectionDSN = $configuration['datasources']['workflow']['connection']; + printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); + + $con = Propel::getConnection('workflow'); + $sql = "show variables like 'datadir'"; + $stmt = $con->createStatement(); + $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + if (! is_array($row)) { + throw (new Exception("unable to execute query in database")); + } + $dataDir = $row['Value']; + if ($dataDir[count($dataDir) - 1] == '/') { + $dataDir = substr($dataDir, count($dataDir) - 1); + } + + printf("MySQL data dir %s \n", pakeColor::colorize($dataDir, 'INFO')); + + $sql = "SELECT VERSION();"; + $stmt = $con->createStatement(); + $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM); + $rs->next(); + $row = $rs->getRow(); + $mysqlVersion = $row[0]; + $aSerializeData['DATABASE'] = $mysqlVersion; + + //new db restore rotines, by Erik on May 17th, 2010 + //set the temporal directory for all tables into wf, rb, and rp databases + $tmpDir = G::sys_get_temp_dir() . PATH_SEP . 'pmDbBackup' . PATH_SEP; + //create the db maintenance temporal dir + G::mk_dir($tmpDir); + + $fileMetadata = $tmpDir . 'metadata.txt'; + $sMetadata = file_put_contents($fileMetadata, serialize($aSerializeData)); + if ($sMetadata === false) { + throw new Exception("Metadata file could not be written"); + } + + + + $tar = new Archive_Tar($fileTar); + if (!isset($gzipPath)) { + $tar->_compress = $compress; + } + + $pathSharedBase = PATH_DATA . 'sites' . PATH_SEP . $workspace . PATH_SEP; + printf("copying folder: %s \n", pakeColor::colorize($pathSharedBase, 'INFO')); + backupAddTarFolder($tar, $pathSharedBase, PATH_DATA . 'sites'); + + backupAddTarFolder($tar, $fileMetadata, dirname($fileMetadata)); + unlink($fileMetadata); + $aFiles = $tar->listContent(); + + $total = 0; + foreach ($aFiles as $key => $val) { + // printf( " %6d %s \n", $val['size'], pakeColor::colorize( $val['filename'], 'INFO') ); + $total += $val['size']; + } + + /* If using system gzip, compress the temporary tar to the original + * filename. + */ + if (isset($gzipPath)) { + exec("gzip -c \"$fileTar\" > $gzipFinal", $output, $ret); + if ($ret != 0) { + /* The error message is in stderr, which should be displayed already */ + echo pakeColor::colorize("Error compressing backup", "ERROR") . "\n"; + die(1); + } + unlink($fileTar); + $fileTar = $gzipFinal; + } + + printMetadata($aSerializeData); + printf("%20s %s \n", 'Backup File', pakeColor::colorize($fileTar, 'INFO')); + printf("%20s %s \n", 'Files in Backup', pakeColor::colorize(count($aFiles), 'INFO')); + printf("%20s %s \n", 'Total Filesize', pakeColor::colorize(sprintf("%5.2f MB", $total / 1024 / 1024), 'INFO')); + printf("%20s %s \n", 'Backup Filesize', pakeColor::colorize(sprintf("%5.2f MB", filesize($fileTar) / 1024 / 1024), 'INFO')); + } catch (Exception $e) { + printf("Error: %s\n", pakeColor::colorize($e->getMessage(), 'ERROR')); + exit(0); + } } /** @@ -1830,361 +1899,375 @@ function run_workspace_backup($task, $args) { * * @author Erik A. O. */ -function getDataBaseConfiguration($dsn) { - $dsn = trim($dsn); - $tmp = explode(':', $dsn); - $tmp2 = str_replace('//', '', $tmp[1]); - $result["user"] = $tmp2; - $tmp2 = explode('@', $tmp[2]); - $result["passwd"] = $tmp2[0]; - $result["host"] = $tmp2[1]; - $tmp2 = explode('?', $tmp[3]); - $tmp2 = explode('/', $tmp2[0]); - $result["port"] = $tmp2[0]; - $result["dbname"] = $tmp2[1]; +function getDataBaseConfiguration($dsn) +{ + $dsn = trim($dsn); + $tmp = explode(':', $dsn); + $tmp2 = str_replace('//', '', $tmp[1]); + $result["user"] = $tmp2; + $tmp2 = explode('@', $tmp[2]); + $result["passwd"] = $tmp2[0]; + $result["host"] = $tmp2[1]; + $tmp2 = explode('?', $tmp[3]); + $tmp2 = explode('/', $tmp2[0]); + $result["port"] = $tmp2[0]; + $result["dbname"] = $tmp2[1]; - return $result; + return $result; } -function updateDBCallback($matches) { - global $updateDBCallbackData; - /* This function changes the values of defines while keeping their formatting - * intact. - * $matches will contain several groups: - * ((define('()2', ')1 ()3 (');)4 )0 - */ - $dbPrefix = array( +function updateDBCallback($matches) +{ + global $updateDBCallbackData; + /* This function changes the values of defines while keeping their formatting + * intact. + * $matches will contain several groups: + * ((define('()2', ')1 ()3 (');)4 )0 + */ + $dbPrefix = array( 'DB_NAME' => 'wf_', 'DB_USER' => 'wf_', 'DB_RBAC_NAME' => 'rb_', 'DB_RBAC_USER' => 'rb_', 'DB_REPORT_NAME' => 'rp_', 'DB_REPORT_USER' => 'rp_'); - $key = $matches['key']; - $value = $matches['value']; - if (array_search($key,array('DB_HOST', 'DB_RBAC_HOST', 'DB_REPORT_HOST')) !== false) { - /* Change the database hostname for these keys */ - $value = $updateDBCallbackData['new_host']; - } else if (array_key_exists($key, $dbPrefix)) { - if ($updateDBCallbackData['change_workspace']) - /* Change the database name to the new workspace, following the standard - * of prefix (either wf_, rp_, rb_) and the workspace name. - */ - $value = $dbPrefix[$key].$updateDBCallbackData['target_workspace']; - } - $updateDBCallbackData['config'][$key] = $value; - return $matches[1].$value.$matches[4]; + $key = $matches['key']; + $value = $matches['value']; + if (array_search($key, array('DB_HOST', 'DB_RBAC_HOST', 'DB_REPORT_HOST')) !== false) { + /* Change the database hostname for these keys */ + $value = $updateDBCallbackData['new_host']; + } elseif (array_key_exists($key, $dbPrefix)) { + if ($updateDBCallbackData['change_workspace']) { + /* Change the database name to the new workspace, following the standard + * of prefix (either wf_, rp_, rb_) and the workspace name. + */ + $value = $dbPrefix[$key].$updateDBCallbackData['target_workspace']; + } + } + $updateDBCallbackData['config'][$key] = $value; + return $matches[1].$value.$matches[4]; } -function updateDBfile($directory, $targetWorkspace, $dbNewHost, $changeWorkspace) { - if (count(explode(":", $dbNewHost)) < 2) - $dbNewHost .= ':3306'; - /* Workaround to send variables to updateDBCallback callback */ - $GLOBALS['updateDBCallbackData'] = array( +function updateDBfile($directory, $targetWorkspace, $dbNewHost, $changeWorkspace) +{ + if (count(explode(":", $dbNewHost)) < 2) { + $dbNewHost .= ':3306'; + } + /* Workaround to send variables to updateDBCallback callback */ + $GLOBALS['updateDBCallbackData'] = array( "new_host" => $dbNewHost, "change_workspace" => $changeWorkspace, "target_workspace" => $targetWorkspace, "config" => array() ); - global $updateDBCallbackData; + global $updateDBCallbackData; - $dbfile = $directory . PATH_SEP . 'db.php'; - if( file_exists($dbfile) ) { - $sDbFile = file_get_contents($dbfile); - /* Match all defines in the config file. Check updateDBCallback to know what - * keys are changed and what groups are matched. - * This regular expression will match any "define ('', '');" - * with any combination of whitespace between words. - */ - $sNewDbFile = preg_replace_callback("/( *define *\( *'(?P.*?)' *, *\n* *')(?P.*?)(' *\) *;.*)/", + $dbfile = $directory . PATH_SEP . 'db.php'; + if (file_exists($dbfile)) { + $sDbFile = file_get_contents($dbfile); + /* Match all defines in the config file. Check updateDBCallback to know what + * keys are changed and what groups are matched. + * This regular expression will match any "define ('', '');" + * with any combination of whitespace between words. + */ + $sNewDbFile = preg_replace_callback( + "/( *define *\( *'(?P.*?)' *, *\n* *')(?P.*?)(' *\) *;.*)/", updateDBCallback, - $sDbFile); - file_put_contents($dbfile, $sNewDbFile); - return $updateDBCallbackData['config']; - } -} - -function restoreDB($dbHost, $dbMaintainer, $dbOldName, $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite) { - printf("Restoring database %s to %s\n", $dbOldName, pakeColor::colorize($dbName, 'INFO')); - - /* Check if the hostname is local (localhost or 127.0.0.1) */ - $islocal = (strcmp(substr($dbHost, 0, strlen('localhost')),'localhost')===0) || - (strcmp(substr($dbHost, 0, strlen('127.0.0.1')),'127.0.0.1')===0); - - $dbMaintainer->connect('mysql'); - - $result = $dbMaintainer->query("SELECT * FROM `user` WHERE user='$dbUser' AND password=PASSWORD('{$dbPass}')"); - if( ! isset($result[0]) ){ //the user doesn't exist - $dbHostPerm = $islocal ? "localhost":"%"; - $dbMaintainer->query("INSERT INTO user VALUES('$dbHostPerm','$dbUser',PASSWORD('{$dbPass}'),'Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);"); - } - $dbMaintainer->query("GRANT ALL PRIVILEGES ON `$dbUser`.* TO $dbName@'localhost' IDENTIFIED BY '{$dbPass}' WITH GRANT OPTION"); - - if( $overwrite ) { - $dbMaintainer->createDb($dbName, true); - } else { - $dbMaintainer->createDb($dbName); - } - - $dbMaintainer->connect($dbName); - $dbMaintainer->setTempDir($tempDirectory . PATH_SEP . $dbOldName . PATH_SEP); - $dbMaintainer->restoreFromSql($dbMaintainer->getTempDir() . $dbOldName . '.sql'); - $dbMaintainer->restoreAllData('sql'); -} - -function workspaceRestore($backupFilename, $targetWorkspace, $overwrite) { - - $tempDirectory = tempnam(__FILE__, ''); - if (file_exists($tempDirectory)) { - unlink($tempDirectory); - } - - if (file_exists($tempDirectory)) - G::rm_dir($tempDirectory); - G::mk_dir($tempDirectory); - - - $tar = new Archive_Tar($backupFilename); - $res = $tar->extract($tempDirectory); - - $metadataFilename = $tempDirectory . PATH_SEP . 'metadata.txt'; - if (!file_exists($metadataFilename)) { - /* Look for legacy backups, where metadata was stored as a file with the - * workspace name, such as workflow.txt - * This means the backup filename must be the same as the metadata file. - */ - $info = pathinfo($backupFilename); - /* Check if it's a compressed backup, in which case we need to remove - * both the gz and the tar extensions. - */ - if ($info['extension'] == "gz") - $info = pathinfo(basename($backupFilename, '.' . $info['extension'])); - $wsNameFromTar = basename($backupFilename, '.' . $info['extension']); - $metadataFilename = $tempDirectory . PATH_SEP . $wsNameFromTar . '.txt'; - if (!file_exists($metadataFilename)) { - throw (new Exception("Metadata file was not found in backup")); + $sDbFile + ); + file_put_contents($dbfile, $sNewDbFile); + return $updateDBCallbackData['config']; } - } - - $metadata = unserialize(file_get_contents($metadataFilename)); - - $backupWorkspace = $metadata['WORKSPACE_NAME']; - $changeWorkspace = (isset($targetWorkspace)); - if (!$changeWorkspace) { - $targetWorkspace = $backupWorkspace; - } else { - echo "Restoring from workspace: " . pakeColor::colorize($backupWorkspace, 'INFO') . "\n"; - } - echo "Restoring to workspace: ".pakeColor::colorize($targetWorkspace, 'INFO')."\n"; - - //moving the site files - $backupWorkspaceDir = $tempDirectory . PATH_SEP . $backupWorkspace; - $targetWorkspaceDir = PATH_DATA . 'sites' . PATH_SEP . $targetWorkspace; - - if (!$overwrite && file_exists($targetWorkspaceDir)) { - $overwrite = strtolower(prompt('Workspace already exists, do you want to overwrite? [Y/n]')); - if( array_search(trim($overwrite), array("y", "")) === false ) - die(); - $overwrite = true; - } - - printf("Moving files to %s \n", pakeColor::colorize($targetWorkspaceDir, 'INFO')); - - /* We already know we will be overwriting the new workspace if we reach this - * point, so remove the workspace directory if it exists. - */ - if (file_exists($targetWorkspaceDir)) - G::rm_dir($targetWorkspaceDir); - - if( ! rename($backupWorkspaceDir, $targetWorkspaceDir) ) { - throw (new Exception("There was an error moving from $backupWorkspaceDir to $targetWorkspaceDir")); - } - - $dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH)); - $dbHostname = $dbOpt[0]; - - /* TODO: Check if database exists after updateDBfile */ - $config = updateDBfile($targetWorkspaceDir, $targetWorkspace, $dbHostname, $changeWorkspace); - - $oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]); - - $dbName = $config['DB_NAME']; - $dbUser = $config['DB_USER']; - $dbPass = $config['DB_PASS']; - restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); - - $dbName = $config['DB_RBAC_NAME']; - $dbUser = $config['DB_RBAC_USER']; - $dbPass = $config['DB_RBAC_PASS']; - restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_RBAC_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); - - $dbName = $config['DB_REPORT_NAME']; - $dbUser = $config['DB_REPORT_USER']; - $dbPass = $config['DB_REPORT_PASS']; - restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_REPORT_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); - - echo "\n"; - - $wsInfo = getSysInfo(); - $wsInfo['WORKSPACE_NAME'] = $targetWorkspace; - $wsInfo = array_merge($wsInfo, $config); - - printInfoSites($metadata, $wsInfo); - - return true; } -function get_DirDB($workspace) { +function restoreDB($dbHost, $dbMaintainer, $dbOldName, $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite) +{ + printf("Restoring database %s to %s\n", $dbOldName, pakeColor::colorize($dbName, 'INFO')); - $dbFile = PATH_DB . $workspace . PATH_SEP . 'db.php'; - if( ! file_exists($dbFile) ) { - throw (new Exception("the db file does not exist, $dbFile")); - } + /* Check if the hostname is local (localhost or 127.0.0.1) */ + $islocal = (strcmp(substr($dbHost, 0, strlen('localhost')), 'localhost')===0) || + (strcmp(substr($dbHost, 0, strlen('127.0.0.1')), '127.0.0.1')===0); - require_once ($dbFile); + $dbMaintainer->connect('mysql'); + $result = $dbMaintainer->query("SELECT * FROM `user` WHERE user='$dbUser' AND password=PASSWORD('{$dbPass}')"); + if (! isset($result[0])) { //the user doesn't exist + $dbHostPerm = $islocal ? "localhost":"%"; + $dbMaintainer->query("INSERT INTO user VALUES('$dbHostPerm','$dbUser',PASSWORD('{$dbPass}'),'Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);"); + } + $dbMaintainer->query("GRANT ALL PRIVILEGES ON `$dbUser`.* TO $dbName@'localhost' IDENTIFIED BY '{$dbPass}' WITH GRANT OPTION"); - Propel::init(PATH_CORE . "config/databases.php"); - $configuration = Propel::getConfiguration(); - $connectionDSN = $configuration['datasources']['workflow']['connection']; + if ($overwrite) { + $dbMaintainer->createDb($dbName, true); + } else { + $dbMaintainer->createDb($dbName); + } - // printf("using DSN Connection %s \n", pakeColor::colorize( $connectionDSN, 'INFO')); - - - $con = Propel::getConnection('workflow'); - $sql = "show variables like 'datadir'"; - $stmt = $con->createStatement(); - $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - - if( ! is_array($row) ) - throw (new Exception("unable to execute query in database")); - $dataDir = $row['Value']; - if( $dataDir[count($dataDir) - 1] == '/' ) - $dataDir = substr($dataDir, count($dataDir) - 1); - - $info_db = array (); - $info_db['conx'] = $configuration['datasources']['workflow']['connection']; - $info_db['adap'] = $configuration['datasources']['workflow']['adapter']; - $info_db['datadir'] = $dataDir; - - $info_db['DB_ADAPTER'] = DB_ADAPTER; - $info_db['DB_HOST'] = DB_HOST; - $info_db['DB_NAME'] = DB_NAME; - $info_db['DB_USER'] = DB_USER; - $info_db['DB_PASS'] = DB_PASS; - $info_db['DB_RBAC_HOST'] = DB_RBAC_HOST; - $info_db['DB_RBAC_NAME'] = DB_RBAC_NAME; - $info_db['DB_RBAC_USER'] = DB_RBAC_USER; - $info_db['DB_RBAC_PASS'] = DB_RBAC_PASS; - $info_db['DB_REPORT_HOST'] = DB_REPORT_HOST; - $info_db['DB_REPORT_NAME'] = DB_REPORT_NAME; - $info_db['DB_REPORT_USER'] = DB_REPORT_USER; - $info_db['DB_REPORT_PASS'] = DB_REPORT_PASS; - - return $info_db; + $dbMaintainer->connect($dbName); + $dbMaintainer->setTempDir($tempDirectory . PATH_SEP . $dbOldName . PATH_SEP); + $dbMaintainer->restoreFromSql($dbMaintainer->getTempDir() . $dbOldName . '.sql'); + $dbMaintainer->restoreAllData('sql'); } -function printInfoSites($aSitebck, $aSiterestared) { - printf("%25s %s \n", 'Workspace Name Backup', pakeColor::colorize($aSitebck['WORKSPACE_NAME'], 'INFO')); - printf("%25s %s \n", 'Workspace Name Restored', pakeColor::colorize($aSiterestared['WORKSPACE_NAME'], 'INFO')); +function workspaceRestore($backupFilename, $targetWorkspace, $overwrite) +{ + $tempDirectory = tempnam(__FILE__, ''); + if (file_exists($tempDirectory)) { + unlink($tempDirectory); + } - printf("%25s %s \n", 'System Backup', pakeColor::colorize($aSitebck['SYSTEM'], 'INFO')); - printf("%25s %s \n", 'System Restored', pakeColor::colorize($aSiterestared['SYSTEM'], 'INFO')); - - printf("%25s %s \n", 'PM Version Backup', pakeColor::colorize($aSitebck['PM_VERSION'], 'INFO')); - printf("%25s %s \n", 'PM Version Restored', pakeColor::colorize($aSiterestared['PM_VERSION'], 'INFO')); - - printf("%25s %s \n", 'PHP Version Backup', pakeColor::colorize($aSitebck['PHP'], 'INFO')); - printf("%25s %s \n", 'PHP Version Restored', pakeColor::colorize($aSiterestared['PHP'], 'INFO')); - - //printf( "%25s %s \n", 'Server Address', pakeColor::colorize( $aSitebck['SERVER_ADDR'], 'INFO') ); - //printf( "%25s %s \n", 'Client IP Address', pakeColor::colorize( $aSitebck['IP'], 'INFO') ); + if (file_exists($tempDirectory)) { + G::rm_dir($tempDirectory); + } + G::mk_dir($tempDirectory); - //printf( "%25s %s \n", 'MySql Version', pakeColor::colorize( $aSitebck['DATABASE'], 'INFO') ); - //printf( "%25s %s \n", 'MySql Version', pakeColor::colorize( $aSiterestared['DATABASE'], 'INFO') ); + $tar = new Archive_Tar($backupFilename); + $res = $tar->extract($tempDirectory); + + $metadataFilename = $tempDirectory . PATH_SEP . 'metadata.txt'; + if (!file_exists($metadataFilename)) { + /* Look for legacy backups, where metadata was stored as a file with the + * workspace name, such as workflow.txt + * This means the backup filename must be the same as the metadata file. + */ + $info = pathinfo($backupFilename); + /* Check if it's a compressed backup, in which case we need to remove + * both the gz and the tar extensions. + */ + if ($info['extension'] == "gz") { + $info = pathinfo(basename($backupFilename, '.' . $info['extension'])); + } + $wsNameFromTar = basename($backupFilename, '.' . $info['extension']); + $metadataFilename = $tempDirectory . PATH_SEP . $wsNameFromTar . '.txt'; + if (!file_exists($metadataFilename)) { + throw (new Exception("Metadata file was not found in backup")); + } + } + + $metadata = unserialize(file_get_contents($metadataFilename)); + + $backupWorkspace = $metadata['WORKSPACE_NAME']; + $changeWorkspace = (isset($targetWorkspace)); + if (!$changeWorkspace) { + $targetWorkspace = $backupWorkspace; + } else { + echo "Restoring from workspace: " . pakeColor::colorize($backupWorkspace, 'INFO') . "\n"; + } + echo "Restoring to workspace: ".pakeColor::colorize($targetWorkspace, 'INFO')."\n"; + + //moving the site files + $backupWorkspaceDir = $tempDirectory . PATH_SEP . $backupWorkspace; + $targetWorkspaceDir = PATH_DATA . 'sites' . PATH_SEP . $targetWorkspace; + + if (!$overwrite && file_exists($targetWorkspaceDir)) { + $overwrite = strtolower(prompt('Workspace already exists, do you want to overwrite? [Y/n]')); + if (array_search(trim($overwrite), array("y", "")) === false) { + die(); + } + $overwrite = true; + } + + printf("Moving files to %s \n", pakeColor::colorize($targetWorkspaceDir, 'INFO')); + + /* We already know we will be overwriting the new workspace if we reach this + * point, so remove the workspace directory if it exists. + */ + if (file_exists($targetWorkspaceDir)) { + G::rm_dir($targetWorkspaceDir); + } + + if (! rename($backupWorkspaceDir, $targetWorkspaceDir)) { + throw (new Exception("There was an error moving from $backupWorkspaceDir to $targetWorkspaceDir")); + } + + $dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH)); + $dbHostname = $dbOpt[0]; + + /* TODO: Check if database exists after updateDBfile */ + $config = updateDBfile($targetWorkspaceDir, $targetWorkspace, $dbHostname, $changeWorkspace); + + $oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]); + + $dbName = $config['DB_NAME']; + $dbUser = $config['DB_USER']; + $dbPass = $config['DB_PASS']; + restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); + + $dbName = $config['DB_RBAC_NAME']; + $dbUser = $config['DB_RBAC_USER']; + $dbPass = $config['DB_RBAC_PASS']; + restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_RBAC_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); + + $dbName = $config['DB_REPORT_NAME']; + $dbUser = $config['DB_REPORT_USER']; + $dbPass = $config['DB_REPORT_PASS']; + restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_REPORT_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite); + + echo "\n"; + + $wsInfo = getSysInfo(); + $wsInfo['WORKSPACE_NAME'] = $targetWorkspace; + $wsInfo = array_merge($wsInfo, $config); + + printInfoSites($metadata, $wsInfo); + + return true; +} + +function get_DirDB($workspace) +{ + $dbFile = PATH_DB . $workspace . PATH_SEP . 'db.php'; + if (! file_exists($dbFile)) { + throw (new Exception("the db file does not exist, $dbFile")); + } + + require_once($dbFile); - //printf( "%25s %s \n", 'MySql Data Directory', pakeColor::colorize( $aSitebck['MYSQL_DATA_DIR'], 'INFO') ); - //printf( "%25s %s \n", 'MySql Data Directory', pakeColor::colorize( $aSiterestared['MYSQL_DATA_DIR'], 'INFO') ); + Propel::init(PATH_CORE . "config/databases.php"); + $configuration = Propel::getConfiguration(); + $connectionDSN = $configuration['datasources']['workflow']['connection']; + + // printf("using DSN Connection %s \n", pakeColor::colorize( $connectionDSN, 'INFO')); - //printf( "%25s %s \n", 'Available Databases', pakeColor::colorize( $aSitebck['AVAILABLE_DB'], 'INFO') ); + $con = Propel::getConnection('workflow'); + $sql = "show variables like 'datadir'"; + $stmt = $con->createStatement(); + $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + + if (! is_array($row)) { + throw (new Exception("unable to execute query in database")); + } + $dataDir = $row['Value']; + if ($dataDir[count($dataDir) - 1] == '/') { + $dataDir = substr($dataDir, count($dataDir) - 1); + } + + $info_db = array(); + $info_db['conx'] = $configuration['datasources']['workflow']['connection']; + $info_db['adap'] = $configuration['datasources']['workflow']['adapter']; + $info_db['datadir'] = $dataDir; + + $info_db['DB_ADAPTER'] = DB_ADAPTER; + $info_db['DB_HOST'] = DB_HOST; + $info_db['DB_NAME'] = DB_NAME; + $info_db['DB_USER'] = DB_USER; + $info_db['DB_PASS'] = DB_PASS; + $info_db['DB_RBAC_HOST'] = DB_RBAC_HOST; + $info_db['DB_RBAC_NAME'] = DB_RBAC_NAME; + $info_db['DB_RBAC_USER'] = DB_RBAC_USER; + $info_db['DB_RBAC_PASS'] = DB_RBAC_PASS; + $info_db['DB_REPORT_HOST'] = DB_REPORT_HOST; + $info_db['DB_REPORT_NAME'] = DB_REPORT_NAME; + $info_db['DB_REPORT_USER'] = DB_REPORT_USER; + $info_db['DB_REPORT_PASS'] = DB_REPORT_PASS; + + return $info_db; +} + +function printInfoSites($aSitebck, $aSiterestared) +{ + printf("%25s %s \n", 'Workspace Name Backup', pakeColor::colorize($aSitebck['WORKSPACE_NAME'], 'INFO')); + printf("%25s %s \n", 'Workspace Name Restored', pakeColor::colorize($aSiterestared['WORKSPACE_NAME'], 'INFO')); + + printf("%25s %s \n", 'System Backup', pakeColor::colorize($aSitebck['SYSTEM'], 'INFO')); + printf("%25s %s \n", 'System Restored', pakeColor::colorize($aSiterestared['SYSTEM'], 'INFO')); + + printf("%25s %s \n", 'PM Version Backup', pakeColor::colorize($aSitebck['PM_VERSION'], 'INFO')); + printf("%25s %s \n", 'PM Version Restored', pakeColor::colorize($aSiterestared['PM_VERSION'], 'INFO')); + + printf("%25s %s \n", 'PHP Version Backup', pakeColor::colorize($aSitebck['PHP'], 'INFO')); + printf("%25s %s \n", 'PHP Version Restored', pakeColor::colorize($aSiterestared['PHP'], 'INFO')); + + //printf( "%25s %s \n", 'Server Address', pakeColor::colorize( $aSitebck['SERVER_ADDR'], 'INFO') ); + //printf( "%25s %s \n", 'Client IP Address', pakeColor::colorize( $aSitebck['IP'], 'INFO') ); - /*printf( "%20s %s \n", 'Plugins', pakeColor::colorize( '', 'INFO') ); - foreach ($aSitebck['PLUGINS_LIST'] as $k => $v){ - printf( "%20s %s \n", ' -', pakeColor::colorize( $v, 'INFO') ); - }*/ + //printf( "%25s %s \n", 'MySql Version', pakeColor::colorize( $aSitebck['DATABASE'], 'INFO') ); + //printf( "%25s %s \n", 'MySql Version', pakeColor::colorize( $aSiterestared['DATABASE'], 'INFO') ); - $wfDsn = $aSiterestared['DB_ADAPTER'] . '://' . $aSiterestared['DB_USER'] . ':' . $aSiterestared['DB_PASS'] . '@' . $aSiterestared['DB_HOST'] . '/' . $aSiterestared['DB_NAME']; - $rbDsn = $aSiterestared['DB_ADAPTER'] . '://' . $aSiterestared['DB_RBAC_USER'] . ':' . $aSiterestared['DB_RBAC_PASS'] . '@' . $aSiterestared['DB_RBAC_HOST'] . '/' . $aSiterestared['DB_RBAC_NAME']; - $rpDsn = $aSiterestared['DB_ADAPTER'] . '://' . $aSiterestared['DB_REPORT_USER'] . ':' . $aSiterestared['DB_REPORT_PASS'] . '@' . $aSiterestared['DB_REPORT_HOST'] . '/' . $aSiterestared['DB_REPORT_NAME']; - printf("%25s %s \n", 'Workflow Database', pakeColor::colorize($wfDsn, 'INFO')); - printf("%25s %s \n", 'RBAC Database', pakeColor::colorize($rbDsn, 'INFO')); - printf("%25s %s \n", 'Report Database', pakeColor::colorize($rpDsn, 'INFO')); + //printf( "%25s %s \n", 'MySql Data Directory', pakeColor::colorize( $aSitebck['MYSQL_DATA_DIR'], 'INFO') ); + //printf( "%25s %s \n", 'MySql Data Directory', pakeColor::colorize( $aSiterestared['MYSQL_DATA_DIR'], 'INFO') ); + + + //printf( "%25s %s \n", 'Available Databases', pakeColor::colorize( $aSitebck['AVAILABLE_DB'], 'INFO') ); + + + /*printf( "%20s %s \n", 'Plugins', pakeColor::colorize( '', 'INFO') ); + foreach ($aSitebck['PLUGINS_LIST'] as $k => $v){ + printf( "%20s %s \n", ' -', pakeColor::colorize( $v, 'INFO') ); + }*/ + + $wfDsn = $aSiterestared['DB_ADAPTER'] . '://' . $aSiterestared['DB_USER'] . ':' . $aSiterestared['DB_PASS'] . '@' . $aSiterestared['DB_HOST'] . '/' . $aSiterestared['DB_NAME']; + $rbDsn = $aSiterestared['DB_ADAPTER'] . '://' . $aSiterestared['DB_RBAC_USER'] . ':' . $aSiterestared['DB_RBAC_PASS'] . '@' . $aSiterestared['DB_RBAC_HOST'] . '/' . $aSiterestared['DB_RBAC_NAME']; + $rpDsn = $aSiterestared['DB_ADAPTER'] . '://' . $aSiterestared['DB_REPORT_USER'] . ':' . $aSiterestared['DB_REPORT_PASS'] . '@' . $aSiterestared['DB_REPORT_HOST'] . '/' . $aSiterestared['DB_REPORT_NAME']; + printf("%25s %s \n", 'Workflow Database', pakeColor::colorize($wfDsn, 'INFO')); + printf("%25s %s \n", 'RBAC Database', pakeColor::colorize($rbDsn, 'INFO')); + printf("%25s %s \n", 'Report Database', pakeColor::colorize($rpDsn, 'INFO')); } global $aFiles; -function checkFileStandardCode ( $file ) { - global $aFiles; +function checkFileStandardCode($file) +{ + global $aFiles; - if ( strpos ($file, 'workflow/engine/classes/model/om/') !== false ) { - return; - } - if ( strpos ($file, 'workflow/engine/classes/model/map/') !== false ) { - return; - } - if ( substr ($file, -4 ) == '.gif' ) { - return; - } + if (strpos($file, 'workflow/engine/classes/model/om/') !== false) { + return; + } + if (strpos($file, 'workflow/engine/classes/model/map/') !== false) { + return; + } + if (substr($file, -4) == '.gif') { + return; + } - $rootFolder = str_replace ( PATH_TRUNK, '', $file ); + $rootFolder = str_replace(PATH_TRUNK, '', $file); - $data = file_get_contents ( $file ); + $data = file_get_contents($file); - $bTabs = false; - if ( strpos( $data, "\t" ) !== false ) { - $bTabs = true; - } + $bTabs = false; + if (strpos($data, "\t") !== false) { + $bTabs = true; + } - $bUtf8 = false; - if ( strpos( $data, "\xff" ) !== false || strpos( $data, "\x00" ) !== false ) { -//isUTF8 - $bUtf8 = true; - } - if ( filesize ( $file ) != strlen($data) ) { - $bUtf8 = true; - } + $bUtf8 = false; + if (strpos($data, "\xff") !== false || strpos($data, "\x00") !== false) { + //isUTF8 + $bUtf8 = true; + } + if (filesize($file) != strlen($data)) { + $bUtf8 = true; + } - $bDos = false; - if ( strpos( $data, "\x0D" ) !== false ) { - $bDos = true; - } + $bDos = false; + if (strpos($data, "\x0D") !== false) { + $bDos = true; + } - if ( $bUtf8 || $bTabs || $bDos ) { - $aFiles[] = array ( 'file' => $rootFolder, 'tab' => $bTabs, 'utf' => $bUtf8, 'dos' => $bDos ); - - } + if ($bUtf8 || $bTabs || $bDos) { + $aFiles[] = array( 'file' => $rootFolder, 'tab' => $bTabs, 'utf' => $bUtf8, 'dos' => $bDos ); + } } /*----------------------------------********---------------------------------*/ /*function checkFolderStandardCode ( $folder, $bSubFolders ) { global $aFiles; - $rootFolder = str_replace ( PATH_TRUNK, '', $folder ); + $rootFolder = str_replace ( PATH_TRUNK, '', $folder ); //printf("%s \n", pakeColor::colorize($rootFolder, 'INFO')); if ($handle = opendir( $folder )) { while ( false !== ($file = readdir($handle))) { if ( substr( $file, 0, 1 ) !== '.' ) { - if ( is_file ( $folder . '/' . $file ) ) { + if ( is_file ( $folder . '/' . $file ) ) { checkFileStandardCode ( $folder . '/' . $file); } if ( is_dir( $folder . '/' . $file ) && $bSubFolders ) { - checkFolderStandardCode ( $folder . '/' . $file, $bSubFolders ); + checkFolderStandardCode ( $folder . '/' . $file, $bSubFolders ); } } } @@ -2193,31 +2276,35 @@ function checkFileStandardCode ( $file ) { /*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/ -function run_check_standard_code ( $task, $options) { - global $aFiles; - $aFiles = array(); - if ( ! isset( $options[0]) ) { - $folder = PATH_TRUNK . 'classes'; - } - else - $folder = PATH_TRUNK . $options[0]; +function run_check_standard_code($task, $options) +{ + global $aFiles; + $aFiles = array(); + if (! isset($options[0])) { + $folder = PATH_TRUNK . 'classes'; + } else { + $folder = PATH_TRUNK . $options[0]; + } - if ( ! isset( $options[1]) ) { - $bSubFolders = false; - } - else - $bSubFolders = strtolower($options[1]) == 'true'; + if (! isset($options[1])) { + $bSubFolders = false; + } else { + $bSubFolders = strtolower($options[1]) == 'true'; + } - printf("checking folder %s\n", pakeColor::colorize($folder, 'INFO') ); - checkFolderStandardCode ( $folder , $bSubFolders); - sort($aFiles); - foreach ( $aFiles as $key => $val ) { - - printf("%s %s %s %s \n", pakeColor::colorize($val['tab'] ? 'tab' : ' ', 'INFO'), + printf("checking folder %s\n", pakeColor::colorize($folder, 'INFO')); + checkFolderStandardCode($folder, $bSubFolders); + sort($aFiles); + foreach ($aFiles as $key => $val) { + printf( + "%s %s %s %s \n", + pakeColor::colorize($val['tab'] ? 'tab' : ' ', 'INFO'), pakeColor::colorize($val['utf'] ? 'utf' : ' ', 'INFO'), - pakeColor::colorize($val['dos'] ? 'dos' : ' ', 'INFO'), $val['file'] ); - } + pakeColor::colorize($val['dos'] ? 'dos' : ' ', 'INFO'), + $val['file'] + ); + } } /*----------------------------------********---------------------------------*/ function run_update_plugin_attributes($task, $args) @@ -2317,7 +2404,6 @@ function run_check_plugin_disabled_code($task, $args) //Check disabled code if (count($arrayData) > 0) { - $cs = new CodeScanner(true); $strFoundDisabledCode = ""; @@ -2356,4 +2442,3 @@ function run_check_plugin_disabled_code($task, $args) error_log($e->getMessage() . "\n"); } } - diff --git a/gulliver/bin/tasks/templates/dbInfo.php.tpl b/gulliver/bin/tasks/templates/dbInfo.php.tpl index 0dff1bc0a..3868ff189 100644 --- a/gulliver/bin/tasks/templates/dbInfo.php.tpl +++ b/gulliver/bin/tasks/templates/dbInfo.php.tpl @@ -1,108 +1,106 @@ '; - //if( eregi('[a-zA-Z]', $target) ) - if( preg_match('[a-zA-Z]', $target)) //Made compatible to PHP 5.3 + global $ntarget; + $msg = $target . ' => '; + //if( eregi('[a-zA-Z]', $target) ) + if (preg_match('[a-zA-Z]', $target)) { //Made compatible to PHP 5.3 $ntarget = gethostbyname($target); - else - $ntarget = gethostbyaddr($target); - $msg .= $ntarget; - return($msg); + } else { + $ntarget = gethostbyaddr($target); + } + $msg .= $ntarget; + return($msg); } - function getDbServicesAvailables() - { - $servicesAvailables = Array(); - - $dbServices = Array( - 'mysql' => Array( - 'id' => 'mysql', - 'command' => 'mysql_connect', + function getDbServicesAvailables() + { + $servicesAvailables = array(); + + $dbServices = array( + 'mysql' => array( + 'id' => 'mysql', + 'command' => 'mysqli_connect', 'name' => 'MySql' ), - 'pgsql' => Array( + 'pgsql' => array( 'id' => 'pgsql', 'command' => 'pg_connect', 'name' => 'PostgreSQL' ), - 'mssql' => Array( + 'mssql' => array( 'id' => 'mssql', 'command' => 'mssql_connect', 'name' => 'Microsoft SQL Server'), - 'oracle'=> Array( + 'oracle'=> array( 'id' => 'oracle', 'command' => 'oci_connect', 'name' => 'Oracle' ), - 'informix'=> Array( + 'informix'=> array( 'id' => 'informix', 'command' => 'ifx_connect', 'name' => 'Informix' ), - 'sqlite' => Array( + 'sqlite' => array( 'id' => 'sqlite', 'command' => 'sqlite_open', 'name' => 'SQLite' ) - ); - - foreach($dbServices as $service) { - if(@function_exists($service['command'])){ - $servicesAvailables[] = $service; - } - } - return $servicesAvailables; - } + ); + + foreach ($dbServices as $service) { + if (@function_exists($service['command'])) { + $servicesAvailables[] = $service; + } + } + return $servicesAvailables; + } - function getDbServerVersion($driver) { - try{ - switch($driver) - { + function getDbServerVersion($driver) + { + try { + switch ($driver) { case 'mysql': - if($link = @mysql_connect( DB_HOST, DB_USER, DB_PASS)){ - $v = @mysql_get_server_info(); + if ($link = mysqli_connect(DB_HOST, DB_USER, DB_PASS)) { + $v = mysqli_get_server_info($link); } else { - throw new Exception(@mysql_error($link)); + throw new Exception(mysqli_error($link)); } break; } - return (isset($v))?$v:'none'; - } catch (Exception $e){ - return ($e->getMessage()); - } + return (isset($v))?$v:'none'; + } catch (Exception $e) { + return ($e->getMessage()); + } } - if (file_exists(PATH_METHODS . 'login/version-{projectName}.php')) - { - include('version-{projectName}.php'); - } - else { - define('PRG_VERSION', 'Development Version'); + if (file_exists(PATH_METHODS . 'login/version-{projectName}.php')) { + include('version-{projectName}.php'); + } else { + define('PRG_VERSION', 'Development Version'); } if (getenv('HTTP_CLIENT_IP')) { - $ip = getenv('HTTP_CLIENT_IP'); - } - elseif(getenv('HTTP_X_FORWARDED_FOR')) { - $ip = getenv('HTTP_X_FORWARDED_FOR'); + $ip = getenv('HTTP_CLIENT_IP'); + } elseif (getenv('HTTP_X_FORWARDED_FOR')) { + $ip = getenv('HTTP_X_FORWARDED_FOR'); } else { - $ip = getenv('REMOTE_ADDR'); + $ip = getenv('REMOTE_ADDR'); } $redhat = ''; - if ( file_exists ( '/etc/redhat-release' ) ) { - $fnewsize = filesize( '/etc/redhat-release' ); - $fp = fopen( '/etc/redhat-release' , 'r' ); - $redhat = fread( $fp, $fnewsize ); - fclose( $fp ); + if (file_exists('/etc/redhat-release')) { + $fnewsize = filesize('/etc/redhat-release'); + $fp = fopen('/etc/redhat-release', 'r'); + $redhat = fread($fp, $fnewsize); + fclose($fp); } $redhat .= " (" . PHP_OS . ")"; @@ -111,9 +109,11 @@ function lookup($target) //$dbNetView->loginDbServer(DB_USER, DB_PASS); $availdb = ''; - foreach ( getDbServicesAvailables() as $key => $val ) { - if ( $availdb != '' ) $availdb .= ', '; - $availdb .= $val['name']; + foreach (getDbServicesAvailables() as $key => $val) { + if ($availdb != '') { + $availdb .= ', '; + } + $availdb .= $val['name']; } $Fields['SYSTEM'] = $redhat; @@ -122,7 +122,7 @@ function lookup($target) $Fields['DATABASE_NAME'] = DB_NAME; $Fields['PHP'] = phpversion(); $Fields['FLUID'] = PRG_VERSION; - $Fields['IP'] = lookup ($ip); + $Fields['IP'] = lookup($ip); $Fields['ENVIRONMENT'] = SYS_SYS; $Fields['SERVER_SOFTWARE'] = getenv('SERVER_SOFTWARE'); $Fields['SERVER_NAME'] = getenv('SERVER_NAME'); diff --git a/gulliver/bin/tasks/templates/green.php.tpl b/gulliver/bin/tasks/templates/green.php.tpl index fc0698c48..c73ca3336 100644 --- a/gulliver/bin/tasks/templates/green.php.tpl +++ b/gulliver/bin/tasks/templates/green.php.tpl @@ -25,7 +25,7 @@ $smarty->display('blank.html'); } else { - $oHeadPublisher =& headPublisher::getSingleton(); + $oHeadPublisher = headPublisher::getSingleton(); if (isset($oHeadPublisher)) $header = $oHeadPublisher->printHeader(); $smarty->assign('username', (isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : '') ); $smarty->assign('header', $header ); diff --git a/gulliver/bin/tasks/templates/pluginApplication.php.tpl b/gulliver/bin/tasks/templates/pluginApplication.php.tpl index 308e10b0a..cf73b99c9 100644 --- a/gulliver/bin/tasks/templates/pluginApplication.php.tpl +++ b/gulliver/bin/tasks/templates/pluginApplication.php.tpl @@ -7,7 +7,7 @@ try { /* Render page */ - $oHeadPublisher = &headPublisher::getSingleton(); + $oHeadPublisher = headPublisher::getSingleton(); $G_MAIN_MENU = "processmaker"; $G_ID_MENU_SELECTED = "{menuId}_MNU_01"; diff --git a/gulliver/bin/tasks/templates/pluginApplication2.php.tpl b/gulliver/bin/tasks/templates/pluginApplication2.php.tpl index 320f44c6e..58cd380e9 100644 --- a/gulliver/bin/tasks/templates/pluginApplication2.php.tpl +++ b/gulliver/bin/tasks/templates/pluginApplication2.php.tpl @@ -1,6 +1,6 @@ addContent("{className}/{className}Application2"); //Adding a html file .html. $oHeadPublisher->addExtJsScript("{className}/{className}Application2", false); //Adding a javascript file .js diff --git a/gulliver/bin/tasks/templates/pluginApplication3.php.tpl b/gulliver/bin/tasks/templates/pluginApplication3.php.tpl index 575befe8a..6729c27df 100644 --- a/gulliver/bin/tasks/templates/pluginApplication3.php.tpl +++ b/gulliver/bin/tasks/templates/pluginApplication3.php.tpl @@ -1,6 +1,6 @@ addContent("{className}/{className}Application3"); //Adding a html file .html. $oHeadPublisher->addExtJsScript("{className}/{className}Application3", false); //Adding a javascript file .js diff --git a/gulliver/bin/tasks/templates/pluginMainFile.tpl b/gulliver/bin/tasks/templates/pluginMainFile.tpl index b1b438ca3..74459db57 100644 --- a/gulliver/bin/tasks/templates/pluginMainFile.tpl +++ b/gulliver/bin/tasks/templates/pluginMainFile.tpl @@ -111,5 +111,5 @@ class {className}Plugin extends PMPlugin } -$oPluginRegistry = &PMPluginRegistry::getSingleton(); +$oPluginRegistry = PMPluginRegistry::getSingleton(); $oPluginRegistry->registerPlugin("{className}", __FILE__); diff --git a/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl b/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl index a763be264..7f08e28d1 100644 --- a/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl +++ b/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl @@ -1,7 +1,7 @@ unSerializeInstance( file_get_contents ( $sSerializedFile ) ); // @@ -297,7 +297,7 @@ $docuroot = explode ( PATH_SEP , $_SERVER['DOCUMENT_ROOT'] ); // ***************** enable rbac ************************** - $RBAC =& RBAC::getSingleton(); + $RBAC = RBAC::getSingleton(); $RBAC->sSystem = '{rbacProjectName}'; // ***************** Headers ************************** diff --git a/gulliver/methods/defaultAjax.php b/gulliver/methods/defaultAjax.php index 645cf34b6..1a89e359c 100644 --- a/gulliver/methods/defaultAjax.php +++ b/gulliver/methods/defaultAjax.php @@ -26,113 +26,115 @@ use ProcessMaker\Plugins\PluginRegistry; -if (isset( $_SESSION['CURRENT_PAGE_INITILIZATION'] )) - eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] ); +if (isset($_SESSION['CURRENT_PAGE_INITILIZATION'])) { + eval($_SESSION['CURRENT_PAGE_INITILIZATION']); +} - // $json=new Services_JSON(); -if (! defined( 'XMLFORM_AJAX_PATH' )) - define( 'XMLFORM_AJAX_PATH', PATH_XMLFORM ); +// $json=new Services_JSON(); +if (!defined('XMLFORM_AJAX_PATH')) { + define('XMLFORM_AJAX_PATH', PATH_XMLFORM); +} -$_DBArray = array (); -if (isset( $_SESSION['_DBArray'] )) { +$_DBArray = array(); +if (isset($_SESSION['_DBArray'])) { $_DBArray = $_SESSION['_DBArray']; } -$xmlFile = G::getUIDName( urlDecode( $_POST['form'] ) ); +$xmlFile = G::getUIDName(urlDecode($_POST['form'])); $sPath = XMLFORM_AJAX_PATH; //if the xmlform file doesn't exist, then try with the plugins folders -if (! is_file( XMLFORM_AJAX_PATH . $xmlFile )) { - $aux = explode( PATH_SEP, $xmlFile ); +if (!is_file(XMLFORM_AJAX_PATH . $xmlFile)) { + $aux = explode(PATH_SEP, $xmlFile); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment - if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) { + if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry = PluginRegistry::loadSingleton(); - if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) { + if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; } } } -$G_FORM = new Form( $xmlFile, $sPath ); -$G_FORM->id = urlDecode( $_POST['form'] ); -$G_FORM->values = isset( $_SESSION[$G_FORM->id] ) ? $_SESSION[$G_FORM->id] : array (); +$G_FORM = new Form($xmlFile, $sPath); +$G_FORM->id = urlDecode($_POST['form']); +$G_FORM->values = isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array(); -$newValues = (Bootstrap::json_decode( urlDecode( stripslashes( $_POST['fields'] ) ) )); +$newValues = (Bootstrap::json_decode(urlDecode(stripslashes($_POST['fields'])))); -if (isset( $_POST['grid'] )) { - $_POST['row'] = (int) $_POST['row']; - $aAux = array (); +if (isset($_POST['grid'])) { + $_POST['row'] = (int)$_POST['row']; + $aAux = array(); foreach ($newValues as $sKey => $newValue) { - $newValue = (array) $newValue; - $aKeys = array_keys( $newValue ); - if (count($aKeys)>0) { - $aValues = array (); - for ($i = 1; $i <= ($_POST['row'] - 1); $i ++) { - $aValues[$i] = array ($aKeys[0] => '' ); + $newValue = (array)$newValue; + $aKeys = array_keys($newValue); + if (count($aKeys) > 0) { + $aValues = array(); + for ($i = 1; $i <= ($_POST['row'] - 1); $i++) { + $aValues[$i] = array($aKeys[0] => ''); } - $aValues[$_POST['row']] = array ($aKeys[0] => $newValue[$aKeys[0]] ); - $newValues[$sKey]->$_POST['grid'] = $aValues; - unset( $newValues[$sKey]->$aKeys[0] ); + $aValues[$_POST['row']] = array($aKeys[0] => $newValue[$aKeys[0]]); + $newValues[$sKey]->{$_POST['grid']} = $aValues; + unset($newValues[$sKey]->{$aKeys[0]}); } } } //Next Lines re-build newValues array to send multiple dependent fields merged by row into a grid. -if (sizeof( $newValues ) > 1 && isset( $_POST['grid'] )) { - $fieldBase = array (); +if (count($newValues) > 1 && isset($_POST['grid'])) { + $fieldBase = array(); foreach ($newValues as $key => $values) { - for ($r2 = 1; $r2 <= $_POST['row']; $r2 ++) { + for ($r2 = 1; $r2 <= $_POST['row']; $r2++) { foreach ($values as $class => $value) { if ($class == $_POST['grid']) { - $value = (array) $value; + $value = (array)$value; $arrayK = $value[$r2]; foreach ($arrayK as $key2 => $val) { - $fieldBase[$r2][$key2] = is_array( $val ) ? $val[$key2] : $val; + $fieldBase[$r2][$key2] = is_array($val) ? $val[$key2] : $val; } } } } } - $newValues[0]->$_POST['grid'] = $fieldBase; + $newValues[0]->{$_POST['grid']} = $fieldBase; } //Resolve dependencies //Returns an array ($dependentFields) with the names of the fields //that depends of fields passed through AJAX ($_GET/$_POST) //Returns all dependencies of all fields, this in grids -$dependentFields = array (); -$aux = array (); -for ($r = 0; $r < sizeof( $newValues ); $r ++) { - $newValues[$r] = (array) $newValues[$r]; - $G_FORM->setValues( $newValues[$r] ); +$dependentFields = array(); +$aux = array(); +for ($r = 0; $r < count($newValues); $r++) { + $newValues[$r] = (array)$newValues[$r]; + $G_FORM->setValues($newValues[$r]); //Search dependent fields foreach ($newValues[$r] as $k => $v) { - if (! is_array( $v )) { - $myDependentFields = subDependencies( $k, $G_FORM, $aux ); + if (!is_array($v)) { + $myDependentFields = subDependencies($k, $G_FORM, $aux); $_SESSION[$G_FORM->id][$k] = $v; } else { foreach ($v[$_POST['row']] as $k1 => $v1) { - $myDependentFields = subDependencies( $k1, $G_FORM, $aux, $_POST['grid'] ); + $myDependentFields = subDependencies($k1, $G_FORM, $aux, $_POST['grid']); $_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1; $G_FORM->values[$_POST['grid']][$_POST['row']][$k1] = $v1; } } - $dependentFields = array_merge( $dependentFields, $myDependentFields ); + $dependentFields = array_merge($dependentFields, $myDependentFields); } } -$dependentFields = array_unique( $dependentFields ); +$dependentFields = array_unique($dependentFields); //Update when is depenfield set empty $newForm = $G_FORM->values; -foreach($newForm as $fKey => $values){ - foreach($dependentFields as $att){ - if($att == $fKey){ - $newForm[$fKey] = ''; +foreach ($newForm as $fKey => $values) { + foreach ($dependentFields as $att) { + if ($att == $fKey) { + $newForm[$fKey] = ''; + } } - } } $G_FORM->values = $newForm; @@ -148,7 +150,7 @@ if (isset($_POST["grid"])) { $arrayAux = (array)($fieldData); foreach ($arrayAux as $index => $value) { - $ereg = $ereg . (($ereg != null)? "|" : null) . $index; //Concatenate field + $ereg = $ereg . (($ereg != null) ? "|" : null) . $index; //Concatenate field } } @@ -200,10 +202,10 @@ if (isset($_POST["grid"]) && isset($_POST["gridField"])) { } //Parse and update the new content -$newContent = $G_FORM->getFields(PATH_CORE . "templates" . PATH_SEP . "xmlform.html", (isset($_POST["row"])? $_POST["row"] : -1)); +$newContent = $G_FORM->getFields(PATH_CORE . "templates" . PATH_SEP . "xmlform.html", (isset($_POST["row"]) ? $_POST["row"] : -1)); //Returns the dependentFields's content -$sendContent = array (); +$sendContent = array(); $r = 0; //Set data @@ -213,19 +215,19 @@ foreach ($dependentFields as $d) { $sendContent[$r]->name = $d; $sendContent[$r]->content = new stdclass(); - if (! isset( $_POST['grid'] )) { - if (isset( $G_FORM->fields[$d] )) { + if (!isset($_POST['grid'])) { + if (isset($G_FORM->fields[$d])) { foreach ($G_FORM->fields[$d] as $attribute => $value) { switch ($attribute) { case 'type': $sendContent[$r]->content->{$attribute} = $value; break; case 'options': - $sendContent[$r]->content->{$attribute} = toJSArray( $value, $sendContent[$r]->content->type ); + $sendContent[$r]->content->{$attribute} = toJSArray($value, $sendContent[$r]->content->type); break; } } - $sendContent[$r]->value = isset( $G_FORM->values[$d] ) ? $G_FORM->values[$d] : ''; + $sendContent[$r]->value = isset($G_FORM->values[$d]) ? $G_FORM->values[$d] : ''; } } else { foreach ($G_FORM->fields[$_POST['grid']]->fields[$d] as $attribute => $value) { @@ -237,12 +239,12 @@ foreach ($dependentFields as $d) { if ($sendContent[$r]->content->type != "text" && $sendContent[$r]->content->type != "textarea") { $sendContent[$r]->content->{$attribute} = toJSArray($value); } else { - $sendContent[$r]->content->{$attribute} = toJSArray((isset($value[$_POST["row"]])? array($value[$_POST["row"]]) : array())); + $sendContent[$r]->content->{$attribute} = toJSArray((isset($value[$_POST["row"]]) ? array($value[$_POST["row"]]) : array())); } break; } } - $sendContent[$r]->value = isset( $G_FORM->values[$_POST['grid']][$_POST['row']][$d] ) ? $G_FORM->values[$_POST['grid']][$_POST['row']][$d] : ''; + $sendContent[$r]->value = isset($G_FORM->values[$_POST['grid']][$_POST['row']][$d]) ? $G_FORM->values[$_POST['grid']][$_POST['row']][$d] : ''; } $r = $r + 1; @@ -250,9 +252,9 @@ foreach ($dependentFields as $d) { echo Bootstrap::json_encode($sendContent); -function toJSArray ($array, $type = '') +function toJSArray($array, $type = '') { - $result = array (); + $result = array(); foreach ($array as $k => $v) { $o = new stdclass(); $o->key = $k; @@ -264,55 +266,62 @@ function toJSArray ($array, $type = '') return $result; } -function subDependencies ($k, &$G_FORM, &$aux, $grid = '') +function subDependencies($k, &$G_FORM, &$aux, $grid = '') { - if (array_search( $k, $aux ) !== FALSE) - return array (); + if (array_search($k, $aux) !== false) { + return array(); + } if ($grid == '') { - if (! array_key_exists( $k, $G_FORM->fields )) - return array (); - if (! isset( $G_FORM->fields[$k]->dependentFields )) - return array (); - $aux[] = $k; - if (strpos( $G_FORM->fields[$k]->dependentFields, ',' ) !== false) { - $myDependentFields = explode( ',', $G_FORM->fields[$k]->dependentFields ); - } else { - $myDependentFields = explode( '|', $G_FORM->fields[$k]->dependentFields ); + if (!array_key_exists($k, $G_FORM->fields)) { + return array(); } - for ($r = 0; $r < sizeof( $myDependentFields ); $r ++) { - if ($myDependentFields[$r] == "") - unset( $myDependentFields[$r] ); + if (!isset($G_FORM->fields[$k]->dependentFields)) { + return array(); + } + $aux[] = $k; + if (strpos($G_FORM->fields[$k]->dependentFields, ',') !== false) { + $myDependentFields = explode(',', $G_FORM->fields[$k]->dependentFields); + } else { + $myDependentFields = explode('|', $G_FORM->fields[$k]->dependentFields); + } + for ($r = 0; $r < count($myDependentFields); $r++) { + if ($myDependentFields[$r] == "") { + unset($myDependentFields[$r]); + } } $mD = $myDependentFields; - foreach( $mD as $ki) { - $myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux ) ); + foreach ($mD as $ki) { + $myDependentFields = array_merge($myDependentFields, subDependencies($ki, $G_FORM, $aux)); } } else { - if (! isset($G_FORM->fields[$grid])) { - return array (); + if (!isset($G_FORM->fields[$grid])) { + return array(); + } + if (!array_key_exists($k, $G_FORM->fields[$grid]->fields)) { + return array(); + } + if (!isset($G_FORM->fields[$grid]->fields[$k]->dependentFields)) { + return array(); } - if (! array_key_exists( $k, $G_FORM->fields[$grid]->fields )) - return array (); - if (! isset( $G_FORM->fields[$grid]->fields[$k]->dependentFields )) - return array (); $aux[] = $k; - if (strpos( $G_FORM->fields[$grid]->fields[$k]->dependentFields, ',' ) !== false) { - $myDependentFields = explode( ',', $G_FORM->fields[$grid]->fields[$k]->dependentFields ); + if (strpos($G_FORM->fields[$grid]->fields[$k]->dependentFields, ',') !== false) { + $myDependentFields = explode(',', $G_FORM->fields[$grid]->fields[$k]->dependentFields); } else { - $myDependentFields = explode( '|', $G_FORM->fields[$grid]->fields[$k]->dependentFields ); + $myDependentFields = explode('|', $G_FORM->fields[$grid]->fields[$k]->dependentFields); } - for ($r = 0; $r < sizeof( $myDependentFields ); $r ++) { - if ($myDependentFields[$r] == "") - unset( $myDependentFields[$r] ); + for ($r = 0; $r < count($myDependentFields); $r++) { + if ($myDependentFields[$r] == "") { + unset($myDependentFields[$r]); + } } $mD = $myDependentFields; - foreach( $mD as $ki) { - $myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux, $grid) ); + foreach ($mD as $ki) { + $myDependentFields = array_merge($myDependentFields, subDependencies($ki, $G_FORM, $aux, $grid)); } //Set field and the dependent field of the grid @@ -323,4 +332,3 @@ function subDependencies ($k, &$G_FORM, &$aux, $grid = '') return $myDependentFields; } - diff --git a/gulliver/methods/genericAjax.php b/gulliver/methods/genericAjax.php index f75561d26..83883f03b 100644 --- a/gulliver/methods/genericAjax.php +++ b/gulliver/methods/genericAjax.php @@ -24,7 +24,7 @@ if (isset($request)) { $_SESSION[$_POST["formID"]][$_POST["gridname"]] = (array)$_SESSION[$_POST["formID"]][$_POST["gridname"]]; } ksort($_SESSION[$_POST["formID"]][$_POST["gridname"]]); - $oFields = array(); + $oFields = []; $initialKey = 1; foreach ($_SESSION[$_POST["formID"]][$_POST["gridname"]] as $key => $value) { @@ -66,12 +66,12 @@ if (isset($request)) { $bdUid = 'workflow'; - if (isset($_GET['type']) && $_GET['type']==='form' && isset($myForm->fields[$_GET['variable']]->sql)) { + if (isset($_GET['type']) && $_GET['type'] === 'form' && isset($myForm->fields[$_GET['variable']]->sql)) { $sqlQuery = $myForm->fields[$_GET['variable']]->sql; if (isset($myForm->fields[$_GET['variable']]->sqlConnection) && !empty($myForm->fields[$_GET['variable']]->sqlConnection)) { $bdUid = $myForm->fields[$_GET['variable']]->sqlConnection; } - } elseif (isset($_GET['type']) && $_GET['type']==='grid' && isset($myForm->fields[$_GET['grid']])) { + } elseif (isset($_GET['type']) && $_GET['type'] === 'grid' && isset($myForm->fields[$_GET['grid']])) { foreach ($myForm->fields[$_GET['grid']] as $index => $value) { if (is_array($value) && isset($value[$_GET['variable']])) { $newObj = $value[$_GET['variable']]; @@ -89,7 +89,7 @@ if (isset($request)) { $aDependentFieldsKeys = explode("|", base64_decode(str_rot13($_GET['dependentFieldsKeys']))); $aDependentFieldsValue = explode("|", $_GET['dependentFieldsValue']); if ($aDependentFieldsKeys) { - $aDependentFields = array(); + $aDependentFields = []; foreach ($aDependentFieldsKeys as $nKey => $sFieldVar) { $sKeyDepFields = substr($sFieldVar, 2); $aDependentFields[$sKeyDepFields] = $aDependentFieldsValue[$nKey]; @@ -105,7 +105,7 @@ if (isset($request)) { // Verify parsed array $sqlQuery = queryModified($parser->parsed, $_GET['input'], $searchType); - $aRows = Array(); + $aRows = []; try { $con = Propel::getConnection($bdUid); $con->begin(); @@ -122,7 +122,7 @@ if (isset($request)) { $input = strtolower($_GET['input']); $len = strlen($input); $limit = isset($_GET['limit']) ? (int)$_GET['limit'] : 0; - $aResults = array(); + $aResults = []; $count = 0; $aRows = sortByChar($aRows, $input); @@ -213,7 +213,7 @@ if (isset($request)) { } // See above. Gross, but it works. - $field = mysql_real_escape_string($_GET['fld']); + $field = mysqli_real_escape_string($con->getResource(), $_GET['fld']); $field = str_replace("`", "", $field); $query = "INSERT INTO $tableName ($primaryKeyField, $field) VALUES (?, ?)"; // '$gKey', '{$_GET['value']}')"; @@ -235,8 +235,8 @@ if (isset($request)) { function sortByChar($aRows, $charSel) { - $aIniChar = array(); - $aRest = array(); + $aIniChar = []; + $aRest = []; for ($i = 0; $i < count($aRows); $i++) { $aRow = $aRows[$i]; $nCols = sizeof($aRow); diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 40d1f90a4..fef3f13bd 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -134,7 +134,7 @@ class Bootstrap $filter = new InputFilter(); - $smarty = new Smarty (); + $smarty = new Smarty(); $smarty->compile_dir = Bootstrap::sys_get_temp_dir(); $smarty->cache_dir = Bootstrap::sys_get_temp_dir(); $configDir = PATH_THIRDPARTY . 'smarty/configs'; @@ -320,7 +320,7 @@ class Bootstrap if ($download) { Bootstrap::sendHeaders($fileNameIni, "text/plain", $download, $downloadFileName); } else { - require_once ($filename); + require_once($filename); return; } break; @@ -334,7 +334,7 @@ class Bootstrap } } else { if (strpos($file, 'gulliver') !== false) { - list ($path, $filename) = explode('gulliver', $file); + list($path, $filename) = explode('gulliver', $file); } $_SESSION['phpFileNotFound'] = $file; @@ -358,7 +358,7 @@ class Bootstrap * * @return string */ - static public function parseURI($uri, array $arrayFriendlyUri = null) + public static function parseURI($uri, array $arrayFriendlyUri = null) { // *** process the $_POST with magic_quotes enabled // The magic_quotes_gpc feature has been DEPRECATED as of PHP 5.3.0. @@ -475,21 +475,21 @@ class Bootstrap */ public static function LoadTranslationObject($lang = SYS_LANG) { - $defaultTranslations = Array(); - $foreignTranslations = Array(); + $defaultTranslations = array(); + $foreignTranslations = array(); // if the default translations table doesn't exist we can't proceed if (!is_file(PATH_LANGUAGECONT . 'translation.en')) { return null; } // load the translations table - require_once (PATH_LANGUAGECONT . 'translation.en'); + require_once(PATH_LANGUAGECONT . 'translation.en'); $defaultTranslations = $translation; // if some foreign language was requested and its translation file // exists if ($lang != 'en' && file_exists(PATH_LANGUAGECONT . 'translation.' . $lang)) { - require_once (PATH_LANGUAGECONT . 'translation.' . $lang); // load the foreign translations table + require_once(PATH_LANGUAGECONT . 'translation.' . $lang); // load the foreign translations table $foreignTranslations = $translation; } @@ -514,9 +514,9 @@ class Bootstrap * @param array list plugins active * @return void */ - public static function LoadTranslationPlugins ($lang = SYS_LANG, $listPluginsActive) + public static function LoadTranslationPlugins($lang = SYS_LANG, $listPluginsActive) { - if ( ! ( is_array ( $listPluginsActive ) ) ) { + if (! (is_array($listPluginsActive))) { return null; } @@ -528,17 +528,17 @@ class Bootstrap Translation::generateFileTranslationPlugin($namePlugin, 'en'); } - if ( ($lang != 'en') && (!file_exists(PATH_LANGUAGECONT . $namePlugin . '.' . $lang)) ) { + if (($lang != 'en') && (!file_exists(PATH_LANGUAGECONT . $namePlugin . '.' . $lang))) { Translation::generateFileTranslationPlugin($namePlugin, $lang); } if (file_exists(PATH_LANGUAGECONT . $namePlugin . '.' . $lang)) { eval('global $translation'.$namePlugin.';'); - require_once (PATH_LANGUAGECONT . $namePlugin . '.' . $lang); + require_once(PATH_LANGUAGECONT . $namePlugin . '.' . $lang); } else { if (file_exists(PATH_LANGUAGECONT . $namePlugin . '.en')) { eval('global $translation'.$namePlugin.';'); - require_once (PATH_LANGUAGECONT . $namePlugin . '.en'); + require_once(PATH_LANGUAGECONT . $namePlugin . '.en'); } } } @@ -575,7 +575,7 @@ class Bootstrap } catch (Exception $e) { global $G_PUBLISH; if (is_null($G_PUBLISH)) { - $G_PUBLISH = new Publisher (); + $G_PUBLISH = new Publisher(); } if (count($G_PUBLISH->Parts) == 1) { array_shift($G_PUBLISH->Parts); @@ -594,7 +594,7 @@ class Bootstrap } else { $token = strtotime("now"); PMException::registerErrorLog($e, $token); - G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); + G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token))); die; } } @@ -676,7 +676,7 @@ class Bootstrap { // Get the current Include path, where the plugins directories should be if (!defined('PATH_SEPARATOR')) { - define('PATH_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':' ); + define('PATH_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':'); } $path = explode(PATH_SEPARATOR, get_include_path()); @@ -687,7 +687,7 @@ class Bootstrap if ($handle = opendir($baseDir)) { while (false !== ($file = readdir($handle))) { if (strpos($file, '.php', 1) && !strpos($file, 'Peer.php', 1)) { - require_once ($baseDir . PATH_SEP . $file); + require_once($baseDir . PATH_SEP . $file); } } } @@ -756,19 +756,19 @@ class Bootstrap $fileConst = ($typeName == 'translation') ? 'translation.' . $locale : 'translation.' . $typeName . '.' . $locale; if ($typeName == 'translation') { - $defaultTranslations = Array(); - $foreignTranslations = Array(); + $defaultTranslations = array(); + $foreignTranslations = array(); $calendarJs = ''; //load the translations table if (is_file(PATH_LANGUAGECONT . 'translation.en')) { - require_once (PATH_LANGUAGECONT . 'translation.en'); + require_once(PATH_LANGUAGECONT . 'translation.en'); $defaultTranslations = $translation; } //if some foreign language was requested and its translation file exists if ($locale != 'en' && file_exists(PATH_LANGUAGECONT . 'translation.' . $locale)) { - require_once (PATH_LANGUAGECONT . 'translation.' . $locale); //load the foreign translations table + require_once(PATH_LANGUAGECONT . 'translation.' . $locale); //load the foreign translations table $foreignTranslations = $translation; } @@ -790,7 +790,7 @@ class Bootstrap unset($typearray[count($typearray)]); $newName = implode('.', $typearray); if (file_exists(PATH_LANGUAGECONT . $newName)) { - require_once (PATH_LANGUAGECONT . $newName); + require_once(PATH_LANGUAGECONT . $newName); $return = ''; eval('$return = "var TRANSLATIONS_" . strtoupper($typeName) . " = " . Bootstrap::json_encode($translation' . $typeName . ') . ";";'); return $return; @@ -921,8 +921,7 @@ class Bootstrap if (((in_array($browserName, $enabledBrowsers)) || (in_array('ALL', $enabledBrowsers))) && (!(in_array($browserName, $disabledBrowsers)))) { if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') { - - $oServerConf = & ServerConf::getSingleton(); + $oServerConf = ServerConf::getSingleton(); if (!(defined('SYS_LANG'))) { if (isset($_SERVER['HTTP_REFERER'])) { $syss = explode('://', $_SERVER['HTTP_REFERER']); @@ -997,7 +996,6 @@ class Bootstrap } if (!$download) { - header('Pragma: cache'); if (file_exists($filename)) { @@ -1203,7 +1201,6 @@ class Bootstrap if (function_exists('json_encode')) { return json_encode($Json); } else { - $oJSON = new Services_JSON(); return $oJSON->encode($Json); } @@ -1219,7 +1216,6 @@ class Bootstrap if (function_exists('json_decode')) { return json_decode($Json); } else { - $oJSON = new Services_JSON(); return $oJSON->decode($Json); } @@ -1575,7 +1571,7 @@ class Bootstrap //start the search after the first string occurrence if (strpos($pv_browser_user_agent, $pv_search_string, $start_pos) !== false) { $start_pos = strpos($pv_browser_user_agent, $pv_search_string, $start_pos) + strlen($pv_search_string); - if (!$pv_b_break_last || ( $pv_extra_search && strstr($pv_browser_user_agent, $pv_extra_search) )) { + if (!$pv_b_break_last || ($pv_extra_search && strstr($pv_browser_user_agent, $pv_extra_search))) { break; } } else { @@ -1683,7 +1679,7 @@ class Bootstrap $os_working_type = 'nt'; } elseif (strstr($pv_browser_string, '95')) { $os_working_number = '95'; - } elseif (( strstr($pv_browser_string, '9x 4.9') ) || ( strstr($pv_browser_string, ' me') )) { + } elseif ((strstr($pv_browser_string, '9x 4.9')) || (strstr($pv_browser_string, ' me'))) { $os_working_number = 'me'; } elseif (strstr($pv_browser_string, '98')) { $os_working_number = '98'; @@ -1699,9 +1695,9 @@ class Bootstrap } else { $os_working_number = 10; } - } elseif (( $pv_browser_name == 'saf' ) || ( $pv_browser_name == 'cam' ) || - ( ( $pv_browser_name == 'moz' ) && ( $pv_version_number >= 1.3 ) ) || - ( ( $pv_browser_name == 'ie' ) && ( $pv_version_number >= 5.2 ) )) { + } elseif (($pv_browser_name == 'saf') || ($pv_browser_name == 'cam') || + (($pv_browser_name == 'moz') && ($pv_version_number >= 1.3)) || + (($pv_browser_name == 'ie') && ($pv_version_number >= 5.2))) { $os_working_number = 10; } break; @@ -1712,23 +1708,23 @@ class Bootstrap break; } break; - } elseif (is_array($os_working_data) && ( $i == ( $i_count - 2 ) )) { + } elseif (is_array($os_working_data) && ($i == ($i_count - 2))) { $j_count = count($os_working_data); for ($j = 0; $j < $j_count; $j++) { if (strstr($pv_browser_string, $os_working_data[$j])) { $os_working_type = 'unix'; //if the os is in the unix array, it's unix, obviously... - $os_working_number = ( $os_working_data[$j] != 'unix' ) ? $os_working_data[$j] : ''; // assign sub unix version from the unix array + $os_working_number = ($os_working_data[$j] != 'unix') ? $os_working_data[$j] : ''; // assign sub unix version from the unix array break; } } - } elseif (is_array($os_working_data) && ( $i == ( $i_count - 1 ))) { + } elseif (is_array($os_working_data) && ($i == ($i_count - 1))) { $j_count = count($os_working_data); for ($j = 0; $j < $j_count; $j++) { if (strstr($pv_browser_string, $os_working_data[$j])) { $os_working_type = 'lin'; // assign linux distro from the linux array, there's a default //search for 'lin', if it's that, set version to '' - $os_working_number = ( $os_working_data[$j] != 'linux' ) ? $os_working_data[$j] : ''; + $os_working_number = ($os_working_data[$j] != 'linux') ? $os_working_data[$j] : ''; break; } } @@ -1827,7 +1823,7 @@ class Bootstrap } } // just for cases where we know it's a mobile device already - if (!$mobile_os && ( $mobile_browser || $mobile_device || $mobile_server ) && strstr($pv_browser_user_agent, 'linux')) { + if (!$mobile_os && ($mobile_browser || $mobile_device || $mobile_server) && strstr($pv_browser_user_agent, 'linux')) { $mobile_os = 'linux'; $mobile_os_number = Bootstrap::get_item_version($pv_browser_user_agent, 'linux'); } @@ -2176,7 +2172,7 @@ class Bootstrap switch ($DBEngine) { case 'mysql': $con = Propel::getConnection('workflow'); - return mysql_real_escape_string(stripslashes($sqlString), $con->getResource()); + return mysqli_real_escape_string($con->getResource(), stripslashes($sqlString)); break; case 'myxml': $sqlString = str_replace('"', '""', $sqlString); @@ -2207,13 +2203,13 @@ class Bootstrap // Check if its a user template if (file_exists($file)) { //require_once( $file ); - include ($file); + include($file); } else { // Try to get the global system template $file = PATH_TEMPLATE . PATH_SEP . $temp; //require_once( $file ); if (file_exists($file)) { - include ($file); + include($file); } } } @@ -2295,8 +2291,8 @@ class Bootstrap $lang = defined(SYS_LANG) ? SYS_LANG : 'en'; } $aux = explode(' ', $date); //para dividir la fecha del dia - $date = explode('-', isset($aux[0]) ? $aux[0] : '00-00-00' ); //para obtener los dias, el mes, y el año. - $time = explode(':', isset($aux[1]) ? $aux[1] : '00:00:00' ); //para obtener las horas, minutos, segundos. + $date = explode('-', isset($aux[0]) ? $aux[0] : '00-00-00'); //para obtener los dias, el mes, y el año. + $time = explode(':', isset($aux[1]) ? $aux[1] : '00:00:00'); //para obtener las horas, minutos, segundos. $year = (int) ((isset($date[0])) ? $date[0] : '0'); //year @@ -2309,7 +2305,7 @@ class Bootstrap $s = isset($time[2]) ? $time[2] : '00'; //second - $MONTHS = Array(); + $MONTHS = array(); for ($i = 1; $i <= 12; $i++) { $MONTHS[$i] = Bootstrap::LoadTranslation("ID_MONTH_$i", $lang); } @@ -2418,7 +2414,7 @@ class Bootstrap */ public function evalJScript($c) { - print (""); + print(""); } /** @@ -2595,13 +2591,13 @@ class Bootstrap //To enable compatibility with soap login if ((Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) || ($pass === $hashTypeCurrent . ':' . $userPass)) { $acceptance = true; - } else if ((Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) || ($pass === $hashTypePrevious . ':' . $userPass)) { + } elseif ((Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) || ($pass === $hashTypePrevious . ':' . $userPass)) { $acceptance = true; } } else { if (Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) { $acceptance = true; - } else if (Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) { + } elseif (Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) { $acceptance = true; } } @@ -2613,7 +2609,7 @@ class Bootstrap * @param $string * @return mixed */ - public function encryptOld ($string) + public function encryptOld($string) { $consthashFx = self::hashFx; return $consthashFx($string); @@ -2630,7 +2626,7 @@ class Bootstrap $translationsTable = $Translations->getTranslationEnvironments(); $inLang = false; foreach ($translationsTable as $locale) { - if ($locale['LOCALE'] == $acceptLanguage){ + if ($locale['LOCALE'] == $acceptLanguage) { $inLang = true; break; } @@ -2638,7 +2634,6 @@ class Bootstrap $lang = $inLang?$acceptLanguage:'en'; define("SYS_LANG", $lang); } - } /** @@ -2672,7 +2667,7 @@ class Bootstrap { $fileLog = $pathData .'sites'. PATH_SEP . $ws . PATH_SEP . 'log' . PATH_SEP . $file; - $registerLogger = &MonologProvider::getSingleton($channel, $fileLog); + $registerLogger = MonologProvider::getSingleton($channel, $fileLog); $registerLogger->addLog($level, $message, $context); } @@ -2747,6 +2742,4 @@ class Bootstrap } set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DATA_SITE); } - } - diff --git a/gulliver/system/class.controller.php b/gulliver/system/class.controller.php index 3e6eccf4d..65d91a003 100644 --- a/gulliver/system/class.controller.php +++ b/gulliver/system/class.controller.php @@ -1,326 +1,325 @@ - - * @package gulliver.system - * @access private - */ -class Controller -{ - /** - * - * @var boolean debug switch for general purpose - */ - public $debug = null; - - /** - * - * @var array - private array to store proxy data - */ - private $__data__ = array (); - - /** - * - * @var object - private object to store the http request data - */ - private $__request__; - - /** - * - * @var object - headPublisher object to handle the output - */ - private $headPublisher = null; - - /** - * - * @var string - response type var. possibles values: json|plain - */ - private $responseType = ''; - - /** - * - * @var string - layout to pass skinEngine - */ - private $layout = ''; - - /** - * - * @var string contains the pluin name, in case the controller is on a plugin - */ - private $pluginName = ''; - - /** - * - * @var string contains the plugin path - */ - private $pluginHomeDir = ''; - - /** - * Magic setter method - * - * @param string $name - * @param string $value - */ - public function __set ($name, $value) - { - $this->__data__[$name] = $value; - } - - /** - * Magic getter method - * - * @param string $name - * @return string or NULL if the internal var doesn't exist - */ - public function __get ($name) - { - if (array_key_exists( $name, $this->__data__ )) { - return $this->__data__[$name]; - } - - $trace = debug_backtrace(); - trigger_error( 'Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE ); - return null; - } - - /** - * Magic isset method - * - * @param string $name - */ - public function __isset ($name) - { - return isset( $this->__data__[$name] ); - } - - /** - * Magic unset method - * - * @param string $name - */ - public function __unset ($name) - { - unset( $this->__data__[$name] ); - } - - /** - * Set Response type method - * - * @param string $type contains : json|plain - */ - public function setResponseType ($type) - { - $this->responseType = $type; - } - - /** - * call to execute a internal proxy method and handle its exceptions - * - * @param string $name - */ - public function call ($name) - { - try { - $result = $this->$name( $this->__request__ ); - if ($this->responseType == 'json') { - print G::json_encode( $result ); - } - } catch (Exception $e) { - $result = new StdClass(); - if ($this->responseType != 'json') { - Bootstrap::renderTemplate('controller.exception.tpl', array( - 'title' => 'Controller Exception', - 'message' => nl2br($e->getMessage()), - 'controller' => (function_exists( 'get_called_class' ) ? get_called_class() : 'Controller'), - 'exceptionClass' => get_class($e), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'trace' => $e->getTrace() - )); - } else { - $result->success = false; - $result->msg = $e->getMessage(); - switch (get_class( $e )) { - case 'Exception': - $error = "SYSTEM ERROR"; - break; - case 'PMException': - $error = "PROCESSMAKER ERROR"; - break; - case 'PropelException': - $error = "DATABASE ERROR"; - break; - case 'UserException': - $error = "USER ERROR"; - break; - } - $result->error = $error; - - $result->exception->class = get_class( $e ); - $result->exception->code = $e->getCode(); - print G::json_encode( $result ); - } - } - } - - /** - * Set the http request data - * - * @param array $data - */ - public function setHttpRequestData ($data) - { - if (! is_object( $this->__request__ )) { - $this->__request__ = new stdclass(); - } - if (is_array( $data )) { - while ($var = each( $data )) { - $this->__request__->$var['key'] = $var['value']; - } - } else { - $this->__request__ = $data; - } - } - - /** - * Get debug var. - * method - * - * @param boolan $val boolean value for debug var. - */ - public function setDebug ($val) - { - $this->debug = $val; - } - - /** - * Get debug var. - * method - */ - public function getDebug () - { - if ($this->debug === null) { - $this->debug = defined( 'DEBUG' ) && DEBUG ? true : false; - } - - return $this->debug; - } - - /** - * * HeadPublisher Functions Binding ** - */ - - /** - * Include a particular extjs library or extension to the main output - * - * @param string $srcFile path of a extjs library or extension - * @param boolean $debug debug flag to indicate if the js output will be minifield or not - * $debug: true -> the js content will be not minified (readable) - * false -> the js content will be minified - */ - public function includeExtJSLib ($srcFile, $debug = false) - { - $this->getHeadPublisher()->usingExtJs( $srcFile, ($debug ? $debug : $this->getDebug()) ); - } - - /** - * Include a javascript file that is using extjs framework to the main output - * - * @param string $srcFile path of javascrit file to include - * @param boolean $debug debug flag to indicate if the js output will be minifield or not - * $debug: true -> the js content will be not minified (readable) - * false -> the js content will be minified - */ - public function includeExtJS ($srcFile, $debug = false) - { - $this->getHeadPublisher()->addExtJsScript( $srcFile, ($debug ? $debug : $this->getDebug()) ); - } - - /** - * Include a Html file to the main output - * - * @param string $file path of html file to include to the main output - */ - public function setView ($file) - { - $this->getHeadPublisher()->addContent( $file ); - } - - /** - * Set variables to be accesible by javascripts - * - * @param string $name contains var. name - * @param string $value conatins var. value - */ - public function setJSVar ($name, $value) - { - $this->getHeadPublisher()->assign( $name, $value ); - } - - /** - * Set variables to be accesible by the extjs layout template - * - * @param string $name contains var. name - * @param string $value conatins var. value - */ - public function setVar ($name, $value) - { - $this->getHeadPublisher()->assignVar( $name, $value ); - } - - /** - * method to get the local getHeadPublisher object - */ - public function getHeadPublisher () - { - if (! is_object( $this->headPublisher )) { - $this->headPublisher = headPublisher::getSingleton(); - } - - return $this->headPublisher; - } - - public function setLayout ($layout) - { - $this->layout = $layout; - } - - public function render ($type = 'mvc') - { - G::RenderPage( 'publish', $type, null, $this->layout ); - } - - public function header ($header) - { - G::header( $header ); - } - - public function redirect ($url) - { - G::header( "Location: $url" ); - } - - public function setPluginName($name) - { - $this->pluginName = $name; - } - - public function getPluginName() - { - return $this->pluginName; - } - - public function setPluginHomeDir($dir) - { - $this->pluginHomeDir = $dir; - } - - public function getPluginHomeDir() - { - return $this->pluginHomeDir; - } -} - + + * @package gulliver.system + * @access private + */ +class Controller +{ + /** + * + * @var boolean debug switch for general purpose + */ + public $debug = null; + + /** + * + * @var array - private array to store proxy data + */ + private $__data__ = array(); + + /** + * + * @var object - private object to store the http request data + */ + private $__request__; + + /** + * + * @var object - headPublisher object to handle the output + */ + private $headPublisher = null; + + /** + * + * @var string - response type var. possibles values: json|plain + */ + private $responseType = ''; + + /** + * + * @var string - layout to pass skinEngine + */ + private $layout = ''; + + /** + * + * @var string contains the pluin name, in case the controller is on a plugin + */ + private $pluginName = ''; + + /** + * + * @var string contains the plugin path + */ + private $pluginHomeDir = ''; + + /** + * Magic setter method + * + * @param string $name + * @param string $value + */ + public function __set($name, $value) + { + $this->__data__[$name] = $value; + } + + /** + * Magic getter method + * + * @param string $name + * @return string or NULL if the internal var doesn't exist + */ + public function __get($name) + { + if (array_key_exists($name, $this->__data__)) { + return $this->__data__[$name]; + } + + $trace = debug_backtrace(); + trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); + return null; + } + + /** + * Magic isset method + * + * @param string $name + */ + public function __isset($name) + { + return isset($this->__data__[$name]); + } + + /** + * Magic unset method + * + * @param string $name + */ + public function __unset($name) + { + unset($this->__data__[$name]); + } + + /** + * Set Response type method + * + * @param string $type contains : json|plain + */ + public function setResponseType($type) + { + $this->responseType = $type; + } + + /** + * call to execute a internal proxy method and handle its exceptions + * + * @param string $name + */ + public function call($name) + { + try { + $result = $this->$name($this->__request__); + if ($this->responseType == 'json') { + print G::json_encode($result); + } + } catch (Exception $e) { + $result = new StdClass(); + if ($this->responseType != 'json') { + Bootstrap::renderTemplate('controller.exception.tpl', array( + 'title' => 'Controller Exception', + 'message' => nl2br($e->getMessage()), + 'controller' => (function_exists('get_called_class') ? get_called_class() : 'Controller'), + 'exceptionClass' => get_class($e), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'trace' => $e->getTrace() + )); + } else { + $result->success = false; + $result->msg = $e->getMessage(); + switch (get_class($e)) { + case 'Exception': + $error = "SYSTEM ERROR"; + break; + case 'PMException': + $error = "PROCESSMAKER ERROR"; + break; + case 'PropelException': + $error = "DATABASE ERROR"; + break; + case 'UserException': + $error = "USER ERROR"; + break; + } + $result->error = $error; + + $result->exception->class = get_class($e); + $result->exception->code = $e->getCode(); + print G::json_encode($result); + } + } + } + + /** + * Set the http request data + * + * @param array $data + */ + public function setHttpRequestData($data) + { + if (! is_object($this->__request__)) { + $this->__request__ = new stdclass(); + } + if (is_array($data)) { + while ($var = each($data)) { + $this->__request__->{$var['key']} = $var['value']; + } + } else { + $this->__request__ = $data; + } + } + + /** + * Get debug var. + * method + * + * @param boolan $val boolean value for debug var. + */ + public function setDebug($val) + { + $this->debug = $val; + } + + /** + * Get debug var. + * method + */ + public function getDebug() + { + if ($this->debug === null) { + $this->debug = defined('DEBUG') && DEBUG ? true : false; + } + + return $this->debug; + } + + /** + * * HeadPublisher Functions Binding ** + */ + + /** + * Include a particular extjs library or extension to the main output + * + * @param string $srcFile path of a extjs library or extension + * @param boolean $debug debug flag to indicate if the js output will be minifield or not + * $debug: true -> the js content will be not minified (readable) + * false -> the js content will be minified + */ + public function includeExtJSLib($srcFile, $debug = false) + { + $this->getHeadPublisher()->usingExtJs($srcFile, ($debug ? $debug : $this->getDebug())); + } + + /** + * Include a javascript file that is using extjs framework to the main output + * + * @param string $srcFile path of javascrit file to include + * @param boolean $debug debug flag to indicate if the js output will be minifield or not + * $debug: true -> the js content will be not minified (readable) + * false -> the js content will be minified + */ + public function includeExtJS($srcFile, $debug = false) + { + $this->getHeadPublisher()->addExtJsScript($srcFile, ($debug ? $debug : $this->getDebug())); + } + + /** + * Include a Html file to the main output + * + * @param string $file path of html file to include to the main output + */ + public function setView($file) + { + $this->getHeadPublisher()->addContent($file); + } + + /** + * Set variables to be accesible by javascripts + * + * @param string $name contains var. name + * @param string $value conatins var. value + */ + public function setJSVar($name, $value) + { + $this->getHeadPublisher()->assign($name, $value); + } + + /** + * Set variables to be accesible by the extjs layout template + * + * @param string $name contains var. name + * @param string $value conatins var. value + */ + public function setVar($name, $value) + { + $this->getHeadPublisher()->assignVar($name, $value); + } + + /** + * method to get the local getHeadPublisher object + */ + public function getHeadPublisher() + { + if (! is_object($this->headPublisher)) { + $this->headPublisher = headPublisher::getSingleton(); + } + + return $this->headPublisher; + } + + public function setLayout($layout) + { + $this->layout = $layout; + } + + public function render($type = 'mvc') + { + G::RenderPage('publish', $type, null, $this->layout); + } + + public function header($header) + { + G::header($header); + } + + public function redirect($url) + { + G::header("Location: $url"); + } + + public function setPluginName($name) + { + $this->pluginName = $name; + } + + public function getPluginName() + { + return $this->pluginName; + } + + public function setPluginHomeDir($dir) + { + $this->pluginHomeDir = $dir; + } + + public function getPluginHomeDir() + { + return $this->pluginHomeDir; + } +} diff --git a/gulliver/system/class.database_mysql.php b/gulliver/system/class.database_mysql.php index d8666f588..419d6ccb6 100644 --- a/gulliver/system/class.database_mysql.php +++ b/gulliver/system/class.database_mysql.php @@ -30,31 +30,27 @@ * @package gulliver.system * */ - - - class database extends database_base { - - public $iFetchType = MYSQL_ASSOC; + public $iFetchType = MYSQLI_ASSOC; /** - * class database constructor + * class database constructor. * - * @param $sType adapter type - * @param $sServer server - * @param $sUser db user - * @param $sPass db user password - * @param $sDataBase Database name + * @param string $sType adapter type + * @param string $sServer server + * @param string $sUser db user + * @param string $sPass db user password + * @param string $sDataBase Database name */ - public function __construct ($sType = DB_ADAPTER, $sServer = DB_HOST, $sUser = DB_USER, $sPass = DB_PASS, $sDataBase = DB_NAME) + public function __construct($sType = DB_ADAPTER, $sServer = DB_HOST, $sUser = DB_USER, $sPass = DB_PASS, $sDataBase = DB_NAME) { $this->sType = $sType; $this->sServer = $sServer; $this->sUser = $sUser; $this->sPass = $sPass; $this->sDataBase = $sDataBase; - $this->oConnection = @mysql_connect( $sServer, $sUser, $sPass ) || null; + $this->oConnection = mysqli_connect($sServer, $sUser, $sPass, $sDataBase) or die('Could not connect to database...'); $this->sQuoteCharacter = '`'; $this->nullString = 'null'; } @@ -66,30 +62,29 @@ class database extends database_base * @param $aColumns array of columns * @return $sSql the sql sentence */ - public function generateCreateTableSQL ($sTable, $aColumns) + public function generateCreateTableSQL($sTable, $aColumns) { $sKeys = ''; $sSQL = 'CREATE TABLE IF NOT EXISTS ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . '('; foreach ($aColumns as $sColumnName => $aParameters) { if ($sColumnName != 'INDEXES') { - - if ($sColumnName != '' && isset( $aParameters['Type'] ) && $aParameters['Type'] != '') { + if ($sColumnName != '' && isset($aParameters['Type']) && $aParameters['Type'] != '') { $sSQL .= $this->sQuoteCharacter . $sColumnName . $this->sQuoteCharacter . ' ' . $aParameters['Type']; - if (isset( $aParameters['Null'] ) && $aParameters['Null'] == 'YES') { + if (isset($aParameters['Null']) && $aParameters['Null'] == 'YES') { $sSQL .= ' NULL'; } else { - $sSQL .= ' NOT NULL'; + $sSQL .= ' NOT NULL'; } - if (isset( $aParameters['AutoIncrement'] ) && $aParameters['AutoIncrement']) { + if (isset($aParameters['AutoIncrement']) && $aParameters['AutoIncrement']) { $sSQL .= ' AUTO_INCREMENT PRIMARY KEY'; } - if (isset( $aParameters['Key'] ) && $aParameters['Key'] == 'PRI') { + if (isset($aParameters['Key']) && $aParameters['Key'] == 'PRI') { $sKeys .= $this->sQuoteCharacter . $sColumnName . $this->sQuoteCharacter . ','; } - if (isset( $aParameters['Default'] )) { + if (isset($aParameters['Default'])) { $sSQL .= " DEFAULT '" . trim($aParameters['Default']) . "'"; } @@ -97,9 +92,9 @@ class database extends database_base } } } - $sSQL = substr( $sSQL, 0, - 1 ); + $sSQL = substr($sSQL, 0, -1); if ($sKeys != '') { - $sSQL .= ',PRIMARY KEY(' . substr( $sKeys, 0, - 1 ) . ')'; + $sSQL .= ',PRIMARY KEY(' . substr($sKeys, 0, -1) . ')'; } $sSQL .= ')ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci' . $this->sEndLine; @@ -112,7 +107,7 @@ class database extends database_base * @param $sTable table name * @return sql sentence string */ - public function generateDropTableSQL ($sTable) + public function generateDropTableSQL($sTable) { return 'DROP TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . $this->sEndLine; } @@ -123,7 +118,7 @@ class database extends database_base * @param $sTableOld old table name * @return $sSql sql sentence */ - public function generateRenameTableSQL ($sTableOld) + public function generateRenameTableSQL($sTableOld) { $sSQL = 'ALTER TABLE ' . $sTableOld . ' RENAME TO RBAC_' . $sTableOld; return $sSQL; @@ -136,7 +131,7 @@ class database extends database_base * @param $sColumn column name * @return $sSql sql sentence */ - public function generateDropColumnSQL ($sTable, $sColumn) + public function generateDropColumnSQL($sTable, $sColumn) { $sSQL = 'ALTER TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' DROP COLUMN ' . $this->sQuoteCharacter . $sColumn . $this->sQuoteCharacter . $this->sEndLine; return $sSQL; @@ -187,7 +182,6 @@ class database extends database_base } - /** * generate an add column sentence * @@ -196,9 +190,9 @@ class database extends database_base * @param $aParameters parameters of field like typo or if it can be null * @return $sSql sql sentence */ - public function generateAddColumnSQL ($sTable, $sColumn, $aParameters) + public function generateAddColumnSQL($sTable, $sColumn, $aParameters) { - if (isset( $aParameters['Type'] ) && isset( $aParameters['Null'] )) { + if (isset($aParameters['Type']) && isset($aParameters['Null'])) { $sSQL = 'ALTER TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' ADD COLUMN ' . $this->sQuoteCharacter . $sColumn . $this->sQuoteCharacter . ' ' . $aParameters['Type']; if ($aParameters['Null'] == 'YES') { $sSQL .= ' NULL'; @@ -206,18 +200,18 @@ class database extends database_base $sSQL .= ' NOT NULL'; } } - if (isset( $aParameters['AutoIncrement'] ) && $aParameters['AutoIncrement']) { + if (isset($aParameters['AutoIncrement']) && $aParameters['AutoIncrement']) { $sSQL .= ' AUTO_INCREMENT'; } - if (isset( $aParameters['PrimaryKey'] ) && $aParameters['PrimaryKey']) { + if (isset($aParameters['PrimaryKey']) && $aParameters['PrimaryKey']) { $sSQL .= ' PRIMARY KEY'; } - if (isset( $aParameters['Unique'] ) && $aParameters['Unique']) { + if (isset($aParameters['Unique']) && $aParameters['Unique']) { $sSQL .= ' UNIQUE'; } //we need to check the property AI - if (isset( $aParameters['AI'] )) { + if (isset($aParameters['AI'])) { if ($aParameters['AI'] == 1) { $sSQL .= ' AUTO_INCREMENT'; } else { @@ -226,7 +220,7 @@ class database extends database_base } } } else { - if (isset( $aParameters['Default'] )) { + if (isset($aParameters['Default'])) { $sSQL .= " DEFAULT '" . $aParameters['Default'] . "'"; } } @@ -243,13 +237,13 @@ class database extends database_base * @param $sColumnNewName column new name * @return $sSql sql sentence */ - public function generateChangeColumnSQL ($sTable, $sColumn, $aParameters, $sColumnNewName = '') + public function generateChangeColumnSQL($sTable, $sColumn, $aParameters, $sColumnNewName = '') { $sSQL = 'ALTER TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' CHANGE COLUMN ' . $this->sQuoteCharacter . ($sColumnNewName != '' ? $sColumnNewName : $sColumn) . $this->sQuoteCharacter . ' ' . $this->sQuoteCharacter . $sColumn . $this->sQuoteCharacter; - if (isset( $aParameters['Type'] )) { + if (isset($aParameters['Type'])) { $sSQL .= ' ' . $aParameters['Type']; } - if (isset( $aParameters['Null'] )) { + if (isset($aParameters['Null'])) { if ($aParameters['Null'] == 'YES') { $sSQL .= ' NULL'; } else { @@ -269,15 +263,15 @@ class database extends database_base // } //} //else { - if (isset( $aParameters['Default'] )) { - if (trim( $aParameters['Default'] ) == '' && $aParameters['Type'] == 'datetime') { + if (isset($aParameters['Default'])) { + if (trim($aParameters['Default']) == '' && $aParameters['Type'] == 'datetime') { //do nothing } else { $sSQL .= " DEFAULT '" . $aParameters['Default'] . "'"; } //} } - if (! isset( $aParameters['Default'] ) && isset( $aParameters['Null'] ) && $aParameters['Null'] == 'YES') { + if (!isset($aParameters['Default']) && isset($aParameters['Null']) && $aParameters['Null'] == 'YES') { $sSQL .= " DEFAULT NULL "; } //} @@ -291,11 +285,11 @@ class database extends database_base * @param $sTable table name * @return $sSql sql sentence */ - public function generateGetPrimaryKeysSQL ($sTable) + public function generateGetPrimaryKeysSQL($sTable) { try { if ($sTable == '') { - throw new Exception( 'The table name cannot be empty!' ); + throw new Exception('The table name cannot be empty!'); } return 'SHOW INDEX FROM ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' WHERE Seq_in_index = 1' . $this->sEndLine; } catch (Exception $oException) { @@ -309,11 +303,11 @@ class database extends database_base * @param $sTable table name * @return sql sentence */ - public function generateDropPrimaryKeysSQL ($sTable) + public function generateDropPrimaryKeysSQL($sTable) { try { if ($sTable == '') { - throw new Exception( 'The table name cannot be empty!' ); + throw new Exception('The table name cannot be empty!'); } return 'ALTER TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' DROP PRIMARY KEY' . $this->sEndLine; } catch (Exception $oException) { @@ -328,17 +322,17 @@ class database extends database_base * @param $aPrimaryKeys array of primary keys * @return sql sentence */ - public function generateAddPrimaryKeysSQL ($sTable, $aPrimaryKeys) + public function generateAddPrimaryKeysSQL($sTable, $aPrimaryKeys) { try { if ($sTable == '') { - throw new Exception( 'The table name cannot be empty!' ); + throw new Exception('The table name cannot be empty!'); } $sSQL = 'ALTER TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' ADD PRIMARY KEY ('; foreach ($aPrimaryKeys as $sKey) { $sSQL .= $this->sQuoteCharacter . $sKey . $this->sQuoteCharacter . ','; } - $sSQL = substr( $sSQL, 0, - 1 ) . ')' . $this->sEndLine; + $sSQL = substr($sSQL, 0, -1) . ')' . $this->sEndLine; return $sSQL; } catch (Exception $oException) { throw $oException; @@ -352,14 +346,14 @@ class database extends database_base * @param $sIndexName index name * @return sql sentence */ - public function generateDropKeySQL ($sTable, $sIndexName) + public function generateDropKeySQL($sTable, $sIndexName) { try { if ($sTable == '') { - throw new Exception( 'The table name cannot be empty!' ); + throw new Exception('The table name cannot be empty!'); } if ($sIndexName == '') { - throw new Exception( 'The column name cannot be empty!' ); + throw new Exception('The column name cannot be empty!'); } return 'ALTER TABLE ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . ' DROP INDEX ' . $this->sQuoteCharacter . $sIndexName . $this->sQuoteCharacter . $this->sEndLine; } catch (Exception $oException) { @@ -376,7 +370,7 @@ class database extends database_base * @return sql sentence */ - public function generateAddKeysSQL ($sTable, $indexName, $aKeys) + public function generateAddKeysSQL($sTable, $indexName, $aKeys) { try { $indexType = 'INDEX'; @@ -388,7 +382,7 @@ class database extends database_base foreach ($aKeys as $sKey) { $sSQL .= $this->sQuoteCharacter . $sKey . $this->sQuoteCharacter . ', '; } - $sSQL = substr( $sSQL, 0, - 2 ); + $sSQL = substr($sSQL, 0, -2); $sSQL .= ')' . $this->sEndLine; return $sSQL; } catch (Exception $oException) { @@ -401,7 +395,7 @@ class database extends database_base * * @return sql sentence */ - public function generateShowTablesSQL () + public function generateShowTablesSQL() { return 'SHOW TABLES' . $this->sEndLine; } @@ -411,7 +405,7 @@ class database extends database_base * * @return sql sentence */ - public function generateShowTablesLikeSQL ($sTable) + public function generateShowTablesLikeSQL($sTable) { return "SHOW TABLES LIKE '" . $sTable . "'" . $this->sEndLine; } @@ -422,11 +416,11 @@ class database extends database_base * @param $sTable table name * @return sql sentence */ - public function generateDescTableSQL ($sTable) + public function generateDescTableSQL($sTable) { try { if ($sTable == '') { - throw new Exception( 'The table name cannot be empty!' ); + throw new Exception('The table name cannot be empty!'); } return 'DESC ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . $this->sEndLine; } catch (Exception $oException) { @@ -440,7 +434,7 @@ class database extends database_base * @param $sTable table name * @return sql sentence */ - public function generateTableIndexSQL ($sTable) + public function generateTableIndexSQL($sTable) { return 'SHOW INDEX FROM ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . " " . $this->sEndLine; //return 'SHOW INDEX FROM ' . $this->sQuoteCharacter . $sTable . $this->sQuoteCharacter . " WHERE Key_name <> 'PRIMARY'" . $this->sEndLine; @@ -451,12 +445,14 @@ class database extends database_base * * @return void */ - public function isConnected () + public function isConnected() { - if (! $this->oConnection) { - return false; + $connect = false; + if ($this->oConnection !== false) { + $this->executeQuery('USE ' . $this->sDataBase); + $connect = true; } - return $this->executeQuery( 'USE ' . $this->sDataBase ); + return $connect; } /** @@ -465,34 +461,34 @@ class database extends database_base * @param $sQuery sql query string * @return void */ - public function logQuery ($sQuery) + public function logQuery($sQuery) { try { $found = false; - if (substr( $sQuery, 0, 6 ) == 'SELECT') { + if (substr($sQuery, 0, 6) == 'SELECT') { $found = true; } - if (substr( $sQuery, 0, 4 ) == 'SHOW') { + if (substr($sQuery, 0, 4) == 'SHOW') { $found = true; } - if (substr( $sQuery, 0, 4 ) == 'DESC') { + if (substr($sQuery, 0, 4) == 'DESC') { $found = true; } - if (substr( $sQuery, 0, 4 ) == 'USE ') { + if (substr($sQuery, 0, 4) == 'USE ') { $found = true; } - if (! $found) { + if (!$found) { $logDir = PATH_DATA . 'log'; - if (! file_exists( $logDir )) { - if (! mkdir( $logDir )) { + if (!file_exists($logDir)) { + if (!mkdir($logDir)) { return; } } $logFile = "$logDir/query.log"; - $fp = fopen( $logFile, 'a+' ); + $fp = fopen($logFile, 'a+'); if ($fp !== false) { - fwrite( $fp, date( "Y-m-d H:i:s" ) . " " . $this->sDataBase . " " . $sQuery . "\n" ); - fclose( $fp ); + fwrite($fp, date("Y-m-d H:i:s") . " " . $this->sDataBase . " " . $sQuery . "\n"); + fclose($fp); } } } catch (Exception $oException) { @@ -505,20 +501,21 @@ class database extends database_base * @param $sQuery table name * @return void */ - public function executeQuery ($sQuery) + public function executeQuery($sQuery) { - $this->logQuery( $sQuery ); + $this->logQuery($sQuery); try { if ($this->oConnection) { - @mysql_select_db( $this->sDataBase ); - - return @mysql_query( $sQuery ); + mysqli_select_db($this->oConnection, $this->sDataBase); + $result = mysqli_query($this->oConnection, $sQuery); + mysqli_use_result($this->oConnection); + return $result; } else { - throw new Exception( 'invalid connection to database ' . $this->sDataBase ); + throw new Exception('invalid connection to database ' . $this->sDataBase); } } catch (Exception $oException) { - $this->logQuery( $oException->getMessage() ); + $this->logQuery($oException->getMessage()); throw $oException; } } @@ -529,20 +526,24 @@ class database extends database_base * @param $oDataset * @return the number of rows */ - public function countResults ($oDataset) + public function countResults($oDataset) { - return @mysql_num_rows( $oDataset ); + return mysqli_num_rows($oDataset); } /** * count an array of the registry from a dataset * - * @param $oDataset + * @param $dataSet * @return the registry */ - public function getRegistry ($oDataset) + public function getRegistry($dataSet) { - return @mysql_fetch_array( $oDataset, $this->iFetchType ); + $response = null; + if ($dataSet !== false) { + $response = mysqli_fetch_array($dataSet, $this->iFetchType); + } + return $response; } /** @@ -550,80 +551,80 @@ class database extends database_base * * @return void */ - public function close () + public function close() { - @mysql_close( $this->oConnection ); + mysqli_close($this->oConnection); } - public function generateInsertSQL ($table, $data) + public function generateInsertSQL($table, $data) { - $fields = array (); - $values = array (); + $fields = array(); + $values = array(); foreach ($data as $field) { $fields[] = $field['field']; - if (! is_null( $field['value'] )) { + if (!is_null($field['value'])) { switch ($field['type']) { case 'text': case 'date': - $values[] = "'" . mysql_real_escape_string( $field['value'] ) . "'"; + $values[] = "'" . mysqli_real_escape_string($this->oConnection, $field['value']) . "'"; break; case 'int': default: - $values[] = mysql_real_escape_string( $field['value'] ); + $values[] = mysqli_real_escape_string($this->oConnection, $field['value']); break; } } else { $values[] = $this->nullString; } } - $fields = array_map( array ($this,'putQuotes' - ), $fields ); - $sql = sprintf( "INSERT INTO %s (%s) VALUES (%s)", $this->putQuotes( $table ), implode( ', ', $fields ), implode( ', ', $values ) ); + $fields = array_map(array($this, 'putQuotes' + ), $fields); + $sql = sprintf("INSERT INTO %s (%s) VALUES (%s)", $this->putQuotes($table), implode(', ', $fields), implode(', ', $values)); return $sql; } - public function generateUpdateSQL ($table, $keys, $data) + public function generateUpdateSQL($table, $keys, $data) { - $fields = array (); - $where = array (); + $fields = array(); + $where = array(); foreach ($data as $field) { - if (! is_null( $field['value'] )) { + if (!is_null($field['value'])) { switch ($field['type']) { case 'text': case 'date': - $fields[] = $this->putQuotes( $field['field'] ) . " = '" . mysql_real_escape_string( $field['value'] ) . "'"; + $fields[] = $this->putQuotes($field['field']) . " = '" . mysqli_real_escape_string($this->oConnection, $field['value']) . "'"; break; case 'int': default: - $fields[] = $this->putQuotes( $field['field'] ) . " = " . mysql_real_escape_string( $field['value'] ); + $fields[] = $this->putQuotes($field['field']) . " = " . mysqli_real_escape_string($this->oConnection, $field['value']); break; } } else { $values[] = $this->nullString; } - if (in_array( $field['field'], $keys )) { - $where[] = $fields[count( $fields ) - 1]; + if (in_array($field['field'], $keys)) { + $where[] = $fields[count($fields) - 1]; } } - $sql = sprintf( "UPDATE %s SET %s WHERE %s", $this->putQuotes( $table ), implode( ', ', $fields ), implode( ', ', $where ) ); + $sql = sprintf("UPDATE %s SET %s WHERE %s", $this->putQuotes($table), implode(', ', $fields), implode(', ', $where)); return $sql; } - public function generateDeleteSQL ($table, $keys, $data) + public function generateDeleteSQL($table, $keys, $data) { - $fields = array (); - $where = array (); + $fields = array(); + $where = array(); foreach ($data as $field) { - if (in_array( $field['field'], $keys )) { - if (! is_null( $field['value'] )) { + if (in_array($field['field'], $keys)) { + if (!is_null($field['value'])) { switch ($field['type']) { case 'text': case 'date': - $where[] = $this->putQuotes( $field['field'] ) . " = '" . mysql_real_escape_string( $field['value'] ) . "'"; + $where[] = $this->putQuotes($field['field']) . " = '" . mysqli_real_escape_string($this->oConnection, $field['value']) . "'"; break; case 'int': default: - $where[] = $this->putQuotes( $field['field'] ) . " = " . mysql_real_escape_string( $field['value'] ); + $where[] = $this->putQuotes($field['field']) . " = " . mysqli_real_escape_string($this->oConnection, $field['value']); break; } } else { @@ -631,25 +632,25 @@ class database extends database_base } } } - $sql = sprintf( "DELETE FROM %s WHERE %s", $this->putQuotes( $table ), implode( ', ', $where ) ); + $sql = sprintf("DELETE FROM %s WHERE %s", $this->putQuotes($table), implode(', ', $where)); return $sql; } - public function generateSelectSQL ($table, $keys, $data) + public function generateSelectSQL($table, $keys, $data) { - $fields = array (); - $where = array (); + $fields = array(); + $where = array(); foreach ($data as $field) { - if (in_array( $field['field'], $keys )) { - if (! is_null( $field['value'] )) { + if (in_array($field['field'], $keys)) { + if (!is_null($field['value'])) { switch ($field['type']) { case 'text': case 'date': - $where[] = $this->putQuotes( $field['field'] ) . " = '" . mysql_real_escape_string( $field['value'] ) . "'"; + $where[] = $this->putQuotes($field['field']) . " = '" . mysqli_real_escape_string($this->oConnection, $field['value']) . "'"; break; case 'int': default: - $where[] = $this->putQuotes( $field['field'] ) . " = " . mysql_real_escape_string( $field['value'] ); + $where[] = $this->putQuotes($field['field']) . " = " . mysqli_real_escape_string($this->oConnection, $field['value']); break; } } else { @@ -657,11 +658,11 @@ class database extends database_base } } } - $sql = sprintf( "SELECT * FROM %s WHERE %s", $this->putQuotes( $table ), implode( ', ', $where ) ); + $sql = sprintf("SELECT * FROM %s WHERE %s", $this->putQuotes($table), implode(', ', $where)); return $sql; } - private function putQuotes ($element) + private function putQuotes($element) { return $this->sQuoteCharacter . $element . $this->sQuoteCharacter; } @@ -676,14 +677,14 @@ class database extends database_base * * @return string $sConcat */ - public function concatString () + public function concatString() { $nums = func_num_args(); $vars = func_get_args(); $sConcat = " CONCAT("; - for ($i = 0; $i < $nums; $i ++) { - if (isset( $vars[$i] )) { + for ($i = 0; $i < $nums; $i++) { + if (isset($vars[$i])) { $sConcat .= $vars[$i]; if (($i + 1) < $nums) { $sConcat .= ", "; @@ -693,7 +694,6 @@ class database extends database_base $sConcat .= ")"; return $sConcat; - } /* @@ -709,11 +709,10 @@ class database extends database_base * * @return string $sCompare */ - public function getCaseWhen ($compareValue, $trueResult, $falseResult) + public function getCaseWhen($compareValue, $trueResult, $falseResult) { $sCompare = "IF(" . $compareValue . ", " . $trueResult . ", " . $falseResult . ") "; return $sCompare; - } /** @@ -724,7 +723,7 @@ class database extends database_base * * @return string $sql */ - public function createTableObjectPermission () + public function createTableObjectPermission() { $sql = "CREATE TABLE IF NOT EXISTS `OBJECT_PERMISSION` ( `OP_UID` varchar(32) NOT NULL, @@ -754,9 +753,8 @@ class database extends database_base * * @return string $sql */ - public function getSelectReport4 () + public function getSelectReport4() { - $sqlConcat = " CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER "; $sqlGroupBy = " USER "; @@ -772,7 +770,6 @@ class database extends database_base GROUP BY " . $sqlGroupBy; return $sql; - } /** @@ -783,7 +780,7 @@ class database extends database_base * * @return string $sql */ - public function getSelectReport4Filter ($var) + public function getSelectReport4Filter($var) { $sqlConcat = " CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER "; $sqlGroupBy = " USER "; @@ -800,7 +797,6 @@ class database extends database_base GROUP BY " . $sqlGroupBy; return $sql; - } /** @@ -811,7 +807,7 @@ class database extends database_base * * @return string $sql */ - public function getSelectReport5 () + public function getSelectReport5() { $sqlConcat = " CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER "; $sqlGroupBy = " USER "; @@ -828,7 +824,6 @@ class database extends database_base GROUP BY " . $sqlGroupBy; return $sql; - } /** @@ -839,9 +834,8 @@ class database extends database_base * * @return string $sql */ - public function getSelectReport5Filter ($var) + public function getSelectReport5Filter($var) { - $sqlConcat = " CONCAT(U.USR_LASTNAME,' ',USR_FIRSTNAME) AS USER "; $sqlGroupBy = " USER "; @@ -863,41 +857,39 @@ class database extends database_base * query functions for class class.net.php * */ - public function getServerVersion ($driver, $dbIP, $dbPort, $dbUser, $dbPasswd, $dbSourcename) + public function getServerVersion($driver, $dbIP, $dbPort, $dbUser, $dbPasswd, $dbSourcename) { - - if ($link = @mysql_connect( $dbIP, $dbUser, $dbPasswd )) { - $v = @mysql_get_server_info(); + if ($link = mysqli_connect($dbIP, $dbUser, $dbPasswd, $dbSourcename)) { + $v = mysqli_get_server_info($link); } else { - throw new Exception( @mysql_error( $link ) ); + throw new Exception(mysqli_error($link)); } - return (isset( $v )) ? $v : 'none'; - + return (isset($v)) ? $v : 'none'; } /* * query functions for class class.net.php, class.reportTables.php * */ - public function getDropTable ($sTableName) + public function getDropTable($sTableName) { $sql = 'DROP TABLE IF EXISTS `' . $sTableName . '`'; return $sql; } - public function getTableDescription ($sTableName) + public function getTableDescription($sTableName) { $sql = "DESC " . $sTableName; return $sql; } - public function getFieldNull () + public function getFieldNull() { $fieldName = "Null"; return $fieldName; } - public function getValidate ($validate) + public function getValidate($validate) { $oValidate = $validate; return $oValidate; @@ -907,14 +899,14 @@ class database extends database_base * Determines whether a table exists * It is part of class.reportTables.php */ - public function reportTableExist () + public function reportTableExist() { $filter = new InputFilter(); $DB_NAME = $filter->validateInput(DB_NAME); $bExists = true; - $oConnection = mysql_connect( DB_HOST, DB_USER, DB_PASS ); - mysql_select_db( $DB_NAME ); - $oDataset = mysql_query( 'SELECT COUNT(*) FROM REPORT_TABLE' ) || ($bExists = false); + $oConnection = mysqli_connect(DB_HOST, DB_USER, DB_PASS); + mysqli_select_db($oConnection, $DB_NAME); + $oDataset = mysqli_query($oConnection, 'SELECT COUNT(*) FROM REPORT_TABLE') || ($bExists = false); return $bExists; } @@ -922,7 +914,7 @@ class database extends database_base /** * It is part of class.pagedTable.php */ - public function getLimitRenderTable ($nCurrentPage, $nRowsPerPage) + public function getLimitRenderTable($nCurrentPage, $nRowsPerPage) { $sql = ' LIMIT ' . (($nCurrentPage - 1) * $nRowsPerPage) . ', ' . $nRowsPerPage; return $sql; @@ -930,32 +922,23 @@ class database extends database_base /** * Determining the existence of a table + * + * @param string $tableName + * @param string $database + * + * @return bool */ - public function tableExists ($tableName, $database) + public function tableExists($tableName, $database) { - @mysql_select_db( $database ); - $tables = array (); - $tablesResult = mysql_query( "SHOW TABLES FROM $database;" ); - while ($row = @mysql_fetch_row( $tablesResult )) { + mysqli_select_db($this->oConnection, $database); + $tables = array(); + $tablesResult = mysqli_query($this->oConnection, "SHOW TABLES FROM $database;"); + while ($row = mysqli_fetch_row($tablesResult)) { $tables[] = $row[0]; } - if (in_array( $tableName, $tables )) { + if (in_array($tableName, $tables)) { return true; } return false; } - - /* - * Determining the existence of a table (Depricated) - */ - // function tableExists ($table, $db) { - // $tables = mysql_list_tables ($db); - // while (list ($temp) = @mysql_fetch_array ($tables)) { - // if ($temp == $table) { - // return TRUE; - // } - // } - // return FALSE; - // } } - diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php index ffa73dba5..7184ac386 100644 --- a/gulliver/system/class.dbMaintenance.php +++ b/gulliver/system/class.dbMaintenance.php @@ -36,7 +36,6 @@ * * @package gulliver.system */ - class DataBaseMaintenance { private $host; @@ -54,19 +53,19 @@ class DataBaseMaintenance /** * __construct * - * @param string $host is null - * @param string $user is null + * @param string $host is null + * @param string $user is null * @param string $passwd is null * * @return none */ - public function __construct ($host = null, $user = null, $passwd = null) + public function __construct($host = null, $user = null, $passwd = null) { $this->tmpDir = './'; $this->link = null; $this->dbName = null; $this->isWindows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; - if (isset( $host ) && isset( $user ) && isset( $passwd )) { + if (isset($host) && isset($user) && isset($passwd)) { $this->host = $host; $this->user = $user; $this->passwd = $passwd; @@ -80,7 +79,7 @@ class DataBaseMaintenance * * @return none */ - public function setUser ($user) + public function setUser($user) { $this->user = $user; } @@ -92,7 +91,7 @@ class DataBaseMaintenance * * @return none */ - public function setPasswd ($passwd) + public function setPasswd($passwd) { $this->passwd = $passwd; } @@ -104,7 +103,7 @@ class DataBaseMaintenance * * @return none */ - public function setHost ($host) + public function setHost($host) { $this->host = $host; } @@ -116,11 +115,11 @@ class DataBaseMaintenance * * @return none */ - public function setTempDir ($tmpDir) + public function setTempDir($tmpDir) { $this->tmpDir = $tmpDir; - if (! file_exists( $tmpDir )) { - mkdir( $this->tmpDir ); + if (!file_exists($tmpDir)) { + mkdir($this->tmpDir); } } @@ -129,7 +128,7 @@ class DataBaseMaintenance * * @return $this->tmpDir */ - public function getTempDir () + public function getTempDir() { return $this->tmpDir; } @@ -139,7 +138,7 @@ class DataBaseMaintenance * * @return $this->link */ - public function status () + public function status() { return $$this->link; } @@ -151,25 +150,25 @@ class DataBaseMaintenance * * @return none */ - public function connect ($dbname = null) + public function connect($dbname = null) { if ($this->link != null) { - mysql_close( $this->link ); + mysqli_close($this->link); $this->link = null; } - if (isset( $dbname )) { + if (isset($dbname)) { $this->dbName = $dbname; } - $this->link = mysql_connect( $this->host, $this->user, $this->passwd ); - @mysql_query( "SET NAMES 'utf8';" ); - @mysql_query( "SET FOREIGN_KEY_CHECKS=0;" ); - if (! $this->link) { - throw new Exception( "Couldn't connect to host {$this->host} with user {$this->user}" ); + $this->link = mysqli_connect($this->host, $this->user, $this->passwd, $this->dbName); + if (!$this->link) { + throw new Exception("Couldn't connect to host {$this->host} with user {$this->user}"); } + mysqli_query($this->link, "SET NAMES 'utf8';"); + mysqli_query($this->link, "SET FOREIGN_KEY_CHECKS=0;"); if ($this->dbName != null) { - $this->selectDataBase( $this->dbName ); + $this->selectDataBase($this->dbName); } } @@ -180,7 +179,7 @@ class DataBaseMaintenance * * @return none */ - public function setDbName ($dbname) + public function setDbName($dbname) { $this->dbName = $dbname; } @@ -189,14 +188,15 @@ class DataBaseMaintenance * selectDataBase * * @param string $dbname + * @param $dbname * - * @return none + * @throws Exception */ - public function selectDataBase ($dbname) + public function selectDataBase($dbname) { - $this->setDbName( $dbname ); - if (! @mysql_select_db( $this->dbName, $this->link )) { - throw new Exception( "Couldn't select database $dbname" ); + $this->setDbName($dbname); + if (!mysqli_select_db($this->link, $this->dbName)) { + throw new Exception("Couldn't select database $dbname"); } } @@ -207,13 +207,13 @@ class DataBaseMaintenance * * @return $aRows */ - public function query ($sql) + public function query($sql) { - $this->result = @mysql_query( $sql ); + $this->result = mysqli_query($this->link, $sql); if ($this->result) { - $aRows = Array (); - while ($aRow = @mysql_fetch_assoc( $this->result )) { - array_push( $aRows, $aRow ); + $aRows = []; + while ($aRow = mysqli_fetch_assoc($this->result)) { + $aRows[] = $aRow; } return $aRows; } else { @@ -224,26 +224,26 @@ class DataBaseMaintenance /** * error * - * @return @mysql_error() + * @return mysqli_error() */ - public function error () + public function error() { - return @mysql_error( $this->link ); + return mysqli_error($this->link); } /** * getTablesList * - * @return $aRows + * @return array */ - public function getTablesList () + public function getTablesList() { - $this->result = @mysql_query( "SHOW TABLES;" ); - $aRows = Array (); - while ($aRow = mysql_fetch_row( $this->result )) { - array_push( $aRows, $aRow[0] ); + $this->result = mysqli_query($this->link, 'SHOW TABLES;'); + $rows = []; + while ($row = mysqli_fetch_row($this->result)) { + $rows[] = $row[0]; } - return $aRows; + return $rows; } /** @@ -253,24 +253,24 @@ class DataBaseMaintenance * * @return boolean true or false */ - function dumpData ($table) + public function dumpData($table) { $this->outfile = $this->tmpDir . $table . '.dump'; //if the file exists delete it - if (is_file( $this->outfile )) { - @unlink( $this->outfile ); + if (is_file($this->outfile)) { + @unlink($this->outfile); } $sql = "SELECT * INTO OUTFILE '{$this->outfile}' FIELDS TERMINATED BY '\t|\t' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\t\t\r\r\n' FROM $table"; // The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0. // Commented that is not assigned to a variable. // mysql_escape_string("';"); - if (! @mysql_query( $sql )) { - $ws = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined Workspace"; - Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); - $varRes = mysql_error() . "\n"; - G::outRes( $varRes ); + if (!@mysqli_query($this->link, $sql)) { + $ws = (!empty(config('system.workspace'))) ? config('system.workspace') : 'Undefined Workspace'; + Bootstrap::registerMonolog('MysqlCron', 400, mysqli_error($this->link), ['sql' => $sql], $ws, 'processmaker.log'); + $varRes = mysqli_error($this->link) . "\n"; + G::outRes($varRes); return false; } return true; @@ -283,15 +283,15 @@ class DataBaseMaintenance * * @return boolean true or false */ - function restoreData ($backupFile) + public function restoreData($backupFile) { - $tableName = str_replace( '.dump', '', basename( $backupFile ) ); + $tableName = str_replace('.dump', '', basename($backupFile)); $sql = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName FIELDS TERMINATED BY '\t|\t' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\t\t\r\r\n'"; - if (! @mysql_query( $sql )) { - $ws = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined Workspace"; - Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); - $varRes = mysql_error() . "\n"; - G::outRes( $varRes ); + if (!@mysqli_query($this->link, $sql)) { + $ws = (!empty(config("system.workspace"))) ? config("system.workspace") : "Wokspace Undefined"; + Bootstrap::registerMonolog('MysqlCron', 400, mysqli_error($this->link), ['sql' => $sql], $ws, 'processmaker.log'); + $varRes = mysqli_error($this->link) . "\n"; + G::outRes($varRes); return false; } return true; @@ -304,26 +304,25 @@ class DataBaseMaintenance * * @return none */ - function restoreAllData ($type = null) + public function restoreAllData($type = null) { - $aTables = $this->getTablesList(); foreach ($aTables as $table) { - if (isset( $type ) && $type == 'sql') { + if (isset($type) && $type == 'sql') { $this->infile = $this->tmpDir . $table . ".sql"; - if (is_file( $this->infile )) { - $queries = $this->restoreFromSql( $this->infile, true ); - if (! isset( $queries )) { + if (is_file($this->infile)) { + $queries = $this->restoreFromSql($this->infile, true); + if (!isset($queries)) { $queries = "unknown"; } - printf( "%-59s%20s", "Restored table $table", "$queries queries\n" ); + printf("%-59s%20s", "Restored table $table", "$queries queries\n"); } } else { $this->infile = $this->tmpDir . $table . ".dump"; - if (is_file( $this->infile )) { - $this->restoreData( $this->infile ); - printf( "%20s %s %s\n", 'Restoring data from ', $this->infile, " in table $table" ); + if (is_file($this->infile)) { + $this->restoreData($this->infile); + printf("%20s %s %s\n", 'Restoring data from ', $this->infile, " in table $table"); } } } @@ -337,17 +336,17 @@ class DataBaseMaintenance * * @return none */ - function createDb ($dbname, $drop = false) + public function createDb($dbname, $drop = false) { if ($drop) { $sql = "DROP DATABASE IF EXISTS $dbname;"; - if (! @mysql_query( $sql )) { - throw new Exception( mysql_error() ); + if (!mysqli_query($this->link, $sql)) { + throw new Exception(mysqli_error($this->link)); } } $sql = "CREATE DATABASE IF NOT EXISTS $dbname DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"; - if (! @mysql_query( $sql )) { - throw new Exception( mysql_error() ); + if (!mysqli_query($this->link, $sql)) { + throw new Exception(mysqli_error($this->link)); } } @@ -358,24 +357,23 @@ class DataBaseMaintenance * * @return none */ - function restoreFromSql2 ($sqlfile) + public function restoreFromSql2($sqlfile) { - - ini_set( 'memory_limit', '512M' ); - if (! is_file( $sqlfile )) { - throw new Exception( "the $sqlfile doesn't exist!" ); + ini_set('memory_limit', '512M'); + if (!is_file($sqlfile)) { + throw new Exception("the $sqlfile doesn't exist!"); } - $query = file_get_contents( $sqlfile ); - $mysqli = new mysqli( $this->host, $this->user, $this->passwd, $this->dbName ); + $query = file_get_contents($sqlfile); + $mysqli = new mysqli($this->host, $this->user, $this->passwd, $this->dbName); /* check connection */ if (mysqli_connect_errno()) { - printf( "Connect failed: %s\n", mysqli_connect_error() ); + printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* execute multi query */ - if ($mysqli->multi_query( $query )) { + if ($mysqli->multi_query($query)) { do { /* store first result set */ if ($result = $mysqli->store_result()) { @@ -383,7 +381,6 @@ class DataBaseMaintenance } $result->free(); } - } while ($mysqli->next_result()); } @@ -398,12 +395,12 @@ class DataBaseMaintenance * * @return none */ - function backupDataBase ($outfile) + public function backupDataBase($outfile) { $password = escapeshellarg($this->passwd); - - //On Windows, escapeshellarg() instead replaces percent signs, exclamation - //marks (delayed variable substitution) and double quotes with spaces and + + //On Windows, escapeshellarg() instead replaces percent signs, exclamation + //marks (delayed variable substitution) and double quotes with spaces and //adds double quotes around the string. //See: http://php.net/manual/en/function.escapeshellarg.php if ($this->isWindows) { @@ -437,16 +434,16 @@ class DataBaseMaintenance /** * string escapeshellargCustom ( string $arg , character $quotes) - * - * escapeshellarg() adds single quotes around a string and quotes/escapes any - * existing single quotes allowing you to pass a string directly to a shell - * function and having it be treated as a single safe argument. This function - * should be used to escape individual arguments to shell functions coming - * from user input. The shell functions include exec(), system() and the + * + * escapeshellarg() adds single quotes around a string and quotes/escapes any + * existing single quotes allowing you to pass a string directly to a shell + * function and having it be treated as a single safe argument. This function + * should be used to escape individual arguments to shell functions coming + * from user input. The shell functions include exec(), system() and the * backtick operator. - * - * On Windows, escapeshellarg() instead replaces percent signs, exclamation - * marks (delayed variable substitution) and double quotes with spaces and + * + * On Windows, escapeshellarg() instead replaces percent signs, exclamation + * marks (delayed variable substitution) and double quotes with spaces and * adds double quotes around the string. */ private function escapeshellargCustom($string, $quotes = "") @@ -489,57 +486,56 @@ class DataBaseMaintenance * * @return boolean false or true */ - function restoreFromSql ($sqlfile, $type = 'file') + public function restoreFromSql($sqlfile, $type = 'file') { - ini_set( 'memory_limit', '64M' ); - if ($type == 'file' && ! is_file( $sqlfile )) { - throw new Exception( "the $sqlfile doesn't exist!" ); + ini_set('memory_limit', '64M'); + if ($type == 'file' && !is_file($sqlfile)) { + throw new Exception("the $sqlfile doesn't exist!"); } - $metaFile = str_replace( '.sql', '.meta', $sqlfile ); + $metaFile = str_replace('.sql', '.meta', $sqlfile); $queries = 0; - if (is_file( $metaFile )) { + if (is_file($metaFile)) { echo "Using $metaFile as metadata.\n"; - $fp = fopen( $sqlfile, 'rb' ); - $fpmd = fopen( $metaFile, 'r' ); - while ($offset = fgets( $fpmd, 1024 )) { - $buffer = intval( $offset ); //reading the size of $oData - $query = fread( $fp, $buffer ); //reading string $oData + $fp = fopen($sqlfile, 'rb'); + $fpmd = fopen($metaFile, 'r'); + while ($offset = fgets($fpmd, 1024)) { + $buffer = intval($offset); //reading the size of $oData + $query = fread($fp, $buffer); //reading string $oData $queries += 1; - if (! @mysql_query( $query )) { - $varRes = mysql_error() . "\n"; - G::outRes( $varRes ); + if (!mysqli_query($this->link, $query)) { + $varRes = mysqli_error($this->link) . "\n"; + G::outRes($varRes); $varRes = "==>" . $query . "<==\n"; - G::outRes( $varRes ); + G::outRes($varRes); } } - } else { $queries = null; try { - $mysqli = new mysqli( $this->host, $this->user, $this->passwd, $this->dbName ); + $mysqli = new mysqli($this->host, $this->user, $this->passwd, $this->dbName); /* check connection */ if (mysqli_connect_errno()) { - printf( "Connect failed: %s\n", mysqli_connect_error() ); + printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } - if ($type == 'file') { - $query = file_get_contents( $sqlfile ); - } else if ($type == 'string') { + if ($type === 'file') { + $query = file_get_contents($sqlfile); + } elseif ($type === 'string') { $query = $sqlfile; } else { return false; } - if (trim( $query ) == "") { + if (trim($query) == "") { return false; } - /* execute multi query */ - if ($mysqli->multi_query( $query )) { + /* execute multi query */ + if ($mysqli->multi_query($query)) { do { /* store first result set */ if ($result = $mysqli->store_result()) { @@ -554,16 +550,16 @@ class DataBaseMaintenance } } while ($mysqli->next_result()); } else { - throw new Exception( mysqli_error( $mysqli ) ); + throw new Exception(mysqli_error($mysqli)); } - /* close connection */ + /* close connection */ $mysqli->close(); } catch (Exception $e) { echo $query; $token = strtotime("now"); PMException::registerErrorLog($e, $token); - G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); + G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token))); } } return $queries; @@ -576,20 +572,20 @@ class DataBaseMaintenance * * @return string $tableSchema */ - function getSchemaFromTable ($tablename) + public function getSchemaFromTable($tablename) { //$tableSchema = "/* Structure for table `$tablename` */\n"; //$tableSchema .= "DROP TABLE IF EXISTS `$tablename`;\n\n"; $tableSchema = ""; $sql = "show create table `$tablename`; "; - $result = @mysql_query( $sql ); + $result = mysqli_query($this->link, $sql); if ($result) { - if ($row = mysql_fetch_assoc( $result )) { + if ($row = mysqli_fetch_assoc($result)) { $tableSchema .= $row['Create Table'] . ";\n\n"; } - mysql_free_result( $result ); + mysqli_free_result($result); } else { - G::outRes( mysql_error() ); + G::outRes(mysqli_error($this->link)); } return $tableSchema; } @@ -601,12 +597,12 @@ class DataBaseMaintenance * * @return string $str */ - function removeCommentsIntoString ($str) + public function removeCommentsIntoString($str) { - $str = preg_replace( '/\/\*[\w\W]*\*\//', '', $str ); - $str = preg_replace( "/--[\w\W]*\\n/", '', $str ); - $str = preg_replace( "/\/\/[\w\W]*\\n/", '', $str ); - $str = preg_replace( "/\#[\w\W]*\\n/", '', $str ); + $str = preg_replace('/\/\*[\w\W]*\*\//', '', $str); + $str = preg_replace("/--[\w\W]*\\n/", '', $str); + $str = preg_replace("/\/\/[\w\W]*\\n/", '', $str); + $str = preg_replace("/\#[\w\W]*\\n/", '', $str); return $str; } -} \ No newline at end of file +} diff --git a/gulliver/system/class.dbconnection.php b/gulliver/system/class.dbconnection.php index 0f4b2968c..b6400743d 100644 --- a/gulliver/system/class.dbconnection.php +++ b/gulliver/system/class.dbconnection.php @@ -31,13 +31,13 @@ * */ -require_once ("DB.php"); +require_once("DB.php"); -define( 'DB_ERROR_NO_SHOW_AND_CONTINUE', 0 ); -define( 'DB_ERROR_SHOW_AND_STOP', 1 ); -define( 'DB_ERROR_SHOW_AND_CONTINUE', 2 ); -define( 'DB_ERROR_SHOWALL_AND_STOP', 3 ); -define( 'DB_ERROR_SHOWALL_AND_CONTINUE', 4 ); +define('DB_ERROR_NO_SHOW_AND_CONTINUE', 0); +define('DB_ERROR_SHOW_AND_STOP', 1); +define('DB_ERROR_SHOW_AND_CONTINUE', 2); +define('DB_ERROR_SHOWALL_AND_STOP', 3); +define('DB_ERROR_SHOWALL_AND_CONTINUE', 4); /** * DBConnection class definition @@ -49,10 +49,10 @@ define( 'DB_ERROR_SHOWALL_AND_CONTINUE', 4 ); */ class DBConnection { - var $db; - var $db_error; - var $errorLevel; - var $type; + public $db; + public $db_error; + public $errorLevel; + public $type; /** * *************************************************************** @@ -93,7 +93,7 @@ class DBConnection * @return string * */ - function DBConnection ($strServer = DB_HOST, $strUser = DB_USER, $strPwd = DB_PASS, $strDB = DB_NAME, $type = DB_ADAPTER, $strPort = 0, $errorLevel = 2) + public function DBConnection($strServer = DB_HOST, $strUser = DB_USER, $strPwd = DB_PASS, $strDB = DB_NAME, $type = DB_ADAPTER, $strPort = 0, $errorLevel = 2) { $this->errorLevel = $errorLevel; if ($type == null) { @@ -101,36 +101,41 @@ class DBConnection } $this->type = $type; //print "
$type $strServer, $strUser, $strPwd, $strDB
"; - if ($type == "mysql") { - $dsn = "mysql://$strUser:$strPwd@$strServer/$strDB"; - } - if ($type == "pgsql") { - //$dsn = "pgsql://postgres@$strServer/$strDB"; - $prt = ($strPort == 0 || $strPort == 5432 ? '' : ":$strPort"); - $dsn = "pgsql://$strUser:$strPwd@$strServer$prt/$strDB"; - } - if ($type == "odbc") { - $dsn = "odbc://$strUser:$strPwd@$strServer/$strDB"; - } - if ($type == "mssql") { - $strServer = substr( $strServer, 0, strpos( $strServer, ':' ) ); - $prt = ($strPort == 0 || $strPort == 1433 ? '' : ":$strPort"); - $dsn = "mssql://$strUser:$strPwd@$strServer$prt/$strDB"; - ///--) $dsn = "mssql://$strUser:$strPwd@$strServer/$strDB"; - } - if ($type == "oracle") { - $dsn = "oci8://$strUser:$strPwd@$strServer/$strDB"; + switch ($type) { + case 'mysql': + $dsn = "mysql://$strUser:$strPwd@$strServer/$strDB"; + break; + case 'pgsql': + //$dsn = "pgsql://postgres@$strServer/$strDB"; + $prt = ($strPort == 0 || $strPort == 5432 ? '' : ":$strPort"); + $dsn = "pgsql://$strUser:$strPwd@$strServer$prt/$strDB"; + break; + case 'odbc': + $dsn = "odbc://$strUser:$strPwd@$strServer/$strDB"; + break; + case 'mssql': + $strServer = substr($strServer, 0, strpos($strServer, ':')); + $prt = ($strPort == 0 || $strPort == 1433 ? '' : ":$strPort"); + $dsn = "mssql://$strUser:$strPwd@$strServer$prt/$strDB"; + ///--) $dsn = "mssql://$strUser:$strPwd@$strServer/$strDB"; + break; + case 'oracle': + $dsn = "oci8://$strUser:$strPwd@$strServer/$strDB"; + break; + default: + $dsn = "mysql://$strUser:$strPwd@$strServer/$strDB"; + break; } $this->db_error = null; if ($type === 'myxml') { - $this->db = XMLDB::connect( $strServer ); + $this->db = XMLDB::connect($strServer); } else { - $this->db = DB::connect( $dsn ); + $this->db = DB::connect($dsn); } - if (DB::isError( $this->db )) { + if (DB::isError($this->db)) { $this->db_error = $this->db; $this->db = null; - $this->logError( $this->db_error ); + $this->logError($this->db_error); } } @@ -141,7 +146,7 @@ class DBConnection * @access public * @return void */ - function Reset () + public function Reset() { if ($this->db) { $this->db->disconnect(); @@ -156,7 +161,7 @@ class DBConnection * @access public * @return void */ - function Free () + public function Free() { $this->Reset(); } @@ -168,7 +173,7 @@ class DBConnection * @access public * @return void */ - function Close () + public function Close() { $this->Reset(); } @@ -182,7 +187,7 @@ class DBConnection * @param string $errorLevel * @return void */ - function logError ($obj, $errorLevel = null) + public function logError($obj, $errorLevel = null) { global $_SESSION; global $_SERVER; @@ -190,11 +195,12 @@ class DBConnection $filter = new InputFilter(); $_SERVER = $filter->xssFilterHard($_SERVER); $_SESSION = $filter->xssFilterHard($_SESSION); - if (is_null( $errorLevel )) - if (isset( $this->errorLevel )) { - $errorLevel = $this->errorLevel; - } else { - $errorLevel = DB_ERROR_SHOWALL_AND_STOP; //for fatal errors the default is 3, show detailed and die. + if (is_null($errorLevel)) { + if (isset($this->errorLevel)) { + $errorLevel = $this->errorLevel; + } else { + $errorLevel = DB_ERROR_SHOWALL_AND_STOP; //for fatal errors the default is 3, show detailed and die. + } } if ($errorLevel == DB_ERROR_SHOW_AND_STOP || $errorLevel == DB_ERROR_SHOW_AND_CONTINUE || $errorLevel == DB_ERROR_SHOWALL_AND_STOP || $errorLevel == DB_ERROR_SHOWALL_AND_CONTINUE) { @@ -205,9 +211,9 @@ class DBConnection } print ""; } - if (defined( 'DB_ERROR_BACKTRACE' ) && DB_ERROR_BACKTRACE) { + if (defined('DB_ERROR_BACKTRACE') && DB_ERROR_BACKTRACE) { print "
"; } //G::setErrorHandler ( ); @@ -225,7 +231,7 @@ class DBConnection * @param string $limit * @return string */ - function traceError ($tts = 2, $limit = -1) + public function traceError($tts = 2, $limit = -1) { $trace = debug_backtrace(); $out = ''; @@ -233,7 +239,7 @@ class DBConnection if ($tts > 0) { $tts --; } else { - $out .= '[' . basename( $step['file'] ) . ': ' . $step['line'] . '] : ' . $step['function'] . '(' . DBConnection::printArgs( $step['args'] ) . ")\n"; + $out .= '[' . basename($step['file']) . ': ' . $step['line'] . '] : ' . $step['function'] . '(' . DBConnection::printArgs($step['args']) . ")\n"; $limit --; if ($limit === 0) { return $out; @@ -250,31 +256,31 @@ class DBConnection * @param string $args * @return string */ - function printArgs ($args) + public function printArgs($args) { $out = ''; - if (is_array( $args )) { + if (is_array($args)) { foreach ($args as $arg) { if ($out !== '') { $out .= ' ,'; } - if (is_string( $arg )) { + if (is_string($arg)) { $out .= "'" . ($arg) . "'"; - } elseif (is_array( $arg )) { - $out .= print_r( $arg, 1 ); - } elseif (is_object( $arg )) { - $out .= get_class( $arg ); // print_r ( $arg ,1 ); - } elseif (! isset( $arg )) { + } elseif (is_array($arg)) { + $out .= print_r($arg, 1); + } elseif (is_object($arg)) { + $out .= get_class($arg); // print_r ( $arg ,1 ); + } elseif (! isset($arg)) { $out .= 'NULL'; } else { - $out .= sprintf( "%s", $arg ); + $out .= sprintf("%s", $arg); } } } else { - if (! isset( $args )) { + if (! isset($args)) { $out = 'NULL'; } else { - $out = print_r( $args, 1 ); + $out = print_r($args, 1); } } return $out; @@ -287,16 +293,15 @@ class DBConnection * @access public * @return void */ - function GetLastID () + public function GetLastID() { - if (PEAR_DATABASE == "mysql") { - return mysql_insert_id(); + if (PEAR_DATABASE === 'mysql') { + $lastId = mysqli_insert_id($this->db); } else { - $dberror = PEAR::raiseError( null, DB_ERROR_FEATURE_NOT_AVAILABLE, null, 'null', "getLastID with " . PEAR_DATABASE . ' database.', 'G_Error', true ); - DBconnection::logError( $dberror, DB_ERROR_SHOWALL_AND_STOP ); //this error will stop the execution, until we add this feature!! - return $dberror; + $dberror = PEAR::raiseError(null, DB_ERROR_FEATURE_NOT_AVAILABLE, null, 'null', "getLastID with " . PEAR_DATABASE . ' database.', 'G_Error', true); + DBconnection::logError($dberror, DB_ERROR_SHOWALL_AND_STOP); //this error will stop the execution, until we add this feature!! + $lastId = $dberror; } - return mysql_insert_id(); + return $lastId; } } - diff --git a/gulliver/system/class.dbtable.php b/gulliver/system/class.dbtable.php index 12ab7d9f9..b43929378 100644 --- a/gulliver/system/class.dbtable.php +++ b/gulliver/system/class.dbtable.php @@ -185,7 +185,7 @@ class DBTable * @param array array of arguments key values * @return void */ - public function load() + public function load($sUID = null) { // bug::traceRoute(); $ncount = 0; @@ -347,7 +347,7 @@ class DBTable * @access public * @return boolean */ - public function save() + public function save($Fields = null, $labels = [], $options = []) { if ($this->is_new == true) { return $this->Insert(); @@ -363,7 +363,7 @@ class DBTable * @access public * @return boolean */ - public function delete() + public function delete($uid = null) { $stQry = "delete from `" . $this->table_name . "` "; diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 5fb8e7ade..6bc5af32a 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -67,7 +67,7 @@ class G */ public function LoadSystemExist($strClass) { - if (file_exists( PATH_GULLIVER . 'class.' . $strClass . '.php' )) { + if (file_exists(PATH_GULLIVER . 'class.' . $strClass . '.php')) { return true; } else { return false; @@ -122,10 +122,10 @@ class G public function LoadAllModelClasses() { $baseDir = PATH_CORE . 'classes' . PATH_SEP . 'model'; - if ($handle = opendir( $baseDir )) { - while (false !== ($file = readdir( $handle ))) { - if (strpos( $file, '.php', 1 ) && ! strpos( $file, 'Peer.php', 1 )) { - require_once ($baseDir . PATH_SEP . $file); + if ($handle = opendir($baseDir)) { + while (false !== ($file = readdir($handle))) { + if (strpos($file, '.php', 1) && ! strpos($file, 'Peer.php', 1)) { + require_once($baseDir . PATH_SEP . $file); } } } @@ -153,18 +153,18 @@ class G * @param Boolean $recursive * @return Array */ - public function array_fill_value ($arr = Array(), $value = '', $recursive = false) + public function array_fill_value($arr = array(), $value = '', $recursive = false) { - if (is_array( $arr )) { + if (is_array($arr)) { foreach ($arr as $key => $val) { - if (is_array( $arr[$key] )) { - $arr[$key] = ($recursive === true) ? G::array_fill_value( $arr[$key], $value, true ) : $val; + if (is_array($arr[$key])) { + $arr[$key] = ($recursive === true) ? G::array_fill_value($arr[$key], $value, true) : $val; } else { $arr[$key] = $value; } } } else { - $arr = Array (); + $arr = array(); } return $arr; } @@ -176,15 +176,15 @@ class G * u: uppercase set A-Z * n: numbers set 0-9 * s: symbols set _-+=!@#$%*&,.;:?^()[]{}<> - * + * * $symbol is source symbol generate - * + * * @param int $length * @param string $availableSets * @param string $symbol * @return string */ - public function generate_password($length = 15, $availableSets = "luns", $symbol = "_-$!") + public static function generate_password($length = 15, $availableSets = "luns", $symbol = "_-$!") { $chars = ""; if (strpos($availableSets, "l") !== false) { @@ -201,17 +201,17 @@ class G } $n = strlen($chars); do { - $password = ""; + $password = ""; $i = 0; while ($i < $length) { $chars = str_shuffle($chars); $char = substr($chars, mt_rand(0, $n - 1), 1); - if (!strstr($password, $char)) { + if (!strstr($password, $char)) { $password = $password . $char; - $i++; - } + $i++; + } $password = str_shuffle($password); - } + } $info = G::check_password($password, $length, $length, $availableSets); } while (!$info->isValid); return $password; @@ -219,20 +219,20 @@ class G /** * Check password strong - * + * * $availableSets set next options: * l: lowercase set a-z * u: uppercase set A-Z * n: numbers set 0-9 * s: symbols set _-+=!@#$%*&,.;:?^()[]{}<> - * + * * @param string $password * @param int $min * @param int $max * @param string $availableSets * @return \stdClass */ - public function check_password($password, $min = 2, $max = 20, $availableSets = "luns") + public static function check_password($password, $min = 2, $max = 20, $availableSets = "luns") { $info = new stdClass(); $info->isValid = true; @@ -272,13 +272,13 @@ class G * @param Array * @return Array */ - public function array_concat () + public function array_concat() { $nums = func_num_args(); $vars = func_get_args(); - $ret = Array (); + $ret = array(); for ($i = 0; $i < $nums; $i ++) { - if (is_array( $vars[$i] )) { + if (is_array($vars[$i])) { foreach ($vars[$i] as $key => $value) { $ret[$key] = $value; } @@ -295,14 +295,14 @@ class G * @param void $var1-N * @return Boolean */ - public function var_compare ($value = true) + public function var_compare($value = true) { $nums = func_num_args(); if ($nums < 2) { - return true; + return true; } $vars = func_get_args(); - $ret = Array (); + $ret = array(); for ($i = 1; $i < $nums; $i ++) { if ($vars[$i] !== $value) { return false; @@ -317,7 +317,7 @@ class G * @param void * @return void */ - public function var_probe () + public function var_probe() { //return (!$variable)? $nums = func_num_args(); @@ -337,7 +337,7 @@ class G * @access public * @return string */ - public function &getVersion () + public function &getVersion() { //majorVersion.minorVersion-SvnRevision return '3.0-1'; @@ -347,14 +347,14 @@ class G * getIpAddress * @return string $ip */ - public static function getIpAddress () + public static function getIpAddress() { - if (getenv( 'HTTP_CLIENT_IP' )) { - $ip = getenv( 'HTTP_CLIENT_IP' ); - } elseif (getenv( 'HTTP_X_FORWARDED_FOR' )) { - $ip = getenv( 'HTTP_X_FORWARDED_FOR' ); + if (getenv('HTTP_CLIENT_IP')) { + $ip = getenv('HTTP_CLIENT_IP'); + } elseif (getenv('HTTP_X_FORWARDED_FOR')) { + $ip = getenv('HTTP_X_FORWARDED_FOR'); } else { - $ip = getenv( 'REMOTE_ADDR' ); + $ip = getenv('REMOTE_ADDR'); } return $ip; } @@ -364,16 +364,16 @@ class G * * @return string $mac */ - public function getMacAddress () + public function getMacAddress() { - if (strstr( getenv( 'OS' ), 'Windows' )) { + if (strstr(getenv('OS'), 'Windows')) { $ipconfig = `ipconfig /all`; - preg_match( '/[\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}/i', $ipconfig, $mac ); + preg_match('/[\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}/i', $ipconfig, $mac); } else { $ifconfig = `/sbin/ifconfig`; - preg_match( '/[\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}/i', $ifconfig, $mac ); + preg_match('/[\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}[\:-][\dA-Z]{2,2}/i', $ifconfig, $mac); } - return isset( $mac[0] ) ? $mac[0] : '00:00:00:00:00:00'; + return isset($mac[0]) ? $mac[0] : '00:00:00:00:00:00'; } /** @@ -382,9 +382,9 @@ class G * @return array_sum(explode(' ',microtime())) */ /*public static*/ - public function microtime_float () + public function microtime_float() { - return array_sum( explode( ' ', microtime() ) ); + return array_sum(explode(' ', microtime())); } /** @@ -469,13 +469,13 @@ class G * @param string $target * @return void */ - public function lookup ($target) + public function lookup($target) { //Made compatible to PHP 5.3 - if (preg_match( "[a-zA-Z]", $target )) { - $ntarget = gethostbyname( $target ); + if (preg_match("[a-zA-Z]", $target)) { + $ntarget = gethostbyname($target); } else { - $ntarget = gethostbyaddr( $target ); + $ntarget = gethostbyaddr($target); } return ($ntarget); } @@ -483,18 +483,18 @@ class G /** * ************* path functions **************** */ - public static function mk_dir ($strPath, $rights = 0770) + public static function mk_dir($strPath, $rights = 0770) { - $folder_path = array ($strPath); - $oldumask = umask( 0 ); - while (! @is_dir( dirname( end( $folder_path ) ) ) && dirname( end( $folder_path ) ) != '/' && dirname( end( $folder_path ) ) != '.' && dirname( end( $folder_path ) ) != '') { - array_push( $folder_path, dirname( end( $folder_path ) ) ); //var_dump($folder_path); die; + $folder_path = array($strPath); + $oldumask = umask(0); + while (! @is_dir(dirname(end($folder_path))) && dirname(end($folder_path)) != '/' && dirname(end($folder_path)) != '.' && dirname(end($folder_path)) != '') { + array_push($folder_path, dirname(end($folder_path))); //var_dump($folder_path); die; } - while ($parent_folder_path = array_pop( $folder_path )) { - if (! @is_dir( $parent_folder_path )) { - if (! @mkdir( $parent_folder_path, $rights)) { - error_log( "Can't create folder \"$parent_folder_path\""); + while ($parent_folder_path = array_pop($folder_path)) { + if (! @is_dir($parent_folder_path)) { + if (! @mkdir($parent_folder_path, $rights)) { + error_log("Can't create folder \"$parent_folder_path\""); //umask( $oldumask ); } } @@ -509,22 +509,22 @@ class G * * @return void */ - public static function rm_dir ($dirName) + public static function rm_dir($dirName) { - if (! is_writable( $dirName )) { + if (! is_writable($dirName)) { return false; } - if (is_dir( $dirName )) { - foreach (glob( $dirName . '/{,.}*', GLOB_BRACE ) as $file) { + if (is_dir($dirName)) { + foreach (glob($dirName . '/{,.}*', GLOB_BRACE) as $file) { if ($file == $dirName . '/.' || $file == $dirName . '/..') { continue; } - if (is_dir( $file )) { - G::rm_dir( $file ); + if (is_dir($file)) { + G::rm_dir($file); } else { - @unlink( $file ); + @unlink($file); } } @@ -537,7 +537,7 @@ class G @rmdir($dirName); } } else { - @unlink( $dirName ); + @unlink($dirName); } } @@ -548,16 +548,16 @@ class G */ public function delTree($dir) { - $files = glob( $dir . '*', GLOB_MARK ); - foreach ($files as $file ) { - if (substr( $file, -1 ) == '/' ) { - self::delTree( $file ); + $files = glob($dir . '*', GLOB_MARK); + foreach ($files as $file) { + if (substr($file, -1) == '/') { + self::delTree($file); } else { - unlink( $file ); + unlink($file); } } if (is_dir($dir)) { - rmdir( $dir ); + rmdir($dir); } } @@ -567,7 +567,8 @@ class G * @param string $destination * @return boolean */ - function recursive_copy ($source, $destination) { + public function recursive_copy($source, $destination) + { if ($source == $destination) { return false; } @@ -577,9 +578,9 @@ class G G::mk_dir($destination, 0777); } - while (false !== ( $file = readdir($dir))) { - if (( $file != '.' ) && ( $file != '..' )) { - if ( is_dir($source . '/' . $file) ) { + while (false !== ($file = readdir($dir))) { + if (($file != '.') && ($file != '..')) { + if (is_dir($source . '/' . $file)) { self::recursive_copy($source . '/' . $file, $destination . '/' . $file); } else { copy($source . '/' . $file, $destination . '/' . $file); @@ -599,16 +600,16 @@ class G * @param boolean $createPath if true this public function will create the path * @return boolean */ - public static function verifyPath ($strPath, $createPath = false) + public static function verifyPath($strPath, $createPath = false) { - $folder_path = strstr( $strPath, '.' ) ? dirname( $strPath ) : $strPath; + $folder_path = strstr($strPath, '.') ? dirname($strPath) : $strPath; - if (file_exists( $strPath ) || @is_dir( $strPath )) { + if (file_exists($strPath) || @is_dir($strPath)) { return true; } else { if ($createPath) { //TODO:: Define Environment constants: Devel (0777), Production (0770), ... - G::mk_dir( $strPath, 0777 ); + G::mk_dir($strPath, 0777); } else { return false; } @@ -624,7 +625,7 @@ class G * @param string $strPath * @return string */ - public static function expandPath ($strPath = '') + public static function expandPath($strPath = '') { $res = ""; $res = PATH_CORE; @@ -645,7 +646,7 @@ class G * @param string $strSkin * @return void */ - public static function RenderPage ($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '') + public static function RenderPage($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '') { global $G_CONTENT; global $G_TEMPLATE; @@ -657,31 +658,31 @@ class G $G_SKIN = $strSkin; try { - $file = G::ExpandPath( 'skinEngine' ) . 'skinEngine.php'; + $file = G::ExpandPath('skinEngine') . 'skinEngine.php'; include $file; - $skinEngine = new SkinEngine( $G_TEMPLATE, $G_SKIN, $G_CONTENT ); - $skinEngine->setLayout( $layout ); + $skinEngine = new SkinEngine($G_TEMPLATE, $G_SKIN, $G_CONTENT); + $skinEngine->setLayout($layout); $skinEngine->dispatch(); } catch (Exception $e) { global $G_PUBLISH; - if (is_null( $G_PUBLISH )) { + if (is_null($G_PUBLISH)) { $G_PUBLISH = new Publisher(); } - if (count( $G_PUBLISH->Parts ) == 1) { - array_shift( $G_PUBLISH->Parts ); + if (count($G_PUBLISH->Parts) == 1) { + array_shift($G_PUBLISH->Parts); } global $oHeadPublisher; $leimnudInitString = $oHeadPublisher->leimnudInitString; $oHeadPublisher->clearScripts(); $oHeadPublisher->leimnudInitString = $leimnudInitString; - $oHeadPublisher->addScriptFile( '/js/maborak/core/maborak.js' ); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', null, array ('MESSAGE' => self::getErrorMessage($e) - ) ); - if (class_exists( 'SkinEngine' )) { - $skinEngine = new SkinEngine( 'publish', 'blank', '' ); + $oHeadPublisher->addScriptFile('/js/maborak/core/maborak.js'); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', null, array('MESSAGE' => self::getErrorMessage($e) + )); + if (class_exists('SkinEngine')) { + $skinEngine = new SkinEngine('publish', 'blank', ''); $skinEngine->dispatch(); } else { - die( self::getErrorMessage($e) ); + die(self::getErrorMessage($e)); } } } @@ -694,25 +695,24 @@ class G * @param string $strSkinName * @return void */ - public function LoadSkin ($strSkinName) + public function LoadSkin($strSkinName) { //print $strSkinName; //now, we are using the skin, a skin is a file in engine/skin directory - $file = G::ExpandPath( "skins" ) . $strSkinName . ".php"; + $file = G::ExpandPath("skins") . $strSkinName . ".php"; //G::pr($file); - if (file_exists( $file )) { - require_once ($file); + if (file_exists($file)) { + require_once($file); return; } else { - if (file_exists( PATH_HTML . 'errors/error703.php' )) { - header( 'location: /errors/error703.php' ); + if (file_exists(PATH_HTML . 'errors/error703.php')) { + header('location: /errors/error703.php'); die(); } else { $text = "The Skin $file does not exist, please review the Skin Definition"; - throw (new Exception( $text )); + throw (new Exception($text)); } } - } @@ -725,26 +725,25 @@ class G * @access public * @return void */ - public function LoadAllPluginModelClasses () + public function LoadAllPluginModelClasses() { //Get the current Include path, where the plugins directories should be - if (! defined( 'PATH_SEPARATOR' )) { - define( 'PATH_SEPARATOR', (substr( PHP_OS, 0, 3 ) == 'WIN') ? ';' : ':' ); + if (! defined('PATH_SEPARATOR')) { + define('PATH_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':'); } - $path = explode( PATH_SEPARATOR, get_include_path() ); + $path = explode(PATH_SEPARATOR, get_include_path()); foreach ($path as $possiblePath) { - if (strstr( $possiblePath, "plugins" )) { + if (strstr($possiblePath, "plugins")) { $baseDir = $possiblePath . 'classes' . PATH_SEP . 'model'; - if (file_exists( $baseDir )) { - if ($handle = opendir( $baseDir )) { - while (false !== ($file = readdir( $handle ))) { - if (strpos( $file, '.php', 1 ) && ! strpos( $file, 'Peer.php', 1 )) { - require_once ($baseDir . PATH_SEP . $file); + if (file_exists($baseDir)) { + if ($handle = opendir($baseDir)) { + while (false !== ($file = readdir($handle))) { + if (strpos($file, '.php', 1) && ! strpos($file, 'Peer.php', 1)) { + require_once($baseDir . PATH_SEP . $file); } } } - } } } @@ -758,24 +757,24 @@ class G * @param string $strTemplateName * @return void */ - public function LoadTemplate ($strTemplateName) + public function LoadTemplate($strTemplateName) { if ($strTemplateName == '') { return; } $temp = $strTemplateName . ".php"; - $file = G::ExpandPath( 'templates' ) . $temp; + $file = G::ExpandPath('templates') . $temp; // Check if its a user template - if (file_exists( $file )) { + if (file_exists($file)) { //require_once( $file ); - include ($file); + include($file); } else { // Try to get the global system template $file = PATH_TEMPLATE . PATH_SEP . $temp; //require_once( $file ); - if (file_exists( $file )) { - include ($file); + if (file_exists($file)) { + include($file); } } } @@ -788,10 +787,10 @@ class G * @param string $urlLink * @return string */ - public function encryptlink ($url) + public function encryptlink($url) { - if (defined( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes') { - return urlencode( G::encrypt( $url, URL_KEY ) ); + if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { + return urlencode(G::encrypt($url, URL_KEY)); } else { return $url; } @@ -805,25 +804,25 @@ class G * @param string $urlLink * @return string */ - static public function parseURI ($uri, $isRestRequest = false) + public static function parseURI($uri, $isRestRequest = false) { //*** process the $_POST with magic_quotes enabled // The magic_quotes_gpc feature has been DEPRECATED as of PHP 5.3.0. if (get_magic_quotes_gpc() === 1) { - $_POST = G::strip_slashes( $_POST ); + $_POST = G::strip_slashes($_POST); } - $aRequestUri = explode( '/', $uri ); + $aRequestUri = explode('/', $uri); if ($isRestRequest) { - $args = self::parseRestUri( $aRequestUri ); + $args = self::parseRestUri($aRequestUri); } else { - $args = self::parseNormalUri( $aRequestUri ); + $args = self::parseNormalUri($aRequestUri); } - define( "SYS_LANG", $args['SYS_LANG'] ); - define( "SYS_SKIN", $args['SYS_SKIN'] ); - define( 'SYS_COLLECTION', $args['SYS_COLLECTION'] ); - define( 'SYS_TARGET', $args['SYS_TARGET'] ); + define("SYS_LANG", $args['SYS_LANG']); + define("SYS_SKIN", $args['SYS_SKIN']); + define('SYS_COLLECTION', $args['SYS_COLLECTION']); + define('SYS_TARGET', $args['SYS_TARGET']); if ($args['SYS_COLLECTION'] == 'js2') { print "ERROR"; @@ -831,17 +830,17 @@ class G } } - public function parseNormalUri ($aRequestUri) + public function parseNormalUri($aRequestUri) { - if (substr( $aRequestUri[1], 0, 3 ) == 'sys') { - define( 'SYS_TEMP', substr( $aRequestUri[1], 3 ) ); + if (substr($aRequestUri[1], 0, 3) == 'sys') { + define('SYS_TEMP', substr($aRequestUri[1], 3)); } else { - define( "ENABLE_ENCRYPT", 'yes' ); - define( 'SYS_TEMP', $aRequestUri[1] ); + define("ENABLE_ENCRYPT", 'yes'); + define('SYS_TEMP', $aRequestUri[1]); $plain = '/sys' . SYS_TEMP; - for ($i = 2; $i < count( $aRequestUri ); $i ++) { - $decoded = G::decrypt( urldecode( $aRequestUri[$i] ), URL_KEY ); + for ($i = 2; $i < count($aRequestUri); $i ++) { + $decoded = G::decrypt(urldecode($aRequestUri[$i]), URL_KEY); if ($decoded == 'sWì›') { $decoded = $VARS[$i]; //this is for the string "../" } @@ -850,47 +849,47 @@ class G $_SERVER["REQUEST_URI"] = $plain; } - $work = explode( '?', $_SERVER["REQUEST_URI"] ); + $work = explode('?', $_SERVER["REQUEST_URI"]); - if (count( $work ) > 1) { - define( 'SYS_CURRENT_PARMS', $work[1] ); + if (count($work) > 1) { + define('SYS_CURRENT_PARMS', $work[1]); } else { - define( 'SYS_CURRENT_PARMS', '' ); + define('SYS_CURRENT_PARMS', ''); } - define( 'SYS_CURRENT_URI', $work[0] ); + define('SYS_CURRENT_URI', $work[0]); - if (! defined( 'SYS_CURRENT_PARMS' )) { - define( 'SYS_CURRENT_PARMS', $work[1] ); + if (! defined('SYS_CURRENT_PARMS')) { + define('SYS_CURRENT_PARMS', $work[1]); } - $preArray = explode( '&', SYS_CURRENT_PARMS ); - $buffer = explode( '.', $work[0] ); + $preArray = explode('&', SYS_CURRENT_PARMS); + $buffer = explode('.', $work[0]); - if (count( $buffer ) == 1) { + if (count($buffer) == 1) { $buffer[1] = ''; } //request type - define( 'REQUEST_TYPE', ($buffer[1] != "" ? $buffer[1] : 'html') ); + define('REQUEST_TYPE', ($buffer[1] != "" ? $buffer[1] : 'html')); - $toparse = substr( $buffer[0], 1, strlen( $buffer[0] ) - 1 ); - $uriVars = explode( '/', $toparse ); + $toparse = substr($buffer[0], 1, strlen($buffer[0]) - 1); + $uriVars = explode('/', $toparse); - unset( $work ); - unset( $buffer ); - unset( $toparse ); - array_shift( $uriVars ); + unset($work); + unset($buffer); + unset($toparse); + array_shift($uriVars); - $args = array (); - $args['SYS_LANG'] = array_shift( $uriVars ); - $args['SYS_SKIN'] = array_shift( $uriVars ); - $args['SYS_COLLECTION'] = array_shift( $uriVars ); - $args['SYS_TARGET'] = array_shift( $uriVars ); + $args = array(); + $args['SYS_LANG'] = array_shift($uriVars); + $args['SYS_SKIN'] = array_shift($uriVars); + $args['SYS_COLLECTION'] = array_shift($uriVars); + $args['SYS_TARGET'] = array_shift($uriVars); //to enable more than 2 directories...in the methods structure - while (count( $uriVars ) > 0) { - $args['SYS_TARGET'] .= '/' . array_shift( $uriVars ); + while (count($uriVars) > 0) { + $args['SYS_TARGET'] .= '/' . array_shift($uriVars); } /* Fix to prevent use uxs skin outside siplified interface, @@ -903,14 +902,14 @@ class G return $args; } - public function parseRestUri ($requestUri) + public function parseRestUri($requestUri) { - $args = array (); + $args = array(); //$args['SYS_TEMP'] = $requestUri[1]; - define( 'SYS_TEMP', $requestUri[2] ); + define('SYS_TEMP', $requestUri[2]); $restUri = ''; - for ($i = 3; $i < count( $requestUri ); $i ++) { + for ($i = 3; $i < count($requestUri); $i ++) { $restUri .= '/' . $requestUri[$i]; } @@ -922,18 +921,18 @@ class G return $args; } - public function strip_slashes ($vVar) + public function strip_slashes($vVar) { - if (is_array( $vVar )) { + if (is_array($vVar)) { foreach ($vVar as $sKey => $vValue) { - if (is_array( $vValue )) { - G::strip_slashes( $vVar[$sKey] ); + if (is_array($vValue)) { + G::strip_slashes($vVar[$sKey]); } else { - $vVar[$sKey] = stripslashes( $vVar[$sKey] ); + $vVar[$sKey] = stripslashes($vVar[$sKey]); } } } else { - $vVar = stripslashes( $vVar ); + $vVar = stripslashes($vVar); } return $vVar; @@ -942,19 +941,19 @@ class G /** * function to calculate the time used to render a page */ - public function logTimeByPage () + public function logTimeByPage() { - if (! defined( PATH_DATA )) { + if (! defined(PATH_DATA)) { return false; } $serverAddr = $_SERVER['SERVER_ADDR']; global $startingTime; - $endTime = microtime( true ); + $endTime = microtime(true); $time = $endTime - $startingTime; - $fpt = fopen( PATH_DATA . 'log/time.log', 'a' ); - fwrite( $fpt, sprintf( "%s.%03d %15s %s %5.3f %s\n", date( 'Y-m-d H:i:s' ), $time, getenv( 'REMOTE_ADDR' ), substr( $serverAddr, - 4 ), $time, $_SERVER['REQUEST_URI'] ) ); - fclose( $fpt ); + $fpt = fopen(PATH_DATA . 'log/time.log', 'a'); + fwrite($fpt, sprintf("%s.%03d %15s %s %5.3f %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), substr($serverAddr, - 4), $time, $_SERVER['REQUEST_URI'])); + fclose($fpt); } /** @@ -965,17 +964,17 @@ class G * @param string $file * @return string */ - public function streamCSSBigFile ($filename) + public function streamCSSBigFile($filename) { - header( 'Content-Type: text/css' ); + header('Content-Type: text/css'); //First get Skin info - $filenameParts = explode( "-", $filename ); + $filenameParts = explode("-", $filename); $skinName = $filenameParts[0]; $skinVariant = "skin"; - if (isset( $filenameParts[1] )) { - $skinVariant = strtolower( $filenameParts[1] ); + if (isset($filenameParts[1])) { + $skinVariant = strtolower($filenameParts[1]); } $configurationFile = ''; @@ -986,34 +985,34 @@ class G $skinName = "classic"; } if ($skinName == "classic") { - $configurationFile = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP . 'config.xml'; + $configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml'; } else { $configurationFile = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml'; - if (! is_file( $configurationFile )) { - $configurationFile = G::ExpandPath( "skinEngine" ) . $skinName . PATH_SEP . 'config.xml'; + if (! is_file($configurationFile)) { + $configurationFile = G::ExpandPath("skinEngine") . $skinName . PATH_SEP . 'config.xml'; } } //Read Configuration File - $xmlConfiguration = file_get_contents( $configurationFile ); - $xmlConfigurationObj = G::xmlParser( $xmlConfiguration ); - $baseSkinDirectory = dirname( $configurationFile ); - $directorySize = G::getDirectorySize( $baseSkinDirectory ); + $xmlConfiguration = file_get_contents($configurationFile); + $xmlConfigurationObj = G::xmlParser($xmlConfiguration); + $baseSkinDirectory = dirname($configurationFile); + $directorySize = G::getDirectorySize($baseSkinDirectory); $mtime = $directorySize['maxmtime']; $outputHeader = "/* Autogenerated CSS file by gulliver framework \n"; $outputHeader .= " Skin: $filename\n"; - $mtimeNow = date( 'U' ); - $gmt_mtimeNow = gmdate( "D, d M Y H:i:s", $mtimeNow ) . " GMT"; + $mtimeNow = date('U'); + $gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow) . " GMT"; $outputHeader .= " Date: $gmt_mtimeNow*/\n"; $output = ""; //Base files - switch (strtolower( $skinVariant )) { + switch (strtolower($skinVariant)) { case "extjs": //Base $baseCSSPath = PATH_SKIN_ENGINE . "base" . PATH_SEP . "baseCss" . PATH_SEP; - $output .= file_get_contents( $baseCSSPath . 'ext-all-notheme.css' ); + $output .= file_get_contents($baseCSSPath . 'ext-all-notheme.css'); //Classic Skin $extJsSkin = 'xtheme-gray'; @@ -1023,16 +1022,16 @@ class G } //Get Browser Info - $infoBrowser = G::browser_detection( 'full_assoc' ); + $infoBrowser = G::browser_detection('full_assoc'); $browserName = $infoBrowser['browser_working']; - if (isset( $infoBrowser[$browserName . '_data'] )) { + if (isset($infoBrowser[$browserName . '_data'])) { if ($infoBrowser[$browserName . '_data'][0] != "") { $browserName = $infoBrowser[$browserName . '_data'][0]; } } //Read Configuration File - $xmlConfiguration = file_get_contents ( $configurationFile ); + $xmlConfiguration = file_get_contents($configurationFile); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['cssFiles']['__CONTENT__'][$skinVariant]['__CONTENT__']['cssFile'] ; @@ -1042,7 +1041,7 @@ class G if (((in_array($browserName, $enabledBrowsers)) || (in_array('ALL', $enabledBrowsers)))&&(!(in_array($browserName, $disabledBrowsers)))) { if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') { - $oServerConf =& ServerConf::getSingleton(); + $oServerConf = ServerConf::getSingleton(); if (!(defined('SYS_LANG'))) { if (isset($_SERVER['HTTP_REFERER'])) { $syss = explode('://', $_SERVER['HTTP_REFERER']); @@ -1055,17 +1054,17 @@ class G $sysLang = SYS_LANG; } if ($oServerConf->isRtl($sysLang)) { - $output .= file_get_contents ( $baseSkinDirectory . PATH_SEP.'css'.PATH_SEP.$cssFileInfo['__ATTRIBUTES__']['file'] ); + $output .= file_get_contents($baseSkinDirectory . PATH_SEP.'css'.PATH_SEP.$cssFileInfo['__ATTRIBUTES__']['file']); } } else { - $output .= file_get_contents ( $baseSkinDirectory . PATH_SEP.'css'.PATH_SEP.$cssFileInfo['__ATTRIBUTES__']['file'] ); + $output .= file_get_contents($baseSkinDirectory . PATH_SEP.'css'.PATH_SEP.$cssFileInfo['__ATTRIBUTES__']['file']); } } } //Remove comments.. - $regex = array ("`^([\t\s]+)`ism" => '',"`^\/\*(.+?)\*\/`ism" => "","`([\n\A;]+)\/\*(.+?)\*\/`ism" => "$1","`([\n\A;\s]+)//(.+?)[\n\r]`ism" => "$1\n","`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism" => "\n" ); - $output = preg_replace( array_keys( $regex ), $regex, $output ); + $regex = array("`^([\t\s]+)`ism" => '',"`^\/\*(.+?)\*\/`ism" => "","`([\n\A;]+)\/\*(.+?)\*\/`ism" => "$1","`([\n\A;\s]+)//(.+?)[\n\r]`ism" => "$1\n","`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism" => "\n" ); + $output = preg_replace(array_keys($regex), $regex, $output); $output = $outputHeader . $output; return $output; @@ -1082,29 +1081,29 @@ class G * @param string $downloadFileName * @return string */ - public function streamJSTranslationFile ($filename, $locale = 'en') + public function streamJSTranslationFile($filename, $locale = 'en') { - $defaultTranslations = Array (); - $foreignTranslations = Array (); + $defaultTranslations = array(); + $foreignTranslations = array(); //if the default translations table doesn't exist we can't proceed - if (! is_file( PATH_LANGUAGECONT . 'translation.en' )) { + if (! is_file(PATH_LANGUAGECONT . 'translation.en')) { return ; } //load the translations table - require_once (PATH_LANGUAGECONT . 'translation.en'); + require_once(PATH_LANGUAGECONT . 'translation.en'); $defaultTranslations = $translation; //if some foreign language was requested and its translation file exists - if ($locale != 'en' && file_exists( PATH_LANGUAGECONT . 'translation.' . $locale )) { - require_once (PATH_LANGUAGECONT . 'translation.' . $locale); //load the foreign translations table + if ($locale != 'en' && file_exists(PATH_LANGUAGECONT . 'translation.' . $locale)) { + require_once(PATH_LANGUAGECONT . 'translation.' . $locale); //load the foreign translations table $foreignTranslations = $translation; } - if (defined( "SHOW_UNTRANSLATED_AS_TAG" ) && SHOW_UNTRANSLATED_AS_TAG != 0) { + if (defined("SHOW_UNTRANSLATED_AS_TAG") && SHOW_UNTRANSLATED_AS_TAG != 0) { $translation = $foreignTranslations; } else { - $translation = array_merge( $defaultTranslations, $foreignTranslations ); + $translation = array_merge($defaultTranslations, $foreignTranslations); } $calendarJs = ''; @@ -1114,7 +1113,7 @@ class G } $calendarJs = file_get_contents($calendarJsFile) . "\n"; - return $calendarJs . 'var TRANSLATIONS = ' . G::json_encode( $translation ) . ';' ; + return $calendarJs . 'var TRANSLATIONS = ' . G::json_encode($translation) . ';' ; } /** @@ -1127,91 +1126,90 @@ class G * @param string $downloadFileName * @return string */ - public static function streamFile ($file, $download = false, $downloadFileName = '') + public static function streamFile($file, $download = false, $downloadFileName = '') { - $filter = new InputFilter(); $file = $filter->xssFilterHard($file); - if(isset($_SERVER['REQUEST_URI'])) { - $_SERVER['REQUEST_URI'] = $filter->xssFilterHard($_SERVER['REQUEST_URI'],"url"); + if (isset($_SERVER['REQUEST_URI'])) { + $_SERVER['REQUEST_URI'] = $filter->xssFilterHard($_SERVER['REQUEST_URI'], "url"); } - require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php'); - $folderarray = explode( '/', $file ); - $typearray = explode( '.', basename( $file ) ); - $typefile = $typearray[count( $typearray ) - 1]; + require_once(PATH_THIRDPARTY . 'jsmin/jsmin.php'); + $folderarray = explode('/', $file); + $typearray = explode('.', basename($file)); + $typefile = $typearray[count($typearray) - 1]; $filename = $file; //trick to generate the translation.language.js file , merging two files - if (strtolower( $typefile ) == 'js' && $typearray[0] == 'translation') { + if (strtolower($typefile) == 'js' && $typearray[0] == 'translation') { $download = $filter->xssFilterHard($download); $downloadFileName = $filter->xssFilterHard($downloadFileName); - G::sendHeaders( $filename, 'text/javascript', $download, $downloadFileName ); - $output = G::streamJSTranslationFile( $filename, $typearray[1] ); + G::sendHeaders($filename, 'text/javascript', $download, $downloadFileName); + $output = G::streamJSTranslationFile($filename, $typearray[1]); $output = $filter->xssFilterHard($output); print $output; return; } //trick to generate the big css file for ext style . - if (strtolower( $typefile ) == 'css' && $folderarray[count( $folderarray ) - 2] == 'css') { - G::sendHeaders( $filename, 'text/css', $download, $downloadFileName ); - $output = G::streamCSSBigFile( $typearray[0] ); + if (strtolower($typefile) == 'css' && $folderarray[count($folderarray) - 2] == 'css') { + G::sendHeaders($filename, 'text/css', $download, $downloadFileName); + $output = G::streamCSSBigFile($typearray[0]); $output = $filter->xssFilterHard($output); print $output; return; } - if (file_exists( $filename )) { - switch (strtolower( $typefile )) { + if (file_exists($filename)) { + switch (strtolower($typefile)) { case 'swf': - G::sendHeaders( $filename, 'application/x-shockwave-flash', $download, $downloadFileName ); + G::sendHeaders($filename, 'application/x-shockwave-flash', $download, $downloadFileName); break; case 'js': - G::sendHeaders( $filename, 'text/javascript', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/javascript', $download, $downloadFileName); break; case 'htm': case 'html': - G::sendHeaders( $filename, 'text/html', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/html', $download, $downloadFileName); break; case 'htc': - G::sendHeaders( $filename, 'text/plain', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/plain', $download, $downloadFileName); break; case 'json': - G::sendHeaders( $filename, 'text/plain', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/plain', $download, $downloadFileName); break; case 'gif': - G::sendHeaders( $filename, 'image/gif', $download, $downloadFileName ); + G::sendHeaders($filename, 'image/gif', $download, $downloadFileName); break; case 'png': - G::sendHeaders( $filename, 'image/png', $download, $downloadFileName ); + G::sendHeaders($filename, 'image/png', $download, $downloadFileName); break; case 'jpg': - G::sendHeaders( $filename, 'image/jpg', $download, $downloadFileName ); + G::sendHeaders($filename, 'image/jpg', $download, $downloadFileName); break; case 'css': - G::sendHeaders( $filename, 'text/css', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/css', $download, $downloadFileName); break; case 'xml': - G::sendHeaders( $filename, 'text/xml', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/xml', $download, $downloadFileName); break; case 'txt': - G::sendHeaders( $filename, 'text/html', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/html', $download, $downloadFileName); break; case 'pdf': - G::sendHeaders( $filename, 'application/pdf', $download, $downloadFileName ); + G::sendHeaders($filename, 'application/pdf', $download, $downloadFileName); break; case 'doc': case 'pm': case 'po': - G::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName ); + G::sendHeaders($filename, 'application/octet-stream', $download, $downloadFileName); break; case 'php': if ($download) { - G::sendHeaders( $filename, 'text/plain', $download, $downloadFileName ); + G::sendHeaders($filename, 'text/plain', $download, $downloadFileName); } else { if (\Bootstrap::getDisablePhpUploadExecution() === 0) { \Bootstrap::registerMonologPhpUploadExecution('phpExecution', 200, 'Php Execution', $filename); - require_once ($filename); + require_once($filename); } else { $message = G::LoadTranslation('THE_PHP_FILES_EXECUTION_WAS_DISABLED'); \Bootstrap::registerMonologPhpUploadExecution('phpExecution', 550, $message, $filename); @@ -1221,26 +1219,26 @@ class G } break; case 'tar': - G::sendHeaders( $filename, 'application/x-tar', $download, $downloadFileName ); + G::sendHeaders($filename, 'application/x-tar', $download, $downloadFileName); break; default: //throw new Exception ( "Unknown type of file '$file'. " ); - G::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName ); + G::sendHeaders($filename, 'application/octet-stream', $download, $downloadFileName); break; } } else { - if (strpos( $file, 'gulliver' ) !== false) { - list ($path, $filename) = explode( 'gulliver', $file ); + if (strpos($file, 'gulliver') !== false) { + list($path, $filename) = explode('gulliver', $file); } $_SESSION['phpFileNotFound'] = $file; - G::header( "location: /errors/error404.php?l=" . $_SERVER['REQUEST_URI'] ); + G::header("location: /errors/error404.php?l=" . $_SERVER['REQUEST_URI']); } - if ( substr($filename,-10) == "ext-all.js" ) { + if (substr($filename, -10) == "ext-all.js") { $filename = PATH_GULLIVER_HOME . 'js/ext/min/ext-all.js'; } - @readfile( $filename ); + @readfile($filename); } /** @@ -1253,7 +1251,7 @@ class G * * @return void */ - public function sendHeaders ($filename, $contentType = '', $download = false, $downloadFileName = '') + public function sendHeaders($filename, $contentType = '', $download = false, $downloadFileName = '') { if ($download) { if ($downloadFileName == '') { @@ -1267,48 +1265,47 @@ class G header('Content-Type: ' . $contentType); //if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor. - $userAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); - if (preg_match( "/msie/i", $userAgent )) { + $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); + if (preg_match("/msie/i", $userAgent)) { //if ( ereg("msie", $userAgent)) { - header( 'Pragma: cache' ); + header('Pragma: cache'); - if (file_exists( $filename )) { - $mtime = filemtime( $filename ); + if (file_exists($filename)) { + $mtime = filemtime($filename); } else { - $mtime = date( 'U' ); + $mtime = date('U'); } - $gmt_mtime = gmdate( "D, d M Y H:i:s", $mtime ) . " GMT"; - header( 'ETag: "' . G::encryptOld( $mtime . $filename ) . '"' ); - header( "Last-Modified: " . $gmt_mtime ); - header( 'Cache-Control: public' ); - header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + 60 * 10 ) . " GMT" ); //ten minutes + $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT"; + header('ETag: "' . G::encryptOld($mtime . $filename) . '"'); + header("Last-Modified: " . $gmt_mtime); + header('Cache-Control: public'); + header("Expires: " . gmdate("D, d M Y H:i:s", time() + 60 * 10) . " GMT"); //ten minutes return; } if (! $download) { + header('Pragma: cache'); - header( 'Pragma: cache' ); - - if (file_exists( $filename )) { - $mtime = filemtime( $filename ); + if (file_exists($filename)) { + $mtime = filemtime($filename); } else { - $mtime = date( 'U' ); + $mtime = date('U'); } - $gmt_mtime = gmdate( "D, d M Y H:i:s", $mtime ) . " GMT"; - header( 'ETag: "' . G::encryptOld( $mtime . $filename ) . '"' ); - header( "Last-Modified: " . $gmt_mtime ); - header( 'Cache-Control: public' ); - header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + 90 * 60 * 60 * 24 ) . " GMT" ); - if (isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] )) { + $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT"; + header('ETag: "' . G::encryptOld($mtime . $filename) . '"'); + header("Last-Modified: " . $gmt_mtime); + header('Cache-Control: public'); + header("Expires: " . gmdate("D, d M Y H:i:s", time() + 90 * 60 * 60 * 24) . " GMT"); + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) { - header( 'HTTP/1.1 304 Not Modified' ); + header('HTTP/1.1 304 Not Modified'); exit(); } } - if (isset( $_SERVER['HTTP_IF_NONE_MATCH'] )) { - if (str_replace( '"', '', stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) == G::encryptOld( $mtime . $filename )) { - header( "HTTP/1.1 304 Not Modified" ); + if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { + if (str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == G::encryptOld($mtime . $filename)) { + header("HTTP/1.1 304 Not Modified"); exit(); } } @@ -1325,15 +1322,15 @@ class G * @param string $realPath = local path * @return boolean */ - public function virtualURI ($url, $convertionTable, &$realPath) + public function virtualURI($url, $convertionTable, &$realPath) { foreach ($convertionTable as $urlPattern => $localPath) { // $urlPattern = addcslashes( $urlPattern , '/'); - $urlPattern = addcslashes( $urlPattern, './' ); - $urlPattern = '/^' . str_replace( array ('*','?' - ), array ('.*','.?' - ), $urlPattern ) . '$/'; - if (preg_match( $urlPattern, $url, $match )) { + $urlPattern = addcslashes($urlPattern, './'); + $urlPattern = '/^' . str_replace(array('*','?' + ), array('.*','.?' + ), $urlPattern) . '$/'; + if (preg_match($urlPattern, $url, $match)) { if ($localPath === false) { $realPath = $url; return false; @@ -1359,13 +1356,13 @@ class G * @param string $id * @return string */ - public static function createUID ($scope, $id) + public static function createUID($scope, $id) { $e = $scope . $id; - $e = G::encrypt( $e, URL_KEY ); - $e = str_replace( array ('+','/','=' - ), array ('__','_','___' - ), base64_encode( $e ) ); + $e = G::encrypt($e, URL_KEY); + $e = str_replace(array('+','/','=' + ), array('__','_','___' + ), base64_encode($e)); return $e; } @@ -1379,14 +1376,14 @@ class G * @param string $scope * @return string */ - public function getUIDName ($uid, $scope = '') + public function getUIDName($uid, $scope = '') { - $e = str_replace( array ('=','+','/' - ), array ('___','__','_' - ), $uid ); - $e = base64_decode( $e ); - $e = G::decrypt( $e, URL_KEY ); - $e = substr( $e, strlen( $scope ) ); + $e = str_replace(array('=','+','/' + ), array('___','__','_' + ), $uid); + $e = base64_decode($e); + $e = G::decrypt($e, URL_KEY); + $e = substr($e, strlen($scope)); return $e; } @@ -1396,7 +1393,7 @@ class G * @param int/string $num * @return string number */ - public function formatNumber ($num, $language = 'latin') + public function formatNumber($num, $language = 'latin') { switch ($language) { default: @@ -1410,32 +1407,32 @@ class G * @param string $format The format of the outputted date string * @param string $datetime Date in the format YYYY-MM-DD HH:MM:SS */ - public function formatDate ($datetime, $format = 'Y-m-d', $lang = '') + public function formatDate($datetime, $format = 'Y-m-d', $lang = '') { if ($lang === '') { - $lang = defined( SYS_LANG ) ? SYS_LANG : 'en'; + $lang = defined(SYS_LANG) ? SYS_LANG : 'en'; } - $aux = explode( ' ', $datetime ); //para dividir la fecha del dia - $date = explode( '-', isset( $aux[0] ) ? $aux[0] : '00-00-00' ); //para obtener los dias, el mes, y el año. - $time = explode( ':', isset( $aux[1] ) ? $aux[1] : '00:00:00' ); //para obtener las horas, minutos, segundos. - $date[0] = (int) ((isset( $date[0] )) ? $date[0] : '0'); - $date[1] = (int) ((isset( $date[1] )) ? $date[1] : '0'); - $date[2] = (int) ((isset( $date[2] )) ? $date[2] : '0'); - $time[0] = (int) ((isset( $time[0] )) ? $time[0] : '0'); - $time[1] = (int) ((isset( $time[1] )) ? $time[1] : '0'); - $time[2] = (int) ((isset( $time[2] )) ? $time[2] : '0'); + $aux = explode(' ', $datetime); //para dividir la fecha del dia + $date = explode('-', isset($aux[0]) ? $aux[0] : '00-00-00'); //para obtener los dias, el mes, y el año. + $time = explode(':', isset($aux[1]) ? $aux[1] : '00:00:00'); //para obtener las horas, minutos, segundos. + $date[0] = (int) ((isset($date[0])) ? $date[0] : '0'); + $date[1] = (int) ((isset($date[1])) ? $date[1] : '0'); + $date[2] = (int) ((isset($date[2])) ? $date[2] : '0'); + $time[0] = (int) ((isset($time[0])) ? $time[0] : '0'); + $time[1] = (int) ((isset($time[1])) ? $time[1] : '0'); + $time[2] = (int) ((isset($time[2])) ? $time[2] : '0'); // Spanish months - $ARR_MONTHS['es'] = array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre" + $ARR_MONTHS['es'] = array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre" ); // English months - $ARR_MONTHS['en'] = array ("January","February","March","April","May","June","July","August","September","October","November","December" + $ARR_MONTHS['en'] = array("January","February","March","April","May","June","July","August","September","October","November","December" ); // Spanish days - $ARR_WEEKDAYS['es'] = array ("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado" + $ARR_WEEKDAYS['es'] = array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado" ); // English days - $ARR_WEEKDAYS['en'] = array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" + $ARR_WEEKDAYS['en'] = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" ); if ($lang == 'fa') { @@ -1444,33 +1441,33 @@ class G $number = 'latin'; } $d = '0' . $date[2]; - $d = G::formatNumber( substr( $d, strlen( $d ) - 2, 2 ), $number ); - $j = G::formatNumber( $date[2], $number ); - $F = isset( $ARR_MONTHS[$lang][$date[1] - 1] ) ? $ARR_MONTHS[$lang][$date[1] - 1] : ''; + $d = G::formatNumber(substr($d, strlen($d) - 2, 2), $number); + $j = G::formatNumber($date[2], $number); + $F = isset($ARR_MONTHS[$lang][$date[1] - 1]) ? $ARR_MONTHS[$lang][$date[1] - 1] : ''; $m = '0' . $date[1]; - $m = G::formatNumber( substr( $m, strlen( $m ) - 2, 2 ), $number ); - $n = G::formatNumber( $date[1], $number ); - $y = G::formatNumber( substr( $date[0], strlen( $date[0] ) - 2, 2 ), $number ); + $m = G::formatNumber(substr($m, strlen($m) - 2, 2), $number); + $n = G::formatNumber($date[1], $number); + $y = G::formatNumber(substr($date[0], strlen($date[0]) - 2, 2), $number); $Y = '0000' . $date[0]; - $Y = G::formatNumber( substr( $Y, strlen( $Y ) - 4, 4 ), $number ); + $Y = G::formatNumber(substr($Y, strlen($Y) - 4, 4), $number); $g = ($time[0] % 12); if ($g === 0) { $g = 12; } $G = $time[0]; $h = '0' . $g; - $h = G::formatNumber( substr( $h, strlen( $h ) - 2, 2 ), $number ); + $h = G::formatNumber(substr($h, strlen($h) - 2, 2), $number); $H = '0' . $G; - $H = G::formatNumber( substr( $H, strlen( $H ) - 2, 2 ), $number ); + $H = G::formatNumber(substr($H, strlen($H) - 2, 2), $number); $i = '0' . $time[1]; - $i = G::formatNumber( substr( $i, strlen( $i ) - 2, 2 ), $number ); + $i = G::formatNumber(substr($i, strlen($i) - 2, 2), $number); $s = '0' . $time[2]; - $s = G::formatNumber( substr( $s, strlen( $s ) - 2, 2 ), $number ); - $names = array ('d','j','F','m','n','y','Y','g','G','h','H','i','s' + $s = G::formatNumber(substr($s, strlen($s) - 2, 2), $number); + $names = array('d','j','F','m','n','y','Y','g','G','h','H','i','s' ); - $values = array ($d,$j,$F,$m,$n,$y,$Y,$g,$G,$h,$H,$i,$s + $values = array($d,$j,$F,$m,$n,$y,$Y,$g,$G,$h,$H,$i,$s ); - $_formatedDate = str_replace( $names, $values, $format ); + $_formatedDate = str_replace($names, $values, $format); return $_formatedDate; } @@ -1483,7 +1480,7 @@ class G * * @return string $ret */ - public static function getformatedDate ($date, $format = 'yyyy-mm-dd', $lang = '') + public static function getformatedDate($date, $format = 'yyyy-mm-dd', $lang = '') { /** * ****************************************************************************************************** @@ -1503,71 +1500,71 @@ class G //scape the literal switch ($lang) { case 'es': - $format = str_replace( ' del ', '[ofl]', $format ); - $format = str_replace( ' de ', '[of]', $format ); + $format = str_replace(' del ', '[ofl]', $format); + $format = str_replace(' de ', '[of]', $format); break; } //first we must formatted the string - $format = str_replace( 'h', '{h}', $format ); - $format = str_replace( 'i', '{i}', $format ); - $format = str_replace( 's', '{s}', $format ); + $format = str_replace('h', '{h}', $format); + $format = str_replace('i', '{i}', $format); + $format = str_replace('s', '{s}', $format); - $format = str_replace( 'yyyy', '{YEAR}', $format ); - $format = str_replace( 'yy', '{year}', $format ); + $format = str_replace('yyyy', '{YEAR}', $format); + $format = str_replace('yy', '{year}', $format); - $format = str_replace( 'mm', '{YONTH}', $format ); - $format = str_replace( 'm', '{month}', $format ); - $format = str_replace( 'M', '{XONTH}', $format ); + $format = str_replace('mm', '{YONTH}', $format); + $format = str_replace('m', '{month}', $format); + $format = str_replace('M', '{XONTH}', $format); - $format = str_replace( 'dd', '{DAY}', $format ); - $format = str_replace( 'd', '{day}', $format ); + $format = str_replace('dd', '{DAY}', $format); + $format = str_replace('d', '{day}', $format); if ($lang === '') { - $lang = defined( SYS_LANG ) ? SYS_LANG : 'en'; + $lang = defined(SYS_LANG) ? SYS_LANG : 'en'; } - $aux = explode( ' ', $date ); //para dividir la fecha del dia - $date = explode( '-', isset( $aux[0] ) ? $aux[0] : '00-00-00' ); //para obtener los dias, el mes, y el año. - $time = explode( ':', isset( $aux[1] ) ? $aux[1] : '00:00:00' ); //para obtener las horas, minutos, segundos. + $aux = explode(' ', $date); //para dividir la fecha del dia + $date = explode('-', isset($aux[0]) ? $aux[0] : '00-00-00'); //para obtener los dias, el mes, y el año. + $time = explode(':', isset($aux[1]) ? $aux[1] : '00:00:00'); //para obtener las horas, minutos, segundos. - $year = (int) ((isset( $date[0] )) ? $date[0] : '0'); //year - $month = (int) ((isset( $date[1] )) ? $date[1] : '0'); //month - $day = (int) ((isset( $date[2] )) ? $date[2] : '0'); //day + $year = (int) ((isset($date[0])) ? $date[0] : '0'); //year + $month = (int) ((isset($date[1])) ? $date[1] : '0'); //month + $day = (int) ((isset($date[2])) ? $date[2] : '0'); //day - $h = isset( $time[0] ) ? $time[0] : '00'; //hour - $i = isset( $time[1] ) ? $time[1] : '00'; //minute - $s = isset( $time[2] ) ? $time[2] : '00'; //second + $h = isset($time[0]) ? $time[0] : '00'; //hour + $i = isset($time[1]) ? $time[1] : '00'; //minute + $s = isset($time[2]) ? $time[2] : '00'; //second - $MONTHS = Array (); + $MONTHS = array(); for ($j = 1; $j <= 12; $j ++) { - $MONTHS[$j] = G::LoadTranslation( "ID_MONTH_$j", $lang ); + $MONTHS[$j] = G::LoadTranslation("ID_MONTH_$j", $lang); } $d = (int) $day; - $dd = G::complete_field( $day, 2, 1 ); + $dd = G::complete_field($day, 2, 1); //missing D $M = $MONTHS[$month]; $m = (int) $month; - $mm = G::complete_field( $month, 2, 1 ); + $mm = G::complete_field($month, 2, 1); - $yy = substr( $year, strlen( $year ) - 2, 2 ); + $yy = substr($year, strlen($year) - 2, 2); $yyyy = $year; - $names = array ('{day}','{DAY}','{month}','{YONTH}','{XONTH}','{year}','{YEAR}','{h}','{i}','{s}' + $names = array('{day}','{DAY}','{month}','{YONTH}','{XONTH}','{year}','{YEAR}','{h}','{i}','{s}' ); - $values = array ($d,$dd,$m,$mm,$M,$yy,$yyyy,$h,$i,$s + $values = array($d,$dd,$m,$mm,$M,$yy,$yyyy,$h,$i,$s ); - $ret = str_replace( $names, $values, $format ); + $ret = str_replace($names, $values, $format); //recovering the original literal switch ($lang) { case 'es': - $ret = str_replace( '[ofl]', ' del ', $ret ); - $ret = str_replace( '[of]', ' de ', $ret ); + $ret = str_replace('[ofl]', ' del ', $ret); + $ret = str_replace('[of]', ' de ', $ret); break; } @@ -1579,21 +1576,21 @@ class G * Here's a little wrapper for array_diff - I found myself needing * to iterate through the edited array, and I didn't need to original keys for anything. */ - public function arrayDiff ($array1, $array2) + public function arrayDiff($array1, $array2) { - if (! is_array( $array1 )) { + if (! is_array($array1)) { $array1 = (array) $array1; } - if (! is_array( $array2 )) { + if (! is_array($array2)) { $array2 = (array) $array2; } // This wrapper for array_diff rekeys the array returned - $valid_array = array_diff( $array1, $array2 ); + $valid_array = array_diff($array1, $array2); // reinstantiate $array1 variable - $array1 = array (); + $array1 = array(); // loop through the validated array and move elements to $array1 // this is necessary because the array_diff function returns arrays that retain their original keys @@ -1608,49 +1605,49 @@ class G * @author Erik Amaru Ortiz * @name complete_field($string, $lenght, $type={1:number/2:string/3:float}) */ - public static function complete_field ($campo, $long, $tipo) + public static function complete_field($campo, $long, $tipo) { - $campo = trim( $campo ); + $campo = trim($campo); switch ($tipo) { case 1: //number - $long = $long - strlen( $campo ); + $long = $long - strlen($campo); for ($i = 1; $i <= $long; $i ++) { $campo = "0" . $campo; } break; case 2: //string - $long = $long - strlen( $campo ); + $long = $long - strlen($campo); for ($i = 1; $i <= $long; $i ++) { $campo = " " . $campo; } break; case 3: //float if ($campo != "0") { - $vals = explode( ".", $long ); + $vals = explode(".", $long); $ints = $vals[0]; $decs = $vals[1]; - $valscampo = explode( ".", $campo ); + $valscampo = explode(".", $campo); $intscampo = $valscampo[0]; $decscampo = $valscampo[1]; - $ints = $ints - strlen( $intscampo ); + $ints = $ints - strlen($intscampo); for ($i = 1; $i <= $ints; $i ++) { $intscampo = "0" . $intscampo; } //los decimales pueden ser 0 uno o dos - $decs = $decs - strlen( $decscampo ); + $decs = $decs - strlen($decscampo); for ($i = 1; $i <= $decs; $i ++) { $decscampo = $decscampo . "0"; } $campo = $intscampo . "." . $decscampo; } else { - $vals = explode( ".", $long ); + $vals = explode(".", $long); $ints = $vals[0]; $decs = $vals[1]; @@ -1671,24 +1668,23 @@ class G } /* Escapes special characters in a string for use in a SQL statement - * @author David Callizaya * @param string $sqlString The string to be escaped * @param string $DBEngine Target DBMS */ - public function sqlEscape ($sqlString, $DBEngine = DB_ADAPTER) + public function sqlEscape($sqlString, $DBEngine = DB_ADAPTER) { $DBEngine = DB_ADAPTER; switch ($DBEngine) { case 'mysql': - $con = Propel::getConnection( 'workflow' ); - return mysql_real_escape_string( stripslashes( $sqlString ), $con->getResource() ); + $con = Propel::getConnection('workflow'); + return mysqli_real_escape_string($con->getResource(), stripslashes($sqlString)); break; case 'myxml': - $sqlString = str_replace( '"', '""', $sqlString ); - return str_replace( "'", "''", $sqlString ); + $sqlString = str_replace('"', '""', $sqlString); + return str_replace("'", "''", $sqlString); break; default: - return addslashes( stripslashes( $sqlString ) ); + return addslashes(stripslashes($sqlString)); break; } } @@ -1700,7 +1696,7 @@ class G * @return Boolean * */ - public function MySQLSintaxis () + public function MySQLSintaxis() { $DBEngine = DB_ADAPTER; switch ($DBEngine) { @@ -1726,26 +1722,26 @@ class G * @fn() Evaluate string with the function "fn" * @author David Callizaya */ - public static function replaceDataField ($sqlString, $result, $DBEngine = 'mysql') + public static function replaceDataField($sqlString, $result, $DBEngine = 'mysql') { - if (! is_array( $result )) { - $result = array (); + if (! is_array($result)) { + $result = array(); } $result = $result + G::getSystemConstants(); $__textoEval = ""; $u = 0; - $count = preg_match_all( '/\@(?:([\@\%\#\?\$\=\&Qq\!])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+|\-\>([a-zA-Z\_]\w*))?/', $sqlString, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ); + $count = preg_match_all('/\@(?:([\@\%\#\?\$\=\&Qq\!])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+|\-\>([a-zA-Z\_]\w*))?/', $sqlString, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); if ($count) { for ($r = 0; $r < $count; $r ++) { - if (! isset( $result[$match[2][$r][0]] )) { + if (! isset($result[$match[2][$r][0]])) { $result[$match[2][$r][0]] = ''; } - if (! is_array( $result[$match[2][$r][0]] )) { - $__textoEval .= substr( $sqlString, $u, $match[0][$r][1] - $u ); - $u = $match[0][$r][1] + strlen( $match[0][$r][0] ); + if (! is_array($result[$match[2][$r][0]])) { + $__textoEval .= substr($sqlString, $u, $match[0][$r][1] - $u); + $u = $match[0][$r][1] + strlen($match[0][$r][0]); //Mysql quotes scape - if (($match[1][$r][0] == '@') && (isset( $result[$match[2][$r][0]] ))) { - $__textoEval .= "\"" . G::sqlEscape( $result[$match[2][$r][0]], $DBEngine ) . "\""; + if (($match[1][$r][0] == '@') && (isset($result[$match[2][$r][0]]))) { + $__textoEval .= "\"" . G::sqlEscape($result[$match[2][$r][0]], $DBEngine) . "\""; continue; } //URL encode @@ -1755,22 +1751,22 @@ class G } //Double quoted parameter if (($match[1][$r][0]=='Q')&&(isset($result[$match[2][$r][0]]))) { - $__textoEval.='"'.addcslashes($result[$match[2][$r][0]],'\\"').'"'; + $__textoEval.='"'.addcslashes($result[$match[2][$r][0]], '\\"').'"'; continue; } //Single quoted parameter if (($match[1][$r][0]=='q')&&(isset($result[$match[2][$r][0]]))) { - $__textoEval.="'".addcslashes($result[$match[2][$r][0]],'\\\'')."'"; + $__textoEval.="'".addcslashes($result[$match[2][$r][0]], '\\\'')."'"; continue; } //Substring (Sub replaceDataField) if (($match[1][$r][0]=='!')&&(isset($result[$match[2][$r][0]]))) { - $__textoEval.=G::replaceDataField($result[$match[2][$r][0]],$result); + $__textoEval.=G::replaceDataField($result[$match[2][$r][0]], $result); continue; } //Call function if (($match[1][$r][0]==='')&&($match[2][$r][0]==='')&&($match[3][$r][0]!=='')) { - eval('$strAux = ' . $match[3][$r][0] . '(\'' . addcslashes(G::replaceDataField(stripslashes($match[4][$r][0]),$result),'\\\'') . '\');'); + eval('$strAux = ' . $match[3][$r][0] . '(\'' . addcslashes(G::replaceDataField(stripslashes($match[4][$r][0]), $result), '\\\'') . '\');'); if ($match[3][$r][0] == "G::LoadTranslation") { $arraySearch = array("'"); @@ -1783,12 +1779,12 @@ class G } //Non-quoted if (($match[1][$r][0]=='#')&&(isset($result[$match[2][$r][0]]))) { - $__textoEval.=G::replaceDataField($result[$match[2][$r][0]],$result); + $__textoEval.=G::replaceDataField($result[$match[2][$r][0]], $result); continue; } //Non-quoted = if (($match[1][$r][0]=='=')&&(isset($result[$match[2][$r][0]]))) { - $__textoEval.=G::replaceDataField($result[$match[2][$r][0]],$result); + $__textoEval.=G::replaceDataField($result[$match[2][$r][0]], $result); continue; } //Objects attributes @@ -1801,7 +1797,7 @@ class G } } } - $__textoEval.=substr($sqlString,$u); + $__textoEval.=substr($sqlString, $u); return $__textoEval; } @@ -1832,16 +1828,16 @@ class G $arrayGrid = array_unique($arrayGrid); - //Given the set: 'valueOne', 'valueOneTwo', where the second string - //contains the first string, this causes the larger string to take - //the second, resulting in a delimitation error, to avoid this problem + //Given the set: 'valueOne', 'valueOneTwo', where the second string + //contains the first string, this causes the larger string to take + //the second, resulting in a delimitation error, to avoid this problem //we first search the string larger size. - usort($arrayGrid, function($a, $b) { + usort($arrayGrid, function ($a, $b) { return strlen($b) - strlen($a); }); foreach ($arrayGrid as $index => $value) { - if($value !== "") { + if ($value !== "") { $grdName = $value; $strContentAux1 = $strContentAux; @@ -1870,7 +1866,6 @@ class G } $strContentAux = $strContentAux1 . $strContentAux; - } } } @@ -1898,35 +1893,35 @@ class G * @parameter $languageId (es|en|...). * @parameter $forceParse Force to read and parse the xml file. */ - public function loadLanguageFile ($filename, $languageId = '', $forceParse = false) + public function loadLanguageFile($filename, $languageId = '', $forceParse = false) { global $arrayXmlMessages; if ($languageId === '') { - $languageId = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; + $languageId = defined('SYS_LANG') ? SYS_LANG : 'en'; } - $languageFile = basename( $filename, '.xml' ); - $cacheFile = substr( $filename, 0, - 3 ) . $languageId; - if (($forceParse) || (! file_exists( $cacheFile )) || (filemtime( $filename ) > filemtime( $cacheFile ))) { + $languageFile = basename($filename, '.xml'); + $cacheFile = substr($filename, 0, - 3) . $languageId; + if (($forceParse) || (! file_exists($cacheFile)) || (filemtime($filename) > filemtime($cacheFile))) { $languageDocument = new Xml_document(); - $languageDocument->parseXmlFile( $filename ); - if (! is_array( $arrayXmlMessages )) { - $arrayXmlMessages = array (); + $languageDocument->parseXmlFile($filename); + if (! is_array($arrayXmlMessages)) { + $arrayXmlMessages = array(); } - $arrayXmlMessages[$languageFile] = array (); - for ($r = 0; $r < sizeof( $languageDocument->children[0]->children ); $r ++) { - $n = $languageDocument->children[0]->children[$r]->findNode( $languageId ); + $arrayXmlMessages[$languageFile] = array(); + for ($r = 0; $r < sizeof($languageDocument->children[0]->children); $r ++) { + $n = $languageDocument->children[0]->children[$r]->findNode($languageId); if ($n) { $k = $languageDocument->children[0]->children[$r]->name; $arrayXmlMessages[$languageFile][$k] = $n->value; } } - $f = fopen( $cacheFile, 'w' ); - fwrite( $f, "" ); - fclose( $f ); + $f = fopen($cacheFile, 'w'); + fwrite($f, ""); + fclose($f); } else { - require ($cacheFile); + require($cacheFile); } } @@ -1934,15 +1929,17 @@ class G * Registra en la base de datos los labels xml usados en el sistema * @author David Callizaya */ - public function registerLabel ($id, $label) + public function registerLabel($id, $label) { return 1; $dbc = new DBConnection(); - $ses = new DBSession( $dbc ); - $ses->Execute( G::replaceDataField( + $ses = new DBSession($dbc); + $ses->Execute(G::replaceDataField( 'REPLACE INTO `TRANSLATION` (`TRN_CATEGORY`, `TRN_ID`, `TRN_LANG`, `TRN_VALUE`) VALUES - ("LABEL", @@ID, "' . SYS_LANG . '", @@LABEL);', array ('ID' => $id,'LABEL' => ($label !== null ? $label : '') - ) ) ); + ("LABEL", @@ID, "' . SYS_LANG . '", @@LABEL);', + array('ID' => $id,'LABEL' => ($label !== null ? $label : '') + ) + )); } /** @@ -1953,13 +1950,13 @@ class G * @param eter string msgID * @return string */ - public function LoadMenuXml ($msgID) + public function LoadMenuXml($msgID) { global $arrayXmlMessages; - if (! isset( $arrayXmlMessages['menus'] )) { - G::loadLanguageFile( G::ExpandPath( 'content' ) . 'languages/menus.xml' ); + if (! isset($arrayXmlMessages['menus'])) { + G::loadLanguageFile(G::ExpandPath('content') . 'languages/menus.xml'); } - G::registerLabel( $msgID, $arrayXmlMessages['menus'][$msgID] ); + G::registerLabel($msgID, $arrayXmlMessages['menus'][$msgID]); return $arrayXmlMessages['menus'][$msgID]; } @@ -1973,15 +1970,15 @@ class G * @param eter string file * @return string */ - public function SendMessageXml ($msgID, $strType, $file = "labels") + public function SendMessageXml($msgID, $strType, $file = "labels") { global $arrayXmlMessages; - if (! isset( $arrayXmlMessages[$file] )) { - G::loadLanguageFile( G::ExpandPath( 'content' ) . 'languages/' . $file . '.xml' ); + if (! isset($arrayXmlMessages[$file])) { + G::loadLanguageFile(G::ExpandPath('content') . 'languages/' . $file . '.xml'); } $_SESSION['G_MESSAGE_TYPE'] = $strType; - G::registerLabel( $msgID, $arrayXmlMessages[$file][$msgID] ); - $_SESSION['G_MESSAGE'] = nl2br( $arrayXmlMessages[$file][$msgID] ); + G::registerLabel($msgID, $arrayXmlMessages[$file][$msgID]); + $_SESSION['G_MESSAGE'] = nl2br($arrayXmlMessages[$file][$msgID]); } /** @@ -1996,29 +1993,29 @@ class G * * @return void */ - public static function SendTemporalMessage ($msgID, $strType, $sType = 'LABEL', $time = null, $width = null, $customLabels = null) + public static function SendTemporalMessage($msgID, $strType, $sType = 'LABEL', $time = null, $width = null, $customLabels = null) { - if (isset( $width )) { + if (isset($width)) { $_SESSION['G_MESSAGE_WIDTH'] = $width; } - if (isset( $time )) { + if (isset($time)) { $_SESSION['G_MESSAGE_TIME'] = $time; } - switch (strtolower( $sType )) { + switch (strtolower($sType)) { case 'label': case 'labels': $_SESSION['G_MESSAGE_TYPE'] = $strType; - $_SESSION['G_MESSAGE'] = nl2br( G::LoadTranslation( $msgID ) ); + $_SESSION['G_MESSAGE'] = nl2br(G::LoadTranslation($msgID)); break; case 'string': $_SESSION['G_MESSAGE_TYPE'] = $strType; - $_SESSION['G_MESSAGE'] = nl2br( $msgID ); + $_SESSION['G_MESSAGE'] = nl2br($msgID); break; } if ($customLabels != null) { $message = $_SESSION['G_MESSAGE']; foreach ($customLabels as $key => $val) { - $message = str_replace( '{' . nl2br( $key ) . '}', nl2br( $val ), $message ); + $message = str_replace('{' . nl2br($key) . '}', nl2br($val), $message); } $_SESSION['G_MESSAGE'] = $message; } @@ -2033,11 +2030,11 @@ class G * * @return void */ - public function SendMessage ($msgID, $strType, $file = "labels") + public function SendMessage($msgID, $strType, $file = "labels") { global $arrayXmlMessages; $_SESSION['G_MESSAGE_TYPE'] = $strType; - $_SESSION['G_MESSAGE'] = nl2br( G::LoadTranslation( $msgID ) ); + $_SESSION['G_MESSAGE'] = nl2br(G::LoadTranslation($msgID)); } /** @@ -2049,11 +2046,11 @@ class G * * @return void */ - public function SendMessageText ($text, $strType) + public function SendMessageText($text, $strType) { global $arrayXmlMessages; $_SESSION['G_MESSAGE_TYPE'] = $strType; - $_SESSION['G_MESSAGE'] = nl2br( $text ); + $_SESSION['G_MESSAGE'] = nl2br($text); } /** @@ -2064,24 +2061,24 @@ class G * @param string $msgID * @return void */ - public function LoadMessage ($msgID, $file = "messages") + public function LoadMessage($msgID, $file = "messages") { global $_SESSION; global $arrayXmlMessages; - if (! is_array( $arrayXmlMessages )) { - $arrayXmlMessages = G::LoadArrayFile( G::ExpandPath( 'content' ) . $file . "." . SYS_LANG ); + if (! is_array($arrayXmlMessages)) { + $arrayXmlMessages = G::LoadArrayFile(G::ExpandPath('content') . $file . "." . SYS_LANG); } $aux = $arrayXmlMessages[$msgID]; $msg = ""; - for ($i = 0; $i < strlen( $aux ); $i ++) { + for ($i = 0; $i < strlen($aux); $i ++) { if ($aux[$i] == "$") { $token = ""; $i ++; - while ($i < strlen( $aux ) && $aux[$i] != " " && $aux[$i] != "." && $aux[$i] != "'" && $aux[$i] != '"') { + while ($i < strlen($aux) && $aux[$i] != " " && $aux[$i] != "." && $aux[$i] != "'" && $aux[$i] != '"') { $token .= $aux[$i ++]; } - eval( "\$msg.= \$_SESSION['" . $token . "'] ; " ); + eval("\$msg.= \$_SESSION['" . $token . "'] ; "); $msg .= $aux[$i]; } else { $msg = $msg . $aux[$i]; @@ -2094,7 +2091,7 @@ class G * Function LoadXmlLabel * deprecated */ - public function LoadXmlLabel ($msgID, $file = 'labels') + public function LoadXmlLabel($msgID, $file = 'labels') { return 'xxxxxx'; } @@ -2108,17 +2105,17 @@ class G * @param eter string file * @return string */ - public function LoadMessageXml ($msgID, $file = 'labels') + public function LoadMessageXml($msgID, $file = 'labels') { global $arrayXmlMessages; - if (! isset( $arrayXmlMessages[$file] )) { - G::loadLanguageFile( G::ExpandPath( 'content' ) . 'languages/' . $file . '.xml' ); + if (! isset($arrayXmlMessages[$file])) { + G::loadLanguageFile(G::ExpandPath('content') . 'languages/' . $file . '.xml'); } - if (isset( $arrayXmlMessages[$file][$msgID] )) { - G::registerLabel( $msgID, $arrayXmlMessages[$file][$msgID] ); + if (isset($arrayXmlMessages[$file][$msgID])) { + G::registerLabel($msgID, $arrayXmlMessages[$file][$msgID]); return $arrayXmlMessages[$file][$msgID]; } else { - G::registerLabel( $msgID, '' ); + G::registerLabel($msgID, ''); return null; } } @@ -2134,30 +2131,30 @@ class G * @param string lang * @return void */ - public function LoadTranslationObject ($lang = SYS_LANG) + public function LoadTranslationObject($lang = SYS_LANG) { - $defaultTranslations = Array (); - $foreignTranslations = Array (); + $defaultTranslations = array(); + $foreignTranslations = array(); //if the default translations table doesn't exist we can't proceed - if (! is_file( PATH_LANGUAGECONT . 'translation.en' )) { + if (! is_file(PATH_LANGUAGECONT . 'translation.en')) { return null; } //load the translations table - require_once (PATH_LANGUAGECONT . 'translation.en'); + require_once(PATH_LANGUAGECONT . 'translation.en'); $defaultTranslations = $translation; //if some foreign language was requested and its translation file exists - if ($lang != 'en' && file_exists( PATH_LANGUAGECONT . 'translation.' . $lang )) { - require_once (PATH_LANGUAGECONT . 'translation.' . $lang); //load the foreign translations table + if ($lang != 'en' && file_exists(PATH_LANGUAGECONT . 'translation.' . $lang)) { + require_once(PATH_LANGUAGECONT . 'translation.' . $lang); //load the foreign translations table $foreignTranslations = $translation; } global $translation; - if (defined( "SHOW_UNTRANSLATED_AS_TAG" ) && SHOW_UNTRANSLATED_AS_TAG != 0) { + if (defined("SHOW_UNTRANSLATED_AS_TAG") && SHOW_UNTRANSLATED_AS_TAG != 0) { $translation = $foreignTranslations; } else { - $translation = array_merge( $defaultTranslations, $foreignTranslations ); + $translation = array_merge($defaultTranslations, $foreignTranslations); } return true; } @@ -2172,29 +2169,29 @@ class G * @param eter array data // erik: associative array within data input to replace for formatted string i.e "any messsage {replaced_label} that contains a replace label" * @return string */ - public static function LoadTranslation ($msgID, $lang = SYS_LANG, $data = null) + public static function LoadTranslation($msgID, $lang = SYS_LANG, $data = null) { global $translation; // if the second parameter ($lang) is an array, it was specified to use as data - if (is_array( $lang )) { + if (is_array($lang)) { $data = $lang; $lang = SYS_LANG; } - if (isset( $translation[$msgID] )) { - $translationString = preg_replace( "[\n|\r|\n\r]", ' ', $translation[$msgID] ); + if (isset($translation[$msgID])) { + $translationString = preg_replace("[\n|\r|\n\r]", ' ', $translation[$msgID]); - if (isset( $data ) && is_array( $data )) { + if (isset($data) && is_array($data)) { foreach ($data as $label => $value) { - $translationString = str_replace( '{' . $label . '}', $value, $translationString ); + $translationString = str_replace('{' . $label . '}', $value, $translationString); } } return $translationString; } else { - if (defined( "UNTRANSLATED_MARK" )) { - $untranslatedMark = strip_tags( UNTRANSLATED_MARK ); + if (defined("UNTRANSLATED_MARK")) { + $untranslatedMark = strip_tags(UNTRANSLATED_MARK); } else { $untranslatedMark = "**"; } @@ -2212,7 +2209,7 @@ class G * @param eter array data * @return string */ - public function LoadTranslationPlugin ($namePlugin, $msgID, $data = null) + public function LoadTranslationPlugin($namePlugin, $msgID, $data = null) { eval('global $translation' . $namePlugin . ';'); @@ -2220,16 +2217,16 @@ class G eval('if (isset( $translation' . $namePlugin . '[$msgID])) { $existId = true; }'); if ($existId) { eval('$translationString = preg_replace( "[\n|\r|\n\r]", " ", $translation' . $namePlugin . '[$msgID] );'); - if (isset( $data ) && is_array( $data )) { + if (isset($data) && is_array($data)) { foreach ($data as $label => $value) { - $translationString = str_replace( '{' . $label . '}', $value, $translationString ); + $translationString = str_replace('{' . $label . '}', $value, $translationString); } } return $translationString; } else { - if (defined( "UNTRANSLATED_MARK" )) { - $untranslatedMark = strip_tags( UNTRANSLATED_MARK ); + if (defined("UNTRANSLATED_MARK")) { + $untranslatedMark = strip_tags(UNTRANSLATED_MARK); } else { $untranslatedMark = "**"; } @@ -2246,14 +2243,14 @@ class G * @param eter string file * @return string */ - public function getTranslations ($msgIDs, $lang = SYS_LANG) + public function getTranslations($msgIDs, $lang = SYS_LANG) { - if (! is_array( $msgIDs )) { + if (! is_array($msgIDs)) { return null; } - $translations = Array (); + $translations = array(); foreach ($msgIDs as $mID) { - $translations[$mID] = self::LoadTranslation( $mID, $lang ); + $translations[$mID] = self::LoadTranslation($mID, $lang); } return $translations; @@ -2267,18 +2264,18 @@ class G * @param string $strFile * @return void */ - public function LoadArrayFile ($strFile = '') + public function LoadArrayFile($strFile = '') { $res = null; if ($strFile != '') { - $src = file( $strFile ); - if (is_array( $src )) { + $src = file($strFile); + if (is_array($src)) { foreach ($src as $key => $val) { - $res[$key] = trim( $val ); + $res[$key] = trim($val); } } } - unset( $src ); + unset($src); return $res; } @@ -2290,13 +2287,13 @@ class G * @param string $methodPage the method directory and the page * @return the expanded uri, later, will encryt the uri... */ - public function expandUri ($methodPage) + public function expandUri($methodPage) { - $uri = explode( '/', getenv( 'REQUEST_URI' ) ); + $uri = explode('/', getenv('REQUEST_URI')); $sw = 0; $newUri = ''; - if (! defined( 'SYS_SKIN' )) { - for ($i = 0; $i < count( $uri ); $i ++) { + if (! defined('SYS_SKIN')) { + for ($i = 0; $i < count($uri); $i ++) { if ($sw == 0) { $newUri .= $uri[$i] . PATH_SEP; } @@ -2328,26 +2325,26 @@ class G * @param string $urlNoAccess * @return void */ - public function genericForceLogin ($permission, $urlNoAccess, $urlLogin = 'login/login') + public function genericForceLogin($permission, $urlNoAccess, $urlLogin = 'login/login') { global $RBAC; //the session is expired, go to login page, //the login page is login/login.html - if (! isset( $_SESSION )) { - header( 'location: ' . G::expandUri( $urlLogin ) ); + if (! isset($_SESSION)) { + header('location: ' . G::expandUri($urlLogin)); die(); } //$permission is an array, we'll verify all permission to allow access. - if (is_array( $permission )) { + if (is_array($permission)) { $aux = $permission; } else { $aux[0] = $permission; } $sw = 0; - for ($i = 0; $i < count( $aux ); $i ++) { - $res = $RBAC->userCanAccess( $aux[$i] ); + for ($i = 0; $i < count($aux); $i ++) { + $res = $RBAC->userCanAccess($aux[$i]); if ($res == 1) { $sw = 1; } @@ -2355,7 +2352,7 @@ class G //you don't have access to this page if ($sw == 0) { - header( 'location: ' . G::expandUri( $urlNoAccess ) ); + header('location: ' . G::expandUri($urlNoAccess)); die(); } } @@ -2367,9 +2364,9 @@ class G * * @return string $string */ - public function capitalize ($string) + public function capitalize($string) { - return ucfirst( $string ); + return ucfirst($string); } /** @@ -2379,9 +2376,9 @@ class G * * @return string strtoupper($sText) */ - public static function toUpper ($sText) + public static function toUpper($sText) { - return strtoupper( $sText ); + return strtoupper($sText); } /** @@ -2390,9 +2387,9 @@ class G * @param string $sText * @return string strtolower($sText) */ - public static function toLower ($sText) + public static function toLower($sText) { - return strtolower( $sText ); + return strtolower($sText); } /** @@ -2404,26 +2401,26 @@ class G * * @return array $res */ - public function http_build_query ($formdata, $numeric_prefix = null, $key = null) + public function http_build_query($formdata, $numeric_prefix = null, $key = null) { - $res = array (); + $res = array(); foreach ((array) $formdata as $k => $v) { - $tmp_key = rawurlencode( is_int( $k ) ? $numeric_prefix . $k : $k ); + $tmp_key = rawurlencode(is_int($k) ? $numeric_prefix . $k : $k); if ($key) { $tmp_key = $key . '[' . $tmp_key . ']'; } - if (is_array( $v ) || is_object( $v )) { - $res[] = G::http_build_query( $v, null /* or $numeric_prefix if you want to add numeric_prefix to all indexes in array*/, $tmp_key ); + if (is_array($v) || is_object($v)) { + $res[] = G::http_build_query($v, null /* or $numeric_prefix if you want to add numeric_prefix to all indexes in array*/, $tmp_key); } else { - $res[] = $tmp_key . "=" . rawurlencode( $v ); + $res[] = $tmp_key . "=" . rawurlencode($v); } /* If you want, you can write this as one string: $res[] = ( ( is_array($v) || is_object($v) ) ? G::http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) ); */ } - $separator = ini_get( 'arg_separator.output' ); - return implode( $separator, $res ); + $separator = ini_get('arg_separator.output'); + return implode($separator, $res); } /** @@ -2434,13 +2431,13 @@ class G * @param string $parameter * @return string */ - public static function header ($parameter) + public static function header($parameter) { - if (defined( 'ENABLE_ENCRYPT' ) && (ENABLE_ENCRYPT == 'yes') && (substr( $parameter, 0, 9 ) == 'location:')) { - $url = G::encryptUrl( substr( $parameter, 10 ), URL_KEY ); - header( 'location:' . $url ); + if (defined('ENABLE_ENCRYPT') && (ENABLE_ENCRYPT == 'yes') && (substr($parameter, 0, 9) == 'location:')) { + $url = G::encryptUrl(substr($parameter, 10), URL_KEY); + header('location:' . $url); } else { - header( $parameter ); + header($parameter); } return; } @@ -2453,7 +2450,7 @@ class G * @param string $urlNoAccess * @return void */ - public function forceLogin ($permission = "", $urlNoAccess = "") + public function forceLogin($permission = "", $urlNoAccess = "") { global $RBAC; @@ -2468,12 +2465,12 @@ class G } $Connection = new DBConnection(); - $ses = new DBSession( $Connection ); + $ses = new DBSession($Connection); $stQry = "SELECT LOG_STATUS FROM LOGIN WHERE LOG_SID = '" . session_id() . "'"; - $dset = $ses->Execute( $stQry ); + $dset = $ses->Execute($stQry); $row = $dset->read(); - $sessionPc = defined( 'SESSION_PC' ) ? SESSION_PC : ''; - $sessionBrowser = defined( 'SESSION_BROWSER' ) ? SESSION_BROWSER : ''; + $sessionPc = defined('SESSION_PC') ? SESSION_PC : ''; + $sessionBrowser = defined('SESSION_BROWSER') ? SESSION_BROWSER : ''; if (($sessionPc == "1") or ($sessionBrowser == "1")) { if ($row['LOG_STATUS'] == 'X') { $sys = (ENABLE_ENCRYPT == 'yes' ? config("system.workspace") : "sys" . config("system.workspace")); @@ -2482,13 +2479,13 @@ class G $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( 'login' ), URL_KEY ) : 'login'); $loginhtml = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( 'login.html' ), URL_KEY ) : 'login.html'); $direction = "/$sys/$lang/$skin/$login/$loginhtml"; - G::SendMessageXml( 'ID_CLOSE_SESSION', "warning" ); - header( "location: $direction" ); + G::SendMessageXml('ID_CLOSE_SESSION', "warning"); + header("location: $direction"); die(); return; } } - if (defined( 'SIN_COMPATIBILIDAD_RBAC' ) and SIN_COMPATIBILIDAD_RBAC == 1) { + if (defined('SIN_COMPATIBILIDAD_RBAC') and SIN_COMPATIBILIDAD_RBAC == 1) { return; } @@ -2496,15 +2493,15 @@ class G return; } - if (is_array( $permission )) { + if (is_array($permission)) { $aux = $permission; } else { $aux[0] = $permission; } $sw = 0; - for ($i = 0; $i < count( $aux ); $i ++) { - $res = $RBAC->userCanAccess( $aux[$i] ); + for ($i = 0; $i < count($aux); $i ++) { + $res = $RBAC->userCanAccess($aux[$i]); if ($res == 1) { $sw = 1; } @@ -2519,12 +2516,12 @@ class G $loginhtml = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( $aux[1] ), URL_KEY ) : $aux[1]); //header ("location: /$sys/$lang/$skin/$login/$loginhtml"); - header( "location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw" ); + header("location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw"); die(); } if ($sw == 0) { - header( "location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw" ); + header("location: /fluid/mNE/o9A/mNGm1aLiop3V4qU/dtij4J°gmaLPwKDU3qNn2qXanw"); die(); } } @@ -2537,26 +2534,25 @@ class G * @param string $val_old * @return string */ - public function add_slashes ($val_old) + public function add_slashes($val_old) { - - if (! is_string( $val_old )) { + if (! is_string($val_old)) { $val_old = "$val_old"; } - $tamano_cadena = strlen( $val_old ); + $tamano_cadena = strlen($val_old); $contador_cadena = 0; $new_val = ""; for ($contador_cadena = 0; $contador_cadena < $tamano_cadena; $contador_cadena ++) { $car = $val_old[$contador_cadena]; - if ($car != chr( 34 ) && $car != chr( 39 ) && $car != chr( 92 )) { + if ($car != chr(34) && $car != chr(39) && $car != chr(92)) { $new_val .= $car; } else { - if ($car2 != chr( 92 )) { + if ($car2 != chr(92)) { //print " xmlvar: $new_val -- $car -- $car2
"; - $new_val .= chr( 92 ) . $car; + $new_val .= chr(92) . $car; } else { $new_val .= $car; } @@ -2571,7 +2567,6 @@ class G */ public function gotDirectoryStructureVer2() { - $configuration = new Configurations(); if (!empty(config("system.workspace")) && $configuration->exists("ENVIRONMENT_SETTINGS")) { return ($configuration->getDirectoryStructureVer() > 1); @@ -2640,7 +2635,7 @@ class G for ($i = 0; $i < $len; $i++) { $uid .= $item[$i]; } - if (strlen($uid) != 32){ + if (strlen($uid) != 32) { return "invalid"; } return $uid; @@ -2705,31 +2700,31 @@ class G * @param integer $permission * @return void */ - public static function uploadFile ($file, $path, $nameToSave, $permission = 0755) + public static function uploadFile($file, $path, $nameToSave, $permission = 0755) { try { if ($file == '') { - throw new Exception( 'The filename is empty!' ); + throw new Exception('The filename is empty!'); } - if (filesize( $file ) > ((((ini_get( 'upload_max_filesize' ) + 0)) * 1024) * 1024)) { - throw new Exception( 'The size of upload file exceeds the allowed by the server!' ); + if (filesize($file) > ((intval(ini_get('upload_max_filesize')) * 1024) * 1024)) { + throw new Exception('The size of upload file exceeds the allowed by the server!'); } - $oldumask = umask( 0 ); - if (! is_dir( $path )) { - G::verifyPath( $path, true ); + $oldumask = umask(0); + if (! is_dir($path)) { + G::verifyPath($path, true); } if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $file = str_replace("\\\\","\\",$file,$count); - if(!$count) { - $winPath = explode("\\",$file); + $file = str_replace("\\\\", "\\", $file, $count); + if (!$count) { + $winPath = explode("\\", $file); $file = ""; - foreach($winPath as $k => $v){ - if($v != "") { + foreach ($winPath as $k => $v) { + if ($v != "") { $file.= $v."\\"; } } - $file = substr($file,0,-1); + $file = substr($file, 0, -1); } } @@ -2738,11 +2733,10 @@ class G $file = $filter->validateInput($file, "path"); $path = $filter->validateInput($path, "path"); - move_uploaded_file( $file, $path . "/" . $nameToSave ); + move_uploaded_file($file, $path . "/" . $nameToSave); $nameToSave = $filter->validateInput($nameToSave, "path"); - @chmod( $path . "/" . $nameToSave, $permission ); - umask( $oldumask ); - + @chmod($path . "/" . $nameToSave, $permission); + umask($oldumask); } catch (Exception $oException) { throw $oException; } @@ -2758,14 +2752,14 @@ class G * * @return void */ - public function resizeImage ($path, $resWidth, $resHeight, $saveTo = null) + public function resizeImage($path, $resWidth, $resHeight, $saveTo = null) { - $imageInfo = @getimagesize( $path ); + $imageInfo = @getimagesize($path); if (! $imageInfo) { - throw new Exception( "Could not get image information" ); + throw new Exception("Could not get image information"); } - list ($width, $height) = $imageInfo; + list($width, $height) = $imageInfo; $percentHeight = $resHeight / $height; $percentWidth = $resWidth / $width; $percent = ($percentWidth < $percentHeight) ? $percentWidth : $percentHeight; @@ -2773,43 +2767,42 @@ class G $resHeight = $height * $percent; // Resample - $image_p = imagecreatetruecolor( $resWidth, $resHeight ); - imagealphablending( $image_p, false ); - imagesavealpha( $image_p, true ); + $image_p = imagecreatetruecolor($resWidth, $resHeight); + imagealphablending($image_p, false); + imagesavealpha($image_p, true); - $background = imagecolorallocate( $image_p, 0, 0, 0 ); - ImageColorTransparent( $image_p, $background ); // make the new temp image all transparent + $background = imagecolorallocate($image_p, 0, 0, 0); + ImageColorTransparent($image_p, $background); // make the new temp image all transparent //Assume 3 channels if we can't find that information - if (! array_key_exists( "channels", $imageInfo )) { + if (! array_key_exists("channels", $imageInfo)) { $imageInfo["channels"] = 3; } - $memoryNeeded = Round( ($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] + Pow( 2, 16 )) * 1.95 ) / (1024 * 1024); + $memoryNeeded = Round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] + Pow(2, 16)) * 1.95) / (1024 * 1024); if ($memoryNeeded < 80) { $memoryNeeded = 80; } - ini_set( 'memory_limit', intval( $memoryNeeded ) . 'M' ); + ini_set('memory_limit', intval($memoryNeeded) . 'M'); - $functions = array (IMAGETYPE_GIF => array ('imagecreatefromgif','imagegif' - ),IMAGETYPE_JPEG => array ('imagecreatefromjpeg','imagejpeg'),IMAGETYPE_PNG => array ('imagecreatefrompng','imagepng')); + $functions = array(IMAGETYPE_GIF => array('imagecreatefromgif','imagegif' + ),IMAGETYPE_JPEG => array('imagecreatefromjpeg','imagejpeg'),IMAGETYPE_PNG => array('imagecreatefrompng','imagepng')); - if (! array_key_exists( $imageInfo[2], $functions )) { - throw new Exception( "Image format not supported" ); + if (! array_key_exists($imageInfo[2], $functions)) { + throw new Exception("Image format not supported"); } - list ($inputFn, $outputFn) = $functions[$imageInfo[2]]; + list($inputFn, $outputFn) = $functions[$imageInfo[2]]; - $image = $inputFn( $path ); - imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $resWidth, $resHeight, $width, $height ); - $outputFn( $image_p, $saveTo ); + $image = $inputFn($path); + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $resWidth, $resHeight, $width, $height); + $outputFn($image_p, $saveTo); - if(!is_null($saveTo)) { - + if (!is_null($saveTo)) { $filter = new InputFilter(); $saveTo = $filter->validateInput($saveTo, "path"); } - @chmod( $saveTo, 0666 ); + @chmod($saveTo, 0666); } /** @@ -2821,11 +2814,11 @@ class G */ public static function array_merges() { - $array = array (); - $arrays = & func_get_args(); + $array = array(); + $arrays = func_get_args(); foreach ($arrays as $array_i) { - if (is_array( $array_i )) { - G::array_merge_2( $array, $array_i ); + if (is_array($array_i)) { + G::array_merge_2($array, $array_i); } } return $array; @@ -2840,19 +2833,19 @@ class G * @param string $array_i * @return array */ - public function array_merge_2 (&$array, &$array_i) + public function array_merge_2(&$array, &$array_i) { foreach ($array_i as $k => $v) { - if (is_array( $v )) { - if (! isset( $array[$k] )) { - $array[$k] = array (); + if (is_array($v)) { + if (! isset($array[$k])) { + $array[$k] = array(); } - G::array_merge_2( $array[$k], $v ); + G::array_merge_2($array[$k], $v); } else { - if (isset( $array[$k] ) && is_array( $array[$k] )) { + if (isset($array[$k]) && is_array($array[$k])) { $array[$k][0] = $v; } else { - if (isset( $array ) && ! is_array( $array )) { + if (isset($array) && ! is_array($array)) { $temp = $array; $array = array(); $array[0] = $temp; @@ -2870,11 +2863,11 @@ class G * @access public * @return int */ - public static function generateUniqueID () + public static function generateUniqueID() { do { - $sUID = str_replace( '.', '0', uniqid( rand( 0, 999999999 ), true ) ); - } while (strlen( $sUID ) != 32); + $sUID = str_replace('.', '0', uniqid(rand(0, 999999999), true)); + } while (strlen($sUID) != 32); return $sUID; //return strtoupper(substr(uniqid(rand(0, 9), false),0,14)); } @@ -2886,7 +2879,7 @@ class G * @access public * @return string */ - public static function generateCode ($iDigits = 4, $sType = 'NUMERIC') + public static function generateCode($iDigits = 4, $sType = 'NUMERIC') { if (($iDigits < 4) || ($iDigits > 50)) { $iDigits = 4; @@ -2894,7 +2887,7 @@ class G if (($sType != 'NUMERIC') && ($sType != 'ALPHA') && ($sType != 'ALPHANUMERIC')) { $sType = 'NUMERIC'; } - $aValidCharacters = array ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' + $aValidCharacters = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ); switch ($sType) { case 'NUMERIC': @@ -2912,7 +2905,7 @@ class G } $sCode = ''; for ($i = 0; $i < $iDigits; $i ++) { - $sCode .= $aValidCharacters[rand( $iMin, $iMax )]; + $sCode .= $aValidCharacters[rand($iMin, $iMax)]; } return $sCode; } @@ -2924,9 +2917,9 @@ class G * @access public * @return int */ - public function verifyUniqueID ($uid) + public function verifyUniqueID($uid) { - return (bool) preg_match( '/^[0-9A-Za-z]{14,}/', $uid ); + return (bool) preg_match('/^[0-9A-Za-z]{14,}/', $uid); } /** @@ -2946,7 +2939,7 @@ class G * * @return string utf8_encode() */ - public function is_utf8 ($string) + public function is_utf8($string) { if (preg_match('//u', $string)) { return true; @@ -3047,17 +3040,17 @@ class G * * @return string substring */ - public function unhtmlentities ($string) + public function unhtmlentities($string) { if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $trans_tbl = get_html_translation_table( HTML_ENTITIES ); + $trans_tbl = get_html_translation_table(HTML_ENTITIES); } else { - $trans_tbl = get_html_translation_table( HTML_ENTITIES, ENT_COMPAT, 'ISO-8859-1' ); + $trans_tbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'ISO-8859-1'); } foreach ($trans_tbl as $k => $v) { - $ttr[$v] = utf8_encode( $k ); + $ttr[$v] = utf8_encode($k); } - return strtr( $string, $ttr ); + return strtr($string, $ttr); } /** @@ -3067,28 +3060,28 @@ class G * * @author Erik Amaru Ortiz */ - public function xmlParser (&$string) + public function xmlParser(&$string) { $parser = xml_parser_create(); - xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 ); - xml_parse_into_struct( $parser, $string, $vals, $index ); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + xml_parse_into_struct($parser, $string, $vals, $index); - $mnary = array (); + $mnary = array(); $ary = &$mnary; foreach ($vals as $r) { $t = $r['tag']; if ($r['type'] == 'open') { - if (isset( $ary[$t] )) { - if (isset( $ary[$t][0] )) { - $ary[$t][] = array (); + if (isset($ary[$t])) { + if (isset($ary[$t][0])) { + $ary[$t][] = array(); } else { - $ary[$t] = array ($ary[$t],array () ); + $ary[$t] = array($ary[$t],array() ); } - $cv = &$ary[$t][count( $ary[$t] ) - 1]; + $cv = &$ary[$t][count($ary[$t]) - 1]; } else { $cv = &$ary[$t]; } - if (isset( $r['attributes'] )) { + if (isset($r['attributes'])) { foreach ($r['attributes'] as $k => $v) { $cv['__ATTRIBUTES__'][$k] = $v; } @@ -3096,44 +3089,42 @@ class G // note by gustavo cruz gustavo[at]colosa[dot]com // minor adjustments to validate if an open node have a value attribute. // for example a dropdown has many childs, but also can have a value attribute. - if (isset( $r['value'] ) && trim( $r['value'] ) != '') { + if (isset($r['value']) && trim($r['value']) != '') { $cv['__VALUE__'] = $r['value']; } // end added code - $cv['__CONTENT__'] = array (); + $cv['__CONTENT__'] = array(); $cv['__CONTENT__']['_p'] = &$ary; $ary = &$cv['__CONTENT__']; - } elseif ($r['type'] == 'complete') { - if (isset( $ary[$t] )) { - if (isset( $ary[$t][0] )) { - $ary[$t][] = array (); + if (isset($ary[$t])) { + if (isset($ary[$t][0])) { + $ary[$t][] = array(); } else { - $ary[$t] = array ($ary[$t],array ()); + $ary[$t] = array($ary[$t],array()); } - $cv = &$ary[$t][count( $ary[$t] ) - 1]; + $cv = &$ary[$t][count($ary[$t]) - 1]; } else { $cv = &$ary[$t]; } - if (isset( $r['attributes'] )) { + if (isset($r['attributes'])) { foreach ($r['attributes'] as $k => $v) { $cv['__ATTRIBUTES__'][$k] = $v; } } - $cv['__VALUE__'] = (isset( $r['value'] ) ? $r['value'] : ''); - + $cv['__VALUE__'] = (isset($r['value']) ? $r['value'] : ''); } elseif ($r['type'] == 'close') { $ary = &$ary['_p']; } } - self::_del_p( $mnary ); + self::_del_p($mnary); $obj_resp = new stdclass(); - $obj_resp->code = xml_get_error_code( $parser ); - $obj_resp->message = xml_error_string( $obj_resp->code ); + $obj_resp->code = xml_get_error_code($parser); + $obj_resp->message = xml_error_string($obj_resp->code); $obj_resp->result = $mnary; - xml_parser_free( $parser ); + xml_parser_free($parser); return $obj_resp; } @@ -3146,13 +3137,13 @@ class G * @return void */ // _Internal: Remove recursion in result array - public function _del_p (&$ary) + public function _del_p(&$ary) { foreach ($ary as $k => $v) { if ($k === '_p') { - unset( $ary[$k] ); - } elseif (is_array( $ary[$k] )) { - self::_del_p( $ary[$k] ); + unset($ary[$k]); + } elseif (is_array($ary[$k])) { + self::_del_p($ary[$k]); } } } @@ -3169,34 +3160,33 @@ class G * @return void */ // Array to XML - public function ary2xml ($cary, $d = 0, $forcetag = '') + public function ary2xml($cary, $d = 0, $forcetag = '') { - $res = array (); + $res = array(); foreach ($cary as $tag => $r) { - if (isset( $r[0] )) { - $res[] = self::ary2xml( $r, $d, $tag ); + if (isset($r[0])) { + $res[] = self::ary2xml($r, $d, $tag); } else { if ($forcetag) { $tag = $forcetag; } - $sp = str_repeat( "\t", $d ); + $sp = str_repeat("\t", $d); $res[] = "$sp<$tag"; - if (isset( $r['_a'] )) { + if (isset($r['_a'])) { foreach ($r['_a'] as $at => $av) { $res[] = " $at=\"$av\""; } } - $res[] = ">" . ((isset( $r['_c'] )) ? "\n" : ''); - if (isset( $r['_c'] )) { - $res[] = ary2xml( $r['_c'], $d + 1 ); - } elseif (isset( $r['_v'] )) { + $res[] = ">" . ((isset($r['_c'])) ? "\n" : ''); + if (isset($r['_c'])) { + $res[] = ary2xml($r['_c'], $d + 1); + } elseif (isset($r['_v'])) { $res[] = $r['_v']; } - $res[] = (isset( $r['_c'] ) ? $sp : '') . "\n"; + $res[] = (isset($r['_c']) ? $sp : '') . "\n"; } - } - return implode( '', $res ); + return implode('', $res); } /** @@ -3211,11 +3201,11 @@ class G * @return void */ // Insert element into array - public function ins2ary (&$ary, $element, $pos) + public function ins2ary(&$ary, $element, $pos) { - $ar1 = array_slice( $ary, 0, $pos ); + $ar1 = array_slice($ary, 0, $pos); $ar1[] = $element; - $ary = array_merge( $ar1, array_slice( $ary, $pos ) ); + $ary = array_merge($ar1, array_slice($ary, $pos)); } /* @@ -3229,13 +3219,13 @@ class G * * @return void */ - public function evalJScript ($c) + public function evalJScript($c) { /* $filter = new InputFilter(); $c = $filter->xssFilterHard($c);*/ - print ('') ; + print('') ; } /** @@ -3284,11 +3274,11 @@ class G * * @return void */ - public function pr ($var) + public function pr($var) { - print ("
") ;
-        print_r( $var );
-        print ("
") ; + print("
") ;
+        print_r($var);
+        print("
") ; } /** @@ -3298,11 +3288,11 @@ class G * * @return void */ - public function dump ($var) + public function dump($var) { - print ("
") ;
-        var_dump( $var );
-        print ("
") ; + print("
") ;
+        var_dump($var);
+        print("
") ; } /** @@ -3312,10 +3302,10 @@ class G * * @return string str_replace */ - public function stripCDATA ($string) + public function stripCDATA($string) { - preg_match_all( '//is', $string, $matches ); - return str_replace( $matches[0], $matches[1], $string ); + preg_match_all('//is', $string, $matches); + return str_replace($matches[0], $matches[1], $string); } /** @@ -3324,25 +3314,25 @@ class G * * @author */ - public function sys_get_temp_dir () + public function sys_get_temp_dir() { - if (! function_exists( 'sys_get_temp_dir' )) { + if (! function_exists('sys_get_temp_dir')) { // Based on http://www.phpit.net/ // article/creating-zip-tar-archives-dynamically-php/2/ // Try to get from environment variable - if (! empty( $_ENV['TMP'] )) { - return realpath( $_ENV['TMP'] ); - } elseif (! empty( $_ENV['TMPDIR'] )) { - return realpath( $_ENV['TMPDIR'] ); - } elseif (! empty( $_ENV['TEMP'] )) { - return realpath( $_ENV['TEMP'] ); + if (! empty($_ENV['TMP'])) { + return realpath($_ENV['TMP']); + } elseif (! empty($_ENV['TMPDIR'])) { + return realpath($_ENV['TMPDIR']); + } elseif (! empty($_ENV['TEMP'])) { + return realpath($_ENV['TEMP']); } else { // Detect by creating a temporary file // Try to use system's temporary directory as random name shouldn't exist - $temp_file = tempnam( G::encryptOld( uniqid( rand(), true ) ), '' ); + $temp_file = tempnam(G::encryptOld(uniqid(rand(), true)), ''); if ($temp_file) { - $temp_dir = realpath( dirname( $temp_file ) ); - unlink( $temp_file ); + $temp_dir = realpath(dirname($temp_file)); + unlink($temp_file); return $temp_dir; } else { return false; @@ -3359,23 +3349,23 @@ class G * * @author */ - public function PMWSCompositeResponse ($oResp, $prop) + public function PMWSCompositeResponse($oResp, $prop) { $Resp = new stdClass(); - if (is_object( $oResp ) && isset( $oResp->{$prop} )) { + if (is_object($oResp) && isset($oResp->{$prop})) { $list = $oResp->{$prop}; - if (is_object( $list )) { + if (is_object($list)) { $aList[0] = $list; } else { $aList = $list; } $result = true; - if (is_array( $aList )) { + if (is_array($aList)) { foreach ($aList as $item) { - if (! isset( $item->guid )) { + if (! isset($item->guid)) { $result = false; break; } @@ -3387,21 +3377,20 @@ class G if ($result) { //verifing if the response has a composite response into a guid value of the first row. - $tmp = explode( ' ', trim( $aList[0]->guid ) ); - if (sizeof( $tmp ) >= 2) { + $tmp = explode(' ', trim($aList[0]->guid)); + if (sizeof($tmp) >= 2) { //the guid can't has a space, so this should be a ws response $Resp->status_code = $tmp[0]; - $Resp->message = substr( $aList[0]->guid, strpos( $aList[0]->guid, ' ' ) + 1 ); + $Resp->message = substr($aList[0]->guid, strpos($aList[0]->guid, ' ') + 1); } else { return $aList; } - } else { $Resp->status_code = - 2; $Resp->message = "Bad respose, the response has not a uniform struct."; } - } elseif (is_object( $oResp )) { - return Array (); + } elseif (is_object($oResp)) { + return array(); } else { $Resp->status_code = - 1; $Resp->message = "1 Bad respose type for ({$prop})"; @@ -3421,10 +3410,10 @@ class G { $o = new stdClass(); - if ( strpos($sEmail, '<') !== false ) { + if (strpos($sEmail, '<') !== false) { preg_match('/([\"\w@\.-_\s]*\s*)?(<(\w+[\.-]?\w+]*@\w+([\.-]?\w+)*\.\w{2,3})+>)/', $sEmail, $matches); - if ( isset($matches[1]) && $matches[3]) { + if (isset($matches[1]) && $matches[3]) { $o->email = $matches[3]; $o->name = $matches[1]; return $o; @@ -3432,7 +3421,7 @@ class G return false; } else { preg_match('/\w+[\.-]?\w+]*@\w+([\.-]?\w+)*\.\w{2,3}+/', $sEmail, $matches); - if ( isset($matches[0]) ) { + if (isset($matches[0])) { $o->email = $matches[0]; $o->name = ''; return $o; @@ -3449,10 +3438,9 @@ class G */ public static function json_encode($Json) { - if ( function_exists('json_encode') ) { + if (function_exists('json_encode')) { return json_encode($Json); } else { - $oJSON = new Services_JSON(); return $oJSON->encode($Json); } @@ -3468,7 +3456,6 @@ class G if (function_exists('json_decode')) { return json_decode($Json, $assoc); } else { - $oJSON = new Services_JSON(); return $oJSON->decode($Json); } @@ -3503,7 +3490,7 @@ class G * @param string $body contains the email body (text plain or html) * @return mixed boolean or string : if the email was sent successfully returns true, otherwise returns a string within error message */ - public function sendMail ($from, $fromName, $address, $subject, $body) + public function sendMail($from, $fromName, $address, $subject, $body) { // require_once "classes/class.pmFunctions.php"; @@ -3524,7 +3511,7 @@ class G } $passwd = $setup['MESS_PASSWORD']; - $passwdDec = G::decrypt($passwd,'EMAILENCRYPT'); + $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT'); $auxPass = explode('hash:', $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { @@ -3540,7 +3527,7 @@ class G $mail->FromName = $fromName; $mail->Subject = $subject; $mail->Body = $body; - $mail->IsHTML (true); + $mail->IsHTML(true); $mail->IsSMTP(); $mail->Host = $setup['MESS_SERVER']; $mail->Port = $setup['MESS_PORT']; @@ -3558,7 +3545,7 @@ class G $mail->AddCC($emails[0], $emails[1]); } foreach ($emailAddressList['bcc'] as $emails) { - $mail->AddBCC($emails[0], $emails[1]); + $mail->AddBCC($emails[0], $emails[1]); } return $mail->Send() ? true : $mail->ErrorInfo; @@ -3691,7 +3678,7 @@ class G { $size = memory_get_usage(true); $unit=array('B','Kb','Mb','Gb','Tb','Pb'); - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; + return @round($size/pow(1024, ($i=floor(log($size, 1024)))), 2).' '.$unit[$i]; } public function getFormatUserList($format, $aUserInfo) @@ -3787,7 +3774,7 @@ class G static $a_full_assoc_data, $a_mobile_data, $a_moz_data, $a_webkit_data, $b_dom_browser, $b_repeat, $b_safe_browser, $browser_name, $browser_number, $browser_math_number, $browser_user_agent, $browser_working, $ie_version, $mobile_test, $moz_number, $moz_rv, $moz_rv_full, $moz_release_date, $moz_type, $os_number, $os_type, $true_ie_number, $ua_type, $webkit_type, $webkit_type_number; // switch off the optimization for external ua string testing. - if ( $external_ua_string ) { + if ($external_ua_string) { $b_repeat = false; } @@ -3796,7 +3783,7 @@ class G all the variables are filled on the first run through, it's only a matter of returning the the right ones */ - if ( !$b_repeat ) { + if (!$b_repeat) { //initialize all variables with default values to prevent error $a_browser_math_number = ''; $a_full_assoc_data = ''; @@ -3831,8 +3818,8 @@ class G $webkit_type_number = ''; // set the excludes if required - if ( $test_excludes ) { - switch ( $test_excludes ){ + if ($test_excludes) { + switch ($test_excludes) { case '1': $b_os_test = false; break; @@ -3844,7 +3831,7 @@ class G $b_mobile_test = false; break; default: - die( 'Error: bad $test_excludes parameter 2 used: ' . $test_excludes ); + die('Error: bad $test_excludes parameter 2 used: ' . $test_excludes); break; } } @@ -3854,10 +3841,10 @@ class G isset protects against blank user agent failure. tolower also lets the script use strstr instead of stristr, which drops overhead slightly. */ - if ( $external_ua_string ) { - $browser_user_agent = strtolower( $external_ua_string ); - } elseif ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) { - $browser_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); + if ($external_ua_string) { + $browser_user_agent = strtolower($external_ua_string); + } elseif (isset($_SERVER['HTTP_USER_AGENT'])) { + $browser_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); } else { $browser_user_agent = ''; } @@ -3955,12 +3942,12 @@ class G run through the browser_types array, break if you hit a match, if no match, assume old browser or non dom browser, assigns false value to $b_success. */ - $i_count = count( $a_browser_types ); + $i_count = count($a_browser_types); for ($i = 0; $i < $i_count; $i++) { //unpacks browser array, assigns to variables, need to not assign til found in string $browser_temp = $a_browser_types[$i][0];// text string to id browser from array - if ( strstr( $browser_user_agent, $browser_temp ) ) { + if (strstr($browser_user_agent, $browser_temp)) { /* it defaults to true, will become false below if needed this keeps it easier to keep track of what is safe, only @@ -3974,12 +3961,12 @@ class G $browser_working = $a_browser_types[$i][2];// working name for browser $ua_type = $a_browser_types[$i][3];// sets whether bot or browser - switch ( $browser_working ) { + switch ($browser_working) { // this is modified quite a bit, now will return proper netscape version number // check your implementation to make sure it works case 'ns': $b_safe_browser = false; - $browser_number = G::get_item_version( $browser_user_agent, 'mozilla' ); + $browser_number = G::get_item_version($browser_user_agent, 'mozilla'); break; case 'moz': /* @@ -3989,16 +3976,16 @@ class G numbering conventions here: http://www.mozilla.org/releases/cvstags.html */ // this will return alpha and beta version numbers, if present - $moz_rv_full = G::get_item_version( $browser_user_agent, 'rv' ); + $moz_rv_full = G::get_item_version($browser_user_agent, 'rv'); // this slices them back off for math comparisons - $moz_rv = substr( $moz_rv_full, 0, 3 ); + $moz_rv = substr($moz_rv_full, 0, 3); // this is to pull out specific mozilla versions, firebird, netscape etc.. - $j_count = count( $a_moz_types ); + $j_count = count($a_moz_types); for ($j = 0; $j < $j_count; $j++) { - if ( strstr( $browser_user_agent, $a_moz_types[$j] ) ) { + if (strstr($browser_user_agent, $a_moz_types[$j])) { $moz_type = $a_moz_types[$j]; - $moz_number = G::get_item_version( $browser_user_agent, $moz_type ); + $moz_number = G::get_item_version($browser_user_agent, $moz_type); break; } } @@ -4006,31 +3993,31 @@ class G this is necesary to protect against false id'ed moz'es and new moz'es. this corrects for galeon, or any other moz browser without an rv number */ - if ( !$moz_rv ) { + if (!$moz_rv) { // you can use this if you are running php >= 4.2 - if ( function_exists( 'floatval' ) ) { - $moz_rv = floatval( $moz_number ); + if (function_exists('floatval')) { + $moz_rv = floatval($moz_number); } else { - $moz_rv = substr( $moz_number, 0, 3 ); + $moz_rv = substr($moz_number, 0, 3); } $moz_rv_full = $moz_number; } // this corrects the version name in case it went to the default 'rv' for the test - if ( $moz_type == 'rv' ) { + if ($moz_type == 'rv') { $moz_type = 'mozilla'; } //the moz version will be taken from the rv number, see notes above for rv problems $browser_number = $moz_rv; // gets the actual release date, necessary if you need to do functionality tests - G::get_set_count( 'set', 0 ); - $moz_release_date = G::get_item_version( $browser_user_agent, 'gecko/' ); + G::get_set_count('set', 0); + $moz_release_date = G::get_item_version($browser_user_agent, 'gecko/'); /* Test for mozilla 0.9.x / netscape 6.x test your javascript/CSS to see if it works in these mozilla releases, if it does, just default it to: $b_safe_browser = true; */ - if ( ( $moz_release_date < 20020400 ) || ( $moz_rv < 1 ) ) { + if (($moz_release_date < 20020400) || ($moz_rv < 1)) { $b_safe_browser = false; } break; @@ -4040,25 +4027,25 @@ class G of msie 8, and we're triggering the break last condition in the test, as well as the test for a second search string, trident/ */ - $browser_number = G::get_item_version( $browser_user_agent, $browser_name, true, 'trident/' ); + $browser_number = G::get_item_version($browser_user_agent, $browser_name, true, 'trident/'); // construct the proper real number if it's in compat mode and msie 8.0/9.0 - if ( strstr( $browser_number, '7.' ) && strstr( $browser_user_agent, 'trident/5' ) ) { + if (strstr($browser_number, '7.') && strstr($browser_user_agent, 'trident/5')) { // note that 7.0 becomes 9 when adding 1, but if it's 7.1 it will be 9.1 $true_ie_number = $browser_number + 2; - } elseif ( strstr( $browser_number, '7.' ) && strstr( $browser_user_agent, 'trident/4' ) ) { + } elseif (strstr($browser_number, '7.') && strstr($browser_user_agent, 'trident/4')) { // note that 7.0 becomes 8 when adding 1, but if it's 7.1 it will be 8.1 $true_ie_number = $browser_number + 1; } // the 9 series is finally standards compatible, html 5 etc, so worth a new id - if ( $browser_number >= 9 ) { + if ($browser_number >= 9) { $ie_version = 'ie9x'; - } elseif ( $browser_number >= 7 ) { + } elseif ($browser_number >= 7) { $ie_version = 'ie7x'; - } elseif ( strstr( $browser_user_agent, 'mac') ) { + } elseif (strstr($browser_user_agent, 'mac')) { $ie_version = 'ieMac'; - } elseif ( $browser_number >= 5 ) { + } elseif ($browser_number >= 5) { $ie_version = 'ie5x'; - } elseif ( ( $browser_number > 3 ) && ( $browser_number < 5 ) ) { + } elseif (($browser_number > 3) && ($browser_number < 5)) { $b_dom_browser = false; $ie_version = 'ie4'; // this depends on what you're using the script for, make sure this fits your needs @@ -4070,32 +4057,32 @@ class G } break; case 'op': - $browser_number = G::get_item_version( $browser_user_agent, $browser_name ); + $browser_number = G::get_item_version($browser_user_agent, $browser_name); // opera is leaving version at 9.80 (or xx) for 10.x - see this for explanation // http://dev.opera.com/articles/view/opera-ua-string-changes/ - if ( strstr( $browser_number, '9.' ) && strstr( $browser_user_agent, 'version/' ) ) { - G::get_set_count( 'set', 0 ); - $browser_number = G::get_item_version( $browser_user_agent, 'version/' ); + if (strstr($browser_number, '9.') && strstr($browser_user_agent, 'version/')) { + G::get_set_count('set', 0); + $browser_number = G::get_item_version($browser_user_agent, 'version/'); } - if ( $browser_number < 5 ) { + if ($browser_number < 5) { $b_safe_browser = false; } break; case 'webkit': // note that this is the Webkit version number - $browser_number = G::get_item_version( $browser_user_agent, $browser_name ); + $browser_number = G::get_item_version($browser_user_agent, $browser_name); // this is to pull out specific webkit versions, safari, google-chrome etc.. - $j_count = count( $a_webkit_types ); + $j_count = count($a_webkit_types); for ($j = 0; $j < $j_count; $j++) { - if (strstr( $browser_user_agent, $a_webkit_types[$j])) { + if (strstr($browser_user_agent, $a_webkit_types[$j])) { $webkit_type = $a_webkit_types[$j]; - if ( $webkit_type == 'omniweb' ) { - G::get_set_count( 'set', 2 ); + if ($webkit_type == 'omniweb') { + G::get_set_count('set', 2); } - $webkit_type_number = G::get_item_version( $browser_user_agent, $webkit_type ); + $webkit_type_number = G::get_item_version($browser_user_agent, $webkit_type); // epiphany hack - if ( $a_webkit_types[$j] == 'gtklauncher' ) { + if ($a_webkit_types[$j] == 'gtklauncher') { $browser_name = 'epiphany'; } else { $browser_name = $a_webkit_types[$j]; @@ -4105,7 +4092,7 @@ class G } break; default: - $browser_number = G::get_item_version( $browser_user_agent, $browser_name ); + $browser_number = G::get_item_version($browser_user_agent, $browser_name); break; } // the browser was id'ed @@ -4115,7 +4102,7 @@ class G } //assigns defaults if the browser was not found in the loop test - if ( !$b_success ) { + if (!$b_success) { /* this will return the first part of the browser string if the above id's failed usually the first part of the browser string has the navigator useragent name/version in it. @@ -4126,14 +4113,14 @@ class G the browser_name is '', you can always test for that */ // delete this part if you want an unknown browser returned - $browser_name = substr( $browser_user_agent, 0, strcspn( $browser_user_agent , '();') ); + $browser_name = substr($browser_user_agent, 0, strcspn($browser_user_agent, '();')); // this extracts just the browser name from the string, if something usable was found - if ( $browser_name && preg_match( '/[^0-9][a-z]*-*\ *[a-z]*\ *[a-z]*/', $browser_name, $a_unhandled_browser ) ) { + if ($browser_name && preg_match('/[^0-9][a-z]*-*\ *[a-z]*\ *[a-z]*/', $browser_name, $a_unhandled_browser)) { $browser_name = $a_unhandled_browser[0]; - if ( $browser_name == 'blackberry' ) { - G::get_set_count( 'set', 0 ); + if ($browser_name == 'blackberry') { + G::get_set_count('set', 0); } - $browser_number = G::get_item_version( $browser_user_agent, $browser_name ); + $browser_number = G::get_item_version($browser_user_agent, $browser_name); } else { $browser_name = 'NA'; $browser_number = 'NA'; @@ -4141,7 +4128,7 @@ class G } // get os data, mac os x test requires browser/version information, this is a change from older scripts if ($b_os_test) { - $a_os_data = G::get_os_data( $browser_user_agent, $browser_working, $browser_number ); + $a_os_data = G::get_os_data($browser_user_agent, $browser_working, $browser_number); $os_type = $a_os_data[0];// os name, abbreviated $os_number = $a_os_data[1];// os number or version if available } @@ -4150,13 +4137,13 @@ class G to true so the function won't retest everything */ $b_repeat = true; - if ($browser_number && preg_match( '/[0-9]*\.*[0-9]*/', $browser_number, $a_browser_math_number ) ) { + if ($browser_number && preg_match('/[0-9]*\.*[0-9]*/', $browser_number, $a_browser_math_number)) { $browser_math_number = $a_browser_math_number[0]; } - if ( $b_mobile_test ) { - $mobile_test = G::check_is_mobile( $browser_user_agent ); - if ( $mobile_test ) { - $a_mobile_data = G::get_mobile_data( $browser_user_agent ); + if ($b_mobile_test) { + $mobile_test = G::check_is_mobile($browser_user_agent); + if ($mobile_test) { + $a_mobile_data = G::get_mobile_data($browser_user_agent); $ua_type = 'mobile'; } } @@ -4197,7 +4184,7 @@ class G } $run_time = G::script_time(); - if ( !$a_full_assoc_data ) { + if (!$a_full_assoc_data) { $a_full_assoc_data = array( 'browser_working' => $browser_working, 'browser_number' => $browser_number, @@ -4247,17 +4234,17 @@ class G break; default: # check to see if the data is available, otherwise it's user typo of unsupported option - if (isset( $a_full_assoc_data[$which_test])) { + if (isset($a_full_assoc_data[$which_test])) { return $a_full_assoc_data[$which_test]; } else { - die( "You passed the browser detector an unsupported option for parameter 1: " . $which_test ); + die("You passed the browser detector an unsupported option for parameter 1: " . $which_test); } break; } } // gets which os from the browser string - public function get_os_data ($pv_browser_string, $pv_browser_name, $pv_version_number) + public function get_os_data($pv_browser_string, $pv_browser_name, $pv_version_number) { // initialize variables $os_working_type = ''; @@ -4271,12 +4258,12 @@ class G $a_unix_types = array( 'dragonfly', 'freebsd', 'openbsd', 'netbsd', 'bsd', 'unixware', 'solaris', 'sunos', 'sun4', 'sun5', 'suni86', 'sun', 'irix5', 'irix6', 'irix', 'hpux9', 'hpux10', 'hpux11', 'hpux', 'hp-ux', 'aix1', 'aix2', 'aix3', 'aix4', 'aix5', 'aix', 'sco', 'unixware', 'mpras', 'reliant', 'dec', 'sinix', 'unix' ); // only sometimes will you get a linux distro to id itself... $a_linux_distros = array( 'ubuntu', 'kubuntu', 'xubuntu', 'mepis', 'xandros', 'linspire', 'winspire', 'jolicloud', 'sidux', 'kanotix', 'debian', 'opensuse', 'suse', 'fedora', 'redhat', 'slackware', 'slax', 'mandrake', 'mandriva', 'gentoo', 'sabayon', 'linux' ); - $a_linux_process = array ( 'i386', 'i586', 'i686' );// not use currently + $a_linux_process = array( 'i386', 'i586', 'i686' );// not use currently // note, order of os very important in os array, you will get failed ids if changed $a_os_types = array( 'android', 'blackberry', 'iphone', 'palmos', 'palmsource', 'symbian', 'beos', 'os2', 'amiga', 'webtv', 'mac', 'nt', 'win', $a_unix_types, $a_linux_distros ); //os tester - $i_count = count( $a_os_types ); + $i_count = count($a_os_types); for ($i = 0; $i < $i_count; $i++) { // unpacks os array, assigns to variable $a_os_working $os_working_data = $a_os_types[$i]; @@ -4284,58 +4271,48 @@ class G assign os to global os variable, os flag true on success !strstr($pv_browser_string, "linux" ) corrects a linux detection bug */ - if (!is_array($os_working_data) && strstr($pv_browser_string, $os_working_data ) && !strstr( $pv_browser_string, "linux")) { + if (!is_array($os_working_data) && strstr($pv_browser_string, $os_working_data) && !strstr($pv_browser_string, "linux")) { $os_working_type = $os_working_data; switch ($os_working_type) { // most windows now uses: NT X.Y syntax case 'nt': - if (strstr( $pv_browser_string, 'nt 6.1' )) { + if (strstr($pv_browser_string, 'nt 6.1')) { $os_working_number = 6.1; - } elseif (strstr( $pv_browser_string, 'nt 6.0')) { + } elseif (strstr($pv_browser_string, 'nt 6.0')) { $os_working_number = 6.0; - } elseif (strstr( $pv_browser_string, 'nt 5.2')) { + } elseif (strstr($pv_browser_string, 'nt 5.2')) { $os_working_number = 5.2; - } elseif (strstr( $pv_browser_string, 'nt 5.1') || strstr( $pv_browser_string, 'xp')) { + } elseif (strstr($pv_browser_string, 'nt 5.1') || strstr($pv_browser_string, 'xp')) { $os_working_number = 5.1;// - } elseif (strstr( $pv_browser_string, 'nt 5') || strstr( $pv_browser_string, '2000')) { + } elseif (strstr($pv_browser_string, 'nt 5') || strstr($pv_browser_string, '2000')) { $os_working_number = 5.0; - } elseif (strstr( $pv_browser_string, 'nt 4')) { + } elseif (strstr($pv_browser_string, 'nt 4')) { $os_working_number = 4; - } elseif (strstr( $pv_browser_string, 'nt 3')) { + } elseif (strstr($pv_browser_string, 'nt 3')) { $os_working_number = 3; } break; case 'win': - if (strstr( $pv_browser_string, 'vista')) { + if (strstr($pv_browser_string, 'vista')) { $os_working_number = 6.0; $os_working_type = 'nt'; - } elseif ( strstr( $pv_browser_string, 'xp')) { + } elseif (strstr($pv_browser_string, 'xp')) { $os_working_number = 5.1; $os_working_type = 'nt'; - } elseif ( strstr( $pv_browser_string, '2003')) { + } elseif (strstr($pv_browser_string, '2003')) { $os_working_number = 5.2; $os_working_type = 'nt'; - } - elseif ( strstr( $pv_browser_string, 'windows ce' ) )// windows CE - { + } elseif (strstr($pv_browser_string, 'windows ce')) {// windows CE $os_working_number = 'ce'; $os_working_type = 'nt'; - } - elseif ( strstr( $pv_browser_string, '95' ) ) - { + } elseif (strstr($pv_browser_string, '95')) { $os_working_number = '95'; - } - elseif ( ( strstr( $pv_browser_string, '9x 4.9' ) ) || ( strstr( $pv_browser_string, ' me' ) ) ) - { + } elseif ((strstr($pv_browser_string, '9x 4.9')) || (strstr($pv_browser_string, ' me'))) { $os_working_number = 'me'; - } - elseif ( strstr( $pv_browser_string, '98' ) ) - { + } elseif (strstr($pv_browser_string, '98')) { $os_working_number = '98'; - } - elseif ( strstr( $pv_browser_string, '2000' ) )// windows 2000, for opera ID - { + } elseif (strstr($pv_browser_string, '2000')) {// windows 2000, for opera ID $os_working_number = 5.0; $os_working_type = 'nt'; } @@ -4343,13 +4320,13 @@ class G case 'mac': if (strstr($pv_browser_string, 'os x')) { if (strstr($pv_browser_string, 'os x ')) { - $os_working_number = str_replace( '_', '.', G::get_item_version( $pv_browser_string, 'os x' ) ); + $os_working_number = str_replace('_', '.', G::get_item_version($pv_browser_string, 'os x')); } else { $os_working_number = 10; } - } elseif ( ( $pv_browser_name == 'saf' ) || ( $pv_browser_name == 'cam' ) || - ( ( $pv_browser_name == 'moz' ) && ( $pv_version_number >= 1.3 ) ) || - ( ( $pv_browser_name == 'ie' ) && ( $pv_version_number >= 5.2 ) ) ) { + } elseif (($pv_browser_name == 'saf') || ($pv_browser_name == 'cam') || + (($pv_browser_name == 'moz') && ($pv_version_number >= 1.3)) || + (($pv_browser_name == 'ie') && ($pv_version_number >= 5.2))) { $os_working_number = 10; } break; @@ -4360,23 +4337,23 @@ class G break; } break; - } elseif ( is_array( $os_working_data ) && ( $i == ( $i_count - 2 ) ) ) { + } elseif (is_array($os_working_data) && ($i == ($i_count - 2))) { $j_count = count($os_working_data); for ($j = 0; $j < $j_count; $j++) { - if (strstr( $pv_browser_string, $os_working_data[$j])) { + if (strstr($pv_browser_string, $os_working_data[$j])) { $os_working_type = 'unix'; //if the os is in the unix array, it's unix, obviously... - $os_working_number = ( $os_working_data[$j] != 'unix' ) ? $os_working_data[$j] : '';// assign sub unix version from the unix array + $os_working_number = ($os_working_data[$j] != 'unix') ? $os_working_data[$j] : '';// assign sub unix version from the unix array break; } } - } elseif (is_array( $os_working_data ) && ( $i == ( $i_count - 1 ))) { + } elseif (is_array($os_working_data) && ($i == ($i_count - 1))) { $j_count = count($os_working_data); for ($j = 0; $j < $j_count; $j++) { - if ( strstr( $pv_browser_string, $os_working_data[$j] )) { + if (strstr($pv_browser_string, $os_working_data[$j])) { $os_working_type = 'lin'; // assign linux distro from the linux array, there's a default //search for 'lin', if it's that, set version to '' - $os_working_number = ( $os_working_data[$j] != 'linux' ) ? $os_working_data[$j] : ''; + $os_working_number = ($os_working_data[$j] != 'linux') ? $os_working_data[$j] : ''; break; } } @@ -4396,9 +4373,9 @@ class G $string_working_number = ''; for ($i = 0; $i < 4; $i++) { //start the search after the first string occurrence - if (strpos( $pv_browser_user_agent, $pv_search_string, $start_pos ) !== false) { - $start_pos = strpos( $pv_browser_user_agent, $pv_search_string, $start_pos ) + strlen( $pv_search_string ); - if (!$pv_b_break_last || ( $pv_extra_search && strstr( $pv_browser_user_agent, $pv_extra_search ) )) { + if (strpos($pv_browser_user_agent, $pv_search_string, $start_pos) !== false) { + $start_pos = strpos($pv_browser_user_agent, $pv_search_string, $start_pos) + strlen($pv_search_string); + if (!$pv_b_break_last || ($pv_extra_search && strstr($pv_browser_user_agent, $pv_extra_search))) { break; } } else { @@ -4406,10 +4383,10 @@ class G } } - $start_pos += G::get_set_count( 'get' ); - $string_working_number = substr( $pv_browser_user_agent, $start_pos, $substring_length ); - $string_working_number = substr( $string_working_number, 0, strcspn($string_working_number, ' );/') ); - if (!is_numeric( substr( $string_working_number, 0, 1 ))) { + $start_pos += G::get_set_count('get'); + $string_working_number = substr($pv_browser_user_agent, $start_pos, $substring_length); + $string_working_number = substr($string_working_number, 0, strcspn($string_working_number, ' );/')); + if (!is_numeric(substr($string_working_number, 0, 1))) { $string_working_number = ''; } return $string_working_number; @@ -4419,9 +4396,9 @@ class G { static $slice_increment; $return_value = ''; - switch ( $pv_type ) { + switch ($pv_type) { case 'get': - if ( is_null( $slice_increment ) ) { + if (is_null($slice_increment)) { $slice_increment = 1; } $return_value = $slice_increment; @@ -4448,9 +4425,9 @@ class G ); // then do basic mobile type search, this uses data from: get_mobile_data() - $j_count = count( $a_mobile_search ); + $j_count = count($a_mobile_search); for ($j = 0; $j < $j_count; $j++) { - if (strstr( $pv_browser_user_agent, $a_mobile_search[$j] )) { + if (strstr($pv_browser_user_agent, $a_mobile_search[$j])) { $mobile_working_test = $a_mobile_search[$j]; break; } @@ -4458,7 +4435,7 @@ class G return $mobile_working_test; } - public function get_mobile_data ($pv_browser_user_agent) + public function get_mobile_data($pv_browser_user_agent) { $mobile_browser = ''; $mobile_browser_number = ''; @@ -4474,53 +4451,53 @@ class G $a_mobile_os = array( 'android', 'epoc', 'cpu os', 'iphone os', 'palmos', 'palmsource', 'windows phone os', 'windows ce', 'symbianos', 'symbian os', 'symbian', 'webos', 'linux armv' ); $a_mobile_server = array( 'astel', 'docomo', 'novarra-vision', 'portalmmm', 'reqwirelessweb', 'vodafone' ); - $k_count = count( $a_mobile_browser ); + $k_count = count($a_mobile_browser); for ($k = 0; $k < $k_count; $k++) { - if (strstr( $pv_browser_user_agent, $a_mobile_browser[$k] )) { + if (strstr($pv_browser_user_agent, $a_mobile_browser[$k])) { $mobile_browser = $a_mobile_browser[$k]; - $mobile_browser_number = G::get_item_version( $pv_browser_user_agent, $mobile_browser ); + $mobile_browser_number = G::get_item_version($pv_browser_user_agent, $mobile_browser); break; } } - $k_count = count( $a_mobile_device ); + $k_count = count($a_mobile_device); for ($k = 0; $k < $k_count; $k++) { - if (strstr( $pv_browser_user_agent, $a_mobile_device[$k] )) { - $mobile_device = trim ( $a_mobile_device[$k], '-_' ); // but not space trims yet + if (strstr($pv_browser_user_agent, $a_mobile_device[$k])) { + $mobile_device = trim($a_mobile_device[$k], '-_'); // but not space trims yet if ($mobile_device == 'blackberry') { - G::get_set_count( 'set', 0 ); + G::get_set_count('set', 0); } - $mobile_device_number = G::get_item_version( $pv_browser_user_agent, $mobile_device ); - $mobile_device = trim( $mobile_device ); // some of the id search strings have white space + $mobile_device_number = G::get_item_version($pv_browser_user_agent, $mobile_device); + $mobile_device = trim($mobile_device); // some of the id search strings have white space break; } } - $k_count = count( $a_mobile_os ); + $k_count = count($a_mobile_os); for ($k = 0; $k < $k_count; $k++) { - if (strstr( $pv_browser_user_agent, $a_mobile_os[$k] )) { + if (strstr($pv_browser_user_agent, $a_mobile_os[$k])) { $mobile_os = $a_mobile_os[$k]; - $mobile_os_number = str_replace( '_', '.', G::get_item_version( $pv_browser_user_agent, $mobile_os ) ); + $mobile_os_number = str_replace('_', '.', G::get_item_version($pv_browser_user_agent, $mobile_os)); break; } } - $k_count = count( $a_mobile_server ); + $k_count = count($a_mobile_server); for ($k = 0; $k < $k_count; $k++) { - if (strstr( $pv_browser_user_agent, $a_mobile_server[$k] )) { + if (strstr($pv_browser_user_agent, $a_mobile_server[$k])) { $mobile_server = $a_mobile_server[$k]; - $mobile_server_number = G::get_item_version( $pv_browser_user_agent, $mobile_server ); + $mobile_server_number = G::get_item_version($pv_browser_user_agent, $mobile_server); break; } } // just for cases where we know it's a mobile device already - if (!$mobile_os && ( $mobile_browser || $mobile_device || $mobile_server ) && strstr( $pv_browser_user_agent, 'linux' ) ) { + if (!$mobile_os && ($mobile_browser || $mobile_device || $mobile_server) && strstr($pv_browser_user_agent, 'linux')) { $mobile_os = 'linux'; - $mobile_os_number = G::get_item_version( $pv_browser_user_agent, 'linux' ); + $mobile_os_number = G::get_item_version($pv_browser_user_agent, 'linux'); } $a_mobile_data = array( $mobile_device, $mobile_browser, $mobile_browser_number, $mobile_os, $mobile_os_number, $mobile_server, $mobile_server_number, $mobile_device_number ); return $a_mobile_data; } - public function getBrowser () + public function getBrowser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $bname = 'Unknown'; @@ -4529,49 +4506,49 @@ class G $ub = "other"; //First get the platform? - if (preg_match( '/linux/i', $u_agent )) { + if (preg_match('/linux/i', $u_agent)) { $platform = 'linux'; - } elseif (preg_match( '/macintosh|mac os x/i', $u_agent )) { + } elseif (preg_match('/macintosh|mac os x/i', $u_agent)) { $platform = 'mac'; - } elseif (preg_match( '/windows|win32/i', $u_agent )) { + } elseif (preg_match('/windows|win32/i', $u_agent)) { $platform = 'windows'; } // Next get the name of the useragent yes seperately and for good reason - if ((preg_match('~Trident/7.0; rv:11.0~', $u_agent) || preg_match( '/MSIE/i', $u_agent )) && ! preg_match( '/Opera/i', $u_agent )) { + if ((preg_match('~Trident/7.0; rv:11.0~', $u_agent) || preg_match('/MSIE/i', $u_agent)) && ! preg_match('/Opera/i', $u_agent)) { $bname = 'Internet Explorer'; $ub = "MSIE"; - } elseif (preg_match( '/Firefox/i', $u_agent )) { + } elseif (preg_match('/Firefox/i', $u_agent)) { $bname = 'Mozilla Firefox'; $ub = "Firefox"; - } elseif ((preg_match( '/Opera/i', $u_agent )) || (preg_match( '/OPR/i', $u_agent ))) { + } elseif ((preg_match('/Opera/i', $u_agent)) || (preg_match('/OPR/i', $u_agent))) { $bname = 'Opera'; $ub = "Opera"; - } elseif (preg_match( '/Chrome/i', $u_agent )) { + } elseif (preg_match('/Chrome/i', $u_agent)) { $bname = 'Google Chrome'; $ub = "Chrome"; - } elseif (preg_match( '/Safari/i', $u_agent )) { + } elseif (preg_match('/Safari/i', $u_agent)) { $bname = 'Apple Safari'; $ub = "Safari"; - } elseif (preg_match( '/Netscape/i', $u_agent )) { + } elseif (preg_match('/Netscape/i', $u_agent)) { $bname = 'Netscape'; $ub = "Netscape"; - } elseif (preg_match( '/bingbot/i', $u_agent )) { + } elseif (preg_match('/bingbot/i', $u_agent)) { $bname = 'Bing Bot'; $ub = "bingbot"; } // finally get the correct version number - $known = array ('Version',$ub,'other'); - $pattern = '#(?P' . join( '|', $known ) . ')[/ ]+(?P[0-9.|a-zA-Z.]*)#'; - @preg_match_all( $pattern, $u_agent, $matches ); + $known = array('Version',$ub,'other'); + $pattern = '#(?P' . join('|', $known) . ')[/ ]+(?P[0-9.|a-zA-Z.]*)#'; + @preg_match_all($pattern, $u_agent, $matches); // see how many we have - $i = count( $matches['browser'] ); + $i = count($matches['browser']); if ($i != 1) { //we will have two since we are not using 'other' argument yet //see if version is before or after the name - if (strripos( $u_agent, "Version" ) < strripos( $u_agent, $ub )) { + if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) { $version = $matches['version'][0]; } else { $version = isset($matches['version'][1]) ? $matches['version'][1] : ''; @@ -4582,68 +4559,68 @@ class G // check if we have a number if ($version == null || $version == "") { - if($ub == 'MSIE'){ - $parent = 'RV'; - } elseif ($ub == 'Opera'){ - $parent = 'OPR'; - } - if (isset($parent) && $parent != ""){ - $s = strpos(strtoupper($u_agent), $parent); - $f = $s + strlen($parent); - $version = substr($u_agent, $f, 15); - $version = preg_replace('/[^0-9,.]/','',$version); - }else { + if ($ub == 'MSIE') { + $parent = 'RV'; + } elseif ($ub == 'Opera') { + $parent = 'OPR'; + } + if (isset($parent) && $parent != "") { + $s = strpos(strtoupper($u_agent), $parent); + $f = $s + strlen($parent); + $version = substr($u_agent, $f, 15); + $version = preg_replace('/[^0-9,.]/', '', $version); + } else { $version = "?"; - } + } } - return array ('userAgent' => $u_agent,'name' => strtolower( $ub ),'longName' => $bname,'version' => $version,'platform' => $platform,'pattern' => $pattern + return array('userAgent' => $u_agent,'name' => strtolower($ub),'longName' => $bname,'version' => $version,'platform' => $platform,'pattern' => $pattern ); } // track total script execution time - public function script_time () + public function script_time() { static $script_time; $elapsed_time = ''; /* note that microtime(true) requires php 5 or greater for microtime(true) */ - if (sprintf( "%01.1f", phpversion() ) >= 5) { - if (is_null( $script_time )) { - $script_time = microtime( true ); + if (sprintf("%01.1f", phpversion()) >= 5) { + if (is_null($script_time)) { + $script_time = microtime(true); } else { // note: (string)$var is same as strval($var) // $elapsed_time = (string)( microtime(true) - $script_time ); - $elapsed_time = (microtime( true ) - $script_time); - $elapsed_time = sprintf( "%01.8f", $elapsed_time ); + $elapsed_time = (microtime(true) - $script_time); + $elapsed_time = sprintf("%01.8f", $elapsed_time); $script_time = null; // can't unset a static variable return $elapsed_time; } } } - public function getDirectorySize ($path, $maxmtime = 0) + public function getDirectorySize($path, $maxmtime = 0) { $totalsize = 0; $totalcount = 0; $dircount = 0; - if ($handle = opendir( $path )) { - while (false !== ($file = readdir( $handle ))) { + if ($handle = opendir($path)) { + while (false !== ($file = readdir($handle))) { $nextpath = $path . '/' . $file; - if ($file != '.' && $file != '..' && ! is_link( $nextpath ) && $file != '.svn') { - if (is_dir( $nextpath )) { + if ($file != '.' && $file != '..' && ! is_link($nextpath) && $file != '.svn') { + if (is_dir($nextpath)) { $dircount ++; - $result = G::getDirectorySize( $nextpath, $maxmtime ); + $result = G::getDirectorySize($nextpath, $maxmtime); $totalsize += $result['size']; $totalcount += $result['count']; $dircount += $result['dircount']; $maxmtime = $result['maxmtime'] > $maxmtime ? $result['maxmtime'] : $maxmtime; - } elseif (is_file( $nextpath )) { - $totalsize += filesize( $nextpath ); + } elseif (is_file($nextpath)) { + $totalsize += filesize($nextpath); $totalcount ++; - $mtime = filemtime( $nextpath ); + $mtime = filemtime($nextpath); if ($mtime > $maxmtime) { $maxmtime = $mtime; } @@ -4651,7 +4628,7 @@ class G } } } - closedir( $handle ); + closedir($handle); $total['size'] = $totalsize; $total['count'] = $totalcount; $total['dircount'] = $dircount; @@ -4665,14 +4642,14 @@ class G * * @author erik amaru ortiz */ - public function getCacheFileNameByPattern ($path, $pattern) + public function getCacheFileNameByPattern($path, $pattern) { - if ($file = glob( $path . $pattern )) { - preg_match( '/[a-f0-9]{32}/', $file[0], $match ); + if ($file = glob($path . $pattern)) { + preg_match('/[a-f0-9]{32}/', $file[0], $match); } else { $file[0] = ''; } - return array ('filename' => $file[0],'checksum' => (isset( $match[0] ) ? $match[0] : '')); + return array('filename' => $file[0],'checksum' => (isset($match[0]) ? $match[0] : '')); } /** @@ -4680,23 +4657,23 @@ class G * * @author erik amaru ortiz */ - public function getCheckSum ($files) + public function getCheckSum($files) { $key = System::getVersion(); - if (! is_array( $files )) { + if (! is_array($files)) { $tmp = $files; - $files = array (); + $files = array(); $files[0] = $tmp; } $checkSum = ''; foreach ($files as $file) { - if (is_file( $file )) { - $checkSum .= G::encryptFileOld( $file ); + if (is_file($file)) { + $checkSum .= G::encryptFileOld($file); } } - return G::encryptOld( $checkSum . $key ); + return G::encryptOld($checkSum . $key); } /** @@ -4705,23 +4682,23 @@ class G * Does accept lines starting with ; as comments * Does not accept comments after values */ - public function parse_ini_string ($string) + public static function parse_ini_string($string) { - if (function_exists( 'parse_ini_string' )) { - return parse_ini_string( $string ); + if (function_exists('parse_ini_string')) { + return parse_ini_string($string); } else { - $array = Array (); - $lines = explode( "\n", $string ); + $array = array(); + $lines = explode("\n", $string); foreach ($lines as $line) { - $statement = preg_match( "/^(?!;)(?P[\w+\.\-]+?)\s*=\s*(?P.+?)\s*$/", $line, $match ); + $statement = preg_match("/^(?!;)(?P[\w+\.\-]+?)\s*=\s*(?P.+?)\s*$/", $line, $match); if ($statement) { $key = $match['key']; $value = $match['value']; //Remove quote - if (preg_match( "/^\".*\"$/", $value ) || preg_match( "/^'.*'$/", $value )) { - $value = mb_substr( $value, 1, mb_strlen( $value ) - 2 ); + if (preg_match("/^\".*\"$/", $value) || preg_match("/^'.*'$/", $value)) { + $value = mb_substr($value, 1, mb_strlen($value) - 2); } $array[$key] = $value; } @@ -4735,82 +4712,82 @@ class G * disable or enable a variable in ini file, this is useful for editing the env.ini file * automatically get the value, and change to inverse value, I mean from true to false and viceversa */ - public function disableEnableINIvariable ($inifile, $variable) + public function disableEnableINIvariable($inifile, $variable) { $enabled = 'false'; - if (file_exists( $inifile )) { - $fp = fopen( $inifile, 'r' ); - $line = fgets( $fp ); + if (file_exists($inifile)) { + $fp = fopen($inifile, 'r'); + $line = fgets($fp); $found = false; $buffer = null; - while (! feof( $fp )) { - $config = G::parse_ini_string( $line ); - if (isset( $config[$variable] )) { + while (! feof($fp)) { + $config = G::parse_ini_string($line); + if (isset($config[$variable])) { $enabled = $config[$variable]; - $buffer .= sprintf( "%s = %d \n", $variable, 1 - $enabled ); + $buffer .= sprintf("%s = %d \n", $variable, 1 - $enabled); $found = true; } else { - $buffer .= trim( $line ) . "\n"; + $buffer .= trim($line) . "\n"; } - $line = fgets( $fp ); + $line = fgets($fp); } - fclose( $fp ); + fclose($fp); if (! $found) { - $buffer .= sprintf( "\n%s = 1 \n", $variable ); + $buffer .= sprintf("\n%s = 1 \n", $variable); } - @file_put_contents( $inifile, $buffer ); + @file_put_contents($inifile, $buffer); } else { - $contents = file_put_contents( $inifile, sprintf( "\n%s = 1\n", $variable ) ); + $contents = file_put_contents($inifile, sprintf("\n%s = 1\n", $variable)); } } /** * set a variable in ini file */ - public function setINIvariable ($inifile, $variable, $value) + public function setINIvariable($inifile, $variable, $value) { - if (file_exists( $inifile )) { - $fp = fopen( $inifile, 'r' ); - $line = fgets( $fp ); + if (file_exists($inifile)) { + $fp = fopen($inifile, 'r'); + $line = fgets($fp); $found = false; $buffer = null; - while (! feof( $fp )) { - $config = G::parse_ini_string( $line ); - if (isset( $config[$variable] )) { + while (! feof($fp)) { + $config = G::parse_ini_string($line); + if (isset($config[$variable])) { $enabled = $config[$variable]; - $buffer .= sprintf( "%s = %s \n", $variable, $value ); + $buffer .= sprintf("%s = %s \n", $variable, $value); $found = true; } else { - $buffer .= trim( $line ) . "\n"; + $buffer .= trim($line) . "\n"; } - $line = fgets( $fp ); + $line = fgets($fp); } - fclose( $fp ); + fclose($fp); if (! $found) { - $buffer .= sprintf( "\n%s = %s \n", $variable, $value ); + $buffer .= sprintf("\n%s = %s \n", $variable, $value); } - file_put_contents( $inifile, $buffer ); + file_put_contents($inifile, $buffer); } else { - $contents = file_put_contents( $inifile, sprintf( "\n%s = $s\n", $variable, $value ) ); + $contents = file_put_contents($inifile, sprintf("\n%s = $s\n", $variable, $value)); } } - public function write_php_ini ($file, $array) + public function write_php_ini($file, $array) { - $res = array (); + $res = array(); foreach ($array as $key => $val) { - if (is_array( $val )) { + if (is_array($val)) { $res[] = "[$key]"; foreach ($val as $skey => $sval) { - $res[] = "$skey = " . (is_numeric( $sval ) ? $sval : '"' . $sval . '"'); + $res[] = "$skey = " . (is_numeric($sval) ? $sval : '"' . $sval . '"'); } } else { - $res[] = "$key = " . (is_numeric( $val ) ? $val : '"' . $val . '"'); + $res[] = "$key = " . (is_numeric($val) ? $val : '"' . $val . '"'); } } - file_put_contents( $file, implode( "\r\n", $res ) ); + file_put_contents($file, implode("\r\n", $res)); } /** @@ -4820,17 +4797,17 @@ class G * @author Erik Amaru Ortiz * @param $resources array a list of files to verify write access */ - public function verifyWriteAccess ($resources) + public function verifyWriteAccess($resources) { - $noWritable = array (); + $noWritable = array(); foreach ($resources as $i => $resource) { - if (! is_writable( $resource )) { + if (! is_writable($resource)) { $noWritable[] = $resource; } } - if (count( $noWritable ) > 0) { - $e = new Exception( "Write access not allowed for ProcessMaker resources" ); + if (count($noWritable) > 0) { + $e = new Exception("Write access not allowed for ProcessMaker resources"); $e->files = $noWritable; throw $e; } @@ -4843,13 +4820,13 @@ class G * @param $template string containing the template filename on /gulliver/templates/ directory * @param $data associative array containig the template data */ - public function renderTemplate ($template, $data = array()) + public function renderTemplate($template, $data = array()) { - if (! defined( 'PATH_THIRDPARTY' )) { - throw new Exception( 'System constant (PATH_THIRDPARTY) is not defined!' ); + if (! defined('PATH_THIRDPARTY')) { + throw new Exception('System constant (PATH_THIRDPARTY) is not defined!'); } - $fInfo = pathinfo( $template ); + $fInfo = pathinfo($template); $tplExists = true; @@ -4859,26 +4836,26 @@ class G } // fix for template that have dot in its name but is not a valid extension - if (isset( $fInfo['extension'] ) && ($fInfo['extension'] != 'tpl' || $fInfo['extension'] != 'html')) { - unset( $fInfo['extension'] ); + if (isset($fInfo['extension']) && ($fInfo['extension'] != 'tpl' || $fInfo['extension'] != 'html')) { + unset($fInfo['extension']); } - if (! isset( $fInfo['extension'] )) { - if (file_exists( $template . '.tpl' )) { + if (! isset($fInfo['extension'])) { + if (file_exists($template . '.tpl')) { $template .= '.tpl'; - } elseif (file_exists( $template . '.html' )) { + } elseif (file_exists($template . '.html')) { $template .= '.html'; } else { $tplExists = false; } } else { - if (! file_exists( $template )) { + if (! file_exists($template)) { $tplExists = false; } } if (! $tplExists) { - throw new Exception( "Template: $template, doesn't exist!" ); + throw new Exception("Template: $template, doesn't exist!"); } $smarty = new Smarty(); @@ -4890,10 +4867,10 @@ class G $smarty->force_compile = true; foreach ($data as $key => $value) { - $smarty->assign( $key, $value ); + $smarty->assign($key, $value); } - $smarty->display( $template ); + $smarty->display($template); } /** @@ -4904,12 +4881,12 @@ class G * @param $data associative array containig the template data * @return $content string containing the parsed template content */ - public function parseTemplate ($template, $data = array()) + public function parseTemplate($template, $data = array()) { $content = ''; ob_start(); - G::renderTemplate( $template, $data ); + G::renderTemplate($template, $data); $content = ob_get_contents(); ob_get_clean(); @@ -4925,39 +4902,39 @@ class G * @param $file string containing the ini file to update * @param $array associative array containing the config data */ - public function update_php_ini ($file, $array) + public static function update_php_ini($file, $array) { - $iniLines = array (); - $iniContent = array (); + $iniLines = array(); + $iniContent = array(); - if (file_exists( $file ) && ! is_writable( $file )) { - throw new Exception( "File $file, is not writable." ); + if (file_exists($file) && ! is_writable($file)) { + throw new Exception("File $file, is not writable."); } - if (file_exists( $file )) { - $iniContent = file( $file ); + if (file_exists($file)) { + $iniContent = file($file); } foreach ($iniContent as $line) { - $line = trim( $line ); - $lineParts = explode( ';', $line ); - $setting = G::parse_ini_string( $lineParts[0] ); + $line = trim($line); + $lineParts = explode(';', $line); + $setting = G::parse_ini_string($lineParts[0]); - if (is_array( $setting ) && count( $setting ) > 0) { - list ($key, ) = array_keys( $setting ); + if (is_array($setting) && count($setting) > 0) { + list($key, ) = array_keys($setting); - if (isset( $array[$key] )) { + if (isset($array[$key])) { $value = $array[$key]; - $line = "$key = " . (is_numeric( $value ) ? $value : '"' . $value . '"'); - $line .= isset( $lineParts[1] ) ? ' ;' . $lineParts[1] : ''; - unset( $array[$key] ); + $line = "$key = " . (is_numeric($value) ? $value : '"' . $value . '"'); + $line .= isset($lineParts[1]) ? ' ;' . $lineParts[1] : ''; + unset($array[$key]); - $lastComment = array_pop( $iniLines ); - if (strpos( $lastComment, "Setting $key" ) === false) { + $lastComment = array_pop($iniLines); + if (strpos($lastComment, "Setting $key") === false) { $iniLines[] = $lastComment; } - $iniLines[] = ";Setting $key - Updated by System on " . date( 'D d M, Y H:i:s' ); + $iniLines[] = ";Setting $key - Updated by System on " . date('D d M, Y H:i:s'); } } $iniLines[] = $line; @@ -4965,20 +4942,20 @@ class G // inserting new values foreach ($array as $key => $value) { - $line = "$key = " . (is_numeric( $value ) ? $value : '"' . $value . '"'); + $line = "$key = " . (is_numeric($value) ? $value : '"' . $value . '"'); $iniLines[] = ''; - $iniLines[] = ";Setting $key - Created by System on " . date( 'D d M, Y H:i:s' ); + $iniLines[] = ";Setting $key - Created by System on " . date('D d M, Y H:i:s'); $iniLines[] = $line; } - $content = implode( "\r\n", $iniLines ); + $content = implode("\r\n", $iniLines); - if (@file_put_contents( $file, $content ) === false) { - throw new Exception( "G::update_php_ini() -> can't update file: $file" ); - } else { + if (@file_put_contents($file, $content) === false) { + throw new Exception("G::update_php_ini() -> can't update file: $file"); + } else { //first a raw permission check - if(fileperms($file) != 33200) { - @chmod ($file, 0660); + if (fileperms($file) != 33200) { + @chmod($file, 0660); } } } @@ -4986,25 +4963,24 @@ class G /** * recursive file & directories write permission detect * - * @author Erik Amaru Ortiz * @licence GPL v2 (http://www.gnu.org/licenses/gpl-2.0.html) * * @param $path string of directory or file to verify recursively * @param $noWritableFiles (alternative) array passed by reference to store all no-writable files * @return bool true if all files inside a directory path are writable, false in another case */ - public function is_writable_r ($path, &$noWritableFiles = array()) + public static function is_writable_r($path, &$noWritableFiles = array()) { - if (is_writable( $path )) { - if (! is_dir( $path )) { + if (is_writable($path)) { + if (! is_dir($path)) { return true; } - $list = glob( rtrim( $path, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . '*' ); + $list = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*'); $sw = true; - if(is_array($list)){ + if (is_array($list)) { foreach ($list as $f) { - if (! G::is_writable_r( $f, $noWritableFiles )) { + if (! G::is_writable_r($f, $noWritableFiles)) { $sw = false; } } @@ -5014,7 +4990,7 @@ class G return $sw; } else { - if (! in_array( $path, $noWritableFiles )) { + if (! in_array($path, $noWritableFiles)) { $noWritableFiles[] = $path; } return false; @@ -5026,110 +5002,110 @@ class G * * @author Erik Amaru Ortiz */ - public function dispatchRestService ($uri, $config, $apiClassesPath = '') + public function dispatchRestService($uri, $config, $apiClassesPath = '') { require_once 'restler/restler.php'; $rest = new Restler(); - $rest->setSupportedFormats( 'JsonFormat', 'XmlFormat' ); + $rest->setSupportedFormats('JsonFormat', 'XmlFormat'); // getting all services class - $restClasses = array (); - $restClassesList = G::rglob( '*', 0, PATH_CORE . 'services/' ); + $restClasses = array(); + $restClassesList = G::rglob('*', 0, PATH_CORE . 'services/'); foreach ($restClassesList as $classFile) { - if (substr( $classFile, - 4 ) === '.php') { - $restClasses[str_replace( '.php', '', basename( $classFile ) )] = $classFile; + if (substr($classFile, - 4) === '.php') { + $restClasses[str_replace('.php', '', basename($classFile))] = $classFile; } } - if (! empty( $apiClassesPath )) { - $pluginRestClasses = array (); - $restClassesList = G::rglob( '*', 0, $apiClassesPath . 'services/' ); + if (! empty($apiClassesPath)) { + $pluginRestClasses = array(); + $restClassesList = G::rglob('*', 0, $apiClassesPath . 'services/'); foreach ($restClassesList as $classFile) { - if (substr( $classFile, - 4 ) === '.php') { - $pluginRestClasses[str_replace( '.php', '', basename( $classFile ) )] = $classFile; + if (substr($classFile, - 4) === '.php') { + $pluginRestClasses[str_replace('.php', '', basename($classFile))] = $classFile; } } - $restClasses = array_merge( $restClasses, $pluginRestClasses ); + $restClasses = array_merge($restClasses, $pluginRestClasses); } // hook to get rest api classes from plugins - if (class_exists( 'ProcessMaker\Plugins\PluginRegistry' )) { + if (class_exists('ProcessMaker\Plugins\PluginRegistry')) { $pluginRegistry = PluginRegistry::loadSingleton(); $pluginClasses = $pluginRegistry->getRegisteredRestServices(); - $restClasses = array_merge( $restClasses, $pluginClasses ); + $restClasses = array_merge($restClasses, $pluginClasses); } foreach ($restClasses as $key => $classFile) { - if (! file_exists( $classFile )) { - unset( $restClasses[$key] ); + if (! file_exists($classFile)) { + unset($restClasses[$key]); continue; } //load the file, and check if exist the class inside it. require_once $classFile; $namespace = 'Services_Rest_'; - $className = str_replace( '.php', '', basename( $classFile ) ); + $className = str_replace('.php', '', basename($classFile)); // if the core class does not exists try resolve the for a plugin - if (! class_exists( $namespace . $className )) { + if (! class_exists($namespace . $className)) { $namespace = 'Plugin_Services_Rest_'; // Couldn't resolve the class name, just skipp it - if (! class_exists( $namespace . $className )) { - unset( $restClasses[$key] ); + if (! class_exists($namespace . $className)) { + unset($restClasses[$key]); continue; } } // verify if there is an auth class implementing 'iAuthenticate' $classNameAuth = $namespace . $className; - $reflClass = new ReflectionClass( $classNameAuth ); + $reflClass = new ReflectionClass($classNameAuth); // that wasn't from plugin - if ($reflClass->implementsInterface( 'iAuthenticate' ) && $namespace != 'Plugin_Services_Rest_') { + if ($reflClass->implementsInterface('iAuthenticate') && $namespace != 'Plugin_Services_Rest_') { // auth class found, set as restler authentication class handler - $rest->addAuthenticationClass( $classNameAuth ); + $rest->addAuthenticationClass($classNameAuth); } else { // add api class - $rest->addAPIClass( $classNameAuth ); + $rest->addAPIClass($classNameAuth); } } //end foreach rest class // resolving the class for current request - $uriPart = explode( '/', $uri ); + $uriPart = explode('/', $uri); $requestedClass = ''; - if (isset( $uriPart[1] )) { - $requestedClass = ucfirst( $uriPart[1] ); + if (isset($uriPart[1])) { + $requestedClass = ucfirst($uriPart[1]); } - if (class_exists( 'Services_Rest_' . $requestedClass )) { + if (class_exists('Services_Rest_' . $requestedClass)) { $namespace = 'Services_Rest_'; - } elseif (class_exists( 'Plugin_Services_Rest_' . $requestedClass )) { + } elseif (class_exists('Plugin_Services_Rest_' . $requestedClass)) { $namespace = 'Plugin_Services_Rest_'; } else { $namespace = ''; } // end resolv. // Send additional headers (if exists) configured on rest-config.ini - if (array_key_exists( 'HEADERS', $config )) { + if (array_key_exists('HEADERS', $config)) { foreach ($config['HEADERS'] as $name => $value) { - header( "$name: $value" ); + header("$name: $value"); } } // to handle a request with "OPTIONS" method - if (! empty( $namespace ) && $_SERVER['REQUEST_METHOD'] === 'OPTIONS') { - $reflClass = new ReflectionClass( $namespace . $requestedClass ); + if (! empty($namespace) && $_SERVER['REQUEST_METHOD'] === 'OPTIONS') { + $reflClass = new ReflectionClass($namespace . $requestedClass); // if the rest class has not a "options" method - if (! $reflClass->hasMethod( 'options' )) { - header( 'Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEADERS' ); - header( 'Access-Control-Allow-Headers: authorization, content-type' ); - header( "Access-Control-Allow-Credentials", "false" ); - header( 'Access-Control-Max-Age: 60' ); + if (! $reflClass->hasMethod('options')) { + header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEADERS'); + header('Access-Control-Allow-Headers: authorization, content-type'); + header("Access-Control-Allow-Credentials", "false"); + header('Access-Control-Max-Age: 60'); exit(); } } // override global REQUEST_URI to pass to Restler library - $_SERVER['REQUEST_URI'] = '/' . strtolower( $namespace ) . ltrim( $uri, '/' ); + $_SERVER['REQUEST_URI'] = '/' . strtolower($namespace) . ltrim($uri, '/'); // handle the rest request $rest->handle(); } - public static function reservedWordsSql () + public static function reservedWordsSql() { //Reserved words SQL - $reservedWordsSql = array ("ACCESSIBLE","ACTION","ADD","ALL","ALTER","ANALYZE","AND","ANY","AS","ASC","ASENSITIVE","AUTHORIZATION","BACKUP","BEFORE","BEGIN","BETWEEN","BIGINT","BINARY","BIT","BLOB","BOTH","BREAK","BROWSE","BULK","BY","CALL","CASCADE","CASE","CHANGE","CHAR","CHARACTER","CHECK","CHECKPOINT","CLOSE","CLUSTERED","COALESCE","COLLATE","COLUMN","COMMIT","COMPUTE","CONDITION","CONSTRAINT","CONTAINS","CONTAINSTABLE","CONTINUE","CONVERT","CREATE","CROSS","CURRENT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DATABASES","DATE","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DBCC","DEALLOCATE","DEC","DECIMAL","DECLARE","DEFAULT","DELAYED","DELETE","DENY","DESC","DESCRIBE","DETERMINISTIC","DISK","DISTINCT","DISTINCTROW", + $reservedWordsSql = array("ACCESSIBLE","ACTION","ADD","ALL","ALTER","ANALYZE","AND","ANY","AS","ASC","ASENSITIVE","AUTHORIZATION","BACKUP","BEFORE","BEGIN","BETWEEN","BIGINT","BINARY","BIT","BLOB","BOTH","BREAK","BROWSE","BULK","BY","CALL","CASCADE","CASE","CHANGE","CHAR","CHARACTER","CHECK","CHECKPOINT","CLOSE","CLUSTERED","COALESCE","COLLATE","COLUMN","COMMIT","COMPUTE","CONDITION","CONSTRAINT","CONTAINS","CONTAINSTABLE","CONTINUE","CONVERT","CREATE","CROSS","CURRENT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DATABASES","DATE","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DBCC","DEALLOCATE","DEC","DECIMAL","DECLARE","DEFAULT","DELAYED","DELETE","DENY","DESC","DESCRIBE","DETERMINISTIC","DISK","DISTINCT","DISTINCTROW", "DISTRIBUTED","DIV","DOUBLE","DROP","DUAL","DUMMY","DUMP","EACH","ELSE","ELSEIF","ENCLOSED","END","ENUM","ERRLVL","ESCAPE","ESCAPED","EXCEPT","EXEC","EXECUTE","EXISTS","EXIT","EXPLAIN","FALSE","FETCH","FILE","FILLFACTOR","FLOAT","FLOAT4","FLOAT8","FOR","FORCE","FOREIGN","FREETEXT","FREETEXTTABLE","FROM","FULL","FULLTEXT","FUNCTION","GENERAL","GOTO","GRANT","GROUP","HAVING","HIGH_PRIORITY","HOLDLOCK","HOUR_MICROSECOND","HOUR_MINUTE","HOUR_SECOND","IDENTITY","IDENTITYCOL","IDENTITY_INSERT","IF","IGNORE","IGNORE_SERVER_IDS","IN","INDEX","INFILE","INNER","INOUT","INSENSITIVE","INSERT","INT","INT1","INT2","INT3","INT4","INT8","INTEGER","INTERSECT","INTERVAL","INTO","IS","ITERATE","JOIN","KEY","KEYS","KILL","LEADING","LEAVE","LEFT","LIKE","LIMIT","LINEAR","LINENO","LINES", "LOAD","LOCALTIME","LOCALTIMESTAMP","LOCK","LONG","LONGBLOB","LONGTEXT","LOOP","LOW_PRIORITY","MASTER_HEARTBEAT_PERIOD","MASTER_SSL_VERIFY_SERVER_CERT","MATCH","MAXVALUE","MEDIUMBLOB","MEDIUMINT","MEDIUMTEXT","MIDDLEINT","MINUTE_MICROSECOND","MINUTE_SECOND","MOD","MODIFIES","NATIONAL","NATURAL","NO","NOCHECK","NONCLUSTERED","NOT","NO_WRITE_TO_BINLOG","NULL","NULLIF","NUMERIC","OF","OFF","OFFSETS","ON","OPEN","OPENDATASOURCE","OPENQUERY","OPENROWSET","OPENXML","OPTIMIZE","OPTION","OPTIONALLY","OR","ORDER","OUT","OUTER","OUTFILE","OVER","PERCENT","PLAN","PRECISION","PRIMARY","PRINT","PROC","PROCEDURE","PUBLIC","PURGE","RAISERROR","RANGE","READ","READS","READTEXT","READ_WRITE","REAL","RECONFIGURE","REFERENCES","REGEXP","RELEASE","RENAME","REPEAT","REPLACE", "REPLICATION","REQUIRE","RESIGNAL","RESTORE","RESTRICT","RETURN","REVOKE","RIGHT","RLIKE","ROLLBACK","ROWCOUNT","ROWGUIDCOL","RULE","SAVE","SCHEMA","SCHEMAS","SECOND_MICROSECOND","SELECT","SENSITIVE","SEPARATOR","SESSION_USER","SET","SETUSER","SHOW","SHUTDOWN","SIGNAL","SLOW","SMALLINT","SOME","SPATIAL","SPECIFIC","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","SQL_BIG_RESULT","SQL_CALC_FOUND_ROWS","SQL_SMALL_RESULT","SSL","STARTING","STATISTICS","STRAIGHT_JOIN","SYSTEM_USER","TABLE","TERMINATED","TEXT","TEXTSIZE","THEN","TIME","TIMESTAMP","TINYBLOB","TINYINT","TINYTEXT","TO","TOP","TRAILING","TRAN","TRANSACTION","TRIGGER","TRUE","TRUNCATE","TSEQUAL","UNDO","UNION","UNIQUE","UNLOCK","UNSIGNED","UPDATE","UPDATETEXT","USAGE","USE","USER","USING","UTC_DATE","UTC_TIME", @@ -5157,11 +5133,11 @@ class G $fileCheck = PATH_DATA."UPDATE.dat"; if ($setFlag == 0) { if (file_exists($fileCheck)) { - unlink ($fileCheck); + unlink($fileCheck); } } elseif ($setFlag == 1) { - $fp = fopen($fileCheck,'w'); - $line = fputs($fp,$content); + $fp = fopen($fileCheck, 'w'); + $line = fputs($fp, $content); } //checking temporary file if ($setFlag >= 1) { @@ -5372,7 +5348,6 @@ class G if (isset($_SESSION["currentSkin"])) { $skin = $_SESSION["currentSkin"]; } else { - if (isset($sysConf["default_skin"])) { $skin = $sysConf["default_skin"]; } @@ -5402,7 +5377,8 @@ class G return $path; } - public function isUserFunction($functionName) { + public function isUserFunction($functionName) + { $allFunctions = get_defined_functions(); if (!isset($allFunctions['user'])) { $allFunctions['user'] = array(); @@ -5423,8 +5399,7 @@ class G */ public function sanitizeInput($data, $tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) { - - $filtro = new InputFilter($tagsArray , $attrArray, $tagsMethod, $attrMethod, $xssAuto); + $filtro = new InputFilter($tagsArray, $attrArray, $tagsMethod, $attrMethod, $xssAuto); return $filtro->process($data); } @@ -5506,7 +5481,8 @@ class G return $arrayData; } - public static function buildFrom($configuration, $from = '') { + public static function buildFrom($configuration, $from = '') + { if (!isset($configuration['MESS_FROM_NAME'])) { $configuration['MESS_FROM_NAME'] = ''; } @@ -5517,7 +5493,7 @@ class G if (!preg_match('/(.+)@(.+)\.(.+)/', $from, $match)) { if ($configuration['MESS_FROM_MAIL'] != '') { $from .= ' <' . $configuration['MESS_FROM_MAIL'] . '>'; - } else if ($configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { + } elseif ($configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from .= ' <' . $configuration['MESS_ACCOUNT'] . '>'; } else { $from .= ' '; @@ -5526,15 +5502,15 @@ class G } else { if ($configuration['MESS_FROM_NAME'] != '' && $configuration['MESS_FROM_MAIL'] != '') { $from = $configuration['MESS_FROM_NAME'] . ' <' . $configuration['MESS_FROM_MAIL'] . '>'; - } else if ($configuration['MESS_FROM_NAME'] != '' && $configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { + } elseif ($configuration['MESS_FROM_NAME'] != '' && $configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from = $configuration['MESS_FROM_NAME'] . ' <' . $configuration['MESS_ACCOUNT'] . '>'; - } else if ($configuration['MESS_FROM_NAME'] != '') { + } elseif ($configuration['MESS_FROM_NAME'] != '') { $from = $configuration['MESS_FROM_NAME'] . ' '; - } else if ($configuration['MESS_FROM_MAIL'] != '') { + } elseif ($configuration['MESS_FROM_MAIL'] != '') { $from = $configuration['MESS_FROM_MAIL']; - } else if ($configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { + } elseif ($configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from = $configuration['MESS_ACCOUNT']; - } else if ($configuration['MESS_ENGINE'] == 'PHPMAILER' && $configuration['MESS_ACCOUNT'] != '' && !preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { + } elseif ($configuration['MESS_ENGINE'] == 'PHPMAILER' && $configuration['MESS_ACCOUNT'] != '' && !preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from = $configuration['MESS_ACCOUNT'] . ' '; } else { $from = 'info@' . ((isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] != '')? $_SERVER['HTTP_HOST'] : 'processmaker.com'); @@ -5543,17 +5519,18 @@ class G return $from; } - public function getRealExtension($extensionInpDoc) { + public function getRealExtension($extensionInpDoc) + { $aux = explode('.', strtolower($extensionInpDoc)); return isset($aux[1]) ? $aux[1] : ''; } - /** - * Verify the InputDoc extension, cheking the file name extension (.pdf, .ppt) and the file content. - * - * - * - */ + /** + * Verify the InputDoc extension, cheking the file name extension (.pdf, .ppt) and the file content. + * + * + * + */ public function verifyInputDocExtension($InpDocAllowedFiles, $fileName, $filesTmpName) { // Initialize variables @@ -5583,7 +5560,7 @@ class G $validExtension = in_array($fileExtension, $allowedTypes); if (!$validExtension) { $res->status = false; - $res->message = G::LoadTranslation('ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION' ) . ' ' . $fileName; + $res->message = G::LoadTranslation('ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION') . ' ' . $fileName; return $res; } @@ -5595,7 +5572,7 @@ class G // If enabled fileinfo extension check the content $finfo = new finfo(FILEINFO_MIME_TYPE); - $mimeType = $finfo->file($filesTmpName); + $mimeType = $finfo->file($filesTmpName); $docType = explode('/', $mimeType); // If is a empty file finish validation @@ -5712,10 +5689,9 @@ class G // If content don't match return error if (!$res->status) { - $res->message = G::LoadTranslation('ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION' ) . ' ' . $fileName; + $res->message = G::LoadTranslation('ID_UPLOAD_ERR_NOT_ALLOWED_EXTENSION') . ' ' . $fileName; } return $res; - } /** @@ -5757,33 +5733,33 @@ class G */ public function sanitizeString ($string, $lowercase = true, $alpha = false) { - $strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]", + $strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]", "}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—", "—", "–", ",", "<", ".", ">", "/", "?"); - $clean = trim(str_replace($strip, "", strip_tags($string))); - $clean = preg_replace('/\s+/', "-", $clean); - $clean = ($alpha) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; - $clean = ($lowercase) ? (function_exists('mb_strtolower')) ? mb_strtolower($clean, 'UTF-8') : strtolower($clean) : $clean; - return $clean; - } - /** - * Out the result - * - * @param string $sVar - * - * @return showRes($string) - */ - public static function outRes ($sInfVar) + $clean = trim(str_replace($strip, "", strip_tags($string))); + $clean = preg_replace('/\s+/', "-", $clean); + $clean = ($alpha) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; + $clean = ($lowercase) ? (function_exists('mb_strtolower')) ? mb_strtolower($clean, 'UTF-8') : strtolower($clean) : $clean; + return $clean; + } + /** + * Out the result + * + * @param string $sVar + * + * @return showRes($string) + */ + public static function outRes($sInfVar) { echo $sInfVar; } - /** - * encryptOld - * - * @param string $string - * - * @return md5($string) - */ + /** + * encryptOld + * + * @param string $string + * + * @return md5($string) + */ public static function encryptOld($string) { $consthashFx = self::hashFx; @@ -5808,7 +5784,7 @@ class G * * @return md5_file($string) */ - public function encryptFileOld ($string) + public function encryptFileOld($string) { $consthashFx = self::hashFile; return $consthashFx($string); @@ -5820,7 +5796,7 @@ class G * * @return crc32($string) */ - public static function encryptCrc32 ($string) + public static function encryptCrc32($string) { $consthashFx = self::hashCrc; return $consthashFx($string); @@ -5865,7 +5841,10 @@ class G (empty($sError)) ? 'TriggerExecution' : 'TriggerExecutionError', (empty($sError)) ? 200 : 400, (empty($sError)) ? 'Trigger Execution' : 'Trigger Execution Error', - $lg, $lg['workspace'], 'processmaker.log'); + $lg, + $lg['workspace'], + 'processmaker.log' + ); $_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = true; } @@ -5879,7 +5858,7 @@ class G { //Moved from Enterprise class. if (file_exists(PATH_METHODS . "login/version-pmos.php")) { - include (PATH_METHODS . "login/version-pmos.php"); + include(PATH_METHODS . "login/version-pmos.php"); } //Removed default version from code. @@ -5916,7 +5895,7 @@ class G * Instanciate an adapter by name. * * @param string $name Adapter name or class name :P - * + * * @param string[] $parameters Constructor parameters */ public static function factory($name, ...$parameters) diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index 0f0503c61..8204a05e0 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -96,7 +96,7 @@ class headPublisher $this->addScriptCode(' var __usernameLogged__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";'); } - public function &getSingleton() + public static function &getSingleton() { if (self::$instance == null) { self::$instance = new headPublisher(); @@ -360,7 +360,7 @@ class headPublisher //$head .= $this->getExtJsStylesheets(); $head .= $this->getExtJsScripts(); $head .= $this->getExtJsVariablesScript(); - $oServerConf = & ServerConf::getSingleton(); + $oServerConf = ServerConf::getSingleton(); if ($oServerConf->isRtl(SYS_LANG)) { $head = $head . " \n"; } @@ -752,7 +752,7 @@ class headPublisher $views = array(); $keyState = "extJsViewState"; $prefixExtJs = "ys-"; - $oServerConf = &ServerConf::getSingleton(); + $oServerConf = ServerConf::getSingleton(); $deleteCache = true; $sjson = $oServerConf->getProperty($keyState); diff --git a/gulliver/system/class.httpProxyController.php b/gulliver/system/class.httpProxyController.php index 84ffbfab1..8f4bdc04f 100644 --- a/gulliver/system/class.httpProxyController.php +++ b/gulliver/system/class.httpProxyController.php @@ -14,7 +14,7 @@ class HttpProxyController * * @var array - private array to store proxy data */ - private $__data__ = array (); + private $__data__ = array(); /** * @@ -26,7 +26,8 @@ class HttpProxyController private $sendResponse = true; - public function __construct() { + public function __construct() + { $this->__request__ = new stdclass(); } @@ -36,7 +37,7 @@ class HttpProxyController * @param string $name * @param string $value */ - public function __set ($name, $value) + public function __set($name, $value) { //echo "Setting '$name' to '$value'\n"; $this->__data__[$name] = $value; @@ -48,10 +49,10 @@ class HttpProxyController * @param string $name * @return string or NULL if the internal var doesn't exist */ - public function __get ($name) + public function __get($name) { //echo "Getting '$name'\n"; - if (array_key_exists( $name, $this->__data__ )) { + if (array_key_exists($name, $this->__data__)) { return $this->__data__[$name]; } @@ -69,10 +70,10 @@ class HttpProxyController * * @param string $name */ - public function __isset ($name) + public function __isset($name) { //echo "Is '$name' set?\n"; - return isset( $this->__data__[$name] ); + return isset($this->__data__[$name]); } /** @@ -80,10 +81,10 @@ class HttpProxyController * * @param string $name */ - public function __unset ($name) + public function __unset($name) { //echo "Unsetting '$name'\n"; - unset( $this->__data__[$name] ); + unset($this->__data__[$name]); } /** @@ -91,11 +92,11 @@ class HttpProxyController * * @param string $name */ - public function call ($name) + public function call($name) { $result = new stdClass(); try { - $result = $this->$name( $this->__request__ ); + $result = $this->$name($this->__request__); if (! $this->jsonResponse) { return null; @@ -104,11 +105,10 @@ class HttpProxyController if (! $result) { $result = $this->__data__; } - } catch (Exception $e) { $result->success = false; $result->message = $result->msg = $e->getMessage(); - switch (get_class( $e )) { + switch (get_class($e)) { case 'Exception': $error = "SYSTEM ERROR"; break; @@ -124,13 +124,13 @@ class HttpProxyController } $result->error = $e->getMessage(); $result->exception = new stdClass(); - $result->exception->class = get_class( $e ); + $result->exception->class = get_class($e); $result->exception->code = $e->getCode(); $result->exception->trace = $e->getTraceAsString(); } if ($this->sendResponse) { - print G::json_encode( $result ); + print G::json_encode($result); } } @@ -139,18 +139,18 @@ class HttpProxyController * * @param array $data */ - public function setHttpRequestData ($data) + public function setHttpRequestData($data) { - if (is_array( $data )) { - while ($var = each( $data )) { - $this->__request__->$var['key'] = $var['value']; + if (is_array($data)) { + while ($var = each($data)) { + $this->__request__->{$var['key']} = $var['value']; } } else { $this->__request__ = $data; } } - public function setJsonResponse ($bool) + public function setJsonResponse($bool) { $this->jsonResponse = $bool; } @@ -160,9 +160,8 @@ class HttpProxyController * * @param boolean $val */ - public function setSendResponse ($val) + public function setSendResponse($val) { $this->sendResponse = $val; } } - diff --git a/gulliver/system/class.inputfilter.php b/gulliver/system/class.inputfilter.php index 60cbfe689..1a27eadba 100644 --- a/gulliver/system/class.inputfilter.php +++ b/gulliver/system/class.inputfilter.php @@ -1,15 +1,15 @@ tagsArray = (array) $tagsArray; - $this->attrArray = (array) $attrArray; + $this->tagsArray = (array)$tagsArray; + $this->attrArray = (array)$attrArray; $this->tagsMethod = $tagsMethod; $this->attrMethod = $attrMethod; $this->xssAuto = $xssAuto; } - /** - * Method to be called by another php script. Processes for XSS and specified bad code. - * @access public - * @param Mixed $source - input string/array-of-string to be 'cleaned' - * @return String $source - 'cleaned' version of input parameter - */ + /** + * Method to be called by another php script. Processes for XSS and specified bad code. + * @access public + * @param Mixed $source - input string/array-of-string to be 'cleaned' + * @return String $source - 'cleaned' version of input parameter + */ public function process($source) { // clean all elements in this array @@ -75,15 +75,15 @@ class InputFilter } } - /** - * Internal method to iteratively remove all unwanted tags and attributes - * @access protected - * @param String $source - input string to be 'cleaned' - * @return String $source - 'cleaned' version of input parameter - */ + /** + * Internal method to iteratively remove all unwanted tags and attributes + * @access protected + * @param String $source - input string to be 'cleaned' + * @return String $source - 'cleaned' version of input parameter + */ public function remove($source) { - $loopCounter=0; + $loopCounter = 0; // provides nested-tag protection while ($source != $this->filterTags($source)) { $source = $this->filterTags($source); @@ -92,12 +92,12 @@ class InputFilter return $source; } - /** - * Internal method to strip a string of certain tags - * @access protected - * @param String $source - input string to be 'cleaned' - * @return String $source - 'cleaned' version of input parameter - */ + /** + * Internal method to strip a string of certain tags + * @access protected + * @param String $source - input string to be 'cleaned' + * @return String $source - 'cleaned' version of input parameter + */ public function filterTags($source) { // filter pass setup @@ -119,8 +119,8 @@ class InputFilter // next start of tag (for nested tag assessment) $tagOpen_nested = strpos($fromTagOpen, '<'); if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) { - $preTag .= substr($postTag, 0, ($tagOpen_nested+1)); - $postTag = substr($postTag, ($tagOpen_nested+1)); + $preTag .= substr($postTag, 0, ($tagOpen_nested + 1)); + $postTag = substr($postTag, ($tagOpen_nested + 1)); $tagOpen_start = strpos($postTag, '<'); continue; } @@ -146,7 +146,7 @@ class InputFilter list($tagName) = explode(' ', $currentTag); } // excludes all "non-regular" tagnames OR no tagname OR remove if xssauto is on and tag is blacklisted - if ((!preg_match("/^[a-z][a-z0-9]*$/i",$tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) { + if ((!preg_match("/^[a-z][a-z0-9]*$/i", $tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) { $postTag = substr($postTag, ($tagLength + 2)); $tagOpen_start = strpos($postTag, '<'); // don't append this tag @@ -154,15 +154,15 @@ class InputFilter } // this while is needed to support attribute values with spaces in! while ($currentSpace !== false) { - $fromSpace = substr($tagLeft, ($currentSpace+1)); + $fromSpace = substr($tagLeft, ($currentSpace + 1)); $nextSpace = strpos($fromSpace, ' '); $openQuotes = strpos($fromSpace, '"'); - $closeQuotes = strpos(substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1; + $closeQuotes = strpos(substr($fromSpace, ($openQuotes + 1)), '"') + $openQuotes + 1; // another equals exists if (strpos($fromSpace, '=') !== false) { // opening and closing quotes exists - if (($openQuotes !== false) && (strpos(substr($fromSpace, ($openQuotes+1)), '"') !== false)) { - $attr = substr($fromSpace, 0, ($closeQuotes+1)); + if (($openQuotes !== false) && (strpos(substr($fromSpace, ($openQuotes + 1)), '"') !== false)) { + $attr = substr($fromSpace, 0, ($closeQuotes + 1)); } else { // one or neither exist $attr = substr($fromSpace, 0, $nextSpace); @@ -212,17 +212,17 @@ class InputFilter return $preTag; } - /** - * Internal method to strip a tag of certain attributes - * @access protected - * @param Array $attrSet - * @return Array $newSet - */ + /** + * Internal method to strip a tag of certain attributes + * @access protected + * @param Array $attrSet + * @return Array $newSet + */ public function filterAttr($attrSet) { $newSet = array(); // process attributes - for ($i = 0; $i xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on')))) { + if ((!preg_match("/^[a-z]*$/i", $attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on')))) { continue; } // xss attr value filtering @@ -250,12 +250,12 @@ class InputFilter $attrSubSet[1] = stripslashes($attrSubSet[1]); } // auto strip attr's with "javascript: - if (((strpos(strtolower($attrSubSet[1]), 'expression') !== false) &&(strtolower($attrSubSet[0]) == 'style')) || - (strpos(strtolower($attrSubSet[1]), 'javascript:') !== false) || - (strpos(strtolower($attrSubSet[1]), 'behaviour:') !== false) || - (strpos(strtolower($attrSubSet[1]), 'vbscript:') !== false) || - (strpos(strtolower($attrSubSet[1]), 'mocha:') !== false) || - (strpos(strtolower($attrSubSet[1]), 'livescript:') !== false) + if (((strpos(strtolower($attrSubSet[1]), 'expression') !== false) && (strtolower($attrSubSet[0]) == 'style')) || + (strpos(strtolower($attrSubSet[1]), 'javascript:') !== false) || + (strpos(strtolower($attrSubSet[1]), 'behaviour:') !== false) || + (strpos(strtolower($attrSubSet[1]), 'vbscript:') !== false) || + (strpos(strtolower($attrSubSet[1]), 'mocha:') !== false) || + (strpos(strtolower($attrSubSet[1]), 'livescript:') !== false) ) { continue; } @@ -279,30 +279,34 @@ class InputFilter return $newSet; } - /** - * Try to convert to plaintext - * @access protected - * @param String $source - * @return String $source - */ + /** + * Try to convert to plaintext + * @access protected + * @param String $source + * @return String $source + */ public function decode($source) { // url decode $source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1"); // convert decimal - $source = preg_replace('/&#(\d+);/me',"chr(\\1)", $source);// decimal notation + $source = preg_replace_callback('/&#(\d+);/m', function ($matches) { + return utf8_encode(chr($matches[1])); + }, $source);// decimal notation // convert hex - $source = preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)", $source);// hex notation + $source = preg_replace_callback('/&#x([a-f0-9]+);/mi', function ($matches) { + return utf8_encode(chr('0x' . $matches[1])); + }, $source);// hex notation return $source; } - /** - * Method to be called by another php script. Processes for SQL injection - * @access public - * @param Mixed $source - input string/array-of-string to be 'cleaned' - * @param Buffer $connection - An open MySQL connection - * @return String $source - 'cleaned' version of input parameter - */ + /** + * Method to be called by another php script. Processes for SQL injection + * @access public + * @param Mixed $source - input string/array-of-string to be 'cleaned' + * @param Buffer $connection - An open MySQL connection + * @return String $source - 'cleaned' version of input parameter + */ public function safeSQL($source, &$connection) { // clean all elements in this array @@ -326,14 +330,14 @@ class InputFilter } } - /** - * @author Chris Tobin - * @author Daniel Morris - * @access protected - * @param String $source - * @param Resource $connection - An open MySQL connection - * @return String $source - */ + /** + * @author Chris Tobin + * @author Daniel Morris + * @access protected + * @param String $source + * @param Resource $connection - An open MySQL connection + * @return String $source + */ public function quoteSmart($source, &$connection) { // strip slashes @@ -345,44 +349,37 @@ class InputFilter return $source; } - /** - * @author Chris Tobin - * @author Daniel Morris - * @access protected - * @param String $source - * @param Resource $connection - An open MySQL connection - * @return String $source - */ + /** + * @author Chris Tobin + * @author Daniel Morris + * @access protected + * @param String $source + * @param Resource $connection - An open MySQL connection + * @return String $source + */ public function escapeString($string, &$connection) { - // depreciated function - if (version_compare(phpversion(),"4.3.0", "<")) { - mysql_escape_string($string); - } else { - // current function - mysql_real_escape_string($string); - } - return $string; + return mysqli_real_escape_string($connection, $string); } - - /** - * Internal method removes tags/special characters - * @author Marcelo Cuiza - * @access protected - * @param Array or String $input - * @param String $type - * @return Array or String $input - */ + + /** + * Internal method removes tags/special characters + * @author Marcelo Cuiza + * @access protected + * @param Array or String $input + * @param String $type + * @return Array or String $input + */ public function xssFilter($input, $type = "") { - if(is_array($input)) { - if(sizeof($input)) { - foreach($input as $i => $val) { - if(is_array($val) && sizeof($val)) { + if (is_array($input)) { + if (count($input)) { + foreach ($input as $i => $val) { + if (is_array($val) && count($val)) { $input[$i] = $this->xssFilter($val); } else { - if(!empty($val)) { - if($type != "url") { + if (!empty($val)) { + if ($type != "url") { $inputFiltered = addslashes(htmlspecialchars(filter_var($val, FILTER_SANITIZE_STRING), ENT_COMPAT, 'UTF-8')); } else { $inputFiltered = filter_var($val, FILTER_SANITIZE_STRING); @@ -393,13 +390,13 @@ class InputFilter $input[$i] = $inputFiltered; } } - } + } return $input; } else { - if(!isset($input) || trim($input) === '' || $input === NULL ) { + if (!isset($input) || trim($input) === '' || $input === null) { return ''; } else { - if($type != "url") { + if ($type != "url") { return addslashes(htmlspecialchars(filter_var($input, FILTER_SANITIZE_STRING), ENT_COMPAT, 'UTF-8')); } else { return filter_var($input, FILTER_SANITIZE_STRING); @@ -407,41 +404,41 @@ class InputFilter } } } - - /** - * Internal method: remove malicious code, fix missing end tags, fix illegal nesting, convert deprecated tags, validate CSS, preserve rich formatting - * @author Marcelo Cuiza - * @access protected - * @param Array or String $input - * @param String $type (url) - * @return Array or String $input - */ - function xssFilterHard($input, $type = "") - { + + /** + * Internal method: remove malicious code, fix missing end tags, fix illegal nesting, convert deprecated tags, validate CSS, preserve rich formatting + * @author Marcelo Cuiza + * @access protected + * @param Array or String $input + * @param String $type (url) + * @return Array or String $input + */ + public function xssFilterHard($input, $type = "") + { $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($config); - if(is_array($input)) { - if(sizeof($input)) { - foreach($input as $i => $val) { - if(is_array($val) || is_object($val) && sizeof($val)) { + if (is_array($input)) { + if (count($input)) { + foreach ($input as $i => $val) { + if (is_array($val) || is_object($val) && count($val)) { $input[$i] = $this->xssFilterHard($val); } else { - if(!empty($val)) { - if(!is_object(G::json_decode($val))) { + if (!empty($val)) { + if (!is_object(G::json_decode($val))) { $inputFiltered = $purifier->purify($val); - if($type != "url" && !strpos(basename($val), "=")) { - $inputFiltered = htmlspecialchars($inputFiltered, ENT_NOQUOTES, 'UTF-8'); + if ($type != "url" && !strpos(basename($val), "=")) { + $inputFiltered = htmlspecialchars($inputFiltered, ENT_NOQUOTES, 'UTF-8'); } else { - $inputFiltered = str_replace('&','&',$inputFiltered); + $inputFiltered = str_replace('&', '&', $inputFiltered); } } else { - $jsArray = G::json_decode($val,true); - if(is_array($jsArray) && sizeof($jsArray)) { - foreach($jsArray as $j => $jsVal){ - if(is_array($jsVal) && sizeof($jsVal)) { + $jsArray = G::json_decode($val, true); + if (is_array($jsArray) && count($jsArray)) { + foreach ($jsArray as $j => $jsVal) { + if (is_array($jsVal) && count($jsVal)) { $jsArray[$j] = $this->xssFilterHard($jsVal); } else { - if(!empty($jsVal)) { + if (!empty($jsVal)) { $jsArray[$j] = $purifier->purify($jsVal); } } @@ -450,7 +447,7 @@ class InputFilter } else { $inputFiltered = $val; } - } + } } else { $inputFiltered = ""; } @@ -460,16 +457,16 @@ class InputFilter } return $input; } else { - if(!isset($input) || empty($input)) { + if (!isset($input) || empty($input)) { return ''; } else { - if(is_object($input)) { - if(sizeof($input)) { - foreach($input as $j => $jsVal){ - if(is_array($jsVal) || is_object($jsVal) && sizeof($jsVal)) { + if (is_object($input)) { + if (count($input)) { + foreach ($input as $j => $jsVal) { + if (is_array($jsVal) || is_object($jsVal) && count($jsVal)) { $input->j = $this->xssFilterHard($jsVal); } else { - if(!empty($jsVal)) { + if (!empty($jsVal)) { $input->j = $purifier->purify($jsVal); } } @@ -477,97 +474,101 @@ class InputFilter } return $input; } - if(!is_object(G::json_decode($input))) { + if (!is_object(G::json_decode($input))) { $input = $purifier->purify($input); - if($type != "url" && !strpos(basename($input), "=")) { + if ($type != "url" && !strpos(basename($input), "=")) { $input = addslashes(htmlspecialchars($input, ENT_COMPAT, 'UTF-8')); } else { - $input = str_replace('&','&',$input); + $input = str_replace('&', '&', $input); } } else { - $jsArray = G::json_decode($input,true); - if(is_array($jsArray) && sizeof($jsArray)) { - foreach($jsArray as $j => $jsVal){ - if(is_array($jsVal) || is_object($jsVal) && sizeof($jsVal)) { + $jsArray = G::json_decode($input, true); + if (is_array($jsArray) && count($jsArray)) { + foreach ($jsArray as $j => $jsVal) { + if (is_array($jsVal) || is_object($jsVal) && count($jsVal)) { $jsArray[$j] = $this->xssFilterHard($jsVal); } else { - if(!empty($jsVal)) { + if (!empty($jsVal)) { $jsArray[$j] = $purifier->purify($jsVal); } } } $input = G::json_encode($jsArray); } - } + } return $input; } } } - - /** - * Internal method: protect against SQL injection - * @author Marcelo Cuiza - * @access protected - * @param String $con - * @param String $query - * @param Array $values - * @return String $query - */ - function preventSqlInjection($query, $values = Array(), $con = NULL) + + /** + * Internal method: protect against SQL injection + * @author Marcelo Cuiza + * @access protected + * @param String $con + * @param String $query + * @param array $values + * @return String $query + */ + public function preventSqlInjection($query, $values = array(), $con = null) { - if(is_array($values) && sizeof($values)) { - foreach($values as $k1 => $val1) { - $values[$k1] = mysql_real_escape_string($val1); + if (empty($con)) { + $con = Propel::getConnection('workflow'); + $con = $con->getResource(); + } + if (is_array($values) && count($values)) { + + foreach ($values as $k1 => $val1) { + $values[$k1] = mysqli_real_escape_string($con, $val1); } - - if ( get_magic_quotes_gpc() ) { - foreach($values as $k => $val) { + + if (get_magic_quotes_gpc()) { + foreach ($values as $k => $val) { $values[$k] = stripslashes($val); } } - $newquery = vsprintf($query,$values); + $newQuery = vsprintf($query, $values); } else { - //$newquery = mysql_real_escape_string($query); - $newquery = $this->quoteSmart($this->decode($query), $con); + $newQuery = $this->quoteSmart($this->decode($query), $con); } - return $newquery; + return $newQuery; } - - /** - * Internal method: validate user input - * @author Marcelo Cuiza - * @access protected - * @param String $value (required) - * @param Array or String $types ( string | int | float | boolean | path | nosql ) - * @param String $valType ( validate | sanitize ) - * @return String $value - */ - function validateInput($value, $types = 'string', $valType = 'sanitize') + + /** + * Internal method: validate user input + * @author Marcelo Cuiza + * @access protected + * @param String $value (required) + * @param Array or String $types ( string | int | float | boolean | path | nosql ) + * @param String $valType ( validate | sanitize ) + * @return String $value + */ + public function validateInput($value, $types = 'string', $valType = 'sanitize') { - if(!isset($value) || empty($value)) { + if (!isset($value) || empty($value)) { return ''; - } - - if(is_array($types) && sizeof($types)){ - foreach($types as $type){ - if($valType == 'sanitize') { + } + + if (is_array($types) && count($types)) { + foreach ($types as $type) { + if ($valType == 'sanitize') { $value = $this->sanitizeInputValue($value, $type); } else { - $value = $this->validateInputValue($value, $type); + $value = $this->validateInputValue($value, $type); } - } - } elseif(is_string($types)) { - if($types == 'sanitize' || $types == 'validate') { + } + } elseif (is_string($types)) { + if ($types === 'sanitize' || $types === 'validate') { $valType = $types; $types = 'string'; } - if($valType == 'sanitize') { + if ($valType === 'sanitize') { $value = $this->sanitizeInputValue($value, $types); } else { - $value = $this->validateInputValue($value, $types); + $value = $this->validateInputValue($value, $types); } } - + return $value; } @@ -576,36 +577,36 @@ class InputFilter * @param $type * @return bool|int|mixed|string */ - function sanitizeInputValue($value, $type) { - - switch($type) { + public function sanitizeInputValue($value, $type) + { + switch ($type) { case 'float': $value = filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND); - break; + break; case 'int': $value = (int)filter_var($value, FILTER_SANITIZE_NUMBER_INT); - break; + break; case 'boolean': - $value = (boolean)filter_var($value, FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE); - break; + $value = (boolean)filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + break; case 'path': - if(!file_exists($value)) { - if(!is_dir($value)) { + if (!file_exists($value)) { + if (!is_dir($value)) { $value = ''; } } - break; + break; case 'nosql': $value = (string)filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); - if(preg_match('/\b(or|and|xor|drop|insert|update|delete|select)\b/i' , $value, $matches, PREG_OFFSET_CAPTURE)) { - $value = substr($value,0,$matches[0][1]); + if (preg_match('/\b(or|and|xor|drop|insert|update|delete|select)\b/i', $value, $matches, PREG_OFFSET_CAPTURE)) { + $value = substr($value, 0, $matches[0][1]); } - break; + break; default: $value = (string)filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } - - return $value; + + return $value; } /** @@ -613,39 +614,39 @@ class InputFilter * @param $type * @throws Exception */ - function validateInputValue($value, $type) { - - switch($type) { + public function validateInputValue($value, $type) + { + switch ($type) { case 'float': $value = str_replace(',', '.', $value); - if(!filter_var($value, FILTER_VALIDATE_FLOAT)) { - throw new Exception('not a float value'); + if (!filter_var($value, FILTER_VALIDATE_FLOAT)) { + throw new Exception('not a float value'); } - break; + break; case 'int': - if(!filter_var($value, FILTER_VALIDATE_INT)) { - throw new Exception('not a int value'); + if (!filter_var($value, FILTER_VALIDATE_INT)) { + throw new Exception('not a int value'); } - break; + break; case 'boolean': - if(!preg_match('/\b(yes|no|false|true|1|0)\b/i' , $value)) { + if (!preg_match('/\b(yes|no|false|true|1|0)\b/i', $value)) { throw new Exception('not a boolean value'); } - break; + break; case 'path': - if(!file_exists($value)) { - if(!is_dir($value)) { + if (!file_exists($value)) { + if (!is_dir($value)) { throw new Exception('not a valid path'); } } - break; + break; case 'nosql': - if(preg_match('/\b(or|and|xor|drop|insert|update|delete|select)\b/i' , $value)) { + if (preg_match('/\b(or|and|xor|drop|insert|update|delete|select)\b/i', $value)) { throw new Exception('sql command found'); } - break; + break; default: - if(!is_string($value)) { + if (!is_string($value)) { throw new Exception('not a string value'); } } @@ -655,7 +656,8 @@ class InputFilter * @param $pathFile * @return string */ - function validatePath($pathFile) { + public function validatePath($pathFile) + { $sanitizefilteredPath = mb_ereg_replace("([\.]{2,})", '', $pathFile); $sanitizefilteredPath = mb_ereg_replace("(^~)", '', $sanitizefilteredPath); return $sanitizefilteredPath; @@ -664,23 +666,23 @@ class InputFilter /** * Filter only characters valids by regular expression * - * @param mixed $data Data + * @param mixed $data Data * @param mixed $regex Regular expression * * @return mixed Returns data with the characters valids by regular expression */ - function xssRegexFilter($data, $regex) + public function xssRegexFilter($data, $regex) { try { switch (gettype($data)) { case 'array': foreach ($data as $key => $value) { - $data[$key] = $this->xssRegexFilter($value, (is_array($regex))? ((isset($regex[$key]))? $regex[$key] : '') : $regex); + $data[$key] = $this->xssRegexFilter($value, (is_array($regex)) ? ((isset($regex[$key])) ? $regex[$key] : '') : $regex); } break; default: if ($regex != '') { - $data = (preg_match_all($regex, $data, $arrayMatch))? implode('', $arrayMatch[0]) : ''; + $data = (preg_match_all($regex, $data, $arrayMatch)) ? implode('', $arrayMatch[0]) : ''; } break; } diff --git a/gulliver/system/class.monologProvider.php b/gulliver/system/class.monologProvider.php index 5bbb5b3b4..1bc0710d4 100644 --- a/gulliver/system/class.monologProvider.php +++ b/gulliver/system/class.monologProvider.php @@ -55,7 +55,7 @@ class MonologProvider * @access public * @return object */ - public function getSingleton ($channel, $fileLog) + public static function getSingleton ($channel, $fileLog) { if (self::$instance == null) { self::$instance = new MonologProvider($channel, $fileLog); diff --git a/gulliver/system/class.pagedTable.php b/gulliver/system/class.pagedTable.php index ce030655d..4df9fd8a7 100644 --- a/gulliver/system/class.pagedTable.php +++ b/gulliver/system/class.pagedTable.php @@ -33,20 +33,19 @@ * @package gulliver.system * @access public */ - class pagedTable { public $xmlFormFile; public $currentPage; public $orderBy = ''; - public $filter = array (); - public $filterType = array (); + public $filter = array(); + public $filterType = array(); public $searchBy = ''; public $fastSearch = ''; public $order = ''; public $template = 'templates/paged-table.html'; public $tpl; - public $style = array (); + public $style = array(); public $rowsPerPage = 25; public $ownerPage; public $popupPage; @@ -105,30 +104,30 @@ class pagedTable * @access public * @return string */ - public function analizeSql () + public function analizeSql() { - if (1 === preg_match( '/^\s*SELECT\s+(.+?)(?:\s+FROM\s+(.+?))(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+BETWEEN\s+(.+?)\s+AND\s+(.+?))?\s*$/im', $this->sqlSelect, $matches )) { + if (1 === preg_match('/^\s*SELECT\s+(.+?)(?:\s+FROM\s+(.+?))(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+BETWEEN\s+(.+?)\s+AND\s+(.+?))?\s*$/im', $this->sqlSelect, $matches)) { $this->sqlSelect = 'SELECT ' . $matches[1] . (($matches[2] != '') ? ' FROM ' . $matches[2] : ''); $this->sqlSelect = 'SELECT ' . $matches[1] . (($matches[2] != '') ? ' FROM ' . $matches[2] : ''); } else { //echo('Warning: SQL Query is not well formed.'); return; } - $this->sqlFrom = isset( $matches[2] ) ? $matches[2] : ''; - $this->sqlWhere = isset( $matches[3] ) ? $matches[3] : ''; - $this->sqlGroupBy = isset( $matches[4] ) ? $matches[4] : ''; - $this->sqlOrderBy = isset( $matches[5] ) ? $matches[5] : ''; + $this->sqlFrom = isset($matches[2]) ? $matches[2] : ''; + $this->sqlWhere = isset($matches[3]) ? $matches[3] : ''; + $this->sqlGroupBy = isset($matches[4]) ? $matches[4] : ''; + $this->sqlOrderBy = isset($matches[5]) ? $matches[5] : ''; $this->order = ''; if ($this->sqlOrderBy != '') { - if ($n = preg_match_all( '/\b([\w\.]+)\b(?:\s+(ASC|DESC))?,?/im', $this->sqlOrderBy, $matches, PREG_SET_ORDER )) { - for ($r = 0; $r < $n; $r ++) { - if (! isset( $matches[$r][2] )) { + if ($n = preg_match_all('/\b([\w\.]+)\b(?:\s+(ASC|DESC))?,?/im', $this->sqlOrderBy, $matches, PREG_SET_ORDER)) { + for ($r = 0; $r < $n; $r++) { + if (!isset($matches[$r][2])) { $matches[$r][2] = ''; } if ($matches[$r][2] == '') { $matches[$r][2] = 'ASC'; } - $ord = G::createUID( '', $matches[$r][1] ) . '=' . urlencode( $matches[$r][2] ); + $ord = G::createUID('', $matches[$r][1]) . '=' . urlencode($matches[$r][2]); if ($this->order == '') { $this->order = $ord; } else { @@ -137,7 +136,7 @@ class pagedTable } //Orden ascendente if ($n == 1) { - $this->order = G::createUID( '', $matches[0][1] ) . '=' . $matches[0][2]; + $this->order = G::createUID('', $matches[0][1]) . '=' . $matches[0][2]; } } } @@ -146,7 +145,7 @@ class pagedTable $uniqueWhere = ''; $this->fieldDataList = ''; foreach ($this->fields as $r => $field) { - if ((strpos( $this->notFields, ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) { + if ((strpos($this->notFields, ' ' . $this->fields[$r]['Type'] . ' ') === false)) { if ($uniqueWhere == '') { $uniqueWhere = (($this->sqlWhere != '') ? ('(' . $this->sqlWhere . ') AND (') : '('); } else { @@ -173,77 +172,78 @@ class pagedTable * @access public * @return string */ - public function prepareQuery () + public function prepareQuery() { //DBConnection - if (! $this->sqlConnection) { + if (!$this->sqlConnection) { $this->dbc = new DBConnection(); } else { - if (defined( 'DB_' . $this->sqlConnection . '_USER' )) { - if (defined( 'DB_' . $this->sqlConnection . '_HOST' )) { - eval( '$res[\'DBC_SERVER\'] = DB_' . $this->sqlConnection . '_HOST;' ); + if (defined('DB_' . $this->sqlConnection . '_USER')) { + if (defined('DB_' . $this->sqlConnection . '_HOST')) { + eval('$res[\'DBC_SERVER\'] = DB_' . $this->sqlConnection . '_HOST;'); } else { $res['DBC_SERVER'] = DB_HOST; } - if (defined( 'DB_' . $this->sqlConnection . '_USER' )) { - eval( '$res[\'DBC_USERNAME\'] = DB_' . $this->sqlConnection . '_USER;' ); + if (defined('DB_' . $this->sqlConnection . '_USER')) { + eval('$res[\'DBC_USERNAME\'] = DB_' . $this->sqlConnection . '_USER;'); } - if (defined( 'DB_' . $this->sqlConnection . '_PASS' )) { - eval( '$res[\'DBC_PASSWORD\'] = DB_' . $this->sqlConnection . '_PASS;' ); + if (defined('DB_' . $this->sqlConnection . '_PASS')) { + eval('$res[\'DBC_PASSWORD\'] = DB_' . $this->sqlConnection . '_PASS;'); } else { $res['DBC_PASSWORD'] = DB_PASS; } - if (defined( 'DB_' . $this->sqlConnection . '_NAME' )) { - eval( '$res[\'DBC_DATABASE\'] = DB_' . $this->sqlConnection . '_NAME;' ); + if (defined('DB_' . $this->sqlConnection . '_NAME')) { + eval('$res[\'DBC_DATABASE\'] = DB_' . $this->sqlConnection . '_NAME;'); } else { $res['DBC_DATABASE'] = DB_NAME; } - if (defined( 'DB_' . $this->sqlConnection . '_TYPE' )) { - eval( '$res[\'DBC_TYPE\'] = DB_' . $this->sqlConnection . '_TYPE;' ); + if (defined('DB_' . $this->sqlConnection . '_TYPE')) { + eval('$res[\'DBC_TYPE\'] = DB_' . $this->sqlConnection . '_TYPE;'); } else { - $res['DBC_TYPE'] = defined( 'DB_TYPE' ) ? DB_TYPE : 'mysql'; + $res['DBC_TYPE'] = defined('DB_TYPE') ? DB_TYPE : 'mysql'; } - $this->dbc = new DBConnection( $res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'], $res['DBC_TYPE'] ); + $this->dbc = new DBConnection($res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'], $res['DBC_TYPE']); } else { $dbc = new DBConnection(); - $dbs = new DBSession( $dbc ); - $res = $dbs->execute( "select * from DB_CONNECTION WHERE DBC_UID=" . $this->sqlConnection ); + $dbs = new DBSession($dbc); + $res = $dbs->execute("select * from DB_CONNECTION WHERE DBC_UID=" . $this->sqlConnection); $res = $res->read(); - $this->dbc = new DBConnection( $res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'] ); + $this->dbc = new DBConnection($res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE']); } } - $this->ses = new DBSession( $this->dbc ); + $this->ses = new DBSession($this->dbc); //Query //Filter - if (is_array( $this->filter )) { + if (is_array($this->filter)) { $filterFields = $this->filter; } else { - parse_str( $this->filter, $filterFields ); + parse_str($this->filter, $filterFields); } $this->aFilter = $filterFields; $filter = ''; foreach ($filterFields as $field => $like) { - if ($like != '') { + if ($like !== '') { if ($filter !== '') { $filter .= ' AND '; } - if (isset( $this->filterType[$field] )) { + $like = mysqli_real_escape_string($this->dbc, $like); + if (isset($this->filterType[$field])) { switch ($this->filterType[$field]) { case '=': - $filter .= $field . ' = "' . mysql_real_escape_string( $like ) . '"'; + $filter .= $field . ' = "' . $like . '"'; break; case '<>': - $filter .= $field . ' <> "' . mysql_real_escape_string( $like ) . '"'; + $filter .= $field . ' <> "' . $like . '"'; break; case 'contains': - $filter .= $field . ' LIKE "%' . mysql_real_escape_string( $like ) . '%"'; + $filter .= $field . ' LIKE "%' . $like . '%"'; break; case 'like': - $filter .= $field . ' LIKE "' . mysql_real_escape_string( $like ) . '"'; + $filter .= $field . ' LIKE "' . $like . '"'; break; } } else { - $filter .= $field . ' = "' . mysql_real_escape_string( $like ) . '"'; + $filter .= $field . ' = "' . $like . '"'; } } } @@ -251,11 +251,11 @@ class pagedTable * QuickSearch */ if ($this->searchBy !== '') { - $aSB = explode( '|', $this->searchBy ); + $aSB = explode('|', $this->searchBy); $subFilter = ''; foreach ($aSB as $sBy) { $subFilter .= ($subFilter !== '') ? ' OR ' : ''; - $subFilter .= $sBy . ' LIKE "%' . G::sqlEscape( $this->fastSearch, $this->dbc->type ) . '%"'; + $subFilter .= $sBy . ' LIKE "%' . G::sqlEscape($this->fastSearch, $this->dbc->type) . '%"'; } if ($subFilter !== '') { $filter .= ($filter !== '') ? ' AND ' : ''; @@ -263,18 +263,18 @@ class pagedTable } } //Merge sort array defined by USER with the array defined by SQL - parse_str( $this->order, $orderFields ); - parse_str( $this->orderBy, $orderFields2 ); + parse_str($this->order, $orderFields); + parse_str($this->orderBy, $orderFields2); //User sort is more important (first in merge). - $orderFields3 = array_merge( $orderFields2, $orderFields ); + $orderFields3 = array_merge($orderFields2, $orderFields); //User sort is overwrites XMLs definition. - $orderFields = array_merge( $orderFields3, $orderFields2 ); + $orderFields = array_merge($orderFields3, $orderFields2); //Order (BY SQL DEFINITION AND USER'S DEFINITION) - $this->aOrder = array (); + $this->aOrder = array(); $order = ''; foreach ($orderFields as $field => $fieldOrder) { - $field = G::getUIDName( $field, '' ); - $fieldOrder = strtoupper( $fieldOrder ); + $field = G::getUIDName($field, ''); + $fieldOrder = strtoupper($fieldOrder); if ($fieldOrder === 'A') { $fieldOrder = 'ASC'; } @@ -305,57 +305,57 @@ class pagedTable * @param string xmlForm * @return string */ - public function setupFromXmlform ($xmlForm) + public function setupFromXmlform($xmlForm) { $this->xmlForm = $xmlForm; //Config $this->name = $xmlForm->name; $this->id = $xmlForm->id; - $this->sqlConnection = ((isset( $this->xmlForm->sqlConnection )) ? $this->xmlForm->sqlConnection : ''); - if (isset( $_GET['page'] )) { + $this->sqlConnection = ((isset($this->xmlForm->sqlConnection)) ? $this->xmlForm->sqlConnection : ''); + if (isset($_GET['page'])) { $this->currentPage = $_GET['page']; } else { $this->currentPage = 1; } - if (isset( $_GET['order'] )) { - $this->orderBy = urldecode( $_GET['order'] ); + if (isset($_GET['order'])) { + $this->orderBy = urldecode($_GET['order']); } else { $this->orderBy = ""; } - if (isset( $_GET['filter'] )) { - $this->filter = urldecode( $_GET['filter'] ); + if (isset($_GET['filter'])) { + $this->filter = urldecode($_GET['filter']); } else { $this->filter = ""; } - $this->ajaxServer = G::encryptLink( '../gulliver/pagedTableAjax' ); - $this->ownerPage = G::encryptLink( SYS_CURRENT_URI ); + $this->ajaxServer = G::encryptLink('../gulliver/pagedTableAjax'); + $this->ownerPage = G::encryptLink(SYS_CURRENT_URI); //Needed for $mysql_real_escape_string $auxDbc = new DBConnection(); - if (isset( $this->xmlForm->sql )) { - $this->sqlSelect = G::replaceDataField( $this->xmlForm->sql, $this->xmlForm->values ); + if (isset($this->xmlForm->sql)) { + $this->sqlSelect = G::replaceDataField($this->xmlForm->sql, $this->xmlForm->values); } else { - trigger_Error( 'Warning: sql query is empty', E_USER_WARNING ); + trigger_Error('Warning: sql query is empty', E_USER_WARNING); } // Config attributes from XMLFORM file - $myAttributes = get_class_vars( get_class( $this ) ); + $myAttributes = get_class_vars(get_class($this)); foreach ($this->xmlForm->xmlform->tree->attribute as $atrib => $value) { - if (array_key_exists( $atrib, $myAttributes )) { - eval( 'settype($value,gettype($this->' . $atrib . '));' ); + if (array_key_exists($atrib, $myAttributes)) { + eval('settype($value,gettype($this->' . $atrib . '));'); if ($value !== '') { - eval( '$this->' . $atrib . '=$value;' ); + eval('$this->' . $atrib . '=$value;'); } } } //Prepare the fields - $this->style = array (); + $this->style = array(); $this->gridWidth = ""; $this->gridFields = ""; - $this->fieldsType = array (); + $this->fieldsType = array(); foreach ($this->xmlForm->fields as $f => $v) { $r = $f; $this->fields[$r]['Name'] = $this->xmlForm->fields[$f]->name; $this->fields[$r]['Type'] = $this->xmlForm->fields[$f]->type; - if (isset( $this->xmlForm->fields[$f]->size )) { + if (isset($this->xmlForm->fields[$f]->size)) { $this->fields[$r]['Size'] = $this->xmlForm->fields[$f]->size; } $this->fields[$r]['Label'] = $this->xmlForm->fields[$f]->label; @@ -372,7 +372,7 @@ class pagedTable $r = $f; //Parse the column properties foreach ($this->xmlForm->fields[$f] as $attribute => $value) { - if (! is_object( $value )) { + if (!is_object($value)) { $this->style[$r][$attribute] = $value; } } @@ -533,7 +533,7 @@ class pagedTable * @access public * @return string */ - public function count () + public function count() { $this->prepareQuery(); return $this->query->count(); @@ -546,51 +546,51 @@ class pagedTable * @access public * @return string */ - public function renderTitle () + public function renderTitle() { //Render Title $thereisnotitle = true; foreach ($this->fields as $r => $rval) { if ($this->fields[$r]['Type'] === 'title') { - $this->tpl->assign( "title", $this->fields[$r]['Label'] ); + $this->tpl->assign("title", $this->fields[$r]['Label']); $thereisnotitle = false; } } if ($thereisnotitle) { - $this->tpl->assign( "title", ' ' ); + $this->tpl->assign("title", ' '); } //Render headers $this->colCount = 0; $this->shownFields = '['; foreach ($this->fields as $r => $rval) { if ($this->style[$r]['showInTable'] != '0') { - $this->tpl->newBlock( "headers" ); - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'DESC' : 'ASC'); - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder); - $this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? urlencode( G::createUID( '', $this->fields[$r]['Name'] ) . '=' . $sortOrder ) : '') . '&page=' . $this->currentPage; - $this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , "' . $sortOrder . '");return false;'; - if (isset( $this->style[$r]['href'] )) { - $this->tpl->assign( "href", $this->style[$r]['href'] ); + $this->tpl->newBlock("headers"); + $sortOrder = (((isset($this->aOrder[$this->fields[$r]['Name']])) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'DESC' : 'ASC'); + $sortOrder = (((isset($this->aOrder[$this->fields[$r]['Name']])) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder); + $this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? urlencode(G::createUID('', $this->fields[$r]['Name']) . '=' . $sortOrder) : '') . '&page=' . $this->currentPage; + $this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID('', $this->fields[$r]['Name']) . '" , "' . $sortOrder . '");return false;'; + if (isset($this->style[$r]['href'])) { + $this->tpl->assign("href", $this->style[$r]['href']); } - if (isset( $this->style[$r]['onsort'] )) { - $this->tpl->assign( "onclick", htmlentities( $this->style[$r]['onsort'], ENT_QUOTES, 'UTF-8' ) ); + if (isset($this->style[$r]['onsort'])) { + $this->tpl->assign("onclick", htmlentities($this->style[$r]['onsort'], ENT_QUOTES, 'UTF-8')); } - if (isset( $this->style[$r]['colWidth'] )) { - $this->tpl->assign( "width", $this->style[$r]['colWidth'] ); + if (isset($this->style[$r]['colWidth'])) { + $this->tpl->assign("width", $this->style[$r]['colWidth']); } - if (isset( $this->style[$r]['colWidth'] )) { - $this->tpl->assign( "widthPercent", ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . "%" ); + if (isset($this->style[$r]['colWidth'])) { + $this->tpl->assign("widthPercent", ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . "%"); } - if (isset( $this->style[$r]['titleAlign'] )) { - $this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' ); + if (isset($this->style[$r]['titleAlign'])) { + $this->tpl->assign("align", 'text-align:' . $this->style[$r]['titleAlign'] . ';'); } if ($this->style[$r]['titleVisibility'] != '0') { - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'b2' : ''); - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? 'b<' : $sortOrder); - $this->tpl->assign( "header", $this->fields[$r]['Label'] . $sortOrder ); - $this->tpl->assign( 'displaySeparator', (($this->colCount == 0) || (! isset( $this->fields[$r]['Label'] )) || ($this->fields[$r]['Label'] === '')) ? 'display:none;' : '' ); + $sortOrder = (((isset($this->aOrder[$this->fields[$r]['Name']])) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'b2' : ''); + $sortOrder = (((isset($this->aOrder[$this->fields[$r]['Name']])) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? 'b<' : $sortOrder); + $this->tpl->assign("header", $this->fields[$r]['Label'] . $sortOrder); + $this->tpl->assign('displaySeparator', (($this->colCount == 0) || (!isset($this->fields[$r]['Label'])) || ($this->fields[$r]['Label'] === '')) ? 'display:none;' : ''); } else { - $this->tpl->assign( 'displaySeparator', 'display:none;' ); + $this->tpl->assign('displaySeparator', 'display:none;'); } $this->colCount += 2; $this->shownFields .= ($this->shownFields !== '[') ? ',' : ''; @@ -610,7 +610,7 @@ class pagedTable * @param eter string result * @return string */ - public function renderField ($row, $r, $result) + public function renderField($row, $r, $result) { global $G_DATE_FORMAT; //BEGIN: Special content: __sqlEdit__,__sqlDelete__ @@ -620,10 +620,10 @@ class pagedTable $result['row__'] = $row; //END: Special content. //Merge $result with $xmlForm values (for default valuesSettings) - $result = array_merge( $this->xmlForm->values, $result ); + $result = array_merge($this->xmlForm->values, $result); switch (true) { case ($this->style[$r]['data'] != ''): - $value = ((isset( $result[$this->style[$r]['data']] )) ? $result[$this->style[$r]['data']] : ''); + $value = ((isset($result[$this->style[$r]['data']])) ? $result[$this->style[$r]['data']] : ''); break; default: $value = $this->fields[$r]['Label']; @@ -631,37 +631,37 @@ class pagedTable switch ($this->fields[$r]['Type']) { case 'date': /*Accept dates like 20070515 without - or / to separate its parts*/ - if (strlen( $value ) <= 10 && strlen( $value ) > 4) { - $value = str_replace( '/', '-', $value ); - if (strpos( $value, '-' ) === false) { - $value = substr( $value, 0, 4 ) . '-' . substr( $value, 4, 2 ) . '-' . substr( $value, 6, 2 ); + if (strlen($value) <= 10 && strlen($value) > 4) { + $value = str_replace('/', '-', $value); + if (strpos($value, '-') === false) { + $value = substr($value, 0, 4) . '-' . substr($value, 4, 2) . '-' . substr($value, 6, 2); } } } - $this->tpl->newBlock( "field" ); - $this->tpl->assign( 'width', $this->style[$r]['colWidth'] ); - $this->tpl->assign( 'widthPercent', ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . '%' ); - $this->tpl->assign( 'className', (isset( $this->style[$r]['colClassName'] ) && ($this->style[$r]['colClassName'])) ? $this->style[$r]['colClassName'] : $this->tdClass ); - $this->tpl->assign( 'style', $this->tdStyle ); - if (isset( $this->style[$r]['align'] )) { - $this->tpl->assign( "align", $this->style[$r]['align'] ); + $this->tpl->newBlock("field"); + $this->tpl->assign('width', $this->style[$r]['colWidth']); + $this->tpl->assign('widthPercent', ($this->style[$r]['colWidth'] * 100 / $this->totalWidth) . '%'); + $this->tpl->assign('className', (isset($this->style[$r]['colClassName']) && ($this->style[$r]['colClassName'])) ? $this->style[$r]['colClassName'] : $this->tdClass); + $this->tpl->assign('style', $this->tdStyle); + if (isset($this->style[$r]['align'])) { + $this->tpl->assign("align", $this->style[$r]['align']); } - if (isset( $this->style[$r]['colAlign'] )) { - $this->tpl->assign( "align", $this->style[$r]['colAlign'] ); + if (isset($this->style[$r]['colAlign'])) { + $this->tpl->assign("align", $this->style[$r]['colAlign']); } /** * BEGIN : Reeplace of @@, @%,... * in field's attributes like onclick, link, * ... */ - if (isset( $this->xmlForm->fields[$this->fields[$r]['Name']]->onclick )) { - $this->xmlForm->fields[$this->fields[$r]['Name']]->onclick = G::replaceDataField( $this->style[$r]['onclick'], $result ); + if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->onclick)) { + $this->xmlForm->fields[$this->fields[$r]['Name']]->onclick = G::replaceDataField($this->style[$r]['onclick'], $result); } - if (isset( $this->xmlForm->fields[$this->fields[$r]['Name']]->link )) { - $this->xmlForm->fields[$this->fields[$r]['Name']]->link = G::replaceDataField( $this->style[$r]['link'], $result ); + if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->link)) { + $this->xmlForm->fields[$this->fields[$r]['Name']]->link = G::replaceDataField($this->style[$r]['link'], $result); } - if (isset( $this->xmlForm->fields[$this->fields[$r]['Name']]->value )) { - $this->xmlForm->fields[$this->fields[$r]['Name']]->value = G::replaceDataField( $this->style[$r]['value'], $result ); + if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->value)) { + $this->xmlForm->fields[$this->fields[$r]['Name']]->value = G::replaceDataField($this->style[$r]['value'], $result); } /** * BREAK : Reeplace of @@, @%,... @@ -670,24 +670,24 @@ class pagedTable * Rendering of the field */ $this->xmlForm->setDefaultValues(); - $this->xmlForm->setValues( $result ); + $this->xmlForm->setValues($result); $this->xmlForm->fields[$this->fields[$r]['Name']]->mode = 'view'; - if ((array_search( 'rendergrid', get_class_methods( get_class( $this->xmlForm->fields[$this->fields[$r]['Name']] ) ) ) !== false) || (array_search( 'renderGrid', get_class_methods( get_class( $this->xmlForm->fields[$this->fields[$r]['Name']] ) ) ) !== false)) { - $htmlField = $this->xmlForm->fields[$this->fields[$r]['Name']]->renderGrid( array ($value - ), $this->xmlForm ); - $this->tpl->assign( "value", $htmlField[0] ); + if ((array_search('rendergrid', get_class_methods(get_class($this->xmlForm->fields[$this->fields[$r]['Name']]))) !== false) || (array_search('renderGrid', get_class_methods(get_class($this->xmlForm->fields[$this->fields[$r]['Name']]))) !== false)) { + $htmlField = $this->xmlForm->fields[$this->fields[$r]['Name']]->renderGrid(array($value + ), $this->xmlForm); + $this->tpl->assign("value", $htmlField[0]); } else { } /** * CONTINUE : Reeplace of @@, @%,... */ - if (isset( $this->xmlForm->fields[$this->fields[$r]['Name']]->onclick )) { + if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->onclick)) { $this->xmlForm->fields[$this->fields[$r]['Name']]->onclick = $this->style[$r]['onclick']; } - if (isset( $this->xmlForm->fields[$this->fields[$r]['Name']]->link )) { + if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->link)) { $this->xmlForm->fields[$this->fields[$r]['Name']]->link = $this->style[$r]['link']; } - if (isset( $this->xmlForm->fields[$this->fields[$r]['Name']]->value )) { + if (isset($this->xmlForm->fields[$this->fields[$r]['Name']]->value)) { $this->xmlForm->fields[$this->fields[$r]['Name']]->value = $this->style[$r]['value']; } /** @@ -703,43 +703,43 @@ class pagedTable * @access public * @return string */ - public function defaultStyle () + public function defaultStyle() { // for($r=1;$r<=sizeof($this->fields);$r++) foreach ($this->fields as $r => $rval) { - $this->style[$r] = array ('showInTable' => '1','titleVisibility' => '1','colWidth' => '150','onclick' => '','event' => '' + $this->style[$r] = array('showInTable' => '1', 'titleVisibility' => '1', 'colWidth' => '150', 'onclick' => '', 'event' => '' ); //Some widths - if (! (strpos( ' date linknew ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) { + if (!(strpos(' date linknew ', ' ' . $this->fields[$r]['Type'] . ' ') === false)) { $this->style[$r]['colWidth'] = '70'; //Data source: } - if (! (strpos( ' title button linknew image-text jslink ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) { + if (!(strpos(' title button linknew image-text jslink ', ' ' . $this->fields[$r]['Type'] . ' ') === false)) { $this->style[$r]['data'] = ''; //If the control is a link it shows the label } else { $this->style[$r]['data'] = $this->fields[$r]['Name']; //ELSE: The data value for that field } - //Hidden fields - if (! isset( $this->style[$r]['showInTable'] )) { - if (! (strpos( ' title button endgrid2 submit password ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) { + //Hidden fields + if (!isset($this->style[$r]['showInTable'])) { + if (!(strpos(' title button endgrid2 submit password ', ' ' . $this->fields[$r]['Type'] . ' ') === false)) { $this->style[$r]['showInTable'] = '0'; } else { $this->style[$r]['showInTable'] = '1'; } } //Hidden titles - if (! (strpos( ' linknew button endgrid2 ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) { + if (!(strpos(' linknew button endgrid2 ', ' ' . $this->fields[$r]['Type'] . ' ') === false)) { $this->style[$r]['titleVisibility'] = '0'; } //Align titles $this->style[$r]['titleAlign'] = 'center'; //Align fields - if (isset( $_SESSION['SET_DIRECTION'] ) && (strcasecmp( $_SESSION['SET_DIRECTION'], 'rtl' ) === 0)) { + if (isset($_SESSION['SET_DIRECTION']) && (strcasecmp($_SESSION['SET_DIRECTION'], 'rtl') === 0)) { $this->style[$r]['align'] = 'right'; } else { $this->style[$r]['align'] = 'left'; } - if (! (strpos( ' linknew date ', ' ' . $this->fields[$r]['Type'] . ' ' ) === false)) { + if (!(strpos(' linknew date ', ' ' . $this->fields[$r]['Type'] . ' ') === false)) { $this->style[$r]['align'] = 'center'; } } @@ -774,77 +774,76 @@ class pagedTable * @access public * @return string */ - public function renderTable ($block = '') + public function renderTable($block = '') { - $filter = new InputFilter(); - $this->orderBy = $filter->xssFilterHard($this->orderBy); - $this->currentPage = $filter->xssFilterHard($this->currentPage); - $this->id = $filter->xssFilterHard($this->id); - $this->name = $filter->xssFilterHard($this->name); - $this->ownerPage = $filter->xssFilterHard($this->ownerPage); + $this->orderBy = $filter->xssFilterHard($this->orderBy); + $this->currentPage = $filter->xssFilterHard($this->currentPage); + $this->id = $filter->xssFilterHard($this->id); + $this->name = $filter->xssFilterHard($this->name); + $this->ownerPage = $filter->xssFilterHard($this->ownerPage); // DBConnection $this->prepareQuery(); //Query for get the number of rows - $this->query = $this->ses->execute( $this->sql ); + $this->query = $this->ses->execute($this->sql); $this->totRows = $this->query->count(); - $this->totpages = ceil( $this->query->count() / $this->rowsPerPage ); + $this->totpages = ceil($this->query->count() / $this->rowsPerPage); //Query for obtain the records - $this->query = $this->ses->execute( $this->sql . ' LIMIT ' . (($this->currentPage - 1) * $this->rowsPerPage) . ', ' . $this->rowsPerPage ); + $this->query = $this->ses->execute($this->sql . ' LIMIT ' . (($this->currentPage - 1) * $this->rowsPerPage) . ', ' . $this->rowsPerPage); // Prepare the template - $this->tpl = new TemplatePower( PATH_CORE . $this->template ); + $this->tpl = new TemplatePower(PATH_CORE . $this->template); $this->tpl->prepare(); /** * ******** HEAD BLOCK ************** */ if (($block === '') || ($block === 'head')) { - $this->tpl->newBlock( 'headBlock' ); - $this->tpl->assign( 'pagedTable_Id', $this->id ); - $this->tpl->assign( 'pagedTable_Name', $this->name ); - $this->tpl->assign( 'pagedTable_Height', $this->xmlForm->height ); - $this->xmlForm->home = $filter->xssFilterHard($this->xmlForm->home); - $this->filterForm = $filter->xssFilterHard($this->filterForm); - $this->menu = $filter->xssFilterHard($this->menu); - if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) { - $filterForm = new filterForm( $this->filterForm, $this->xmlForm->home ); + $this->tpl->newBlock('headBlock'); + $this->tpl->assign('pagedTable_Id', $this->id); + $this->tpl->assign('pagedTable_Name', $this->name); + $this->tpl->assign('pagedTable_Height', $this->xmlForm->height); + $this->xmlForm->home = $filter->xssFilterHard($this->xmlForm->home); + $this->filterForm = $filter->xssFilterHard($this->filterForm); + $this->menu = $filter->xssFilterHard($this->menu); + if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) { + $filterForm = new filterForm($this->filterForm, $this->xmlForm->home); if ($this->menu === '') { $this->menu = 'gulliver/pagedTable_Options'; } } - if (file_exists( $this->xmlForm->home . $this->menu . '.xml' )) { - $menu = new xmlMenu( $this->menu, $this->xmlForm->home ); - $this->tpl->newBlock( 'headerBlock' ); + if (file_exists($this->xmlForm->home . $this->menu . '.xml')) { + $menu = new xmlMenu($this->menu, $this->xmlForm->home); + $this->tpl->newBlock('headerBlock'); $template = PATH_CORE . 'templates' . PATH_SEP . $menu->type . '.html'; - $menu->setValues( $this->xmlForm->values ); - $menu->setValues( array ('PAGED_TABLE_ID' => $this->id - ) ); - $menu->setValues( array ('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch - ) ); - if (isset( $filterForm->name )) { - $menu->setValues( array ('SEARCH_FILTER_FORM' => $filterForm->name - ) ); + $menu->setValues($this->xmlForm->values); + $menu->setValues(array('PAGED_TABLE_ID' => $this->id + )); + $menu->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch + )); + if (isset($filterForm->name)) { + $menu->setValues(array('SEARCH_FILTER_FORM' => $filterForm->name + )); } - $this->tpl->assign( 'content', $menu->render( $template, $scriptCode ) ); - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile( $menu->scriptURL ); - $oHeadPublisher->addScriptCode( $scriptCode ); + $this->tpl->assign('content', $menu->render($template, $scriptCode)); + $oHeadPublisher = headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($menu->scriptURL); + $oHeadPublisher->addScriptCode($scriptCode); } - if (file_exists( $this->xmlForm->home . $this->filterForm . '.xml' )) { - $this->tpl->newBlock( 'headerBlock' ); + if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) { + $this->tpl->newBlock('headerBlock'); $this->filterForm_Id = $filterForm->id; $filterForm->type = 'filterform'; $filterForm->ajaxServer = '../gulliver/defaultAjax'; $template = PATH_CORE . 'templates/' . $filterForm->type . '.html'; - $filterForm->setValues( $this->xmlForm->values ); - $filterForm->setValues( array ('PAGED_TABLE_ID' => $this->id - ) ); - $filterForm->setValues( array ('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch - ) ); - $this->tpl->assign( 'content', $filterForm->render( $template, $scriptCode ) ); - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile( $filterForm->scriptURL ); - $oHeadPublisher->addScriptCode( $scriptCode ); - if (isset( $_SESSION )) { + $filterForm->setValues($this->xmlForm->values); + $filterForm->setValues(array('PAGED_TABLE_ID' => $this->id + )); + $filterForm->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch + )); + $this->tpl->assign('content', $filterForm->render($template, $scriptCode)); + $oHeadPublisher = headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($filterForm->scriptURL); + $oHeadPublisher->addScriptCode($scriptCode); + if (isset($_SESSION)) { $_SESSION[$filterForm->id] = $filterForm->values; } } @@ -853,169 +852,170 @@ class pagedTable * ******** CONTENT BLOCK ************** */ if (($block === '') || ($block === 'content')) { - $this->tpl->newBlock( 'contentBlock' ); - $this->tpl->assign( 'gridWidth', '=[' . substr( $this->gridWidth, 1 ) . ']' ); - $this->tpl->assign( 'fieldNames', '=[' . substr( $this->gridFields, 1 ) . ']' ); - $this->tpl->assign( 'ajaxUri', '="' . addslashes( $this->ajaxServer ) . '"' ); - $this->tpl->assign( 'currentUri', '="' . addslashes( $this->ownerPage ) . '"' ); - $this->tpl->assign( 'currentOrder', '="' . addslashes( $this->orderBy ) . '"' ); - $this->tpl->assign( 'currentPage', '=' . $this->currentPage ); - $this->tpl->assign( 'currentFilter', '="' . '"' ); - $this->tpl->assign( 'totalRows', '=' . $this->query->count() ); - $this->tpl->assign( 'rowsPerPage', '=' . $this->rowsPerPage ); - $this->tpl->assign( 'popupPage', '="' . addslashes( $this->popupPage ) . '"' ); - $this->tpl->assign( 'popupWidth', '=' . $this->popupWidth ); - $this->tpl->assign( 'popupHeight', '=' . $this->popupHeight ); - $this->tpl->assign( 'pagedTable_Id', $this->id ); - $this->tpl->assign( 'pagedTable_Name', $this->name ); - $this->tpl->assign( "pagedTable_JS", "{$this->id}.element=document.getElementById('pagedtable[{$this->id}]');" ); + $this->tpl->newBlock('contentBlock'); + $this->tpl->assign('gridWidth', '=[' . substr($this->gridWidth, 1) . ']'); + $this->tpl->assign('fieldNames', '=[' . substr($this->gridFields, 1) . ']'); + $this->tpl->assign('ajaxUri', '="' . addslashes($this->ajaxServer) . '"'); + $this->tpl->assign('currentUri', '="' . addslashes($this->ownerPage) . '"'); + $this->tpl->assign('currentOrder', '="' . addslashes($this->orderBy) . '"'); + $this->tpl->assign('currentPage', '=' . $this->currentPage); + $this->tpl->assign('currentFilter', '="' . '"'); + $this->tpl->assign('totalRows', '=' . $this->query->count()); + $this->tpl->assign('rowsPerPage', '=' . $this->rowsPerPage); + $this->tpl->assign('popupPage', '="' . addslashes($this->popupPage) . '"'); + $this->tpl->assign('popupWidth', '=' . $this->popupWidth); + $this->tpl->assign('popupHeight', '=' . $this->popupHeight); + $this->tpl->assign('pagedTable_Id', $this->id); + $this->tpl->assign('pagedTable_Name', $this->name); + $this->tpl->assign("pagedTable_JS", "{$this->id}.element=document.getElementById('pagedtable[{$this->id}]');"); $this->renderTitle(); //Render rows $gridRows = 0; - for ($j = 0; $j < $this->query->count(); $j ++) { + for ($j = 0; $j < $this->query->count(); $j++) { $result = $this->query->read(); //if (($j>=(($this->currentPage-1)*$this->rowsPerPage))&&($j<(($this->currentPage)*$this->rowsPerPage))) //{ - $gridRows ++; - $this->tpl->newBlock( "row" ); - $this->tpl->assign( "class", "Row" . (($j % 2) + 1) ); + $gridRows++; + $this->tpl->newBlock("row"); + $this->tpl->assign("class", "Row" . (($j % 2) + 1)); $this->tdStyle = ''; $this->tdClass = ''; foreach ($this->fields as $r => $rval) { - if (strcasecmp( $this->fields[$r]['Type'], 'cellMark' ) == 0) { + if (strcasecmp($this->fields[$r]['Type'], 'cellMark') == 0) { $result1 = $result; $result1['row__'] = $j + 1; $this->xmlForm->setDefaultValues(); - $this->xmlForm->setValues( $result1 ); - $result1 = array_merge( $this->xmlForm->values, $result1 ); - $this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle( $result1, $this->xmlForm ); - $this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass( $result1, $this->xmlForm ); + $this->xmlForm->setValues($result1); + $result1 = array_merge($this->xmlForm->values, $result1); + $this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle($result1, $this->xmlForm); + $this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass($result1, $this->xmlForm); } elseif ($this->style[$r]['showInTable'] != '0') { - $this->renderField( $j + 1, $r, $result ); + $this->renderField($j + 1, $r, $result); } } //} } - $this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page - $this->tpl->newBlock( 'rowTag' ); - $this->tpl->assign( 'rowId', 'insertAtLast' ); + $this->tpl->assign('_ROOT.gridRows', '=' . $gridRows); //number of rows in the current page + $this->tpl->newBlock('rowTag'); + $this->tpl->assign('rowId', 'insertAtLast'); if ($this->currentPage > 1) { $firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1'; - $firstUrl = $filter->xssFilterHard($firstUrl); + $firstUrl = $filter->xssFilterHard($firstUrl); $firstAjax = $this->id . ".doGoToPage(1);return false;"; - $firstAjax = $filter->xssFilterHard($firstAjax); + $firstAjax = $filter->xssFilterHard($firstAjax); $prevpage = $this->currentPage - 1; $prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage; - $prevUrl = $filter->xssFilterHard($prevUrl); + $prevUrl = $filter->xssFilterHard($prevUrl); $prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;"; - $prevAjax = $filter->xssFilterHard($prevAjax); - $first = " "; - $prev = " "; + $prevAjax = $filter->xssFilterHard($prevAjax); + $first = " "; + $prev = " "; } else { $first = " "; $prev = " "; } if ($this->currentPage < $this->totpages) { $lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totpages; - $lastUrl = $filter->xssFilterHard($lastUrl); + $lastUrl = $filter->xssFilterHard($lastUrl); $lastAjax = $this->id . ".doGoToPage(" . $this->totpages . ");return false;"; - $lastAjax = $filter->xssFilterHard($lastAjax); + $lastAjax = $filter->xssFilterHard($lastAjax); $nextpage = $this->currentPage + 1; $nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage; - $nextUrl = $filter->xssFilterHard($nextUrl); + $nextUrl = $filter->xssFilterHard($nextUrl); $nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;"; - $nextAjax = $filter->xssFilterHard($nextAjax); - $next = " "; - $last = " "; + $nextAjax = $filter->xssFilterHard($nextAjax); + $next = " "; + $last = " "; } else { $next = " "; $last = " "; } $pagesEnum = ''; - for ($r = 1; $r <= $this->totpages; $r ++) { + for ($r = 1; $r <= $this->totpages; $r++) { if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) { $pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;"; - if ($r != $this->currentPage) { - $pageAjax = $filter->xssFilterHard($pageAjax); - $pagesEnum .= " ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $pageAjax . "\">" . $r . ""; + if ($r != $this->currentPage) { + $pageAjax = $filter->xssFilterHard($pageAjax); + $pagesEnum .= " ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $pageAjax . "\">" . $r . ""; } else { $pagesEnum .= " " . $r . ""; } } } if ($this->query->count() === 0) { - $this->tpl->newBlock( 'norecords' ); - $this->tpl->assign( "columnCount", $this->colCount ); + $this->tpl->newBlock('norecords'); + $this->tpl->assign("columnCount", $this->colCount); $noRecordsFound = 'ID_NO_RECORDS_FOUND'; - if (G::LoadTranslation( $noRecordsFound )) { - $noRecordsFound = G::LoadTranslation( $noRecordsFound ); + if (G::LoadTranslation($noRecordsFound)) { + $noRecordsFound = G::LoadTranslation($noRecordsFound); } - $this->tpl->assign( "noRecordsFound", $noRecordsFound ); + $this->tpl->assign("noRecordsFound", $noRecordsFound); } - if (! $this->disableFooter) { - $this->tpl->newBlock( "bottomFooter" ); - $this->tpl->assign( "columnCount", $this->colCount ); - $this->tpl->assign( "pagedTableId", $this->id ); + if (!$this->disableFooter) { + $this->tpl->newBlock("bottomFooter"); + $this->tpl->assign("columnCount", $this->colCount); + $this->tpl->assign("pagedTableId", $this->id); if (($this->query->count() !== 0)) { if ($this->totpages > 1) { - $this->tpl->assign( "first", $first ); - $this->tpl->assign( "prev", $prev ); - $this->tpl->assign( "next", $next ); - $this->tpl->assign( "last", $last ); + $this->tpl->assign("first", $first); + $this->tpl->assign("prev", $prev); + $this->tpl->assign("next", $next); + $this->tpl->assign("last", $last); } - $this->tpl->assign( "currentPage", $this->currentPage ); - $this->tpl->assign( "totalPages", $this->totpages ); + $this->tpl->assign("currentPage", $this->currentPage); + $this->tpl->assign("totalPages", $this->totpages); $firstRow = ($this->currentPage - 1) * $this->rowsPerPage + 1; $lastRow = $firstRow + $this->query->count() - 1; - $this->tpl->assign( "firstRow", $firstRow ); - $this->tpl->assign( "lastRow", $lastRow ); - $this->tpl->assign( "totalRows", $this->totRows ); + $this->tpl->assign("firstRow", $firstRow); + $this->tpl->assign("lastRow", $lastRow); + $this->tpl->assign("totalRows", $this->totRows); } else { - $this->tpl->assign( "indexStyle", 'visibility:hidden;' ); + $this->tpl->assign("indexStyle", 'visibility:hidden;'); } if ($this->searchBy) { - $this->tpl->assign( "fastSearchValue", $this->fastSearch ); + $this->tpl->assign("fastSearchValue", $this->fastSearch); } else { - $this->tpl->assign( "fastSearchStyle", 'visibility:hidden;' ); + $this->tpl->assign("fastSearchStyle", 'visibility:hidden;'); } if ($this->addRow) { if ($this->sqlInsert != '') { - $this->tpl->assign( "insert", ''./*G::LoadXml('labels','ID_ADD_NEW')*/ 'ID_ADD_NEW' . '' ); + $this->tpl->assign("insert", '' ./*G::LoadXml('labels','ID_ADD_NEW')*/ + 'ID_ADD_NEW' . ''); } } - $this->tpl->assign( "pagesEnum", $pagesEnum ); - } - ?> - - tpl->newBlock( "closeBlock" ); + $this->tpl->newBlock("closeBlock"); } $this->tpl->printToScreen(); - unset( $this->tpl ); - unset( $this->dbc ); - unset( $this->ses ); + unset($this->tpl); + unset($this->dbc); + unset($this->ses); $_SESSION['pagedTable[' . $this->id . ']'] = base64_encode(serialize($this)); return; } @@ -1028,14 +1028,14 @@ class pagedTable * @param array $data * @return void */ - public function printForm ($filename, $data = array()) + public function printForm($filename, $data = array()) { // $G_FORM = new Form($filename, PATH_XMLFORM); // echo $G_FORM->render(PATH_TPL . 'xmlform.html', $scriptContent); global $G_PUBLISH; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $filename, '', $data, $this->popupSubmit ); - G::RenderPage( "publish", "blank" ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', $filename, '', $data, $this->popupSubmit); + G::RenderPage("publish", "blank"); } } @@ -1046,18 +1046,17 @@ class pagedTable * @param string $o * @return void */ -function var_dump2 ($o) +function var_dump2($o) { - if (is_object( $o ) || is_array( $o )) { + if (is_object($o) || is_array($o)) { foreach ($o as $key => $value) { - echo (''); - var_dump( $key ); - echo (''); - print_r( $value ); - echo ('
'); + echo(''); + var_dump($key); + echo(''); + print_r($value); + echo('
'); } } else { - var_dump( $o ); + var_dump($o); } } - diff --git a/gulliver/system/class.publisher.php b/gulliver/system/class.publisher.php index 64fd1769f..8ba2f9797 100644 --- a/gulliver/system/class.publisher.php +++ b/gulliver/system/class.publisher.php @@ -276,7 +276,7 @@ class Publisher if ($Part['Template'] == 'grid') { print ('') ; } - $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher = headPublisher::getSingleton(); $oHeadPublisher->addScriptFile( $G_FORM->scriptURL ); $oHeadPublisher->addScriptCode( $scriptCode ); @@ -535,7 +535,7 @@ class Publisher $mainPanelScript .= '});'; $mainPanelScript .= 'function ' . $panelName . 'Clear(){'; $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . 'Tabs[r].style.display="none";}'; - $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher = headPublisher::getSingleton(); $oHeadPublisher->addScriptCode( $mainPanelScript ); break; diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index bfd54aa5a..7b2c4c4d8 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -204,7 +204,6 @@ class RBAC ]; $this->aliasPermissions['PM_CASES'] = [self::PM_GUEST_CASE]; $this->aliasPermissions['PM_LOGIN'] = [self::PM_GUEST_CASE]; - } /** @@ -231,37 +230,30 @@ class RBAC public function initRBAC() { if (is_null($this->userObj)) { - $this->userObj = new RbacUsers(); } if (is_null($this->systemObj)) { - $this->systemObj = new Systems(); } if (is_null($this->usersRolesObj)) { - $this->usersRolesObj = new UsersRoles(); } if (is_null($this->rolesObj)) { - $this->rolesObj = new Roles(); } if (is_null($this->permissionsObj)) { - $this->permissionsObj = new Permissions(); } if (is_null($this->rolesPermissionsObj)) { - $this->rolesPermissionsObj = new RolesPermissions(); } if (is_null($this->authSourcesObj)) { - $this->authSourcesObj = new AuthenticationSource(); } //hook for RBAC plugins @@ -269,13 +261,11 @@ class RBAC if (is_dir($pathPlugins)) { if ($handle = opendir($pathPlugins)) { while (false !== ($file = readdir($handle))) { - if (strpos($file, '.php', 1) && is_file($pathPlugins . PATH_SEP . $file) && substr($file, 0, - 6) == 'class.' && substr($file, -4) == '.php') { - + if (strpos($file, '.php', 1) && is_file($pathPlugins . PATH_SEP . $file) && + substr($file, 0, 6) === 'class.' && substr($file, -4) === '.php') { $className = substr($file, 6, strlen($file) - 10); require_once($pathPlugins . PATH_SEP . $file); $this->aRbacPlugins[] = $className; - } } } @@ -873,9 +863,9 @@ class RBAC */ public function VerifyWithOtherAuthenticationSource($authType, $userFields, $strPass) { - if ($authType == '' || $authType == 'MYSQL') { + if ($authType === '' || $authType === 'MYSQL') { //check if the user is active - if ($userFields['USR_STATUS'] != 1) { + if ($userFields['USR_STATUS'] !== 1) { return -3; //inactive user } @@ -886,13 +876,12 @@ class RBAC } foreach ($this->aRbacPlugins as $className) { - if (strtolower($className) == strtolower($authType)) { + if (strtolower($className) === strtolower($authType)) { $plugin = new $className(); - $plugin->sAuthSource = $userFields["UID_AUTH_SOURCE"]; + $plugin->sAuthSource = $userFields['UID_AUTH_SOURCE']; $plugin->sSystem = $this->sSystem; - $bValidUser = false; - $bValidUser = $plugin->VerifyLogin($userFields["USR_AUTH_USER_DN"], $strPass); + $bValidUser = $plugin->VerifyLogin($userFields['USR_AUTH_USER_DN'], $strPass); if ($bValidUser === true) { return ($userFields['USR_UID']); } else { @@ -924,14 +913,16 @@ class RBAC { /*----------------------------------********---------------------------------*/ - $licenseManager =& PmLicenseManager::getSingleton(); - if (in_array(G::encryptOld($licenseManager->result), - array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) { + $licenseManager = PmLicenseManager::getSingleton(); + if (in_array( + G::encryptOld($licenseManager->result), + ['38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'] + )) { return -7; } /*----------------------------------********---------------------------------*/ - if (strlen($strPass) == 0) { + if (strlen($strPass) === 0) { return -2; } //check if the user exists in the table RB_WORKFLOW.USERS @@ -955,12 +946,10 @@ class RBAC //Hook for RBAC plugins if ($authType != "mysql" && $authType != "") { $res = $this->VerifyWithOtherAuthenticationSource($authType, $this->userObj->fields, $strPass); - return $res; } else { $this->userObj->reuseUserFields = true; $res = $this->userObj->VerifyLogin($strUser, $strPass); - return $res; } } @@ -976,7 +965,6 @@ class RBAC public function verifyUser($strUser) { $res = $this->userObj->verifyUser($strUser); - return $res; } @@ -990,7 +978,6 @@ class RBAC public function verifyUserId($strUserId) { $res = $this->userObj->verifyUserId($strUserId); - return $res; } @@ -1051,24 +1038,24 @@ class RBAC */ public function createUser($dataCase = [], $rolCode = '') { - if ($dataCase["USR_STATUS"] . "" == "1") { - $dataCase["USR_STATUS"] = "ACTIVE"; + if ($dataCase['USR_STATUS'] . '' === '1') { + $dataCase['USR_STATUS'] = 'ACTIVE'; } - if ($dataCase["USR_STATUS"] . "" == "0") { - $dataCase["USR_STATUS"] = "INACTIVE"; + if ($dataCase['USR_STATUS'] . '' === '0') { + $dataCase['USR_STATUS'] = 'INACTIVE'; } - if ($dataCase['USR_STATUS'] == 'ACTIVE') { + if ($dataCase['USR_STATUS'] === 'ACTIVE') { $dataCase['USR_STATUS'] = 1; } - if ($dataCase['USR_STATUS'] == 'INACTIVE') { + if ($dataCase['USR_STATUS'] === 'INACTIVE') { $dataCase['USR_STATUS'] = 0; } $userUid = $this->userObj->create($dataCase); - if ($rolCode != '') { + if ($rolCode !== '') { $this->assignRoleToUser($userUid, $rolCode); } @@ -1086,7 +1073,7 @@ class RBAC public function updateUser($dataCase = [], $rolCode = '') { if (isset($dataCase['USR_STATUS'])) { - if ($dataCase['USR_STATUS'] == 'ACTIVE') { + if ($dataCase['USR_STATUS'] === 'ACTIVE') { $dataCase['USR_STATUS'] = 1; } } @@ -1141,9 +1128,9 @@ class RBAC $userStatus = 1; } - $aFields = $this->userObj->load($userUid); - $aFields['USR_STATUS'] = $userStatus; - $this->userObj->update($aFields); + $fields = $this->userObj->load($userUid); + $fields['USR_STATUS'] = $userStatus; + $this->userObj->update($fields); } /** @@ -1194,7 +1181,7 @@ class RBAC */ public function createPermision($code) { - return $this->permissionsObj->create(array('PER_CODE' => $code)); + return $this->permissionsObj->create(['PER_CODE' => $code]); } /** @@ -1650,8 +1637,10 @@ class RBAC */ public function createAuthSource($dataCase) { - $dataCase['AUTH_SOURCE_PASSWORD'] = G::encrypt($dataCase['AUTH_SOURCE_PASSWORD'], - $dataCase['AUTH_SOURCE_SERVER_NAME']) . "_2NnV3ujj3w"; + $dataCase['AUTH_SOURCE_PASSWORD'] = G::encrypt( + $dataCase['AUTH_SOURCE_PASSWORD'], + $dataCase['AUTH_SOURCE_SERVER_NAME'] + ) . "_2NnV3ujj3w"; $this->authSourcesObj->create($dataCase); } @@ -1666,8 +1655,10 @@ class RBAC */ public function updateAuthSource($dataCase) { - $dataCase['AUTH_SOURCE_PASSWORD'] = G::encrypt($dataCase['AUTH_SOURCE_PASSWORD'], - $dataCase['AUTH_SOURCE_SERVER_NAME']) . "_2NnV3ujj3w"; + $dataCase['AUTH_SOURCE_PASSWORD'] = G::encrypt( + $dataCase['AUTH_SOURCE_PASSWORD'], + $dataCase['AUTH_SOURCE_SERVER_NAME'] + ) . "_2NnV3ujj3w"; $this->authSourcesObj->update($dataCase); } @@ -1928,14 +1919,18 @@ class RBAC $isAssignedNewpermissions = $this->getPermissionAssignedRole($aRow['ROL_UID'], $item['PER_UID']); $assignPermissions = true; if (!$isAssignedNewpermissions) { - if ($aRow['ROL_CODE'] == 'PROCESSMAKER_OPERATOR' && in_array($item['PER_CODE'], - $permissionsForOperator)) { + if ($aRow['ROL_CODE'] == 'PROCESSMAKER_OPERATOR' && in_array( + $item['PER_CODE'], + $permissionsForOperator + )) { $assignPermissions = false; } if (!in_array($aRow['ROL_CODE'], $perCodePM)) { $assignPermissions = false; - $checkPermisionEdit = $this->getPermissionAssignedRole($aRow['ROL_UID'], - '00000000000000000000000000000014'); + $checkPermisionEdit = $this->getPermissionAssignedRole( + $aRow['ROL_UID'], + '00000000000000000000000000000014' + ); if ($checkPermisionEdit && !in_array($item['PER_CODE'], $permissionsForOperator)) { $assignPermissions = true; } @@ -2025,4 +2020,3 @@ class RBAC return self::GUEST_USER_UID === $usrUid; } } - diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index 9d76da2df..77f0fdcdc 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -29,13 +29,12 @@ * XmlFormFieldWYSIWYGEditor class definition * It is useful to see dynaforms how are built * - * @package gulliver.system + * @package gulliver.system * @author * * @copyright (C) 2012 by Colosa Development Team. * */ - class XmlFormFieldWYSIWYGEditor extends XmlFormField { public $width = '100%'; @@ -50,15 +49,18 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField * * @author * @access public + * * @param string $value * @param string $owner + * * @return string * */ - public function render ($value, $owner = null) + public function render($value, $owner = null) { $value = ($value == '') ? '
' : $value; - $html = ""; + $html = ""; return $html; } @@ -68,19 +70,21 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField * * @author * @access public + * * @param string $element + * * @return string * */ - public function attachEvents ($element) + public function attachEvents($element) { - $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; - $editorDefinition .= 'var domainURL = "/sys'.config("system.workspace").'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; - $serverConf =& ServerConf::getSingleton(); + $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; + $editorDefinition .= 'var domainURL = "/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/"'; + $serverConf = ServerConf::getSingleton(); - switch ($this->editorType){ + switch ($this->editorType) { case 'EMAIL_TEMPLATE': - $editorDefinition.= ' + $editorDefinition .= ' // is necessary the process uid variable in order to load the picker correctly var actualCaretPositionBookmark; var formProcessID = document.getElementById("form[pro_uid]").value; @@ -118,7 +122,7 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField '; break; case 'OUTPUT_DOCUMENT': - $editorDefinition.= ' + $editorDefinition .= ' // is necessary the process uid variable in order to load the picker correctly var formProcessID = document.getElementById("form[PRO_UID]").value; tinyMCE.init({ @@ -156,7 +160,7 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField break; case 'DYNAFORM_TEMPLATE': - $editorDefinition.= ' + $editorDefinition .= ' var formProcessID = document.getElementById("form[PRO_UID]").value; var formDynaformID = document.getElementById("form[DYN_UID]").value; var actualCaretPositionBookmark; @@ -177,7 +181,7 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField popup_css : "/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css", skin : "o2k7", skin_variant : "silver", - content_css : "/css/'.SYS_SKIN.'.css", + content_css : "/css/' . SYS_SKIN . '.css", template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", @@ -207,7 +211,7 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField '; break; default: - $editorDefinition.= ' + $editorDefinition .= ' tinyMCE.init({ // General options mode : "textareas", diff --git a/gulliver/system/class.xmlMenu.php b/gulliver/system/class.xmlMenu.php index 2bba1b6e7..763ad1b3d 100644 --- a/gulliver/system/class.xmlMenu.php +++ b/gulliver/system/class.xmlMenu.php @@ -84,7 +84,7 @@ class XmlFormFieldXmlMenu extends XmlFormField $this->type = 'xmlmenuDyn'; $template = PATH_CORE . 'templates/' . $this->type . '.html'; $out = $this->xmlMenu->render( $template, $scriptCode ); - $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher = headPublisher::getSingleton(); $oHeadPublisher->addScriptFile( $this->xmlMenu->scriptURL ); $oHeadPublisher->addScriptCode( $scriptCode ); return $out; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 0c0f13c76..261aaddce 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -64,26 +64,26 @@ class XmlFormField * @param string home * @return string */ - public function __construct ($xmlNode, $lang = 'en', $home = '', $owner = null) + public function __construct($xmlNode, $lang = 'en', $home = '', $owner = null) { //Loads any attribute that were defined in the xmlNode //except name and label. - $myAttributes = get_class_vars( get_class( $this ) ); + $myAttributes = get_class_vars(get_class($this)); foreach ($myAttributes as $k => $v) { - $myAttributes[$k] = strtoupper( $k ); + $myAttributes[$k] = strtoupper($k); } //$data: Includes labels and options. - $data = &$xmlNode->findNode( $lang ); - if (! isset( $data->value )) { + $data = &$xmlNode->findNode($lang); + if (!isset($data->value)) { //It seems that in the actual language there are no value for the current field, so get the value in English - $data = &$xmlNode->findNode( "en" ); - if (! isset( $data->value )) { + $data = &$xmlNode->findNode("en"); + if (!isset($data->value)) { //It seems that in the actual language there are no value for the current field, so get the value in First language - if (isset( $xmlNode->children[0] )) { + if (isset($xmlNode->children[0])) { //Lets find first child - if ((isset( $xmlNode->children[0]->name )) && (strlen( $xmlNode->children[0]->name ) == 2)) { + if ((isset($xmlNode->children[0]->name)) && (strlen($xmlNode->children[0]->name) == 2)) { //Just to be sure that the node ocrresponds to a valid lang - $data = &$xmlNode->findNode( $xmlNode->children[0]->name ); + $data = &$xmlNode->findNode($xmlNode->children[0]->name); } } } @@ -92,18 +92,18 @@ class XmlFormField /*Loads the field attributes*/ foreach ($xmlNode->attributes as $k => $v) { - $key = array_search( strtoupper( $k ), $myAttributes ); + $key = array_search(strtoupper($k), $myAttributes); if ($key) { - eval( '$this->' . $key . '=$v;' ); + eval('$this->' . $key . '=$v;'); } } //Loads the main attributes $this->name = $xmlNode->name; - $this->type = strtolower( $xmlNode->attributes['type'] ); - preg_match( '/\s*([^\s][\w\W]*)?/m', $xmlNode->value, $matches ); - $this->sql = (isset( $matches[1] )) ? $matches[1] : ''; + $this->type = strtolower($xmlNode->attributes['type']); + preg_match('/\s*([^\s][\w\W]*)?/m', $xmlNode->value, $matches); + $this->sql = (isset($matches[1])) ? $matches[1] : ''; //List Options - if (isset( $data->children )) { + if (isset($data->children)) { foreach ($data->children as $k => $v) { if ($v->type !== 'cdata') { if (isset($v->name) && isset($v->attributes["name"])) { @@ -112,10 +112,10 @@ class XmlFormField } } } - $this->options = (isset( $this->option )) ? $this->option : array (); + $this->options = (isset($this->option)) ? $this->option : []; //Sql Options : cause warning because values are not setted yet. - if (isset( $owner )) { - if (isset( $owner->mode )) { + if (isset($owner)) { + if (isset($owner->mode)) { $ownerMode = $owner->mode; } else { $ownerMode = ''; @@ -138,9 +138,9 @@ class XmlFormField * @param $value * @return boolean true/false */ - public function validateValue ($value) + public function validateValue($value) { - return isset( $value ); + return isset($value); } /** @@ -150,49 +150,48 @@ class XmlFormField * @param $row * @return $result array of results */ - private function executeXmlDB (&$owner, $row = -1) + private function executeXmlDB(&$owner, $row = -1) { - if (! $this->sqlConnection) { + if (!$this->sqlConnection) { $dbc = new DBConnection(); } else { - - if (defined( 'DB_' . $this->sqlConnection . '_USER' )) { - if (defined( 'DB_' . $this->sqlConnection . '_HOST' )) { - eval( '$res[\'DBC_SERVER\'] = DB_' . $this->sqlConnection . '_HOST;' ); + if (defined('DB_' . $this->sqlConnection . '_USER')) { + if (defined('DB_' . $this->sqlConnection . '_HOST')) { + eval('$res[\'DBC_SERVER\'] = DB_' . $this->sqlConnection . '_HOST;'); } else { $res['DBC_SERVER'] = DB_HOST; } - if (defined( 'DB_' . $this->sqlConnection . '_USER' )) { - eval( '$res[\'DBC_USERNAME\'] = DB_' . $this->sqlConnection . '_USER;' ); + if (defined('DB_' . $this->sqlConnection . '_USER')) { + eval('$res[\'DBC_USERNAME\'] = DB_' . $this->sqlConnection . '_USER;'); } - if (defined( 'DB_' . $this->sqlConnection . '_PASS' )) { - eval( '$res[\'DBC_PASSWORD\'] = DB_' . $this->sqlConnection . '_PASS;' ); + if (defined('DB_' . $this->sqlConnection . '_PASS')) { + eval('$res[\'DBC_PASSWORD\'] = DB_' . $this->sqlConnection . '_PASS;'); } else { $res['DBC_PASSWORD'] = DB_PASS; } - if (defined( 'DB_' . $this->sqlConnection . '_NAME' )) { - eval( '$res[\'DBC_DATABASE\'] = DB_' . $this->sqlConnection . '_NAME;' ); + if (defined('DB_' . $this->sqlConnection . '_NAME')) { + eval('$res[\'DBC_DATABASE\'] = DB_' . $this->sqlConnection . '_NAME;'); } else { $res['DBC_DATABASE'] = DB_NAME; } - if (defined( 'DB_' . $this->sqlConnection . '_TYPE' )) { - eval( '$res[\'DBC_TYPE\'] = DB_' . $this->sqlConnection . '_TYPE;' ); + if (defined('DB_' . $this->sqlConnection . '_TYPE')) { + eval('$res[\'DBC_TYPE\'] = DB_' . $this->sqlConnection . '_TYPE;'); } else { - $res['DBC_TYPE'] = defined( 'DB_TYPE' ) ? DB_TYPE : 'mysql'; + $res['DBC_TYPE'] = defined('DB_TYPE') ? DB_TYPE : 'mysql'; } - $dbc = new DBConnection( $res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'], $res['DBC_TYPE'] ); + $dbc = new DBConnection($res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'], $res['DBC_TYPE']); } else { $dbc0 = new DBConnection(); - $dbs0 = new DBSession( $dbc0 ); - $res = $dbs0->execute( "select * from DB_CONNECTION WHERE DBC_UID=" . $this->sqlConnection ); + $dbs0 = new DBSession($dbc0); + $res = $dbs0->execute("select * from DB_CONNECTION WHERE DBC_UID=" . $this->sqlConnection); $res = $res->read(); - $dbc = new DBConnection( $res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'] ); + $dbc = new DBConnection($res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE']); } } - $query = G::replaceDataField( $this->sql, $owner->values ); - $dbs = new DBSession( $dbc ); - $res = $dbs->execute( $query ); - $result = array (); + $query = G::replaceDataField($this->sql, $owner->values); + $dbs = new DBSession($dbc); + $res = $dbs->execute($query); + $result = []; while ($row = $res->Read()) { $result[] = $row; } @@ -206,28 +205,28 @@ class XmlFormField * @param $row * @return $result array of */ - private function executePropel (&$owner, $row = -1) + private function executePropel(&$owner, $row = -1) { //g::pr($row); - if (! isset( $owner->values[$this->name] )) { - if ($row > - 1) { - $owner->values[$this->name] = array (); + if (!isset($owner->values[$this->name])) { + if ($row > -1) { + $owner->values[$this->name] = []; } else { $owner->values[$this->name] = ''; } } - if (! is_array( $owner->values[$this->name] )) { + if (!is_array($owner->values[$this->name])) { //echo '1'; - $query = G::replaceDataField( $this->sql, $owner->values ); + $query = G::replaceDataField($this->sql, $owner->values); } else { - $aAux = array (); + $aAux = []; foreach ($owner->values as $key => $data) { - if (is_array( $data )) { + if (is_array($data)) { //echo '3:'.$key.' '; - if (isset( $data[$row] )) { + if (isset($data[$row])) { $qValue = $data[$row]; } else { - if (isset( $owner->fields[$key]->selectedValue )) { + if (isset($owner->fields[$key]->selectedValue)) { $qValue = $owner->fields[$key]->selectedValue; } else { $qValue = ''; @@ -243,31 +242,31 @@ class XmlFormField //echo '2'; //g::pr($aAux); - $query = G::replaceDataField( $this->sql, $aAux ); + $query = G::replaceDataField($this->sql, $aAux); } //echo $query; - $result = array (); + $result = []; if ($this->sqlConnection == 'dbarray') { try { - $con = Propel::getConnection( $this->sqlConnection ); + $con = Propel::getConnection($this->sqlConnection); $stmt = $con->createStatement(); - $rs = $con->executeQuery( $query, ResultSet::FETCHMODE_NUM ); + $rs = $con->executeQuery($query, ResultSet::FETCHMODE_NUM); } catch (Exception $e) { //dismiss error because dbarray shouldnt be defined in some contexts. - $workspace = !empty(config("system.workspace"))? config("system.workspace") : "Undefined Workspace"; + $workspace = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined Workspace"; G::log($workspace . " | ip: | " . G::getIpAddress() . " | type error: | " . $e->getMessage() . " | query: " . $query, PATH_DATA, "queriesWithErrors.log"); return $result; } } else { try { - $con = Propel::getConnection( $this->sqlConnection ); + $con = Propel::getConnection($this->sqlConnection); $stmt = $con->createStatement(); - $rs = $stmt->executeQuery( $query, ResultSet::FETCHMODE_NUM ); + $rs = $stmt->executeQuery($query, ResultSet::FETCHMODE_NUM); } catch (Exception $e) { //dismiss error because dbarray shouldnt be defined in some contexts. - $workspace = !empty(config("system.workspace"))? config("system.workspace") : "Undefined Workspace"; + $workspace = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined Workspace"; G::log($workspace . " | ip: | " . G::getIpAddress() . " | type error: | " . $e->getMessage() . " | query: " . $query, PATH_DATA, "queriesWithErrors.log"); return $result; @@ -276,7 +275,7 @@ class XmlFormField $rs->next(); $row = $rs->getRow(); - while (is_array( $row )) { + while (is_array($row)) { $result[] = $row; $rs->next(); $row = $rs->getRow(); @@ -291,52 +290,52 @@ class XmlFormField * @param string owner * @return string */ - public function executeSQL (&$owner, $row = -1) + public function executeSQL(&$owner, $row = -1) { - if (! isset( $this->sql )) { + if (!isset($this->sql)) { return 1; } if ($this->sql === '') { return 1; } - if(isset($this->mode) && $this->mode == "edit" && (isset($this->owner->values[$this->name]) && $this->owner->values[$this->name] !== "") && ($this->type == "text" || $this->type == "currency" || $this->type == "percentage" || $this->type == "textarea" || $this->type == "hidden" || $this->type == "suggest")){ - return 1; + if (isset($this->mode) && $this->mode == "edit" && (isset($this->owner->values[$this->name]) && $this->owner->values[$this->name] !== "") && ($this->type == "text" || $this->type == "currency" || $this->type == "percentage" || $this->type == "textarea" || $this->type == "hidden" || $this->type == "suggest")) { + return 1; } - if(isset($this->mode) && $this->mode == "view" && ($this->type == "text" || $this->type == "currency" || $this->type == "percentage" || $this->type == "textarea" || $this->type == "hidden" || $this->type == "suggest")){ - return 1; + if (isset($this->mode) && $this->mode == "view" && ($this->type == "text" || $this->type == "currency" || $this->type == "percentage" || $this->type == "textarea" || $this->type == "hidden" || $this->type == "suggest")) { + return 1; } - if (! $this->sqlConnection) { + if (!$this->sqlConnection) { $this->sqlConnection = 'workflow'; } - //Read the result of the query + //Read the result of the query if ($this->sqlConnection === "XMLDB") { - $result = $this->executeXmlDB( $owner, $row ); + $result = $this->executeXmlDB($owner, $row); } else { - $result = $this->executePropel( $owner, $row ); + $result = $this->executePropel($owner, $row); } - $this->sqlOption = array (); - $this->options = array (); - if (isset( $this->option )) { + $this->sqlOption = []; + $this->options = []; + if (isset($this->option)) { foreach ($this->option as $k => $v) { $this->options[$k] = $v; } } - for ($r = 0; $r < sizeof( $result ); $r ++) { - $key = reset( $result[$r] ); - $this->sqlOption[$key] = next( $result[$r] ); + for ($r = 0; $r < sizeof($result); $r++) { + $key = reset($result[$r]); + $this->sqlOption[$key] = next($result[$r]); $this->options[$key] = $this->sqlOption[$key]; } if ($this->type != 'listbox') { - if (isset( $this->options ) && isset( $this->owner ) && isset( $this->owner->values[$this->name] )) { - if ((! is_array( $this->owner->values[$this->name] )) && ! ((is_string( $this->owner->values[$this->name] ) || is_int( $this->owner->values[$this->name] )) && array_key_exists( $this->owner->values[$this->name], $this->options ))) { - reset( $this->options ); - $firstElement = key( $this->options ); - if (isset( $firstElement )) { + if (isset($this->options) && isset($this->owner) && isset($this->owner->values[$this->name])) { + if ((!is_array($this->owner->values[$this->name])) && !((is_string($this->owner->values[$this->name]) || is_int($this->owner->values[$this->name])) && array_key_exists($this->owner->values[$this->name], $this->options))) { + reset($this->options); + $firstElement = key($this->options); + if (isset($firstElement)) { $this->owner->values[$this->name] = $firstElement; } else { $this->owner->values[$this->name] = ''; @@ -356,13 +355,12 @@ class XmlFormField * @return */ - public function htmlentities ($value, $flags = ENT_QUOTES, $encoding = 'utf-8') + public function htmlentities($value, $flags = ENT_QUOTES, $encoding = 'utf-8') { - if ($this->enableHtml) { return $value; } else { - return htmlentities( $value, $flags, $encoding ); + return htmlentities($value, $flags, $encoding); } } @@ -376,7 +374,7 @@ class XmlFormField public function render($value = null, $paramDummy2 = null) { //this is an unknown field type. - return $this->htmlentities( $value != '' ? $value : $this->name, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value != '' ? $value : $this->name, ENT_COMPAT, 'utf-8'); } /** @@ -386,13 +384,13 @@ class XmlFormField * @param string values * @return string */ - public function renderGrid ($values = array(), $owner = null, $onlyValue = false, $therow = -1) + public function renderGrid($values = array(), $owner = null, $onlyValue = false, $therow = -1) { - $result = array (); + $result = []; $r = 1; foreach ($values as $v) { - $result[] = $this->render( $v, $owner, '[' . $owner->name . '][' . $r . ']', $onlyValue, $r, $therow ); - $r ++; + $result[] = $this->render($v, $owner, '[' . $owner->name . '][' . $r . ']', $onlyValue, $r, $therow); + $r++; } return $result; } @@ -405,10 +403,10 @@ class XmlFormField * @param $onlyValue * @return $result */ - public function renderTable ($values = '', $owner = null, $onlyValue = false) + public function renderTable($values = '', $owner = null, $onlyValue = false) { $r = 1; - $result = $this->render( $values, $owner, '[' . $owner->name . '][' . $r . ']', $onlyValue ); + $result = $this->render($values, $owner, '[' . $owner->name . '][' . $r . ']', $onlyValue); return $result; } @@ -418,11 +416,11 @@ class XmlFormField * @access public * @return array */ - public function dependentOf () + public function dependentOf() { - $fields = array (); - if (isset( $this->formula )) { - preg_match_all( "/\b[a-zA-Z][a-zA-Z_0-9]*\b/", $this->formula, $matches, PREG_PATTERN_ORDER ); + $fields = []; + if (isset($this->formula)) { + preg_match_all("/\b[a-zA-Z][a-zA-Z_0-9]*\b/", $this->formula, $matches, PREG_PATTERN_ORDER); /* if ($this->formula!=''){ var_dump($this->formula); var_dump($matches); @@ -445,26 +443,27 @@ class XmlFormField * @param string value * @return string */ - public function mask ($format, $value) + public function mask($format, $value) { - $value = explode( '', $value ); - for ($j = 0; $j < strlen( $format ); $j ++) { + $value = explode('', $value); + for ($j = 0; $j < strlen($format); $j++) { $result = ''; $correct = true; - for ($i = $j; $i < strlen( $format ); $i ++) { - $a = substr( $format, $i, 1 ); - $e = $i < strlen( $value ) ? substr( $value, $i, 1 ) : ''; + for ($i = $j; $i < strlen($format); $i++) { + $a = substr($format, $i, 1); + $e = $i < strlen($value) ? substr($value, $i, 1) : ''; //$e=$i $value) { switch ($attribute) { case 'sql': @@ -516,17 +516,17 @@ class XmlFormField case 'owner': break; default: - if (substr( $attribute, 0, 2 ) !== 'on') { + if (substr($attribute, 0, 2) !== 'on') { $attributes[$attribute] = $value; } } } - if (sizeof( $attributes ) < 1) { + if (sizeof($attributes) < 1) { return '{}'; } //$json = new Services_JSON(); //return $json->encode( $attributes ); - return G::json_encode( $attributes ); + return G::json_encode($attributes); } /** @@ -535,20 +535,20 @@ class XmlFormField * @access public * @return string */ - public function getEvents () + public function getEvents() { - $events = array (); + $events = []; foreach ($this as $attribute => $value) { - if (substr( $attribute, 0, 2 ) === 'on') { + if (substr($attribute, 0, 2) === 'on') { $events[$attribute] = $value; } } - if (sizeof( $events ) < 1) { + if (sizeof($events) < 1) { return '{}'; } //$json = new Services_JSON(); //return $json->encode( $events ); - return G::json_encode( $events ); + return G::json_encode($events); } /** @@ -558,12 +558,12 @@ class XmlFormField * @param $elementRef * @access public */ - public function attachEvents ($elementRef) + public function attachEvents($elementRef) { $events = ''; foreach ($this as $attribute => $value) { - if (substr( $attribute, 0, 2 ) == 'on') { - $events = 'if (' . $elementRef . ') leimnud.event.add(' . $elementRef . ',"' . substr( $attribute, 2 ) . '",function(){' . $value . '});' . "\n"; + if (substr($attribute, 0, 2) == 'on') { + $events = 'if (' . $elementRef . ') leimnud.event.add(' . $elementRef . ',"' . substr($attribute, 2) . '",function(){' . $value . '});' . "\n"; } } } @@ -575,23 +575,23 @@ class XmlFormField * @access public * @return Xml_Node */ - public function createXmlNode ($includeDefaultValues = false) + public function createXmlNode($includeDefaultValues = false) { /* Start Comment: Creates the corresponding XML Tag for $this * object. */ - $attributesList = $this->getXmlAttributes( $includeDefaultValues ); - $node = new Xml_Node( $this->name, 'open', $this->sql, $attributesList ); + $attributesList = $this->getXmlAttributes($includeDefaultValues); + $node = new Xml_Node($this->name, 'open', $this->sql, $attributesList); /* End Comment */ /* Start Comment: Creates the languages nodes and options * if exist. */ - $node->addChildNode( new Xml_Node( '', 'cdata', "\n" ) ); - $node->addChildNode( new Xml_Node( $this->language, 'open', $this->label ) ); - if (isset( $this->option )) { + $node->addChildNode(new Xml_Node('', 'cdata', "\n")); + $node->addChildNode(new Xml_Node($this->language, 'open', $this->label)); + if (isset($this->option)) { foreach ($this->option as $k => $v) { - $node->children[1]->addChildNode( new Xml_Node( 'option', 'open', $v, array ('name' => $k - ) ) ); + $node->children[1]->addChildNode(new Xml_Node('option', 'open', $v, array('name' => $k + ))); } } /* End Comment */ @@ -606,24 +606,24 @@ class XmlFormField * @param string value * @return Xml_Node */ - public function &updateXmlNode (&$node, $includeDefaultValues = false) + public function &updateXmlNode(&$node, $includeDefaultValues = false) { /* Start Comment: Modify the node's attributes and value. */ - $attributesList = $this->getXmlAttributes( $includeDefaultValues ); + $attributesList = $this->getXmlAttributes($includeDefaultValues); $node->name = $this->name; $node->value = $this->sql; $node->attributes = $attributesList; /* End Comment */ /* Start Comment: Modifies the languages nodes */ - $langNode = & $node->findNode( $this->language ); + $langNode = &$node->findNode($this->language); $langNode->value = $this->label; - if (isset( $this->option )) { - $langNode->children = array (); + if (isset($this->option)) { + $langNode->children = []; foreach ($this->option as $k => $v) { - $langNode->addChildNode( new Xml_Node( 'option', 'open', $v, array ('name' => $k - ) ) ); + $langNode->addChildNode(new Xml_Node('option', 'open', $v, array('name' => $k + ))); } } /* End Comment */ @@ -639,12 +639,12 @@ class XmlFormField * with default values. * @return Xml_Node */ - public function getXmlAttributes ($includeDefaultValues = false) + public function getXmlAttributes($includeDefaultValues = false) { - $attributesList = array (); - $class = get_class( $this ); - $default = new $class( new Xml_Node( 'DEFAULT', 'open', '', array ('type' => $this->type - ) ) ); + $attributesList = []; + $class = get_class($this); + $default = new $class(new Xml_Node('DEFAULT', 'open', '', array('type' => $this->type + ))); foreach ($this as $k => $v) { switch ($k) { case 'owner': @@ -669,7 +669,7 @@ class XmlFormField * @param &$owner * @return $value */ - public function maskValue ($value, &$owner) + public function maskValue($value, &$owner) { return $value; } @@ -679,7 +679,7 @@ class XmlFormField * * @return */ - public function cloneObject () + public function cloneObject() { //return unserialize( serialize( $this ) );//con este cambio los formularios ya no funcionan en php4 return clone ($this); @@ -691,69 +691,67 @@ class XmlFormField * @param $oOwner * @return $sValue */ - public function getPMTableValue ($oOwner) + public function getPMTableValue($oOwner) { $sValue = ''; - if (isset( $oOwner->fields[$this->pmconnection] )) { - if (defined( 'PATH_CORE' )) { - if (file_exists( PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php' )) { - + if (isset($oOwner->fields[$this->pmconnection])) { + if (defined('PATH_CORE')) { + if (file_exists(PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php')) { $oAdditionalTables = new AdditionalTables(); try { - $aData = $oAdditionalTables->load( $oOwner->fields[$this->pmconnection]->pmtable, true ); + $aData = $oAdditionalTables->load($oOwner->fields[$this->pmconnection]->pmtable, true); } catch (Exception $oError) { - $aData = array ('FIELDS' => array ()); + $aData = array('FIELDS' => array()); } - $aKeys = array (); - $aValues = explode( '|', $oOwner->fields[$this->pmconnection]->keys ); + $aKeys = []; + $aValues = explode('|', $oOwner->fields[$this->pmconnection]->keys); $i = 0; - if($aData == "" || count($aData['FIELDS']) < 1){ - $message = G::LoadTranslation( 'ID_PMTABLE_NOT_FOUND' ); - G::SendMessageText( $message, "WARNING" ); + if ($aData == "" || count($aData['FIELDS']) < 1) { + $message = G::LoadTranslation('ID_PMTABLE_NOT_FOUND'); + G::SendMessageText($message, "WARNING"); $sValue = ""; } else { - foreach ($aData['FIELDS'] as $aField) { - if ($aField['FLD_KEY'] == '1') { - // note added by gustavo cruz gustavo[at]colosa[dot]com - // this additional [if] checks if a case variable has been set - // in the keys attribute, so it can be parsed and replaced for - // their respective value. - if (preg_match( "/@#/", $aValues[$i] )) { - // check if a case are running in order to prevent that preview is - // erroneous rendered. - if (isset( $_SESSION['APPLICATION'] )) { - $oApp = new Cases(); - if ($oApp->loadCase( $_SESSION['APPLICATION'] ) != null) { - $aFields = $oApp->loadCase( $_SESSION['APPLICATION'] ); - $formVariable = substr( $aValues[$i], 2 ); - if (isset( $aFields['APP_DATA'][$formVariable] )) { - $formVariableValue = $aFields['APP_DATA'][$formVariable]; - $aKeys[$aField['FLD_NAME']] = (isset( $formVariableValue ) ? G::replaceDataField( $formVariableValue, $oOwner->values ) : ''); - } else { - $aKeys[$aField['FLD_NAME']] = ''; - } - } else { - $aKeys[$aField['FLD_NAME']] = ''; - } - } else { - $aKeys[$aField['FLD_NAME']] = ''; - } - } else { - $aKeys[$aField['FLD_NAME']] = (isset( $aValues[$i] ) ? G::replaceDataField( $aValues[$i], $oOwner->values ) : ''); - } - $i ++; - } - } - try { - $aData = $oAdditionalTables->getDataTable( $oOwner->fields[$this->pmconnection]->pmtable, $aKeys ); - } catch (Exception $oError) { - $aData = array (); - } - if (isset( $aData[$this->pmfield] )) { - $sValue = $aData[$this->pmfield]; - } + foreach ($aData['FIELDS'] as $aField) { + if ($aField['FLD_KEY'] == '1') { + // note added by gustavo cruz gustavo[at]colosa[dot]com + // this additional [if] checks if a case variable has been set + // in the keys attribute, so it can be parsed and replaced for + // their respective value. + if (preg_match("/@#/", $aValues[$i])) { + // check if a case are running in order to prevent that preview is + // erroneous rendered. + if (isset($_SESSION['APPLICATION'])) { + $oApp = new Cases(); + if ($oApp->loadCase($_SESSION['APPLICATION']) != null) { + $aFields = $oApp->loadCase($_SESSION['APPLICATION']); + $formVariable = substr($aValues[$i], 2); + if (isset($aFields['APP_DATA'][$formVariable])) { + $formVariableValue = $aFields['APP_DATA'][$formVariable]; + $aKeys[$aField['FLD_NAME']] = (isset($formVariableValue) ? G::replaceDataField($formVariableValue, $oOwner->values) : ''); + } else { + $aKeys[$aField['FLD_NAME']] = ''; + } + } else { + $aKeys[$aField['FLD_NAME']] = ''; + } + } else { + $aKeys[$aField['FLD_NAME']] = ''; + } + } else { + $aKeys[$aField['FLD_NAME']] = (isset($aValues[$i]) ? G::replaceDataField($aValues[$i], $oOwner->values) : ''); + } + $i++; + } + } + try { + $aData = $oAdditionalTables->getDataTable($oOwner->fields[$this->pmconnection]->pmtable, $aKeys); + } catch (Exception $oError) { + $aData = []; + } + if (isset($aData[$this->pmfield])) { + $sValue = $aData[$this->pmfield]; + } } - } } } @@ -768,9 +766,9 @@ class XmlFormField * @return string */ - public function NSRequiredValue ($show = false) + public function NSRequiredValue($show = false) { - if (isset( $this->required )) { + if (isset($this->required)) { $req = ($this->required) ? '1' : '0'; } else { $req = '0'; @@ -791,7 +789,7 @@ class XmlFormField * @return string */ - public function NSGridLabel ($show = false) + public function NSGridLabel($show = false) { $idv = 'pm:label="' . htmlentities($this->pmLabel, ENT_COMPAT, 'utf-8') . '"'; if ($show) { @@ -808,7 +806,7 @@ class XmlFormField * @param boolean optional (true = always show, false = show only if not empty) * @return string */ - public function NSDefaultValue ($show = false) + public function NSDefaultValue($show = false) { $idv = 'pm:defaultvalue="' . $this->defaultValue . '"'; if ($show) { @@ -824,7 +822,7 @@ class XmlFormField * @author Julio Cesar Laura * @return string */ - public function NSFieldType () + public function NSFieldType() { return 'pmfieldtype="' . $this->type . '"'; } @@ -836,7 +834,7 @@ class XmlFormField * @param boolean optional (true = always show, false = show only if not empty) * @return string */ - public function NSGridType ($show = false) + public function NSGridType($show = false) { $igt = 'pmgridtype="' . $this->gridFieldType . '"'; @@ -854,7 +852,7 @@ class XmlFormField * @param boolean optional (true = always show, false = show only if not empty) * @return string */ - public function NSDependentFields ($show = false) + public function NSDependentFields($show = false) { $idf = 'pm:dependent="' . (($this->dependentFields != '') ? '1' : '0') . '"'; if ($show) { @@ -873,7 +871,7 @@ class XmlFormField * */ - public function renderHint () + public function renderHint() { $_outHint = ''; if ($this->hint != '' && $this->mode == 'edit') { @@ -903,8 +901,8 @@ class XmlFormFieldTitle extends XmlFormField */ public function render($value = null, $owner = null) { - $this->label = G::replaceDataField( $this->label, $owner->values ); - return 'name . ']\' name=\'form[' . $this->name . ']\' ' . $this->NSFieldType() . ' >' . $this->htmlentities( $this->label ) . ''; + $this->label = G::replaceDataField($this->label, $owner->values); + return 'name . ']\' name=\'form[' . $this->name . ']\' ' . $this->NSFieldType() . ' >' . $this->htmlentities($this->label) . ''; } /** @@ -913,7 +911,7 @@ class XmlFormFieldTitle extends XmlFormField * @param $value * @return false */ - public function validateValue ($value) + public function validateValue($value) { return false; } @@ -937,7 +935,7 @@ class XmlFormFieldSubtitle extends XmlFormField */ public function render($value = null, $paramDummy2 = null) { - return 'name . ']\' name=\'form[' . $this->name . ']\' ' . $this->NSFieldType() . ' >' . $this->htmlentities( $this->label ) . ''; + return 'name . ']\' name=\'form[' . $this->name . ']\' ' . $this->NSFieldType() . ' >' . $this->htmlentities($this->label) . ''; } /** @@ -946,7 +944,7 @@ class XmlFormFieldSubtitle extends XmlFormField * @param $value * @return false */ - public function validateValue ($value) + public function validateValue($value) { return false; } @@ -978,19 +976,19 @@ class XmlFormFieldSimpleText extends XmlFormField public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); if ($this->mode === 'edit') { if ($this->readOnly) { - return 'maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSRequiredValue() . ' ' . $this->NSFieldType() . ' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>'; + return 'maxLength) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSRequiredValue() . ' ' . $this->NSFieldType() . ' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>'; } else { - return 'maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSRequiredValue() . ' ' . $this->NSFieldType() . ' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>'; + return 'maxLength) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSRequiredValue() . ' ' . $this->NSFieldType() . ' style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>'; } } elseif ($this->mode === 'view') { - return 'maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSRequiredValue() . ' ' . $this->NSFieldType() . ' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return 'maxLength) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSRequiredValue() . ' ' . $this->NSFieldType() . ' style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . htmlentities($value, ENT_COMPAT, 'utf-8'); } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -1004,7 +1002,7 @@ class XmlFormFieldSimpleText extends XmlFormField */ public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; @@ -1019,8 +1017,8 @@ class XmlFormFieldSimpleText extends XmlFormField $html .= 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; - $html .= 'value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSGridType() . ' '; @@ -1028,14 +1026,14 @@ class XmlFormFieldSimpleText extends XmlFormField $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ); + $html .= $this->htmlentities($v, ENT_QUOTES, 'utf-8'); $html .= 'name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; - $html .= 'type="hidden" value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" />'; } $result[] = $html; - $r ++; + $r++; } return $result; } @@ -1062,7 +1060,7 @@ class XmlFormFieldText extends XmlFormFieldSimpleText public $readOnly = false; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; //Attributes only for grids public $gridFieldType = 'text'; public $formula = ''; @@ -1080,7 +1078,7 @@ class XmlFormFieldText extends XmlFormFieldSimpleText * @param string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if ($this->autocomplete === '1') { $this->autocomplete = "on"; @@ -1093,39 +1091,39 @@ class XmlFormFieldText extends XmlFormFieldSimpleText $this->renderMode = $this->mode; } if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $this->executeSQL( $owner ); - $firstElement = key( $this->sqlOption ); - if (isset( $firstElement )) { + $this->executeSQL($owner); + $firstElement = key($this->sqlOption); + if (isset($firstElement)) { $value = $firstElement; } } //NOTE: string functions must be in G class if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); + $value = strtoupper($value); } if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); + $value = strtolower($value); } if ($this->strTo === 'TITLE') { - $value = strtolower( $value ); - $value = ucwords( $value ); + $value = strtolower($value); + $value = ucwords($value); } if ($this->strTo === 'PHRASE') { //$value = strtolower( $value ); - $title = explode(" ",$value); + $title = explode(" ", $value); - $title[0] = ucwords( $title[0] ); + $title[0] = ucwords($title[0]); $value = implode(" ", $title); } //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); + $value = G::replaceDataField($value, $owner->values); } $html = ''; @@ -1137,9 +1135,9 @@ class XmlFormFieldText extends XmlFormFieldSimpleText $html .= 'name="form[' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; $html .= 'autocomplete="' . $this->autocomplete . '" '; - $html .= 'value="' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; - $html .= 'onkeypress="' . $this->htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; + $html .= 'onkeypress="' . $this->htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSFieldType() . ' '; @@ -1147,18 +1145,18 @@ class XmlFormFieldText extends XmlFormFieldSimpleText $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ); + $html .= $this->htmlentities($value, ENT_QUOTES, 'utf-8'); $html .= 'name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= $this->NSFieldType() . ' '; $this->enableHtml = false; - $html .= 'type="hidden" value="' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '" />'; } $html .= $this->renderHint(); if (($this->readOnly == 1) && ($this->renderMode == 'edit')) { - $html = str_replace( "class=\"module_app_input___gray\"", "class=\"module_app_input___gray_readOnly\"", $html ); + $html = str_replace("class=\"module_app_input___gray\"", "class=\"module_app_input___gray_readOnly\"", $html); } return $html; @@ -1174,20 +1172,20 @@ class XmlFormFieldText extends XmlFormFieldSimpleText */ public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $result = $aux = array (); + $result = $aux = []; $r = 1; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; } foreach ($values as $v) { - $this->executeSQL( $owner, $r ); - $firstElement = key( $this->sqlOption ); - if (isset( $firstElement )) { + $this->executeSQL($owner, $r); + $firstElement = key($this->sqlOption); + if (isset($firstElement)) { $v = $firstElement; } if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); + $v = G::replaceDataField($v, $owner->values); } $aux[$r] = $v; @@ -1199,8 +1197,8 @@ class XmlFormFieldText extends XmlFormFieldSimpleText $html .= 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; - $html .= 'value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSGridLabel() . ' '; @@ -1209,17 +1207,17 @@ class XmlFormFieldText extends XmlFormFieldSimpleText $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ); + $html .= $this->htmlentities($v, ENT_QUOTES, 'utf-8'); $html .= 'name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSGridType() . ' '; - $html .= 'type="hidden" value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" />'; } $result[] = $html; - $r ++; + $r++; } $this->options = $aux; return $result; @@ -1227,7 +1225,7 @@ class XmlFormFieldText extends XmlFormFieldSimpleText public function renderTable($values = "", $owner = null, $paramDummy3 = null) { - $result = $this->htmlentities( $values, ENT_COMPAT, 'utf-8' ); + $result = $this->htmlentities($values, ENT_COMPAT, 'utf-8'); return $result; } } @@ -1253,7 +1251,7 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText public $readOnly = false; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; public $searchType = "*searchtext*"; //Atributes only for grids public $gridFieldType = 'suggest'; @@ -1285,35 +1283,34 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText * @param $owner * @return */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - - if (! $this->sqlConnection) { + if (!$this->sqlConnection) { $this->sqlConnection = 'workflow'; } //NOTE: string functions must be in G class if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); + $value = strtoupper($value); } if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); + $value = strtolower($value); } - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); + $value = G::replaceDataField($value, $owner->values); } - $aProperties = Array ('value' => '""','size' => '"' . $this->size . '"'); + $aProperties = array('value' => '""', 'size' => '"' . $this->size . '"'); $storeEntry = null; $storeEntryData = ", storeEntryData: [0]"; if ($this->store_new_entry) { - $storeEntry = ' title="' . G::LoadTranslation( "ID_FIELD_DYNAFORM_SUGGEST_INPUT_TITLE" ) . '"'; + $storeEntry = ' title="' . G::LoadTranslation("ID_FIELD_DYNAFORM_SUGGEST_INPUT_TITLE") . '"'; $storeEntryData = ", storeEntryData: [1, \"form[" . $this->name . "_label]\", \"" . $this->sqlConnection . "\", \"" . $this->table . "\", \"" . $this->primary_key . "\", \"" . $this->primary_key_type . "\", \"" . $this->field . "\"]"; } @@ -1321,9 +1318,9 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $formVariableKeyValue = ''; $oApp = new Cases(); - if (isset( $_SESSION['APPLICATION'] ) && ($_SESSION['APPLICATION'] != null && $oApp->loadCase( $_SESSION['APPLICATION'] ) != null)) { - $aFields = $oApp->loadCase( $_SESSION['APPLICATION'] ); - if (isset( $aFields['APP_DATA'][$this->name . '_label'] )) { + if (isset($_SESSION['APPLICATION']) && ($_SESSION['APPLICATION'] != null && $oApp->loadCase($_SESSION['APPLICATION']) != null)) { + $aFields = $oApp->loadCase($_SESSION['APPLICATION']); + if (isset($aFields['APP_DATA'][$this->name . '_label'])) { $formVariableValue = $aFields['APP_DATA'][$this->name . '_label']; $formVariableKeyValue = $aFields['APP_DATA'][$this->name]; } @@ -1331,37 +1328,37 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText if ($this->mode === 'edit') { if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSFieldType() . ' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>'; + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSFieldType() . ' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>'; } else { // $str = ''; - if (strlen( trim( $formVariableValue ) ) > 0) { + if (strlen(trim($formVariableValue)) > 0) { $value = $formVariableValue; } $name = "'" . $this->name . "'"; - $str = 'NSDependentFields( true ) . ' '; + $str = 'NSDependentFields(true) . ' '; $str .= '/>'; $str .= 'name . ']" '; $str .= 'name="form[' . $this->name . ']" '; $str .= $this->NSFieldType() . ' '; - $str .= 'value="' . $this->htmlentities( $formVariableKeyValue, ENT_COMPAT, 'utf-8' ) . '" '; + $str .= 'value="' . $this->htmlentities($formVariableKeyValue, ENT_COMPAT, 'utf-8') . '" '; $str .= 'type="hidden" />'; $str .= $this->renderHint(); - if (trim( $this->callback ) != '') { + if (trim($this->callback) != '') { $sCallBack = 'try{' . $this->callback . '}catch(e){alert("Suggest Widget call back error: "+e)}'; } else { $sCallBack = ''; } - - $sSQL = $this->sql; - $nCount = preg_match_all( '/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ); - $aResult = array (); + $sSQL = $this->sql; + $nCount = preg_match_all('/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); + + $aResult = []; if ($nCount) { - for ($i = 0; $i < $nCount; $i ++) { - if (isset( $match[0][$i][0] ) && isset( $match[2][$i][0] )) { + for ($i = 0; $i < $nCount; $i++) { + if (isset($match[0][$i][0]) && isset($match[2][$i][0])) { $aResult[$match[0][$i][0]] = $match[2][$i][0]; } } @@ -1369,17 +1366,16 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $depValues = ''; $i = 1; - if (isset( $aResult ) && $aResult) { - $sResult = '"' . implode( '","', $aResult ) . '"'; - $aResultKeys = array_keys( $aResult ); - $sResultKeys = str_rot13( base64_encode( implode( '|', $aResultKeys ) ) ); + if (isset($aResult) && $aResult) { + $sResult = '"' . implode('","', $aResult) . '"'; + $aResultKeys = array_keys($aResult); + $sResultKeys = str_rot13(base64_encode(implode('|', $aResultKeys))); foreach ($aResult as $key => $field) { $depValues .= 'getField(\'' . $field . '\').value'; - if ($i ++ < count( $aResult )) { + if ($i++ < count($aResult)) { $depValues .= '+"|"+'; } - } $depValues = '+' . $depValues . '+'; } else { @@ -1388,14 +1384,14 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $depValues = '+'; } - $aDepFields = array (); + $aDepFields = []; $count = 0; if ($this->dependentFields !== '') { - $dependentFields = explode( ",", $this->dependentFields ); + $dependentFields = explode(",", $this->dependentFields); foreach ($dependentFields as $keyDependent => $valueDependent) { $sqlDepField = $owner->fields[$valueDependent]->sql; - $count = preg_match_all( '/\@(?:([\@\%\#\=\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sqlDepField, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ); - for ($cnt = 0; $cnt < $count; $cnt ++) { + $count = preg_match_all('/\@(?:([\@\%\#\=\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sqlDepField, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); + for ($cnt = 0; $cnt < $count; $cnt++) { $aDepFields[$cnt] = $match[2][$cnt][0]; } } @@ -1425,8 +1421,8 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $sOptions .= ' var sField = "[]"; '; if ($count > 0) { - for ($cnt = 0; $cnt < $count; $cnt ++) { - if ( $this->name == $aDepFields[$cnt] ) { + for ($cnt = 0; $cnt < $count; $cnt++) { + if ($this->name == $aDepFields[$cnt]) { $sOptions .= ' jField[\'' . $aDepFields[$cnt] . '\'] = obj.id;'; } else { $sOptions .= ' jField[\'' . $aDepFields[$cnt] . '\'] = getField(\'' . $aDepFields[$cnt] . '\').value; '; @@ -1477,46 +1473,46 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText return $str; } } else { - $html = 'NSFieldType() . ' >'; + $html = 'NSFieldType() . ' >'; $html .= $this->htmlentities($formVariableValue, ENT_COMPAT, 'utf-8'); $html .= ''; return $html; } } - /** + /** * render Field Grid * * @param type $value * @param type $owner * @param type $rowId - * @param type $ownerName Grid Name - * @param type $index Index on the grid + * @param type $ownerName Grid Name + * @param type $index Index on the grid * @return string */ public function renderFieldGrid($value = null, $owner = null, $rowId = '', $ownerName = '', $index = 0) { $rowIdField = substr($rowId, 1); - if (! $this->sqlConnection) { + if (!$this->sqlConnection) { $this->sqlConnection = 'workflow'; } if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); + $value = strtoupper($value); } if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); + $value = strtolower($value); } - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); + $value = G::replaceDataField($value, $owner->values); } $storeEntry = null; $storeEntryData = ", storeEntryData: [0]"; if ($this->store_new_entry) { - $storeEntry = ' title="' . G::LoadTranslation( "ID_FIELD_DYNAFORM_SUGGEST_INPUT_TITLE" ) . '"'; + $storeEntry = ' title="' . G::LoadTranslation("ID_FIELD_DYNAFORM_SUGGEST_INPUT_TITLE") . '"'; $storeEntryData = ", storeEntryData: [1, \"form" . $rowId . "[" . $this->name . "_label]\", \"" . $this->sqlConnection . "\", \"" . $this->table . "\", \"" . $this->primary_key . "\", \"" . $this->primary_key_type . "\", \"" . $this->field . "\"]"; } @@ -1524,10 +1520,9 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $formVariableKeyValue = ''; $oApp = new Cases(); - if (isset( $_SESSION['APPLICATION'] ) && ($_SESSION['APPLICATION'] != null && $oApp->loadCase( $_SESSION['APPLICATION'] ) != null)) { - $aFields = $oApp->loadCase( $_SESSION['APPLICATION'] ); - if (isset( $aFields['APP_DATA'][$ownerName][$index][$this->name . '_label'] )) { - + if (isset($_SESSION['APPLICATION']) && ($_SESSION['APPLICATION'] != null && $oApp->loadCase($_SESSION['APPLICATION']) != null)) { + $aFields = $oApp->loadCase($_SESSION['APPLICATION']); + if (isset($aFields['APP_DATA'][$ownerName][$index][$this->name . '_label'])) { $formVariableValue = $aFields['APP_DATA'][$ownerName][$index][$this->name . '_label']; $formVariableKeyValue = $aFields['APP_DATA'][$ownerName][$index][$this->name]; } @@ -1535,14 +1530,14 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText if ($this->mode === 'edit') { if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSGridType() . ' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>'; + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSGridType() . ' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>'; } else { - if (strlen( trim( $formVariableValue ) ) > 0) { + if (strlen(trim($formVariableValue)) > 0) { $value = $formVariableValue; } $str = 'NSDependentFields( true ) . ' '; + $str .= $this->NSDependentFields(true) . ' '; $str .= $this->NSRequiredValue() . ' '; $str .= $this->NSGridLabel() . ' '; $str .= '/>'; @@ -1550,23 +1545,23 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $str .= 'id="form' . $rowId . '[' . $this->name . ']" '; $str .= 'name="form' . $rowId . '[' . $this->name . ']" '; $str .= $this->NSGridType() . ' '; - $str .= 'value="' . $this->htmlentities( $formVariableKeyValue, ENT_COMPAT, 'utf-8' ) . '" '; + $str .= 'value="' . $this->htmlentities($formVariableKeyValue, ENT_COMPAT, 'utf-8') . '" '; $str .= 'type="hidden" />'; //$str .= $this->renderHint(); - if (trim( $this->callback ) != '') { + if (trim($this->callback) != '') { $sCallBack = 'try{' . $this->callback . '}catch(e){alert("Suggest Widget call back error: "+e)}'; } else { $sCallBack = ''; } $sSQL = $this->sql; - $nCount = preg_match_all( '/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ); + $nCount = preg_match_all('/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); - $aResult = array (); + $aResult = []; if ($nCount) { - for ($i = 0; $i < $nCount; $i ++) { - if (isset( $match[0][$i][0] ) && isset( $match[2][$i][0] )) { + for ($i = 0; $i < $nCount; $i++) { + if (isset($match[0][$i][0]) && isset($match[2][$i][0])) { $aResult[$match[0][$i][0]] = $match[2][$i][0]; } } @@ -1575,20 +1570,19 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $depValues = ''; $depFieldsLast = ''; $i = 1; - if (isset( $aResult ) && $aResult) { - $sResult = '"' . implode( '","', $aResult ) . '"'; - $aResultKeys = array_keys( $aResult ); - $sResultKeys = str_rot13( base64_encode( implode( '|', $aResultKeys ) ) ); + if (isset($aResult) && $aResult) { + $sResult = '"' . implode('","', $aResult) . '"'; + $aResultKeys = array_keys($aResult); + $sResultKeys = str_rot13(base64_encode(implode('|', $aResultKeys))); foreach ($aResult as $key => $field) { - $depValues .= 'getField(\''. $rowIdField . '[' . $field . '\').value'; + $depValues .= 'getField(\'' . $rowIdField . '[' . $field . '\').value'; - if ($i ++ < count( $aResult )) { + if ($i++ < count($aResult)) { $depValues .= '+"|"+'; } - } - $depFieldsLast = 'getField(\''. $rowIdField . '[' . $field . '\').value'; + $depFieldsLast = 'getField(\'' . $rowIdField . '[' . $field . '\').value'; $depValues = '+' . $depValues . '+'; } else { $sResult = ''; @@ -1620,7 +1614,7 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $sOptions .= ' var sFieldCurrent = "["+ encodeURIComponent(aFieldCurrent.toJSONString()) + "]"; '; $sOptions .= $sCallBack . '; getField("' . $rowIdField . '[' . $this->name . '").value = obj.id;'; - $sOwnerId = (isset($owner->owner->id))? $owner->owner->id : $owner->id; + $sOwnerId = (isset($owner->owner->id)) ? $owner->owner->id : $owner->id; $sOptions .= 'var indexField = "' . $rowIdField . '[' . $this->name . '";'; $sOptions .= 'indexField = indexField.match(/\[[0-9]+\]/g); '; $sOptions .= 'indexFieldVal = indexField[0].replace(/\[|\]/g,""); '; @@ -1659,7 +1653,7 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText $sOptions .= '}'; $str .= ''; return $str; @@ -1689,11 +1683,11 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText */ public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $aResult = array(); + $aResult = []; $r = 1; foreach ($values as $v) { - $aResult[] = $this->renderFieldGrid( $v, $owner, '[' . $owner->name . '][' . $r . ']', $owner->name, $r ); + $aResult[] = $this->renderFieldGrid($v, $owner, '[' . $owner->name . '][' . $r . ']', $owner->name, $r); $r++; } return $aResult; @@ -1708,7 +1702,7 @@ class XmlFormFieldSuggest extends XmlFormFieldSimpleText */ public function renderTable($values = "", $owner = null, $paramDummy3 = null) { - $result = $this->htmlentities( $values, ENT_COMPAT, 'utf-8' ); + $result = $this->htmlentities($values, ENT_COMPAT, 'utf-8'); return $result; } } @@ -1740,16 +1734,16 @@ class XmlFormFieldPrint extends XmlFormFieldSimpleText //by neyek * @return string */ //750, 450, 10, 32, 1 - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - $onclick = G::replaceDataField( $this->onclick, $owner->values ); - $link = G::replaceDataField( $this->link, $owner->values ); - $target = G::replaceDataField( $this->target, $owner->values ); - $value = G::replaceDataField( $this->value, $owner->values ); - $label = G::replaceDataField( $this->label, $owner->values ); + $onclick = G::replaceDataField($this->onclick, $owner->values); + $link = G::replaceDataField($this->link, $owner->values); + $target = G::replaceDataField($this->target, $owner->values); + $value = G::replaceDataField($this->value, $owner->values); + $label = G::replaceDataField($this->label, $owner->values); - $html = ' - + $html = ' + '; return $html; @@ -1757,6 +1751,7 @@ class XmlFormFieldPrint extends XmlFormFieldSimpleText //by neyek } /*DEPRECATED*/ + /** * caption field for dynaforms * @@ -1764,15 +1759,14 @@ class XmlFormFieldPrint extends XmlFormFieldSimpleText //by neyek */ class XmlFormFieldCaption extends XmlFormField { - public $defaultValue = ''; public $required = false; public $dependentFields = ''; public $readonly = false; - public $option = array (); + public $option = []; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; public $saveLabel = 0; //public $hint; @@ -1795,23 +1789,22 @@ class XmlFormFieldCaption extends XmlFormField * @param string value * @return string modified */ - public function render ($value = null, $owner = null, $rowId = '', $onlyValue = false, $row = -1, $therow = -1) + public function render($value = null, $owner = null, $rowId = '', $onlyValue = false, $row = -1, $therow = -1) { - if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } - if ($therow == - 1) { + if ($therow == -1) { //print_r($this->executeSQL ( $owner, $row ));print"
"; - $this->executeSQL( $owner, $row ); + $this->executeSQL($owner, $row); } else { if ($row == $therow) { - $this->executeSQL( $owner, $row ); + $this->executeSQL($owner, $row); } } $html = ''; - if (! $onlyValue) { + if (!$onlyValue) { foreach ($this->option as $optionName => $option) { if ($optionName == $value) { $value = $option; @@ -1822,7 +1815,6 @@ class XmlFormFieldCaption extends XmlFormField $value = $option; } } - } else { foreach ($this->option as $optionName => $option) { if ($optionName == $value) { @@ -1836,10 +1828,10 @@ class XmlFormFieldCaption extends XmlFormField } } $pID = "form[$this->name]"; - $htm = $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + $htm = $this->htmlentities($value, ENT_COMPAT, 'utf-8'); $htm .= ''; return $htm; - } + } } /** @@ -1875,18 +1867,18 @@ class XmlFormFieldPassword extends XmlFormField if ($this->mode === 'edit') { if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSFieldType() . ' readOnly="readOnly"/>'; + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSFieldType() . ' readOnly="readOnly"/>'; } else { - $html = 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSFieldType() . '/>'; + $html = 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSFieldType() . '/>'; $html .= $this->renderHint(); return $html; } } elseif ($this->mode === 'view') { - $html = 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' ' . $this->NSFieldType() . ' readOnly="readOnly"/>'; - $html .= $this->htmlentities( str_repeat( '*', 10 ), ENT_COMPAT, 'utf-8' ); + $html = 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' ' . $this->NSFieldType() . ' readOnly="readOnly"/>'; + $html .= $this->htmlentities(str_repeat('*', 10), ENT_COMPAT, 'utf-8'); return $html; } else { - return $this->htmlentities( str_repeat( '*', 10 ), ENT_COMPAT, 'utf-8' ); + return $this->htmlentities(str_repeat('*', 10), ENT_COMPAT, 'utf-8'); } } } @@ -1915,29 +1907,28 @@ class XmlFormFieldTextarea extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $this->executeSQL( $owner ); - if (isset( $this->sqlOption )) { - $firstElement = key( $this->sqlOption ); + $this->executeSQL($owner); + if (isset($this->sqlOption)) { + $firstElement = key($this->sqlOption); } - if (isset( $firstElement )) { + if (isset($firstElement)) { $value = $firstElement; } } - $className = isset( $this->className ) ? $this->className : 'module_app_input___gray'; + $className = isset($this->className) ? $this->className : 'module_app_input___gray'; if ($this->renderMode == '') { $this->renderMode = $this->mode; } $resizable = ($this->resizable == 1 || $this->resizable == '1') ? 'resize:both;' : 'resize:none;'; $html = ''; - $scrollStyle = $this->style . "overflow:scroll;overflow-y:scroll;overflow-x:hidden;overflow:-moz-scrollbars-vertical;".$resizable; + $scrollStyle = $this->style . "overflow:scroll;overflow-y:scroll;overflow-x:hidden;overflow:-moz-scrollbars-vertical;" . $resizable; if ($this->renderMode == 'edit') { //EDIT MODE $readOnlyText = ($this->readOnly == 1 || $this->readOnly == '1') ? 'readOnly="readOnly"' : ''; @@ -1945,12 +1936,12 @@ class XmlFormFieldTextarea extends XmlFormField $html .= 'id="form[' . $this->name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= 'wrap="soft" cols="' . $this->cols . '" rows="' . $this->rows . '" '; - $html .= 'style="' . $scrollStyle . '" wrap="' . $this->htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" '; + $html .= 'style="' . $scrollStyle . '" wrap="' . $this->htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSFieldType() . ' '; $html .= 'class="' . $className . '" >'; - $html .= $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); $html .= ''; } else { //VIEW MODE @@ -1958,9 +1949,9 @@ class XmlFormFieldTextarea extends XmlFormField $html .= 'id="form[' . $this->name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= 'wrap="soft" cols="' . $this->cols . '" rows="' . $this->rows . '" '; - $html .= $this->NSFieldType(). ' style="border:0px;backgroud-color:inherit;' . $scrollStyle . '" wrap="' . $this->htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" '; + $html .= $this->NSFieldType() . ' style="border:0px;backgroud-color:inherit;' . $scrollStyle . '" wrap="' . $this->htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" '; $html .= 'class="FormTextArea" >'; - $html .= $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); $html .= ''; } @@ -1984,8 +1975,8 @@ class XmlFormFieldTextarea extends XmlFormField $this->renderMode = $this->modeForGrid; } - $result = array(); - $arrayOptions = array(); + $result = []; + $arrayOptions = []; $r = 1; @@ -2002,7 +1993,7 @@ class XmlFormFieldTextarea extends XmlFormField $arrayOptions[$r] = $v; $resizable = ($this->resizable == 1 || $this->resizable == '1') ? 'resize:both;' : 'resize:none;'; - $scrollStyle = $this->style . "overflow:scroll;overflow-y:scroll;overflow-x:hidden;overflow:-moz-scrollbars-vertical;".$resizable; + $scrollStyle = $this->style . "overflow:scroll;overflow-y:scroll;overflow-x:hidden;overflow:-moz-scrollbars-vertical;" . $resizable; $html = ''; if ($this->renderMode == 'edit') { //EDIT MODE @@ -2017,7 +2008,7 @@ class XmlFormFieldTextarea extends XmlFormField $html .= $this->NSGridType() . ' '; $html .= $this->NSGridLabel() . ' '; $html .= '>'; - $html .= $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $html .= $this->htmlentities($v, ENT_COMPAT, 'utf-8'); $html .= ''; } else { //VIEW MODE @@ -2026,13 +2017,13 @@ class XmlFormFieldTextarea extends XmlFormField $html .= $this->NSGridType() . ' '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'wrap="soft" cols="' . $this->cols . '" rows="' . $this->rows . '" '; - $html .= 'style="' . $scrollStyle . '" wrap="' . $this->htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" '; + $html .= 'style="' . $scrollStyle . '" wrap="' . $this->htmlentities($this->wrap, ENT_QUOTES, 'UTF-8') . '" '; $html .= 'class="FormTextArea" >'; - $html .= $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $html .= $this->htmlentities($v, ENT_COMPAT, 'utf-8'); $html .= ''; } $result[] = $html; - $r ++; + $r++; } $this->options = $arrayOptions; @@ -2062,7 +2053,7 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText public $function = ''; public $gridFieldType = 'currency'; public $comma_separator = '.'; - public $sqlOption = array(); + public $sqlOption = []; /** * render the field in a dynaform @@ -2071,16 +2062,16 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText * @param $owner * @return */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $this->executeSQL( $owner ); - if (isset( $this->sqlOption )) { - $firstElement = key( $this->sqlOption ); + $this->executeSQL($owner); + if (isset($this->sqlOption)) { + $firstElement = key($this->sqlOption); } - if (isset( $firstElement )) { + if (isset($firstElement)) { $value = $firstElement; } } @@ -2088,11 +2079,11 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText if ($this->renderMode == '') { $this->renderMode = $this->mode; } - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); $html = ''; - $currency = preg_replace( '/([_;#,.])/', '', $this->mask ); - if (! $value) { + $currency = preg_replace('/([_;#,.])/', '', $this->mask); + if (!$value) { $value = $currency; } @@ -2103,9 +2094,9 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText $html .= 'id="form[' . $this->name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; - $html .= 'value="' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; - $html .= 'onkeypress="' . $this->htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; + $html .= 'onkeypress="' . $this->htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSFieldType() . ' '; @@ -2113,20 +2104,19 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); $html .= 'name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= $this->NSFieldType() . ' '; - $html .= 'type="hidden" value="' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '" />'; } if (($this->readOnly == 1) && ($this->renderMode == 'edit')) { - $html = str_replace( "class=\"module_app_input___gray\"", "class=\"module_app_input___gray_readOnly\"", $html ); + $html = str_replace("class=\"module_app_input___gray\"", "class=\"module_app_input___gray_readOnly\"", $html); } - $html .= $this->renderHint(); + $html .= $this->renderHint(); return $html; - } /** @@ -2140,22 +2130,22 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText */ public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; } foreach ($values as $v) { - $this->executeSQL( $owner, $r ); - $firstElement = key( $this->sqlOption ); - if (isset( $firstElement )) { + $this->executeSQL($owner, $r); + $firstElement = key($this->sqlOption); + if (isset($firstElement)) { $v = $firstElement; } $html = ''; - $currency = preg_replace( '/([_;#,.])/', '', $this->mask ); - if (! $v) { + $currency = preg_replace('/([_;#,.])/', '', $this->mask); + if (!$v) { $v = $currency; } if ($this->renderMode === 'edit') { @@ -2165,8 +2155,8 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText $html .= 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; - $html .= 'value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSGridType() . ' '; @@ -2174,21 +2164,22 @@ class XmlFormFieldCurrency extends XmlFormFieldSimpleText $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ); + $html .= $this->htmlentities($v, ENT_QUOTES, 'utf-8'); $html .= 'name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= $this->NSGridType() . ' '; - $html .= 'type="hidden" value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" />'; } $result[] = $html; - $r ++; + $r++; } return $result; } } /*DEPRECATED*/ + /** * * @package gulliver.system @@ -2205,7 +2196,7 @@ class XmlFormFieldCaptionCurrency extends XmlFormField */ public function render($value = null, $paramDummy2 = null) { - return '$ ' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return '$ ' . $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -2228,18 +2219,18 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText public $function = ''; public $gridFieldType = 'percentage'; public $comma_separator = '.'; - public $sqlOption = array(); + public $sqlOption = []; - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $this->executeSQL( $owner ); - if (isset( $this->sqlOption )) { - $firstElement = key( $this->sqlOption ); + $this->executeSQL($owner); + if (isset($this->sqlOption)) { + $firstElement = key($this->sqlOption); } - if (isset( $firstElement )) { + if (isset($firstElement)) { $value = $firstElement; } } @@ -2247,7 +2238,7 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText if ($this->renderMode == '') { $this->renderMode = $this->mode; } - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); $html = ''; @@ -2258,9 +2249,9 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText $html .= 'id="form[' . $this->name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; - $html .= 'value="' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; - $html .= 'onkeypress="' . $this->htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; + $html .= 'onkeypress="' . $this->htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSFieldType() . ' '; @@ -2268,16 +2259,16 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); $html .= 'name . ']" '; $html .= 'name="form[' . $this->name . ']" '; $html .= $this->NSFieldType() . ' '; - $html .= 'type="hidden" value="' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($value, ENT_COMPAT, 'utf-8') . '" />'; } if (($this->readOnly == 1) && ($this->renderMode == 'edit')) { - $html = str_replace( "class=\"module_app_input___gray\"", "class=\"module_app_input___gray_readOnly\"", $html ); + $html = str_replace("class=\"module_app_input___gray\"", "class=\"module_app_input___gray_readOnly\"", $html); } $html .= $this->renderHint(); return $html; @@ -2285,22 +2276,22 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; } foreach ($values as $v) { - $this->executeSQL( $owner, $r ); - $firstElement = key( $this->sqlOption ); - if (isset( $firstElement )) { + $this->executeSQL($owner, $r); + $firstElement = key($this->sqlOption); + if (isset($firstElement)) { $v = $firstElement; } $html = ''; - $percentage = preg_replace( '/([_;#,.])/', '', $this->mask ); - if (! $v) { + $percentage = preg_replace('/([_;#,.])/', '', $this->mask); + if (!$v) { $v = $percentage; } if ($this->renderMode === 'edit') { @@ -2310,8 +2301,8 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText $html .= 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= 'type="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" '; - $html .= 'value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" '; - $html .= 'style="' . $this->htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" '; + $html .= 'value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" '; + $html .= 'style="' . $this->htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" '; $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSGridType() . ' '; @@ -2319,31 +2310,31 @@ class XmlFormFieldPercentage extends XmlFormFieldSimpleText $html .= '/>'; } else { //VIEW MODE - $html .= $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ); + $html .= $this->htmlentities($v, ENT_QUOTES, 'utf-8'); $html .= 'name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; $html .= $this->NSGridType() . ' '; - $html .= 'type="hidden" value="' . $this->htmlentities( $v, ENT_QUOTES, 'utf-8' ) . '" />'; + $html .= 'type="hidden" value="' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '" />'; } $result[] = $html; - $r ++; + $r++; } return $result; } } /*DEPRECATED*/ + /** * * @package gulliver.system */ class XmlFormFieldCaptionPercentage extends XmlFormField { - public function render($value = null, $paramDummy2 = null) { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -2378,13 +2369,13 @@ class XmlFormFieldDate2 extends XmlFormFieldSimpleText * @param $date * @return Boolean true/false */ - public function verifyDateFormat ($date) + public function verifyDateFormat($date) { - $aux = explode( '-', $date ); - if (count( $aux ) != 3) { + $aux = explode('-', $date); + if (count($aux) != 3) { return false; } - if (! (is_numeric( $aux[0] ) && is_numeric( $aux[1] ) && is_numeric( $aux[2] ))) { + if (!(is_numeric($aux[0]) && is_numeric($aux[1]) && is_numeric($aux[2]))) { return false; } if ($aux[0] < 1900 || $aux[0] > 2100) { @@ -2399,14 +2390,14 @@ class XmlFormFieldDate2 extends XmlFormFieldSimpleText * @param $date * @return */ - public function isvalidBeforeFormat ($date) + public function isvalidBeforeFormat($date) { - $part1 = substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); if ($part2 != 'd' && $part2 != 'm' && $part2 != 'y') { return false; } - if (! is_numeric( $part1 )) { + if (!is_numeric($part1)) { return false; } return true; @@ -2419,19 +2410,19 @@ class XmlFormFieldDate2 extends XmlFormFieldSimpleText * @param $sign * @return $res date based on the data insert */ - public function calculateBeforeFormat ($date, $sign) + public function calculateBeforeFormat($date, $sign) { - $part1 = $sign * substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = $sign * substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); switch ($part2) { case 'd': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + $part1, date( 'Y' ) ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $part1, date('Y'))); break; case 'm': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + $part1, date( 'd' ), date( 'Y' ) ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m') + $part1, date('d'), date('Y'))); break; case 'y': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + $part1 ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + $part1)); break; } @@ -2445,78 +2436,76 @@ class XmlFormFieldDate2 extends XmlFormFieldSimpleText * @param $owner * @return */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - - $value = G::replaceDataField( $value, $owner->values ); - $startDate = G::replaceDataField( $this->startDate, $owner->values ); - $endDate = G::replaceDataField( $this->endDate, $owner->values ); - $beforeDate = G::replaceDataField( $this->beforeDate, $owner->values ); - $afterDate = G::replaceDataField( $this->afterDate, $owner->values ); + $value = G::replaceDataField($value, $owner->values); + $startDate = G::replaceDataField($this->startDate, $owner->values); + $endDate = G::replaceDataField($this->endDate, $owner->values); + $beforeDate = G::replaceDataField($this->beforeDate, $owner->values); + $afterDate = G::replaceDataField($this->afterDate, $owner->values); //for backward compatibility size and maxlength if ($startDate != '') { - if (! $this->verifyDateFormat( $startDate )) { + if (!$this->verifyDateFormat($startDate)) { $startDate = ''; } } - if (isset( $beforeDate ) && $beforeDate != '') { - if ($this->isvalidBeforeFormat( $beforeDate )) { - $startDate = $this->calculateBeforeFormat( $beforeDate, - 1 ); + if (isset($beforeDate) && $beforeDate != '') { + if ($this->isvalidBeforeFormat($beforeDate)) { + $startDate = $this->calculateBeforeFormat($beforeDate, -1); } } - if ($startDate == '' && isset( $this->size ) && is_numeric( $this->size ) && $this->size >= 1900 && $this->size <= 2100) { + if ($startDate == '' && isset($this->size) && is_numeric($this->size) && $this->size >= 1900 && $this->size <= 2100) { $startDate = $this->size . '-01-01'; } if ($startDate == '') { - $startDate = date( 'Y-m-d' ); // the default is the current date + $startDate = date('Y-m-d'); // the default is the current date } //for backward compatibility maxlength //if ( $this->endDate == '') $this->finalYear = date('Y') + 8; //for backward compatibility size and maxlength if ($endDate != '') { - if (! $this->verifyDateFormat( $endDate )) { + if (!$this->verifyDateFormat($endDate)) { $endDate = ''; } } - if (isset( $afterDate ) && $afterDate != '') { - if ($this->isvalidBeforeFormat( $afterDate )) { - $endDate = $this->calculateBeforeFormat( $afterDate, + 1 ); + if (isset($afterDate) && $afterDate != '') { + if ($this->isvalidBeforeFormat($afterDate)) { + $endDate = $this->calculateBeforeFormat($afterDate, +1); } if ($endDate) { $sign = '1'; $date = $afterDate; - $part1 = $sign * substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = $sign * substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); switch ($part2) { case 'd': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + $part1, date( 'Y' ) ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $part1, date('Y'))); break; case 'm': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + $part1, date( 'd' ) - 1, date( 'Y' ) ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m') + $part1, date('d') - 1, date('Y'))); break; case 'y': - $res = (intVal( date( 'Y' ) ) + $part1) . '-' . date( 'm' ) . '-' . date( 'd' ); + $res = (intVal(date('Y')) + $part1) . '-' . date('m') . '-' . date('d'); break; } $endDate = $res; - } } - if (isset( $this->maxlength ) && is_numeric( $this->maxlength ) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { + if (isset($this->maxlength) && is_numeric($this->maxlength) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { $endDate = $this->maxlength . '-01-01'; } if ($endDate == '') { //$this->endDate = mktime ( 0,0,0,date('m'),date('d'),date('y') ); // the default is the current date + 2 years - $endDate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 2 ) ); // the default is the current date + 2 years + $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); // the default is the current date + 2 years } if ($value == '') { - $value = date( 'Y-m-d' ); + $value = date('Y-m-d'); } $html = ""; $html .= "" . $value . " "; @@ -2536,90 +2525,90 @@ class XmlFormFieldDate2 extends XmlFormFieldSimpleText */ public function renderGrid($values = null, $owner = null, $onlyValue = false, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; foreach ($values as $v) { - $v = G::replaceDataField( $v, $owner->values ); - $startDate = G::replaceDataField( $this->startDate, $owner->values ); - $endDate = G::replaceDataField( $this->endDate, $owner->values ); - $beforeDate = G::replaceDataField( $this->beforeDate, $owner->values ); - $afterDate = G::replaceDataField( $this->afterDate, $owner->values ); + $v = G::replaceDataField($v, $owner->values); + $startDate = G::replaceDataField($this->startDate, $owner->values); + $endDate = G::replaceDataField($this->endDate, $owner->values); + $beforeDate = G::replaceDataField($this->beforeDate, $owner->values); + $afterDate = G::replaceDataField($this->afterDate, $owner->values); //for backward compatibility size and maxlength if ($startDate != '') { - if (! $this->verifyDateFormat( $startDate )) { + if (!$this->verifyDateFormat($startDate)) { $startDate = ''; } } - if ($startDate == '' && isset( $beforeDate ) && $beforeDate != '') { - if ($this->isvalidBeforeFormat( $beforeDate )) { - $startDate = $this->calculateBeforeFormat( $beforeDate, - 1 ); + if ($startDate == '' && isset($beforeDate) && $beforeDate != '') { + if ($this->isvalidBeforeFormat($beforeDate)) { + $startDate = $this->calculateBeforeFormat($beforeDate, -1); } } - if ($startDate == '' && isset( $this->size ) && is_numeric( $this->size ) && $this->size >= 1900 && $this->size <= 2100) { + if ($startDate == '' && isset($this->size) && is_numeric($this->size) && $this->size >= 1900 && $this->size <= 2100) { $startDate = $this->size . '-01-01'; } if ($startDate == '') { - $startDate = date( 'Y-m-d' ); // the default is the current date + $startDate = date('Y-m-d'); // the default is the current date } //for backward compatibility maxlength //if ( $this->endDate == '') $this->finalYear = date('Y') + 8; //for backward compatibility size and maxlength if ($endDate != '') { - if (! $this->verifyDateFormat( $endDate )) { + if (!$this->verifyDateFormat($endDate)) { $endDate = ''; } } - if ($endDate == '' && isset( $afterDate ) && $afterDate != '') { - if ($this->isvalidBeforeFormat( $afterDate )) { - $endDate = $this->calculateBeforeFormat( $afterDate, + 1 ); + if ($endDate == '' && isset($afterDate) && $afterDate != '') { + if ($this->isvalidBeforeFormat($afterDate)) { + $endDate = $this->calculateBeforeFormat($afterDate, +1); } } - if ($endDate == '' && isset( $this->maxlength ) && is_numeric( $this->maxlength ) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { + if ($endDate == '' && isset($this->maxlength) && is_numeric($this->maxlength) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { $endDate = $this->maxlength . '-01-01'; } if ($endDate == '') { //$this->endDate = mktime ( 0,0,0,date('m'),date('d'),date('y') ); // the default is the current date + 2 years - $endDate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 2 ) ); // the default is the current date + 2 years + $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); // the default is the current date + 2 years } if ($v == '') { - $v = date( 'Y-m-d' ); + $v = date('Y-m-d'); } - if (! $onlyValue) { + if (!$onlyValue) { $html = "name . "]' name='form[" . $owner->name . '][' . $r . '][' . $this->name . "]' value='" . $v . "'>"; - if (isset( $owner->owner->id )) { + if (isset($owner->owner->id)) { $html .= "name . "]' name='span[" . $owner->owner->id . "][" . $owner->name . '][' . $r . '][' . $this->name . "]' style='border:1;border-color:#000;width:100px;'>" . $v . " "; } else { $html .= "name . "]' name='span[" . $owner->id . "][" . $owner->name . '][' . $r . '][' . $this->name . "]' style='border:1;border-color:#000;width:100px;'>" . $v . " "; } if ($this->mode == 'edit') { - $html .= "owner ) ? $owner->owner->id : $owner->id) . "', '" . $owner->name . '][' . $r . '][' . $this->name . "', '" . $v . "', '" . $startDate . "', '" . $endDate . "'); return false;\" >"; + $html .= "owner) ? $owner->owner->id : $owner->id) . "', '" . $owner->name . '][' . $r . '][' . $this->name . "', '" . $v . "', '" . $startDate . "', '" . $endDate . "'); return false;\" >"; } } else { $html = $v; } $result[] = $html; - $r ++; + $r++; } return $result; } } /*DEPRECATED*/ + /** * * @package gulliver.system */ class XmlFormFieldDateView extends XmlFormField { - public function render($value = null, $paramDummy2 = null) { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -2642,10 +2631,10 @@ class XmlFormFieldYesNo extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } if ($value == '') { $value = '0'; @@ -2666,8 +2655,8 @@ class XmlFormFieldYesNo extends XmlFormField $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSRequiredValue() . ' '; $html .= '>'; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; $html .= ''; if ($readOnlyText != '') { $html .= 'name . '">'; - $html .= ($value === '0') ? G::LoadTranslation( 'ID_NO_VALUE' ) : G::LoadTranslation( 'ID_YES_VALUE' ); + $html .= ($value === '0') ? G::LoadTranslation('ID_NO_VALUE') : G::LoadTranslation('ID_YES_VALUE'); $html .= 'name . ']" '; $html .= 'name="form[' . $this->name . ']" '; @@ -2701,7 +2690,7 @@ class XmlFormFieldYesNo extends XmlFormField public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { $this->gridFieldType = 'yesno'; - $result = array (); + $result = []; $r = 1; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; @@ -2724,8 +2713,8 @@ class XmlFormFieldYesNo extends XmlFormField $html .= $this->NSRequiredValue() . ' '; $html .= $this->NSGridLabel() . ' '; $html .= '>'; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; $html .= ''; if ($readOnlyText != '') { $html .= 'name . '][' . $r . '][' . $this->name . ']" '; $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; @@ -2744,7 +2733,7 @@ class XmlFormFieldYesNo extends XmlFormField $html .= 'type="hidden" value="' . (($v === '0') ? '0' : '1') . '" />'; } $result[] = $html; - $r ++; + $r++; } return $result; } @@ -2781,7 +2770,7 @@ class XmlFormFieldLink extends XmlFormField switch ($owner->type) { case "grid": $id = $owner->name . "][" . $row . "][" . $this->name; - $v = (isset($owner->values[$owner->name][$row]))? $owner->values[$owner->name][$row] : array(); + $v = (isset($owner->values[$owner->name][$row])) ? $owner->values[$owner->name][$row] : []; //g::pr($this->NSGridType().'gyygygy');die; $pmtype = $this->NSGridType(); break; @@ -2798,19 +2787,19 @@ class XmlFormFieldLink extends XmlFormField } else { $link = !empty($value) ? $value : ""; } - $labelAux1 = (!empty($label))? $label : G::replaceDataField($this->label, $v); - $labelAux2 = (!empty($label))? $label : G::replaceDataField($this->value, $v); + $labelAux1 = (!empty($label)) ? $label : G::replaceDataField($this->label, $v); + $labelAux2 = (!empty($label)) ? $label : G::replaceDataField($this->value, $v); $onclick = G::replaceDataField($this->onclick, $v); $target = G::replaceDataField($this->target, $v); - $html = "htmlentities($link, ENT_QUOTES, "utf-8") . "\""; + $html = "htmlentities($link, ENT_QUOTES, "utf-8") . "\""; $html = $html . " id=\"form[$id]\" name=\"form[$id]\" pm:field=\"pm:field\" "; if ((strrpos($_SERVER['HTTP_USER_AGENT'], "Chrome") === false ? false : true) && trim($this->htmlentities($link, ENT_QUOTES, "utf-8")) === "#") { $html = $html . (($this->onclick) ? " onclick=\"" . htmlentities($onclick, ENT_QUOTES, "utf-8") . " return false;\"" : " onclick=\" return false;\""); } else { $html = $html . (($this->onclick) ? " onclick=\"" . htmlentities($onclick, ENT_QUOTES, "utf-8") . "\"" : null); } - $html = $html . (($this->target)? " target=\"" . htmlentities($target, ENT_QUOTES, "utf-8") . "\"" : null); + $html = $html . (($this->target) ? " target=\"" . htmlentities($target, ENT_QUOTES, "utf-8") . "\"" : null); switch ($owner->type) { case "grid": @@ -2823,7 +2812,7 @@ class XmlFormFieldLink extends XmlFormField break; } - $html = $html . ">" . $this->htmlentities(($this->value == "")? $labelAux1 : $labelAux2, ENT_QUOTES, "utf-8") . ""; + $html = $html . ">" . $this->htmlentities(($this->value == "") ? $labelAux1 : $labelAux2, ENT_QUOTES, "utf-8") . ""; switch ($owner->type) { case "grid": @@ -2845,13 +2834,13 @@ class XmlFormFieldLink extends XmlFormField */ public function renderGrid($value = array(), $label = array(), $owner = null, $paramDummy4 = null) { - $arrayResult = array(); + $arrayResult = []; $row = 1; foreach ($value as $index => $v) { $arrayResult[] = $this->render( - (isset($value[$index]))? $value[$index] : null, - (isset($label[$index]))? $label[$index] : null, + (isset($value[$index])) ? $value[$index] : null, + (isset($label[$index])) ? $label[$index] : null, $owner, $row ); @@ -2871,14 +2860,14 @@ class XmlFormFieldLink extends XmlFormField */ public function renderTable($value = null, $owner = null, $paramDummy3 = null) { - $onclick = $this->htmlentities( G::replaceDataField( $this->onclick, $owner->values ), ENT_QUOTES, 'utf-8' ); - $link = $this->htmlentities( G::replaceDataField( $this->link, $owner->values ), ENT_QUOTES, 'utf-8' ); - $target = G::replaceDataField( $this->target, $owner->values ); - $value = G::replaceDataField( $this->value, $owner->values ); - $label = G::replaceDataField( $this->label, $owner->values ); - $aLabel = $this->htmlentities( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ); - if (isset( $aLabel ) && strlen( $aLabel ) > 0) { - return 'onclick) ? ' onclick="' . $onclick . '"' : '') . (($this->target) ? ' target="' . htmlentities( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $aLabel . ''; + $onclick = $this->htmlentities(G::replaceDataField($this->onclick, $owner->values), ENT_QUOTES, 'utf-8'); + $link = $this->htmlentities(G::replaceDataField($this->link, $owner->values), ENT_QUOTES, 'utf-8'); + $target = G::replaceDataField($this->target, $owner->values); + $value = G::replaceDataField($this->value, $owner->values); + $label = G::replaceDataField($this->label, $owner->values); + $aLabel = $this->htmlentities($this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8'); + if (isset($aLabel) && strlen($aLabel) > 0) { + return 'onclick) ? ' onclick="' . $onclick . '"' : '') . (($this->target) ? ' target="' . htmlentities($target, ENT_QUOTES, 'utf-8') . '"' : '') . '>' . $aLabel . ''; } else { return ''; } @@ -2904,7 +2893,7 @@ class XmlFormFieldFile extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null, $rowId = null, $row = -1, $therow = -1) + public function render($value = null, $owner = null, $rowId = null, $row = -1, $therow = -1) { $permission = false; $url = null; @@ -2918,28 +2907,28 @@ class XmlFormFieldFile extends XmlFormField break; } - if (isset( $_SESSION["APPLICATION"] ) && isset( $_SESSION["USER_LOGGED"] ) && isset( $_SESSION["TASK"] ) && isset( $this->input ) && $this->input != null && $this->mode == "view") { - require_once ("classes/model/AppDocument.php"); + if (isset($_SESSION["APPLICATION"]) && isset($_SESSION["USER_LOGGED"]) && isset($_SESSION["TASK"]) && isset($this->input) && $this->input != null && $this->mode == "view") { + require_once("classes/model/AppDocument.php"); $case = new Cases(); - $arrayField = $case->loadCase( $_SESSION["APPLICATION"] ); - $arrayPermission = $case->getAllObjects( $arrayField["PRO_UID"], $_SESSION["APPLICATION"], $_SESSION["TASK"], $_SESSION["USER_LOGGED"] ); + $arrayField = $case->loadCase($_SESSION["APPLICATION"]); + $arrayPermission = $case->getAllObjects($arrayField["PRO_UID"], $_SESSION["APPLICATION"], $_SESSION["TASK"], $_SESSION["USER_LOGGED"]); $criteria = new Criteria(); - $criteria->add( AppDocumentPeer::APP_DOC_UID, $arrayPermission["INPUT_DOCUMENTS"], Criteria::IN ); + $criteria->add(AppDocumentPeer::APP_DOC_UID, $arrayPermission["INPUT_DOCUMENTS"], Criteria::IN); switch ($owner->type) { case "xmlform": break; case "grid": - $criteria->add( AppDocumentPeer::APP_DOC_FIELDNAME, $owner->name . "_" . $row . "_" . $this->name ); + $criteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $owner->name . "_" . $row . "_" . $this->name); break; } - $criteria->addDescendingOrderByColumn( AppDocumentPeer::APP_DOC_CREATE_DATE ); - $rsCriteria = AppDocumentPeer::doSelectRS( $criteria ); - $rsCriteria->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $criteria->addDescendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE); + $rsCriteria = AppDocumentPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $sw = 0; while (($rsCriteria->next()) && $sw == 0) { @@ -2947,7 +2936,7 @@ class XmlFormFieldFile extends XmlFormField if ($row["DOC_UID"] == $this->input) { $permission = true; - $url = ((G::is_https()) ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . dirname( $_SERVER["REQUEST_URI"] ) . "/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]; + $url = ((G::is_https()) ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . "/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]; $sw = 1; } } @@ -2968,12 +2957,10 @@ class XmlFormFieldFile extends XmlFormField $styleDisplay = "display: none;"; } - $arrayInputDocumentData = array(); + $arrayInputDocumentData = []; $inpDocMaxFilesize = ""; if (isset($this->input) && $this->input != null) { - - try { $inputDocument = new InputDocument(); $arrayInputDocumentData = $inputDocument->load($this->input); @@ -2983,7 +2970,7 @@ class XmlFormFieldFile extends XmlFormField } if (count($arrayInputDocumentData) > 0) { - $inpDocMaxFilesize = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] * (($arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"] == "MB")? 1024 *1024 : 1024); //Bytes + $inpDocMaxFilesize = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] * (($arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"] == "MB") ? 1024 * 1024 : 1024); //Bytes } $pmInputDocument = "pmindocmaxfilesize=\"" . $inpDocMaxFilesize . "\""; //Bytes @@ -2992,9 +2979,9 @@ class XmlFormFieldFile extends XmlFormField if (isset($this->input) && $this->input != null) { if (count($arrayInputDocumentData) > 0) { - $maxUploadFilesizeLabel = ($arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] . "" != "0" && $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] != "")? G::LoadTranslation("ID_MAX_FILE_SIZE") . " [" . $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] . " " . $arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"] . "]" : ""; + $maxUploadFilesizeLabel = ($arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] . "" != "0" && $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] != "") ? G::LoadTranslation("ID_MAX_FILE_SIZE") . " [" . $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"] . " " . $arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"] . "]" : ""; - $arrayInputDocumentData["INP_DOC_TITLE"] = (isset($arrayInputDocumentData["INP_DOC_TITLE"]))? $arrayInputDocumentData["INP_DOC_TITLE"] : null; + $arrayInputDocumentData["INP_DOC_TITLE"] = (isset($arrayInputDocumentData["INP_DOC_TITLE"])) ? $arrayInputDocumentData["INP_DOC_TITLE"] : null; $html = $html . "
"; } else { $html = $html . " \"\"(" . G::loadTranslation("ID_INPUT_DOC_DOESNT_EXIST") . ")"; @@ -3008,11 +2995,11 @@ class XmlFormFieldFile extends XmlFormField public function renderGrid($value = array(), $owner = null, $therow = -1, $paramDummy4 = null) { - $arrayResult = array (); + $arrayResult = []; $r = 1; foreach ($value as $v) { - $arrayResult[] = $this->render( $v, $owner, "[" . $owner->name . "][" . $r . "]", $r, $therow ); + $arrayResult[] = $this->render($v, $owner, "[" . $owner->name . "][" . $r . "]", $r, $therow); $r = $r + 1; } @@ -3031,12 +3018,12 @@ class XmlFormFieldDropdownpt extends XmlFormField { public $value; - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { $this->value = $value; $id = $this->value->id; - $value = isset( $this->value->value ) ? $this->value->value : ''; + $value = isset($this->value->value) ? $this->value->value : ''; $items = $this->value->items; $res = '"; return $res; } @@ -3095,14 +3082,14 @@ class XmlFormFieldCheckboxpt extends XmlFormField */ public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; foreach ($values as $v) { $checked = (($v == $this->value) ? 'checked="checked"' : ''); $disabled = (($this->value == 'view') ? 'disabled="disabled"' : ''); $html = $res = ""; $result[] = $html; - $r ++; + $r++; } return $result; } @@ -3114,7 +3101,7 @@ class XmlFormFieldCheckboxpt extends XmlFormField * @param &$owner * @return either the value or falseValue attributes */ - public function maskValue ($value, &$owner) + public function maskValue($value, &$owner) { return ($value === $this->value) ? $value : $this->falseValue; } @@ -3141,10 +3128,10 @@ class XmlFormFieldCheckbox extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } $disabled = ''; @@ -3154,7 +3141,7 @@ class XmlFormFieldCheckbox extends XmlFormField $readOnly = ''; } - $checked = (isset( $value ) && ($value == $this->value)) ? 'checked' : ''; + $checked = (isset($value) && ($value == $this->value)) ? 'checked' : ''; if ($this->mode === 'edit') { //$readOnly = isset ( $this->readOnly ) && $this->readOnly ? 'disabled' : ''; @@ -3168,7 +3155,7 @@ class XmlFormFieldCheckbox extends XmlFormField // $res = "" . $this->label ; return $res; } elseif ($this->mode === 'view') { - $checked = (isset( $value ) && ($value == $this->value)) ? 'checked' : ''; + $checked = (isset($value) && ($value == $this->value)) ? 'checked' : ''; if ($this->labelOnRight) { $html = " " . $this->label . ''; @@ -3190,7 +3177,7 @@ class XmlFormFieldCheckbox extends XmlFormField public function renderGrid($values = array(), $owner = null, $paramDummy3 = null, $paramDummy4 = null) { $this->gridFieldType = 'checkbox'; - $result = array (); + $result = []; $r = 1; foreach ($values as $v) { $checked = (($v == $this->value) ? 'checked="checked"' : ''); @@ -3202,12 +3189,12 @@ class XmlFormFieldCheckbox extends XmlFormField if ($this->mode === 'edit') { $html = $res = "NSDefaultValue() . " " . $this->NSGridType() . "/>"; $result[] = $html; - $r ++; + $r++; } else { //$disabled = (($this->value == 'view') ? 'disabled="disabled"' : ''); $html = $res = "NSDefaultValue() . " " . $this->NSGridType() . "/>"; $result[] = $html; - $r ++; + $r++; } } return $result; @@ -3220,13 +3207,14 @@ class XmlFormFieldCheckbox extends XmlFormField * @param $owner * @return either the value or falseValue */ - public function maskValue ($value, &$owner) + public function maskValue($value, &$owner) { return ($value === $this->value) ? $value : $this->falseValue; } } /*DEPRECATED*/ + /** * * @package gulliver.system @@ -3260,17 +3248,17 @@ class XmlFormFieldButton extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - $onclick = G::replaceDataField( $this->onclick, $owner->values ); - $label = G::replaceDataField( $this->label, $owner->values ); + $onclick = G::replaceDataField($this->onclick, $owner->values); + $label = G::replaceDataField($this->label, $owner->values); if ($this->mode === 'edit') { - $re = "style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; + $re = "style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities($onclick, ENT_COMPAT, 'utf-8') . '"' : '') . " />"; return $re; } elseif ($this->mode === 'view') { - return "style};display:none\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; + return "style};display:none\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities($onclick, ENT_COMPAT, 'utf-8') . '"' : '') . " />"; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } } @@ -3291,20 +3279,19 @@ class XmlFormFieldReset extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - $onclick = G::replaceDataField( $this->onclick, $owner->values ); + $onclick = G::replaceDataField($this->onclick, $owner->values); $mode = ($this->mode == 'view') ? ' disabled="disabled"' : ''; //return ''; // return "style}\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; if ($this->mode === 'edit') { - return "style}\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; + return "style}\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities($onclick, ENT_COMPAT, 'utf-8') . '"' : '') . " />"; } elseif ($this->mode === 'view') { - return "style};display:none\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; + return "style};display:none\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities($onclick, ENT_COMPAT, 'utf-8') . '"' : '') . " />"; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } - } } @@ -3325,25 +3312,25 @@ class XmlFormFieldSubmit extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - $onclick = G::replaceDataField( $this->onclick, $owner->values ); + $onclick = G::replaceDataField($this->onclick, $owner->values); if ($this->mode === 'edit') { // if ($this->readOnly) // return 'label .'\' disabled/>'; - return "style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; - } elseif ($this->mode === 'view') { + return "style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" " . $this->NSFieldType() . " name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities($onclick, ENT_COMPAT, 'utf-8') . '"' : '') . " />"; + } elseif ($this->mode === 'view') { //return "style};display:none\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; //$sLinkNextStep = 'window.open("' . $owner->fields['__DYNAFORM_OPTIONS']->xmlMenu->values['NEXT_STEP'] . '", "_self");'; $html = ''; - if (isset( $_SESSION['CURRENT_DYN_UID'] )) { + if (isset($_SESSION['CURRENT_DYN_UID'])) { $sLinkNextStep = 'window.location=("casesSaveDataView?UID=' . $_SESSION['CURRENT_DYN_UID'] . '");'; - $html = 'NSFieldType() . ' name="form[' . $this->name . ']" type="button" value="' . G::LoadTranslation( 'ID_CONTINUE' ) . '" onclick="' . htmlentities( $sLinkNextStep, ENT_COMPAT, 'utf-8' ) . '" />'; + $html = 'NSFieldType() . ' name="form[' . $this->name . ']" type="button" value="' . G::LoadTranslation('ID_CONTINUE') . '" onclick="' . htmlentities($sLinkNextStep, ENT_COMPAT, 'utf-8') . '" />'; } return $html; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } } @@ -3358,9 +3345,10 @@ class XmlFormFieldHidden extends XmlFormField { public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; public $dependentFields = ''; public $gridFieldType = 'hidden'; + /** * Function render * @@ -3369,29 +3357,29 @@ class XmlFormFieldHidden extends XmlFormField * @param string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $this->executeSQL( $owner ); + $this->executeSQL($owner); - if (isset( $this->sqlOption )) { - reset( $this->sqlOption ); - $firstElement = key( $this->sqlOption ); - if (isset( $firstElement )) { + if (isset($this->sqlOption)) { + reset($this->sqlOption); + $firstElement = key($this->sqlOption); + if (isset($firstElement)) { $value = $firstElement; } } } //$html .= 'value="' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '" '; if ($this->mode === 'edit') { - return 'NSFieldType() . ' name="form[' . $this->name . ']" type=\'hidden\' value=\'' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '\'/>'; + return 'NSFieldType() . ' name="form[' . $this->name . ']" type=\'hidden\' value=\'' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '\'/>'; } elseif ($this->mode === 'view') { //a button? who wants a hidden field be showed like a button?? very strange. - return 'NSFieldType() . ' name="form[' . $this->name . ']" type=\'text\' value=\'' . $this->htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '\' style="display:none"/>'; + return 'NSFieldType() . ' name="form[' . $this->name . ']" type=\'text\' value=\'' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '\' style="display:none"/>'; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -3404,11 +3392,11 @@ class XmlFormFieldHidden extends XmlFormField */ public function renderGrid($values = null, $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; foreach ($values as $v) { - $result[] = 'NSGridType() . ' value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" />'; - $r ++; + $result[] = 'NSGridType() . ' value="' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" />'; + $r++; } return $result; @@ -3440,10 +3428,10 @@ class XmlFormFieldDropdown extends XmlFormField public $dependentFields = ''; public $readonly = false; public $optgroup = 0; - public $option = array(); + public $option = []; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array(); + public $sqlOption = []; public $saveLabel = 0; public $modeGridDrop = ''; public $renderMode = ''; @@ -3462,21 +3450,21 @@ class XmlFormFieldDropdown extends XmlFormField * @param string owner * @return string */ - public function render ($value = null, $owner = null, $rowId = '', $onlyValue = false, $row = -1, $therow = -1) + public function render($value = null, $owner = null, $rowId = '', $onlyValue = false, $row = -1, $therow = -1) { $displayStyle = ''; //Returns value from a PMTable when it is exists. if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } //Recalculate SQL options if $therow is not defined or the row id equal - if ($therow == - 1) { + if ($therow == -1) { //echo 'Entro:'.$this->dependentFields; - $this->executeSQL( $owner, $row ); + $this->executeSQL($owner, $row); } else { if ($row == $therow) { - $this->executeSQL( $owner, $row ); + $this->executeSQL($owner, $row); } } @@ -3487,7 +3475,7 @@ class XmlFormFieldDropdown extends XmlFormField $this->renderMode = $this->mode; } - if (! $onlyValue) { + if (!$onlyValue) { //Render Field if not defined onlyValue if ($this->renderMode != 'edit') { //EDIT MODE @@ -3507,8 +3495,8 @@ class XmlFormFieldDropdown extends XmlFormField $html .= $this->NSDefaultValue() . ' '; $html .= $this->NSGridLabel() . ' '; $html .= $rowId == '' ? $this->NSFieldType() : $this->NSGridType() . ' '; - $html .= $this->NSDependentFields( true ) . ' '; - $html = $html . (($this->optgroup == 1)? "pm:optgroup=\"1\" " : null); + $html .= $this->NSDependentFields(true) . ' '; + $html = $html . (($this->optgroup == 1) ? "pm:optgroup=\"1\" " : null); $html = $html . ">"; $findValue = ''; @@ -3532,7 +3520,7 @@ class XmlFormFieldDropdown extends XmlFormField $swOptGroupPrev = 1; $swAppend = 0; } else { - $html = $html . $htmlOptGroup . ""; + $html = $html . $htmlOptGroup . ""; $htmlOptGroup = null; $swAppend = 1; @@ -3562,7 +3550,7 @@ class XmlFormFieldDropdown extends XmlFormField $swOptGroupPrev = 1; $swAppend = 0; } else { - $html = $html . $htmlOptGroup . ""; + $html = $html . $htmlOptGroup . ""; $htmlOptGroup = null; $swAppend = 1; @@ -3599,7 +3587,7 @@ class XmlFormFieldDropdown extends XmlFormField $html .= 'value="' . (($findValue != '') ? $findValue : $firstValue) . '" />'; } - $this->selectedValue = ($findValue != "")? $findValue : ($count == 0)? $firstValue : ""; + $this->selectedValue = ($findValue != "") ? $findValue : ($count == 0) ? $firstValue : ""; } else { //Render Field showing only value; foreach ($this->option as $optValue => $optName) { @@ -3634,18 +3622,18 @@ class XmlFormFieldDropdown extends XmlFormField * @param string values * @return string */ - public function renderGrid ($values = array(), $owner = null, $onlyValue = false, $therow = -1) + public function renderGrid($values = array(), $owner = null, $onlyValue = false, $therow = -1) { $this->gridFieldType = 'dropdown'; - $result = array (); + $result = []; $r = 1; if ($owner->mode != 'view') { $this->renderMode = $this->modeForGrid; } foreach ($values as $v) { - $result[] = $this->render( $v, $owner, '[' . $owner->name . '][' . $r . ']', $onlyValue, $r, $therow ); - $r ++; + $result[] = $this->render($v, $owner, '[' . $owner->name . '][' . $r . ']', $onlyValue, $r, $therow); + $r++; } return $result; } @@ -3661,12 +3649,12 @@ class XmlFormFieldListbox extends XmlFormField { public $defaultValue = ''; public $required = false; - public $option = array (); + public $option = []; public $sqlConnection = 0; public $size = 4; public $width = ''; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; /** * Function render @@ -3676,17 +3664,17 @@ class XmlFormFieldListbox extends XmlFormField * @param string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } - $this->executeSQL( $owner ); - if (! is_array( $value )) { - $value = explode( '|', $value ); + $this->executeSQL($owner); + if (!is_array($value)) { + $value = explode('|', $value); } - $arrayAux = array(); + $arrayAux = []; foreach ($value as $index2 => $value2) { if (!is_array($value2)) { @@ -3705,10 +3693,10 @@ class XmlFormFieldListbox extends XmlFormField } $html = ''; @@ -3718,16 +3706,16 @@ class XmlFormFieldListbox extends XmlFormField $valuesFound = array('__NULL__'); $html = ''; foreach ($this->option as $optionName => $option) { - $html .= "name . "][" . $optionName . "]\" name=\"form[" . $this->name . "][]\" " . $this->NSFieldType() . " value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">"; + $html .= "name . "][" . $optionName . "]\" name=\"form[" . $this->name . "][]\" " . $this->NSFieldType() . " value=\"" . ((in_array($optionName . "", $value)) ? $optionName : "__NULL__") . "\">"; } foreach ($this->sqlOption as $optionName => $option) { - $html .= "name . "][" . $optionName . "]\" name=\"form[" . $this->name . "][]\" " . $this->NSFieldType() . " value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">"; + $html .= "name . "][" . $optionName . "]\" name=\"form[" . $this->name . "][]\" " . $this->NSFieldType() . " value=\"" . ((in_array($optionName . "", $value)) ? $optionName : "__NULL__") . "\">"; } if (count($valuesFound) - 1 < count($value)) { $valuesNotFound = array_diff($value, $valuesFound); @@ -3750,7 +3738,7 @@ class XmlFormFieldListbox extends XmlFormField } return $html; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } @@ -3763,7 +3751,7 @@ class XmlFormFieldListbox extends XmlFormField */ public function renderGrid($value = null, $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - return $this->render( $value, $owner ); + return $this->render($value, $owner); } } @@ -3777,10 +3765,10 @@ class XmlFormFieldRadioGroup extends XmlFormField { public $defaultValue = ''; public $required = false; - public $option = array (); + public $option = []; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; public $viewAlign = 'vertical'; public $linkType; @@ -3792,22 +3780,22 @@ class XmlFormFieldRadioGroup extends XmlFormField * @param string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } - $this->executeSQL( $owner ); + $this->executeSQL($owner); if ($this->mode === 'edit') { $html = ''; $i = 0; foreach ($this->options as $optionName => $option) { - if (isset( $this->linkType ) && ($this->linkType == 1 || $this->linkType == "1")) { + if (isset($this->linkType) && ($this->linkType == 1 || $this->linkType == "1")) { $html .= 'NSFieldType() . ' name="form[' . $this->name . ']" type="radio" value="' . $optionName . '" ' . (($optionName == $value) ? ' checked' : '') . '>' . $option . ''; } else { $html .= 'NSFieldType() . ' name="form[' . $this->name . ']" type="radio" value="' . $optionName . '" ' . (($optionName == $value) ? ' checked' : '') . '>'; } - if (++ $i == count( $this->options )) { + if (++$i == count($this->options)) { $html .= '      ' . $this->renderHint(); } @@ -3834,12 +3822,13 @@ class XmlFormFieldRadioGroup extends XmlFormField } return $html; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } } } /*DEPRECATED*/ + /** * * @package gulliver.system @@ -3849,10 +3838,10 @@ class XmlFormFieldRadioGroupView extends XmlFormField { public $defaultValue = ''; public $required = false; - public $option = array (); + public $option = []; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; /** * Function render @@ -3862,9 +3851,9 @@ class XmlFormFieldRadioGroupView extends XmlFormField * @param string owner * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - $this->executeSQL( $owner ); + $this->executeSQL($owner); $html = ''; foreach ($this->option as $optionName => $option) { $html .= '' . $option . '
'; @@ -3882,34 +3871,34 @@ class XmlFormFieldRadioGroupView extends XmlFormField class XmlFormFieldCheckGroup extends XmlFormField { public $required = false; - public $option = array (); + public $option = []; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; /*function validateValue( $value , $owner ) { $this->executeSQL( $owner ); return isset($value) && ( array_key_exists( $value , $this->options ) ); }*/ /** - * Function render - * - * @access public - * @param string value - * @param string owner - * @return string - */ - public function render ($value = null, $owner = null) + * Function render + * + * @access public + * @param string value + * @param string owner + * @return string + */ + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } - $this->executeSQL( $owner ); - if (! is_array( $value )) { - $value = explode( '|', $value ); + $this->executeSQL($owner); + if (!is_array($value)) { + $value = explode('|', $value); } - $arrayAux = array(); + $arrayAux = []; foreach ($value as $index2 => $value2) { $arrayAux[] = $value2 . ""; @@ -3921,9 +3910,9 @@ class XmlFormFieldCheckGroup extends XmlFormField $i = 0; $html = ''; foreach ($this->options as $optionName => $option) { - $html .= "name . "][" . $optionName . "]\" " . $this->NSFieldType() . " name=\"form[" . $this->name . "][]\" value=\"" . $optionName . "\"" . (in_array( $optionName . "", $value ) ? "checked = \"checked\" " : "") . ">"; + $html .= "name . "][" . $optionName . "]\" " . $this->NSFieldType() . " name=\"form[" . $this->name . "][]\" value=\"" . $optionName . "\"" . (in_array($optionName . "", $value) ? "checked = \"checked\" " : "") . ">"; - if (++ $i == count( $this->options )) { + if (++$i == count($this->options)) { $html .= '      ' . $this->renderHint(); } $html .= '
'; @@ -3933,11 +3922,11 @@ class XmlFormFieldCheckGroup extends XmlFormField $valuesFound = array('__NULL__'); $html = ''; foreach ($this->options as $optionName => $option) { - if (in_array( $optionName . "", $value )) { + if (in_array($optionName . "", $value)) { $valuesFound[] = $optionName . ""; } - $html .= "NSFieldType() . "class=\"FormCheck\" type=\"checkbox\" id=\"form[" . $this->name . "][" . $optionName . "]\" value=\"" . $optionName . "\"" . (in_array( $optionName . "", $value ) ? " checked=\"checked\" " : "") . " disabled=\"disabled\">
"; - $html .= "name . "][]\" value=\"" . ((in_array( $optionName . "", $value )) ? $optionName : "__NULL__") . "\">"; + $html .= "NSFieldType() . "class=\"FormCheck\" type=\"checkbox\" id=\"form[" . $this->name . "][" . $optionName . "]\" value=\"" . $optionName . "\"" . (in_array($optionName . "", $value) ? " checked=\"checked\" " : "") . " disabled=\"disabled\">
"; + $html .= "name . "][]\" value=\"" . ((in_array($optionName . "", $value)) ? $optionName : "__NULL__") . "\">"; } if (count($valuesFound) - 1 < count($value)) { $valuesNotFound = array_diff($value, $valuesFound); @@ -3948,37 +3937,37 @@ class XmlFormFieldCheckGroup extends XmlFormField } return $html; } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); } - } /** * Renderring the checkgroup inner grid for Staff Eval Plugin - * @see class.form.php#validateArray(); + * @see class.form.php#validate[]; * @author Edauto * @since 2012-07-20 */ - public function renderGrid($values = NULL, $owner = NULL) { - $this->executeSQL ( $owner ); + public function renderGrid($values = null, $owner = null, $onlyValue = false, $therow = -1) + { + $this->executeSQL($owner); $disable = ($owner->mode === 'view') ? 'disabled="disabled" ' : ' '; $r = 1; - $result = array(); - foreach ( $values as $v ) { // foreach the grid row with selection - $i=1; + $result = []; + foreach ($values as $v) { // foreach the grid row with selection + $i = 1; $html = ''; - if (! is_array ( $v )) { - $aV = explode ( '|', str_replace(" ","",$v)); + if (!is_array($v)) { + $aV = explode('|', str_replace(" ", "", $v)); } else { $aV = $v; } - foreach ( $this->options as $optionName => $option ) { // foreach the options of checkbox group - $bChecked = in_array ( $i , $aV, true ) || in_array($optionName, $aV, true); - $html .= 'name . ']['. $r .']['. $this->name .'][]" '; - $html .= 'type="checkbox" value="' . $optionName . '" ' . ($bChecked ? 'checked ' : ' ') ; + foreach ($this->options as $optionName => $option) { // foreach the options of checkbox group + $bChecked = in_array($i, $aV, true) || in_array($optionName, $aV, true); + $html .= 'name . '][' . $r . '][' . $this->name . '][]" '; + $html .= 'type="checkbox" value="' . $optionName . '" ' . ($bChecked ? 'checked ' : ' '); $html .= $disable . '>' . $option . ''; - if(++$i==count($this->options)){ + if (++$i == count($this->options)) { $html .= ' ' . $this->renderHint(); } $html .= '
'; @@ -3991,6 +3980,7 @@ class XmlFormFieldCheckGroup extends XmlFormField } /* TODO: DEPRECATED */ + /** * * @package gulliver.system @@ -3998,10 +3988,10 @@ class XmlFormFieldCheckGroup extends XmlFormField */ class XmlFormFieldCheckGroupView extends XmlFormField { - public $option = array (); + public $option = []; public $sqlConnection = 0; public $sql = ''; - public $sqlOption = array (); + public $sqlOption = []; /** * Function render @@ -4037,7 +4027,7 @@ class XmlFormFieldGrid extends XmlFormField public $sql = ''; //TODO: 0=doesn't excecute the query, 1=Only the first time, 2=Allways public $fillType = 0; - public $fields = array (); + public $fields = []; public $scriptURL; public $id = ''; @@ -4050,10 +4040,10 @@ class XmlFormFieldGrid extends XmlFormField * @param string home * @return string */ - public function __construct ($xmlnode, $language, $home) + public function __construct($xmlnode, $language, $home) { - parent::__construct( $xmlnode, $language ); - $this->parseFile( $home, $language ); + parent::__construct($xmlnode, $language); + $this->parseFile($home, $language); } /** @@ -4064,17 +4054,17 @@ class XmlFormFieldGrid extends XmlFormField * @param string language * @return string */ - public function parseFile ($home, $language) + public function parseFile($home, $language) { - if (file_exists( $home . $this->xmlGrid . '.xml' )) { + if (file_exists($home . $this->xmlGrid . '.xml')) { $this->xmlform = new XmlForm(); $this->xmlform->home = $home; - $this->xmlform->parseFile( $this->xmlGrid . '.xml', $language, false ); + $this->xmlform->parseFile($this->xmlGrid . '.xml', $language, false); $this->fields = $this->xmlform->fields; $this->scriptURL = $this->xmlform->scriptURL; $this->id = $this->xmlform->id; $this->modeGrid = $this->xmlform->mode; - unset( $this->xmlform ); + unset($this->xmlform); } } @@ -4088,9 +4078,8 @@ class XmlFormFieldGrid extends XmlFormField public function render($values = null, $owner = null) { - $emptyRow = $this->setScrollStyle( $owner ); - return $this->renderGrid( $emptyRow, $owner ); - + $emptyRow = $this->setScrollStyle($owner); + return $this->renderGrid($emptyRow, $owner); } /** @@ -4105,7 +4094,7 @@ class XmlFormFieldGrid extends XmlFormField $this->id = $this->owner->id . $this->name; $using_template = 'grid'; - if (isset( $this->mode )) { + if (isset($this->mode)) { $ownerMode = $this->mode; } else { $ownerMode = ''; @@ -4127,23 +4116,23 @@ class XmlFormFieldGrid extends XmlFormField $tpl = new xmlformTemplate($this, PATH_CORE . "templates" . PATH_SEP . "$using_template.html"); - if (! isset( $values ) || ! is_array( $values ) || sizeof( $values ) == 0) { - $values = array_keys( $this->fields ); + if (!isset($values) || !is_array($values) || sizeof($values) == 0) { + $values = array_keys($this->fields); } - if ($therow != - 1) { + if ($therow != -1) { //Check if values arrary is complete to can flip. - $xValues = array (); - if (isset( $values[$therow] )) { + $xValues = []; + if (isset($values[$therow])) { $aRow = $values[$therow]; } else { - $aRow = array (); + $aRow = []; } - for ($c = 1; $c <= $therow; $c ++) { + for ($c = 1; $c <= $therow; $c++) { if ($c == $therow) { $xValues[$therow] = $aRow; } else { - if (is_array( $aRow )) { + if (is_array($aRow)) { foreach ($aRow as $key => $value) { $xValues[$c][$key] = ""; } @@ -4155,18 +4144,18 @@ class XmlFormFieldGrid extends XmlFormField $values = $xValues; } - $aValuekeys = array_keys( $values ); + $aValuekeys = array_keys($values); - if (count( $aValuekeys ) > 0 && (int) $aValuekeys[0] == 1) { - $values = $this->flipValues( $values ); + if (count($aValuekeys) > 0 && (int)$aValuekeys[0] == 1) { + $values = $this->flipValues($values); } //if ($therow == 1)g::pr($values); - $this->rows = count( reset( $values ) ); + $this->rows = count(reset($values)); //Fields required in grid (view in sql attribute) - $arrayField = array(); - $arrayFieldRequired = array(); + $arrayField = []; + $arrayFieldRequired = []; foreach ($this->fields as $index1 => $value1) { $field = $value1; @@ -4188,7 +4177,7 @@ class XmlFormFieldGrid extends XmlFormField if (isset($owner->values) && count($arrayFieldRequired) > 0) { foreach ($owner->values as $key => $value) { if (in_array($key, $arrayFieldRequired) && !isset($values[$key])) { - $values[$key] = array(); + $values[$key] = []; //for($r=0; $r < $this->rows ; $r++ ) { $values[$key] = $value; //} @@ -4197,7 +4186,7 @@ class XmlFormFieldGrid extends XmlFormField } foreach ($this->fields as $k => $v) { - if (isset( $values['SYS_GRID_AGGREGATE_' . $this->name . '_' . $k] )) { + if (isset($values['SYS_GRID_AGGREGATE_' . $this->name . '_' . $k])) { $this->fields[$k]->aggregate = $values['SYS_GRID_AGGREGATE_' . $this->name . '_' . $k]; } else { $this->fields[$k]->aggregate = '0'; @@ -4206,15 +4195,15 @@ class XmlFormFieldGrid extends XmlFormField $this->values = $values; - $this->NewLabel = G::LoadTranslation( 'ID_NEW' ); - $this->DeleteLabel = G::LoadTranslation( 'ID_DELETE' ); + $this->NewLabel = G::LoadTranslation('ID_NEW'); + $this->DeleteLabel = G::LoadTranslation('ID_DELETE'); - $tpl->template = $tpl->printTemplate( $this ); + $tpl->template = $tpl->printTemplate($this); //In the header - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile( $this->scriptURL ); - $oHeadPublisher->addScriptCode( $tpl->printJavaScript( $this ) ); - return $tpl->printObject( $this, $therow ); + $oHeadPublisher = headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($this->scriptURL); + $oHeadPublisher->addScriptCode($tpl->printJavaScript($this)); + return $tpl->printObject($this, $therow); } /** @@ -4223,15 +4212,15 @@ class XmlFormFieldGrid extends XmlFormField * @param $arrayData * @return */ - public function flipValues ($arrayData) + public function flipValues($arrayData) { - $flipped = array (); + $flipped = []; foreach ($arrayData as $rowIndex => $rowValue) { - if (is_array( $rowValue )) { + if (is_array($rowValue)) { foreach ($rowValue as $colIndex => $colValue) { - if (! isset( $flipped[$colIndex] ) || ! is_array( $flipped[$colIndex] )) { - $flipped[$colIndex] = array (); + if (!isset($flipped[$colIndex]) || !is_array($flipped[$colIndex])) { + $flipped[$colIndex] = []; } $flipped[$colIndex][$rowIndex] = $colValue; @@ -4242,42 +4231,43 @@ class XmlFormFieldGrid extends XmlFormField return $flipped; } - public function setScrollStyle($owner) { - $arrayKeys = array_keys( $this->fields ); - $emptyRow = array (); + public function setScrollStyle($owner) + { + $arrayKeys = array_keys($this->fields); + $emptyRow = []; $fieldsSize = 0; foreach ($arrayKeys as $key) { - if (isset( $this->fields[$key]->defaultValue )) { + if (isset($this->fields[$key]->defaultValue)) { $emptyValue = $this->fields[$key]->defaultValue; } else { $emptyValue = ''; } - if (isset( $this->fields[$key]->size )) { + if (isset($this->fields[$key]->size)) { $size = $this->fields[$key]->size; } - if (! isset( $size )) { + if (!isset($size)) { $size = 15; } $fieldsSize += $size; - $emptyRow[$key] = array ($emptyValue); + $emptyRow[$key] = array($emptyValue); } - if (isset( $owner->adjustgridswidth ) && $owner->adjustgridswidth == '1') { + if (isset($owner->adjustgridswidth) && $owner->adjustgridswidth == '1') { // 400w -> 34s to Firefox // 400w -> 43s to Chrome $baseWidth = 400; $minusWidth = 30; - if (eregi( 'chrome', $_SERVER['HTTP_USER_AGENT'] )) { + if (preg_match('/chrome/i', $_SERVER['HTTP_USER_AGENT'])) { $baseSize = 43; } else { - if (strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false) { + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { $minusWidth = 20; } $baseSize = 34; } $baseWidth = 400; - $formWidth = (int) $owner->width; + $formWidth = (int)$owner->width; $maxSize = (($formWidth * $baseSize) / $baseWidth); if ($fieldsSize > $maxSize) { @@ -4302,31 +4292,31 @@ class XmlFormFieldJavaScript extends XmlFormField public $replaceTags = true; /** - * Function XmlFormFieldJavaScript - * - * @access public - * @param string xmlNode - * @param string lang - * @param string home - * @return string - */ - public function __construct ($xmlNode, $lang = 'en', $home = '') + * Function XmlFormFieldJavaScript + * + * @access public + * @param string xmlNode + * @param string lang + * @param string home + * @return string + */ + public function __construct($xmlNode, $lang = 'en', $home = '') { //Loads any attribute that were defined in the xmlNode //except name and label. - $myAttributes = get_class_vars( get_class( $this ) ); + $myAttributes = get_class_vars(get_class($this)); foreach ($myAttributes as $k => $v) { - $myAttributes[$k] = strtoupper( $k ); + $myAttributes[$k] = strtoupper($k); } foreach ($xmlNode->attributes as $k => $v) { - $key = array_search( strtoupper( $k ), $myAttributes ); + $key = array_search(strtoupper($k), $myAttributes); if ($key) { - eval( '$this->' . $key . '=$v;' ); + eval('$this->' . $key . '=$v;'); } } //Loads the main attributes $this->name = $xmlNode->name; - $this->type = strtolower( $xmlNode->attributes['type'] ); + $this->type = strtolower($xmlNode->attributes['type']); //$data: Includes labels and options. $this->code = $xmlNode->value; } @@ -4338,9 +4328,9 @@ class XmlFormFieldJavaScript extends XmlFormField * @param string value * @return string */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { - $code = ($this->replaceTags) ? G::replaceDataField( $this->code, $owner->values ) : $this->code; + $code = ($this->replaceTags) ? G::replaceDataField($this->code, $owner->values) : $this->code; return $code; } @@ -4354,7 +4344,7 @@ class XmlFormFieldJavaScript extends XmlFormField */ public function renderGrid($values = null, $owner = null, $paramDummy3 = null, $paramDummy4 = null) { - return array (''); + return array(''); } /** @@ -4363,7 +4353,7 @@ class XmlFormFieldJavaScript extends XmlFormField * @param $value * @return false */ - public function validateValue ($value) + public function validateValue($value) { return false; } @@ -4382,11 +4372,11 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText public $startDate = ''; public $endDate = ''; /** - * for dinamically dates, beforeDate << currentDate << afterDate - * beforeDate='1y' means one year before, beforeDate='3m' means 3 months before - * afterDate='5y' means five year after, afterDate='15d' means 15 days after - * startDate and endDate have priority over beforeDate and AfterDate - **/ + * for dinamically dates, beforeDate << currentDate << afterDate + * beforeDate='1y' means one year before, beforeDate='3m' means 3 months before + * afterDate='5y' means five year after, afterDate='15d' means 15 days after + * startDate and endDate have priority over beforeDate and AfterDate + **/ public $afterDate = ''; public $beforeDate = ''; public $defaultValue = null; @@ -4404,14 +4394,14 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText * @param $date * @return true/false */ - public function verifyDateFormat ($date) + public function verifyDateFormat($date) { - $dateTime = explode( " ", $date ); //To accept the Hour part - $aux = explode( '-', $dateTime[0] ); - if (count( $aux ) != 3) { + $dateTime = explode(" ", $date); //To accept the Hour part + $aux = explode('-', $dateTime[0]); + if (count($aux) != 3) { return false; } - if (! (is_numeric( $aux[0] ) && is_numeric( $aux[1] ) && is_numeric( $aux[2] ))) { + if (!(is_numeric($aux[0]) && is_numeric($aux[1]) && is_numeric($aux[2]))) { return false; } if ($aux[0] < 1900 || $aux[0] > 2100) { @@ -4426,14 +4416,14 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText * @param $date * @return true/false */ - public function isvalidBeforeFormat ($date) + public function isvalidBeforeFormat($date) { - $part1 = substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); if ($part2 != 'd' && $part2 != 'm' && $part2 != 'y') { return false; } - if (! is_numeric( $part1 )) { + if (!is_numeric($part1)) { return false; } return true; @@ -4446,14 +4436,14 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText * @param $sign * @return */ - public function calculateBeforeFormat ($date, $sign) + public function calculateBeforeFormat($date, $sign) { - $part1 = $sign * substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = $sign * substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); - $year = (int)(date("Y")); + $year = (int)(date("Y")); $month = (int)(date("m")); - $day = (int)(date("d")); + $day = (int)(date("d")); $osIsLinux = strtoupper(substr(PHP_OS, 0, 3)) != "WIN"; $checkYear = false; @@ -4504,18 +4494,18 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText * @param $owner * @return renderized widget */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { $this->renderMode = $this->mode; if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $value = G::replaceDataField( $value, $owner->values ); + $value = G::replaceDataField($value, $owner->values); } //$this->defaultValue = G::replaceDataField( $this->defaultValue, $owner->values); $id = "form[$this->name]"; - return $this->__draw_widget( $id, $value, $owner ); + return $this->__draw_widget($id, $value, $owner); } /** @@ -4529,7 +4519,7 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText public function renderGrid($values = null, $owner = null, $onlyValue = false, $paramDummy4 = null) { $this->gridFieldType = 'date'; - $result = array (); + $result = []; $r = 1; /* if( ! isset($owner->modeGrid)) $owner->modeGrid = ''; $this->mode = $this->modeForGrid;*/ @@ -4537,28 +4527,28 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText $this->renderMode = $this->modeForGrid; } foreach ($values as $v) { - $v = G::replaceDataField( $v, $owner->values ); - if (! $onlyValue) { - if ($this->mode === 'view' || (isset( $owner->modeGrid ) && $owner->modeGrid === 'view')) { + $v = G::replaceDataField($v, $owner->values); + if (!$onlyValue) { + if ($this->mode === 'view' || (isset($owner->modeGrid) && $owner->modeGrid === 'view')) { if ($this->required) { $isRequired = '1'; } else { $isRequired = '0'; } - $mask = str_replace( "%", "", $this->mask ); + $mask = str_replace("%", "", $this->mask); if (trim($v) !== "") { - $v = date( masktophp($mask, $v) ); + $v = date(masktophp($mask, $v)); } - $html = 'NSRequiredValue() .' class="module_app_input___gray" '. $this->NSGridType() .' id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" pm:required="' . $isRequired . '" style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" />' . htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $html = 'NSRequiredValue() . ' class="module_app_input___gray" ' . $this->NSGridType() . ' id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities($v, ENT_COMPAT, 'utf-8') . '" pm:required="' . $isRequired . '" style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" />' . htmlentities($v, ENT_COMPAT, 'utf-8'); } else { $id = 'form[' . $owner->name . '][' . $r . '][' . $this->name . ']'; - $html = $this->__draw_widget( $id, $v, $owner, true ); + $html = $this->__draw_widget($id, $v, $owner, true); } } else { $html = $v; } $result[] = $html; - $r ++; + $r++; } return $result; } @@ -4571,52 +4561,52 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText * @param $owner * @return */ - public function __draw_widget ($pID, $value, $owner = '', $inGrid = false) + public function __draw_widget($pID, $value, $owner = '', $inGrid = false) { - $startDate = G::replaceDataField( $this->startDate, $owner->values ); - $endDate = G::replaceDataField( $this->endDate, $owner->values ); - $beforeDate = G::replaceDataField( $this->beforeDate, $owner->values ); - $afterDate = G::replaceDataField( $this->afterDate, $owner->values ); + $startDate = G::replaceDataField($this->startDate, $owner->values); + $endDate = G::replaceDataField($this->endDate, $owner->values); + $beforeDate = G::replaceDataField($this->beforeDate, $owner->values); + $afterDate = G::replaceDataField($this->afterDate, $owner->values); $defaultValue = $this->defaultValue; if ($startDate != '') { - if (! $this->verifyDateFormat( $startDate )) { + if (!$this->verifyDateFormat($startDate)) { $startDate = ''; } } - if (isset( $beforeDate ) && $beforeDate != '') { - if ($this->isvalidBeforeFormat( $beforeDate )) { - $startDate = $this->calculateBeforeFormat( $beforeDate, 1 ); + if (isset($beforeDate) && $beforeDate != '') { + if ($this->isvalidBeforeFormat($beforeDate)) { + $startDate = $this->calculateBeforeFormat($beforeDate, 1); } } - if ($startDate == '' && isset( $this->size ) && is_numeric( $this->size ) && $this->size >= 1900 && $this->size <= 2100) { + if ($startDate == '' && isset($this->size) && is_numeric($this->size) && $this->size >= 1900 && $this->size <= 2100) { $startDate = $this->size . '-01-01'; } if ($endDate != '') { - if (! $this->verifyDateFormat( $endDate )) { + if (!$this->verifyDateFormat($endDate)) { $endDate = ''; } } - if (isset( $afterDate ) && $afterDate != '') { - if ($this->isvalidBeforeFormat( $afterDate )) { - $endDate = $this->calculateBeforeFormat( $afterDate, + 1 ); + if (isset($afterDate) && $afterDate != '') { + if ($this->isvalidBeforeFormat($afterDate)) { + $endDate = $this->calculateBeforeFormat($afterDate, +1); } } - if (isset( $this->maxlength ) && is_numeric( $this->maxlength ) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { + if (isset($this->maxlength) && is_numeric($this->maxlength) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { $endDate = $this->maxlength . '-01-01'; } if ($endDate == '') { // the default is the current date + 2 years - $endDate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 2 ) ); + $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); } //validating the mask, if it is not set, - if (isset( $this->mask ) && $this->mask != '') { + if (isset($this->mask) && $this->mask != '') { $mask = $this->mask; } else { $mask = '%Y-%m-%d'; //set default @@ -4625,21 +4615,21 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText $valueDemo = masktophp($mask, "today"); if ($this->defaultValue != "") { - $defaultValue = masktophp( $mask, $defaultValue); + $defaultValue = masktophp($mask, $defaultValue); } - if (strpos( $mask, '%' ) === false) { - if (strpos( $mask, '-' ) !== false) { + if (strpos($mask, '%') === false) { + if (strpos($mask, '-') !== false) { $separator = '-'; } - if (strpos( $mask, '/' ) !== false) { + if (strpos($mask, '/') !== false) { $separator = '/'; } - if (strpos( $mask, '.' ) !== false) { + if (strpos($mask, '.') !== false) { $separator = '.'; } - $maskparts = explode( $separator, $mask ); + $maskparts = explode($separator, $mask); $mask = ''; foreach ($maskparts as $part) { if ($mask != '') { @@ -4661,17 +4651,17 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText } } - $tmp = str_replace( "%", "", $mask ); - if (trim( $value ) == '' or $value == null) { + $tmp = str_replace("%", "", $mask); + if (trim($value) == '' or $value == null) { $value = ''; //date ($tmp); } else { if ($value != "") { - $value = masktophp( $mask, $value); + $value = masktophp($mask, $value); } } //onchange - if (isset( $this->onchange ) && $this->onchange != '') { + if (isset($this->onchange) && $this->onchange != '') { $onchange = 'onchange="' . $this->onchange . '"'; } else { $onchange = ''; @@ -4684,13 +4674,13 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText } if ($this->renderMode == 'edit') { - $maskleng = strlen( $mask ); + $maskleng = strlen($mask); $hour = '%H'; $min = '%M'; $sec = '%S'; - $sizehour = strpos( $mask, $hour ); - $sizemin = strpos( $mask, $min ); - $sizesec = strpos( $mask, $sec ); + $sizehour = strpos($mask, $hour); + $sizemin = strpos($mask, $min); + $sizesec = strpos($mask, $sec); $Time = 'false'; if (($sizehour !== false) && ($sizemin !== false) && ($sizesec !== false)) { @@ -4738,25 +4728,25 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText return $html; } - public function maskDateValue ($value, $field) + public function maskDateValue($value, $field) { $value = trim($value); $mask = $field->mask; if ($value == '' || $mask == '') { return $value; } - if (strpos( $mask, '%' ) === false) { - if (strpos( $mask, '-' ) !== false) { + if (strpos($mask, '%') === false) { + if (strpos($mask, '-') !== false) { $separator = '-'; } - if (strpos( $mask, '/' ) !== false) { + if (strpos($mask, '/') !== false) { $separator = '/'; } - if (strpos( $mask, '.' ) !== false) { + if (strpos($mask, '.') !== false) { $separator = '.'; } - $maskparts = explode( $separator, $mask ); + $maskparts = explode($separator, $mask); $mask = ''; foreach ($maskparts as $part) { if ($mask != '') { @@ -4780,7 +4770,7 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText $withHours = (strpos($mask, '%H') !== false || strpos($mask, '%I') !== false || strpos($mask, '%k') !== false || strpos($mask, '%l') !== false || strpos($mask, '%M') !== false || strpos($mask, '%S') !== false); - $tmp = str_replace( "%", "", $mask ); + $tmp = str_replace("%", "", $mask); return $this->date_create_from_format($tmp, $value, $withHours); } @@ -4805,10 +4795,10 @@ class XmlFormFieldDate extends XmlFormFieldSimpleText //Sec %S seconds, range 00 to 59 */ - function date_create_from_format( $dformat, $dvalue, $withHours = false ) + public function date_create_from_format($dformat, $dvalue, $withHours = false) { $schedule = $dvalue; - $schedule_format = str_replace(array('Y','y','m','B','b','d','e','H','I','k','l','M','S'),array('%Y','%y','%m','%B','%b','%d','%e','%H','%I','%k','%l','%M','%S') ,$dformat); + $schedule_format = str_replace(array('Y', 'y', 'm', 'B', 'b', 'd', 'e', 'H', 'I', 'k', 'l', 'M', 'S'), array('%Y', '%y', '%m', '%B', '%b', '%d', '%e', '%H', '%I', '%k', '%l', '%M', '%S'), $dformat); $ugly = strptime($schedule, $schedule_format); $ymd = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', @@ -4868,27 +4858,27 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText * @param $date * @return true/false */ - public function verifyDateFormat ($date, $mask = '') + public function verifyDateFormat($date, $mask = '') { - $dateTime = explode( " ", $date ); //To accept the Hour part - $aDate = explode( '-', str_replace( "/", "-", $dateTime[0] ) ); + $dateTime = explode(" ", $date); //To accept the Hour part + $aDate = explode('-', str_replace("/", "-", $dateTime[0])); $bResult = true; foreach ($aDate as $sDate) { - if (! is_numeric( $sDate )) { + if (!is_numeric($sDate)) { $bResult = false; break; } } if ($mask != '') { - $aDate = $this->getSplitDate( $dateTime[0], $mask ); - $aDate[0] = ($aDate[0] == '') ? date( 'Y' ) : $aDate[0]; - $aDate[1] = ($aDate[1] == '') ? date( 'm' ) : $aDate[1]; - $aDate[2] = ($aDate[2] == '') ? date( 'd' ) : $aDate[2]; + $aDate = $this->getSplitDate($dateTime[0], $mask); + $aDate[0] = ($aDate[0] == '') ? date('Y') : $aDate[0]; + $aDate[1] = ($aDate[1] == '') ? date('m') : $aDate[1]; + $aDate[2] = ($aDate[2] == '') ? date('d') : $aDate[2]; return true; - if (checkdate( $aDate[1], $aDate[2], $aDate[0] )) { + if (checkdate($aDate[1], $aDate[2], $aDate[0])) { } else { return false; } @@ -4902,23 +4892,23 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText * @param $date * @return true/false */ - public function isvalidBeforeFormat ($date) + public function isvalidBeforeFormat($date) { - $part1 = substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); if ($part2 != 'd' && $part2 != 'm' && $part2 != 'y') { return false; } - if (! is_numeric( $part1 )) { + if (!is_numeric($part1)) { return false; } return true; } - public function calculateBeforeFormat ($date, $sign) + public function calculateBeforeFormat($date, $sign) { - $part1 = $sign * substr( $date, 0, strlen( $date ) - 1 ); - $part2 = substr( $date, strlen( $date ) - 1 ); + $part1 = $sign * substr($date, 0, strlen($date) - 1); + $part2 = substr($date, strlen($date) - 1); #TODO # neyek @@ -4932,15 +4922,15 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText switch ($part2) { case 'd': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + $part1, date( 'Y' ) ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $part1, date('Y'))); break; case 'm': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + $part1, date( 'd' ) - 1, date( 'Y' ) ) ); + $res = date('Y-m-d', mktime(0, 0, 0, date('m') + $part1, date('d') - 1, date('Y'))); break; case 'y': //$res = date ( 'Y-m-d', mktime ( 0, 0, 0, date ( 'm' ), date ( 'd' ), date ( 'Y' ) + $part1) ); //hook - $res = (intVal( date( 'Y' ) ) + $part1) . '-' . date( 'm' ) . '-' . date( 'd' ); + $res = (intVal(date('Y')) + $part1) . '-' . date('m') . '-' . date('d'); break; } @@ -4954,16 +4944,16 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText * @param $owner * @return renderized widget */ - public function render ($value = null, $owner = null) + public function render($value = null, $owner = null) { if (($this->pmconnection != '') && ($this->pmfield != '') && $value == null) { - $value = $this->getPMTableValue( $owner ); + $value = $this->getPMTableValue($owner); } else { - $value = G::replaceDataField( $value, $owner->values ); + $value = G::replaceDataField($value, $owner->values); } //$this->defaultValue = G::replaceDataField( $this->defaultValue, $owner->values); $id = "form[$this->name]"; - return $this->__draw_widget( $id, $value, $owner ); + return $this->__draw_widget($id, $value, $owner); } /** @@ -4976,18 +4966,18 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText */ public function renderGrid($values = null, $owner = null, $onlyValue = false, $paramDummy4 = null) { - $result = array (); + $result = []; $r = 1; foreach ($values as $v) { - $v = ($v != '') ? G::replaceDataField( $v, $owner->values ) : $this->defaultValue; - if (! $onlyValue) { + $v = ($v != '') ? G::replaceDataField($v, $owner->values) : $this->defaultValue; + if (!$onlyValue) { $id = 'form[' . $owner->name . '][' . $r . '][' . $this->name . ']'; - $html = $this->__draw_widget( $id, $v, $owner ); + $html = $this->__draw_widget($id, $v, $owner); } else { $html = $v; } $result[] = $html; - $r ++; + $r++; } return $result; } @@ -5000,21 +4990,21 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText * @param $owner * @return */ - public function __draw_widget ($pID, $value, $owner = '') + public function __draw_widget($pID, $value, $owner = '') { /*for deprecated mask definitions...*/ #first deprecated simple (yyyy-mm-dd) and personalizes combinations - $this->mask = str_replace( 'yyyy', 'Y', $this->mask ); - $this->mask = str_replace( 'yy', 'y', $this->mask ); - $this->mask = str_replace( 'mm', 'm', $this->mask ); - $this->mask = str_replace( 'dd', 'd', $this->mask ); + $this->mask = str_replace('yyyy', 'Y', $this->mask); + $this->mask = str_replace('yy', 'y', $this->mask); + $this->mask = str_replace('mm', 'm', $this->mask); + $this->mask = str_replace('dd', 'd', $this->mask); #second deprecated (%Y-%m-%d) and other combinations - $this->mask = str_replace( '%', '', $this->mask ); + $this->mask = str_replace('%', '', $this->mask); - if (isset( $this->mask ) && $this->mask != '') { + if (isset($this->mask) && $this->mask != '') { $mask = $this->mask; } else { #Default mask @@ -5030,24 +5020,24 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText $isRequired = '0'; } - $startDate = G::replaceDataField( $this->startDate, $owner->values ); - $endDate = G::replaceDataField( $this->endDate, $owner->values ); + $startDate = G::replaceDataField($this->startDate, $owner->values); + $endDate = G::replaceDataField($this->endDate, $owner->values); - $beforeDate = G::replaceDataField( $this->beforeDate, $owner->values ); - $afterDate = G::replaceDataField( $this->afterDate, $owner->values ); + $beforeDate = G::replaceDataField($this->beforeDate, $owner->values); + $afterDate = G::replaceDataField($this->afterDate, $owner->values); if ($startDate != '') { - if (! $this->verifyDateFormat( $startDate )) { + if (!$this->verifyDateFormat($startDate)) { $startDate = ''; } } - if (isset( $beforeDate ) && $beforeDate != '') { - if ($this->isvalidBeforeFormat( $beforeDate )) { - $startDate = $this->calculateBeforeFormat( $beforeDate, 1 ); + if (isset($beforeDate) && $beforeDate != '') { + if ($this->isvalidBeforeFormat($beforeDate)) { + $startDate = $this->calculateBeforeFormat($beforeDate, 1); } } - if ($startDate == '' && isset( $this->size ) && is_numeric( $this->size ) && $this->size >= 1900 && $this->size <= 2100) { + if ($startDate == '' && isset($this->size) && is_numeric($this->size) && $this->size >= 1900 && $this->size <= 2100) { $startDate = $this->size . '-01-01'; } @@ -5056,35 +5046,35 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText } if ($endDate != '') { - if (! $this->verifyDateFormat( $endDate )) { + if (!$this->verifyDateFormat($endDate)) { $endDate = ''; } } - if (isset( $afterDate ) && $afterDate != '') { - if ($this->isvalidBeforeFormat( $afterDate )) { - $endDate = $this->calculateBeforeFormat( $afterDate, + 1 ); + if (isset($afterDate) && $afterDate != '') { + if ($this->isvalidBeforeFormat($afterDate)) { + $endDate = $this->calculateBeforeFormat($afterDate, +1); } } - if (isset( $this->maxlength ) && is_numeric( $this->maxlength ) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { + if (isset($this->maxlength) && is_numeric($this->maxlength) && $this->maxlength >= 1900 && $this->maxlength <= 2100) { $endDate = $this->maxlength . '-01-01'; } if ($endDate == '') { //$this->endDate = mktime ( 0,0,0,date('m'),date('d'),date('y') ); // the default is the current date + 2 years - $endDate = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 2 ) ); // the default is the current date + 2 years + $endDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); // the default is the current date + 2 years } - $tmp = str_replace( "%", "", $mask ); - if (trim( $value ) == '' or $value == null) { + $tmp = str_replace("%", "", $mask); + if (trim($value) == '' or $value == null) { $value = ''; //date ($tmp); } else { - switch (strtolower( $value )) { + switch (strtolower($value)) { case 'today': - $value = date( $tmp ); + $value = date($tmp); break; default: - if (! $this->verifyDateFormat( $value, $mask )) { + if (!$this->verifyDateFormat($value, $mask)) { $value = ''; } break; @@ -5092,29 +5082,29 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText } if ($value == '') { - $valueDate = Array (date( 'Y' ),date( 'm' ),date( 'd' ) + $valueDate = array(date('Y'), date('m'), date('d') ); } else { - $valueDate = $this->getSplitDate( $value, $mask ); + $valueDate = $this->getSplitDate($value, $mask); } - $startDate = $this->getSplitDate( $startDate, 'Y-m-d' ); + $startDate = $this->getSplitDate($startDate, 'Y-m-d'); //adatation for new js calendar widget $startDate[2] = $startDate[2] - 1; - $endDate = $this->getSplitDate( $endDate, 'Y-m-d' ); + $endDate = $this->getSplitDate($endDate, 'Y-m-d'); //adatation for new js calendar widget $endDate[2] = $endDate[2] + 1; - $extra = (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') ? 'direction:rtl; float:right' : 'direction:ltr'; + $extra = (defined('SYS_LANG_DIRECTION') && SYS_LANG_DIRECTION == 'R') ? 'direction:rtl; float:right' : 'direction:ltr'; - if (isset( $this->showtime ) && $this->showtime) { + if (isset($this->showtime) && $this->showtime) { $mask .= ' h:i'; - $img = (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') ? 'pmdatetimeiw.png' : 'pmdatetime.png'; + $img = (defined('SYS_LANG_DIRECTION') && SYS_LANG_DIRECTION == 'R') ? 'pmdatetimeiw.png' : 'pmdatetime.png'; $style = 'background-image:url(/images/' . $img . ');float:left; width:131px; height:22px;padding:2px 1px 1px 3px;cursor:pointer;color:#000; ' . $extra . ';'; $showTime = 'true'; } else { - $img = (defined( 'SYS_LANG_DIRECTION' ) && SYS_LANG_DIRECTION == 'R') ? 'pmdateiw.png' : 'pmdate.png'; + $img = (defined('SYS_LANG_DIRECTION') && SYS_LANG_DIRECTION == 'R') ? 'pmdateiw.png' : 'pmdate.png'; $style = 'background-image:url(/images/' . $img . ');float:left; width:100px; height:22px;padding:2px 1px 1px 3px;cursor:pointer;color:#000; direction:' . $extra . ';'; $showTime = 'false'; } @@ -5152,7 +5142,6 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText event ); return false;">'; } - } else { $html = ''; $html .= "$value"; @@ -5174,22 +5163,22 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText * @param $mask * @return */ - public function getSplitDate ($date, $mask) + public function getSplitDate($date, $mask) { $sw1 = false; - for ($i = 0; $i < 3; $i ++) { - $item = substr( $mask, $i * 2, 1 ); + for ($i = 0; $i < 3; $i++) { + $item = substr($mask, $i * 2, 1); switch ($item) { case 'Y': switch ($i) { case 0: - $d1 = substr( $date, 0, 4 ); + $d1 = substr($date, 0, 4); break; case 1: - $d1 = substr( $date, 3, 4 ); + $d1 = substr($date, 3, 4); break; case 2: - $d1 = substr( $date, 6, 4 ); + $d1 = substr($date, 6, 4); break; } $sw1 = true; @@ -5197,45 +5186,45 @@ class XmlFormFieldDate5 extends XmlFormFieldSimpleText case 'y': switch ($i) { case 0: - $d1 = substr( $date, 0, 2 ); + $d1 = substr($date, 0, 2); break; case 1: - $d1 = substr( $date, 3, 2 ); + $d1 = substr($date, 3, 2); break; case 2: - $d1 = substr( $date, 6, 2 ); + $d1 = substr($date, 6, 2); break; } break; case 'm': switch ($i) { case 0: - $d2 = substr( $date, 0, 2 ); + $d2 = substr($date, 0, 2); break; case 1: - $d2 = ($sw1) ? substr( $date, 5, 2 ) : substr( $date, 3, 2 ); + $d2 = ($sw1) ? substr($date, 5, 2) : substr($date, 3, 2); break; case 2: - $d2 = ($sw1) ? substr( $date, 8, 2 ) : substr( $date, 5, 2 ); + $d2 = ($sw1) ? substr($date, 8, 2) : substr($date, 5, 2); break; } break; case 'd': switch ($i) { case 0: - $d3 = substr( $date, 0, 2 ); + $d3 = substr($date, 0, 2); break; case 1: - $d3 = ($sw1) ? substr( $date, 5, 2 ) : substr( $date, 3, 2 ); + $d3 = ($sw1) ? substr($date, 5, 2) : substr($date, 3, 2); break; case 2: - $d3 = ($sw1) ? substr( $date, 8, 2 ) : substr( $date, 5, 2 ); + $d3 = ($sw1) ? substr($date, 8, 2) : substr($date, 5, 2); break; } break; } } - return Array (isset( $d1 ) ? $d1 : '',isset( $d2 ) ? $d2 : '',isset( $d3 ) ? $d3 : '' + return array(isset($d1) ? $d1 : '', isset($d2) ? $d2 : '', isset($d3) ? $d3 : '' ); } } @@ -5255,7 +5244,7 @@ class XmlFormFieldXmlform extends XmlFormField public $sql = ''; //TODO: 0=doesn't excecute the query, 1=Only the first time, 2=Allways public $fillType = 0; - public $fields = array (); + public $fields = []; public $scriptURL; public $id = ''; @@ -5268,10 +5257,10 @@ class XmlFormFieldXmlform extends XmlFormField * @param string home * @return string */ - public function __construct ($xmlnode, $language, $home) + public function __construct($xmlnode, $language, $home) { - parent::__construct( $xmlnode, $language ); - $this->parseFile( $home, $language ); + parent::__construct($xmlnode, $language); + $this->parseFile($home, $language); } /** @@ -5282,15 +5271,15 @@ class XmlFormFieldXmlform extends XmlFormField * @param string language * @return string */ - public function parseFile ($home, $language) + public function parseFile($home, $language) { $this->xmlform = new XmlForm(); $this->xmlform->home = $home; - $this->xmlform->parseFile( $this->xmlfile . '.xml', $language, false ); + $this->xmlform->parseFile($this->xmlfile . '.xml', $language, false); $this->fields = $this->xmlform->fields; $this->scriptURL = $this->xmlform->scriptURL; $this->id = $this->xmlform->id; - unset( $this->xmlform ); + unset($this->xmlform); } /** @@ -5304,18 +5293,18 @@ class XmlFormFieldXmlform extends XmlFormField { $html = ''; foreach ($this->fields as $f => $v) { - $html .= $v->render( '' ); + $html .= $v->render(''); } $this->id = $this->owner->id . $this->name; - $tpl = new xmlformTemplate( $this, PATH_CORE . 'templates/xmlform.html' ); + $tpl = new xmlformTemplate($this, PATH_CORE . 'templates/xmlform.html'); $this->values = $values; //$this->rows=count(reset($values)); - $tpl->template = $tpl->printTemplate( $this ); + $tpl->template = $tpl->printTemplate($this); //In the header - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile( $this->scriptURL ); - $oHeadPublisher->addScriptCode( $tpl->printJavaScript( $this ) ); - return $tpl->printObject( $this ); + $oHeadPublisher = headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($this->scriptURL); + $oHeadPublisher->addScriptCode($tpl->printJavaScript($this)); + return $tpl->printObject($this); } } @@ -5333,9 +5322,9 @@ class XmlForm public $name = ''; public $language; /* @attribute string version 0.xxx = Previous to pre-open source - */ + */ public $version = '0.3'; - public $fields = array (); + public $fields = []; public $title = ''; public $home = ''; public $parsedFile = ''; @@ -5355,67 +5344,67 @@ class XmlForm // public $labelWidth = 180; public $labelWidth = "40%"; public $onsubmit = ''; - public $requiredFields = array (); + public $requiredFields = []; public $fieldContentWidth = 450; /** * List of xmlform controls and its classes. * - * @var string[] + * @var string[] */ private static $controls = [ - 'button' => XmlFormFieldButton::class, - 'caption' => XmlFormFieldCaption::class, - 'captioncurrency' => XmlFormFieldCaptionCurrency::class, + 'button' => XmlFormFieldButton::class, + 'caption' => XmlFormFieldCaption::class, + 'captioncurrency' => XmlFormFieldCaptionCurrency::class, 'captionpercentage' => XmlFormFieldCaptionPercentage::class, - 'cellmark' => XmlFormFieldCellMark::class, - 'checkbox2' => XmlFormFieldCheckbox2::class, - 'checkbox' => XmlFormFieldCheckbox::class, - 'checkboxpt' => XmlFormFieldCheckboxpt::class, - 'checkboxtable' => XmlFormFieldCheckBoxTable::class, - 'checkgroup' => XmlFormFieldCheckGroup::class, - 'checkgroupview' => XmlFormFieldCheckGroupView::class, - 'currency' => XmlFormFieldCurrency::class, - 'date2' => XmlFormFieldDate2::class, - 'date5' => XmlFormFieldDate5::class, - 'date' => XmlFormFieldDate::class, - 'dateview' => XmlFormFieldDateView::class, - 'dropdown' => XmlFormFieldDropdown::class, - 'dropdownpt' => XmlFormFieldDropdownpt::class, - 'dveditor' => XmlFormFieldDVEditor::class, - 'fastsearch' => XmlFormFieldFastSearch::class, - 'file' => XmlFormFieldFile::class, - 'grid' => XmlFormFieldGrid::class, - 'hidden' => XmlFormFieldHidden::class, - 'hours' => XmlFormFieldHours::class, - 'html' => XmlFormFieldHTML::class, - 'image' => XmlFormFieldImage::class, - 'javascript' => XmlFormFieldJavaScript::class, - 'label' => XmlFormFieldLabel::class, - 'link' => XmlFormFieldLink::class, - 'listbox' => XmlFormFieldListbox::class, - 'password' => XmlFormFieldPassword::class, - 'percentage' => XmlFormFieldPercentage::class, - 'popupoption' => XmlFormFieldPopupOption::class, - 'print' => XmlFormFieldPrint::class, - 'radiogroup' => XmlFormFieldRadioGroup::class, - 'radiogroupview' => XmlFormFieldRadioGroupView::class, - 'reset' => XmlFormFieldReset::class, - 'simpletext' => XmlFormFieldSimpleText::class, - 'submit' => XmlFormFieldSubmit::class, - 'subtitle' => XmlFormFieldSubtitle::class, - 'suggest' => XmlFormFieldSuggest::class, - 'text' => XmlFormFieldText::class, - 'textarea' => XmlFormFieldTextarea::class, - 'textareapm' => XmlFormFieldTextareaPm::class, - 'textpm' => XmlFormFieldTextPm::class, - 'title' => XmlFormFieldTitle::class, - 'toolbar' => XmlFormFieldToolBar::class, - 'toolbutton' => XmlFormFieldToolButton::class, - 'wysiwyg_editor' => XmlFormFieldWYSIWYGEditor::class, - 'xmlform' => XmlFormFieldXmlform::class, - 'xmlmenu' => XmlFormFieldXmlMenu::class, - 'yesno' => XmlFormFieldYesNo::class, + 'cellmark' => XmlFormFieldCellMark::class, + 'checkbox2' => XmlFormFieldCheckbox2::class, + 'checkbox' => XmlFormFieldCheckbox::class, + 'checkboxpt' => XmlFormFieldCheckboxpt::class, + 'checkboxtable' => XmlFormFieldCheckBoxTable::class, + 'checkgroup' => XmlFormFieldCheckGroup::class, + 'checkgroupview' => XmlFormFieldCheckGroupView::class, + 'currency' => XmlFormFieldCurrency::class, + 'date2' => XmlFormFieldDate2::class, + 'date5' => XmlFormFieldDate5::class, + 'date' => XmlFormFieldDate::class, + 'dateview' => XmlFormFieldDateView::class, + 'dropdown' => XmlFormFieldDropdown::class, + 'dropdownpt' => XmlFormFieldDropdownpt::class, + 'dveditor' => XmlFormFieldDVEditor::class, + 'fastsearch' => XmlFormFieldFastSearch::class, + 'file' => XmlFormFieldFile::class, + 'grid' => XmlFormFieldGrid::class, + 'hidden' => XmlFormFieldHidden::class, + 'hours' => XmlFormFieldHours::class, + 'html' => XmlFormFieldHTML::class, + 'image' => XmlFormFieldImage::class, + 'javascript' => XmlFormFieldJavaScript::class, + 'label' => XmlFormFieldLabel::class, + 'link' => XmlFormFieldLink::class, + 'listbox' => XmlFormFieldListbox::class, + 'password' => XmlFormFieldPassword::class, + 'percentage' => XmlFormFieldPercentage::class, + 'popupoption' => XmlFormFieldPopupOption::class, + 'print' => XmlFormFieldPrint::class, + 'radiogroup' => XmlFormFieldRadioGroup::class, + 'radiogroupview' => XmlFormFieldRadioGroupView::class, + 'reset' => XmlFormFieldReset::class, + 'simpletext' => XmlFormFieldSimpleText::class, + 'submit' => XmlFormFieldSubmit::class, + 'subtitle' => XmlFormFieldSubtitle::class, + 'suggest' => XmlFormFieldSuggest::class, + 'text' => XmlFormFieldText::class, + 'textarea' => XmlFormFieldTextarea::class, + 'textareapm' => XmlFormFieldTextareaPm::class, + 'textpm' => XmlFormFieldTextPm::class, + 'title' => XmlFormFieldTitle::class, + 'toolbar' => XmlFormFieldToolBar::class, + 'toolbutton' => XmlFormFieldToolButton::class, + 'wysiwyg_editor' => XmlFormFieldWYSIWYGEditor::class, + 'xmlform' => XmlFormFieldXmlform::class, + 'xmlmenu' => XmlFormFieldXmlMenu::class, + 'yesno' => XmlFormFieldYesNo::class, ]; /** @@ -5446,27 +5435,27 @@ class XmlForm * @param string templateFile * @return string */ - public function parseFile ($filename, $language, $forceParse) + public function parseFile($filename, $language, $forceParse) { $this->language = $language; $filenameInitial = $filename; $filename = $this->home . $filename; //if the xmlform file doesn't exists, then try with the plugins folders - if (! is_file( $filename )) { - $aux = explode( PATH_SEP, $filenameInitial ); + if (!is_file($filename)) { + $aux = explode(PATH_SEP, $filenameInitial); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment - if (count( $aux ) > 2) { + if (count($aux) > 2) { //Subfolders - $filename = array_pop( $aux ); - $aux0 = implode( PATH_SEP, $aux ); - $aux = array (); + $filename = array_pop($aux); + $aux0 = implode(PATH_SEP, $aux); + $aux = []; $aux[0] = $aux0; $aux[1] = $filename; } - if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) { + if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry = PluginRegistry::loadSingleton(); - if ($response = $oPluginRegistry->isRegisteredFolder( $aux[0] )) { + if ($response = $oPluginRegistry->isRegisteredFolder($aux[0])) { if ($response !== true) { $sPath = PATH_PLUGINS . $response . PATH_SEP; } else { @@ -5478,109 +5467,107 @@ class XmlForm } $this->fileName = $filename; - $parsedFile = dirname( $filename ) . PATH_SEP . basename( $filename, 'xml' ) . $language; + $parsedFile = dirname($filename) . PATH_SEP . basename($filename, 'xml') . $language; $parsedFilePath = defined('PATH_C') ? (!empty(config("system.workspace")) ? PATH_C . 'ws' . PATH_SEP . config("system.workspace") . PATH_SEP : PATH_C) : PATH_DATA; - $parsedFilePath .= 'xmlform/' . substr( $parsedFile, strlen( $this->home ) ); + $parsedFilePath .= 'xmlform/' . substr($parsedFile, strlen($this->home)); // Improvement for the js cache - Start - $realPath = substr( realpath( $this->fileName ), strlen( realpath( $this->home ) ), - 4 ); - if (substr( $realPath, 0, 1 ) != PATH_SEP) { + $realPath = substr(realpath($this->fileName), strlen(realpath($this->home)), -4); + if (substr($realPath, 0, 1) != PATH_SEP) { $realPath = PATH_SEP . $realPath; } - $filesToDelete = substr( (defined( 'PATH_C' ) ? PATH_C : PATH_DATA) . 'xmlform/', 0, - 1 ) . $realPath . '.*.js'; - $auxPath = explode( PATH_SEP, $realPath ); - $auxPath[count( $auxPath ) - 1] = $auxPath[count( $auxPath ) - 1] . '.' . G::encryptOld( filemtime( $this->fileName ) ); - $realPath = implode( PATH_SEP, $auxPath ); + $filesToDelete = substr((defined('PATH_C') ? PATH_C : PATH_DATA) . 'xmlform/', 0, -1) . $realPath . '.*.js'; + $auxPath = explode(PATH_SEP, $realPath); + $auxPath[count($auxPath) - 1] = $auxPath[count($auxPath) - 1] . '.' . G::encryptOld(filemtime($this->fileName)); + $realPath = implode(PATH_SEP, $auxPath); // Improvement for the js cache - End $this->parsedFile = $parsedFilePath; $this->scriptURL = '/jsform' . $realPath . '.js'; - $this->scriptFile = substr( (defined( 'PATH_C' ) ? PATH_C : PATH_DATA) . 'xmlform/', 0, - 1 ) . substr( $this->scriptURL, 7 ); - $this->id = G::createUID( '', substr( $this->fileName, strlen( $this->home ) ) ); - $this->scriptURL = str_replace( '\\', '/', $this->scriptURL ); + $this->scriptFile = substr((defined('PATH_C') ? PATH_C : PATH_DATA) . 'xmlform/', 0, -1) . substr($this->scriptURL, 7); + $this->id = G::createUID('', substr($this->fileName, strlen($this->home))); + $this->scriptURL = str_replace('\\', '/', $this->scriptURL); $newVersion = false; - if ($forceParse || ((! file_exists( $this->parsedFile )) || (filemtime( $filename ) > filemtime( $this->parsedFile )) || (filemtime( __FILE__ ) > filemtime( $this->parsedFile ))) || (! file_exists( $this->scriptFile )) || (filemtime( $filename ) > filemtime( $this->scriptFile ))) { - if (glob( $filesToDelete )) { - foreach (glob( $filesToDelete ) as $fileToDelete) { - @unlink( $fileToDelete ); + if ($forceParse || ((!file_exists($this->parsedFile)) || (filemtime($filename) > filemtime($this->parsedFile)) || (filemtime(__FILE__) > filemtime($this->parsedFile))) || (!file_exists($this->scriptFile)) || (filemtime($filename) > filemtime($this->scriptFile))) { + if (glob($filesToDelete)) { + foreach (glob($filesToDelete) as $fileToDelete) { + @unlink($fileToDelete); } } $this->tree = new Xml_Document(); - $this->tree->parseXmlFile( $filename ); + $this->tree->parseXmlFile($filename); //$this->tree->unsetParent(); - if (! is_object( $this->tree->children[0] )) { - throw new Exception( 'Failure loading root node.' ); + if (!is_object($this->tree->children[0])) { + throw new Exception('Failure loading root node.'); } - $this->tree = &$this->tree->children[0]->toTree(); + $this->tree = $this->tree->children[0]->toTree(); //ERROR CODE [1] : Failed to read the xml document - if (! isset( $this->tree )) { + if (!isset($this->tree)) { return 1; } - $xmlNode = & $this->tree->children; + $xmlNode = &$this->tree->children; //Set the form's attributes - $myAttributes = get_class_vars( get_class( $this ) ); + $myAttributes = get_class_vars(get_class($this)); foreach ($myAttributes as $k => $v) { - $myAttributes[$k] = strtolower( $k ); + $myAttributes[$k] = strtolower($k); } foreach ($this->tree->attributes as $k => $v) { - $key = array_search( strtolower( $k ), $myAttributes ); - if (($key !== false) && (strtolower( $k ) !== 'fields') && (strtolower( $k ) !== 'values')) { + $key = array_search(strtolower($k), $myAttributes); + if (($key !== false) && (strtolower($k) !== 'fields') && (strtolower($k) !== 'values')) { $this->{$key} = $v; } } //Reeplace non valid characters in xmlform name with "_" - $this->name = preg_replace( '/\W/', '_', $this->name ); + $this->name = preg_replace('/\W/', '_', $this->name); //Create fields foreach ($xmlNode as $k => $v) { - if (($xmlNode[$k]->type !== 'cdata') && isset( $xmlNode[$k]->attributes['type'] )) { + if (($xmlNode[$k]->type !== 'cdata') && isset($xmlNode[$k]->attributes['type'])) { $class = $this->getClassByControlType($xmlNode[$k]->attributes['type']); - $field = new $class( $xmlNode[$k], $language, $this->home, $this ); + $field = new $class($xmlNode[$k], $language, $this->home, $this); $field->language = $this->language; $this->fields[$field->name] = $field; } - if (isset( $xmlNode[$k]->attributes['required'] ) || isset( $xmlNode[$k]->attributes['validate'] )) { + if (isset($xmlNode[$k]->attributes['required']) || isset($xmlNode[$k]->attributes['validate'])) { // the fields or xml nodes with a required attribute are put in an array that is passed to the view file - $isEditMode = isset( $xmlNode[$k]->attributes['mode'] ) && $xmlNode[$k]->attributes['mode'] == 'view' ? false : true; + $isEditMode = isset($xmlNode[$k]->attributes['mode']) && $xmlNode[$k]->attributes['mode'] == 'view' ? false : true; if ($isEditMode && $this->mode != 'view') { - $validateValue = ""; - if (isset( $xmlNode[$k]->attributes['validate'] )) { + if (isset($xmlNode[$k]->attributes['validate'])) { $validateValue = $xmlNode[$k]->attributes['validate']; } $requiredValue = "0"; - if (isset( $xmlNode[$k]->attributes['required'] )) { + if (isset($xmlNode[$k]->attributes['required'])) { $requiredValue = $xmlNode[$k]->attributes['required'] == 1 ? '1' : '0'; } - $this->requiredFields[] = array ('name' => $field->name,'type' => $xmlNode[$k]->attributes['type'],'label' => addslashes( trim( $field->label ) ),'validate' => $validateValue,'required' => $requiredValue + $this->requiredFields[] = array('name' => $field->name, 'type' => $xmlNode[$k]->attributes['type'], 'label' => addslashes(trim($field->label)), 'validate' => $validateValue, 'required' => $requiredValue ); } - } } //$oJSON = new Services_JSON(); - $jsonRequired = G::json_encode( $this->requiredFields ); - $this->objectRequiredFields = str_replace( '"', "%27", str_replace( "'", "%39", $jsonRequired ) ); + $jsonRequired = G::json_encode($this->requiredFields); + $this->objectRequiredFields = str_replace('"', "%27", str_replace("'", "%39", $jsonRequired)); //Load the default values //$this->setDefaultValues(); //Save the cache file - if (! is_dir( dirname( $this->parsedFile ) )) { - G::mk_dir( dirname( $this->parsedFile ) ); + if (!is_dir(dirname($this->parsedFile))) { + G::mk_dir(dirname($this->parsedFile)); } - $f = fopen( $this->parsedFile, 'w+' ); + $f = fopen($this->parsedFile, 'w+'); //ERROR CODE [2] : Failed to open cache file if ($f === false) { return 2; } - fwrite( $f, " $value) { @@ -5594,30 +5581,30 @@ class XmlForm break; default: switch (true) { - case is_string( $this->{$key} ): - fwrite( $f, '$this->' . $key . '=\'' . addcslashes( $this->{$key}, '\\\'' ) . '\'' . ";\n" ); + case is_string($this->{$key}): + fwrite($f, '$this->' . $key . '=\'' . addcslashes($this->{$key}, '\\\'') . '\'' . ";\n"); break; - case is_bool( $this->{$key} ): - fwrite( $f, '$this->' . $key . '=' . (($this->{$key}) ? 'true;' : 'false') . ";\n" ); + case is_bool($this->{$key}): + fwrite($f, '$this->' . $key . '=' . (($this->{$key}) ? 'true;' : 'false') . ";\n"); break; - case is_null( $this->{$key} ): - fwrite( $f, '$this->' . $key . '=null' . ";\n" ); + case is_null($this->{$key}): + fwrite($f, '$this->' . $key . '=null' . ";\n"); break; - case is_float( $this->{$key} ): - case is_int( $this->{$key} ): - fwrite( $f, '$this->' . $key . '=' . $this->{$key} . ";\n" ); + case is_float($this->{$key}): + case is_int($this->{$key}): + fwrite($f, '$this->' . $key . '=' . $this->{$key} . ";\n"); break; default: - fwrite( $f, '$this->' . $key . ' = unserialize( \'' . addcslashes( serialize( $this->{$key} ), '\\\'' ) . '\' );' . "\n" ); + fwrite($f, '$this->' . $key . ' = unserialize( \'' . addcslashes(serialize($this->{$key}), '\\\'') . '\' );' . "\n"); } } } - fwrite( $f, "?>" ); - fclose( $f ); + fwrite($f, "?>"); + fclose($f); $newVersion = true; } //if $forceParse //Loads the parsedFile. - require ($this->parsedFile); + require($this->parsedFile); $this->fileName = $filename; $this->parsedFile = $parsedFile; @@ -5628,16 +5615,16 @@ class XmlForm $template = PATH_CORE . 'templates/' . $this->type . '.html'; //If the type is not the correct template name, use xmlform.html //if (!file_exists($template)) $template = PATH_CORE . 'templates/xmlform.html'; - if (($template !== '') && (file_exists( $template ))) { - if (! is_dir( dirname( $this->scriptFile ) )) { - G::mk_dir( dirname( $this->scriptFile ) ); + if (($template !== '') && (file_exists($template))) { + if (!is_dir(dirname($this->scriptFile))) { + G::mk_dir(dirname($this->scriptFile)); } - $f = fopen( $this->scriptFile, 'w' ); - $o = new xmlformTemplate( $this, $template ); - $scriptContent = $o->printJSFile( $this ); - unset( $o ); - fwrite( $f, $scriptContent ); - fclose( $f ); + $f = fopen($this->scriptFile, 'w'); + $o = new xmlformTemplate($this, $template); + $scriptContent = $o->printJSFile($this); + unset($o); + fwrite($f, $scriptContent); + fclose($f); } } return 0; @@ -5649,18 +5636,17 @@ class XmlForm * @param $newValues * @return void */ - public function setValues ($newValues = array()) + public function setValues($newValues = array()) { foreach ($this->fields as $k => $v) { - if (array_key_exists( $k, $newValues )) { + if (array_key_exists($k, $newValues)) { $this->values[$k] = $newValues[$k]; } } foreach ($this->fields as $k => $v) { - if (is_object( $this->fields[$k] ) && get_class( $this->fields[$k] ) != '__PHP_Incomplete_Class') { - $this->fields[$k]->owner = & $this; + if (is_object($this->fields[$k]) && get_class($this->fields[$k]) != '__PHP_Incomplete_Class') { + $this->fields[$k]->owner = &$this; } - } } @@ -5671,15 +5657,15 @@ class XmlForm * @param &$scriptContent * @return string */ - public function render ($template, &$scriptContent) + public function render($template, &$scriptContent) { - $o = new xmlformTemplate( $this, $template ); - if (is_array( reset( $this->values ) )) { - $this->rows = count( reset( $this->values ) ); + $o = new xmlformTemplate($this, $template); + if (is_array(reset($this->values))) { + $this->rows = count(reset($this->values)); } - $o->template = $o->printTemplate( $this ); - $scriptContent = $o->printJavaScript( $this ); - return $o->printObject( $this ); + $o->template = $o->printTemplate($this); + $scriptContent = $o->printJavaScript($this); + return $o->printObject($this); } /** @@ -5687,9 +5673,9 @@ class XmlForm * * @return Object */ - public function cloneObject () + public function cloneObject() { - return unserialize( serialize( $this ) ); + return unserialize(serialize($this)); } } @@ -5698,91 +5684,92 @@ class XmlForm */ class XmlFormFieldImage extends XmlFormField { - public $file = ''; - public $home = 'public_html'; + public $file = ''; + public $home = 'public_html'; public $withoutLabel = false; /** - * Function render - * @access public - * @param string values - * @return string - */ + * Function render + * @access public + * @param string values + * @return string + */ public function render($value = null, $owner = null) { $url = G::replaceDataField($this->file, $owner->values); if ($this->home === "methods") { - $url = G::encryptlink( SYS_URI . $url ); + $url = G::encryptlink(SYS_URI . $url); } if ($this->home === "public_html") { - $url ='/' . $url ; + $url = '/' . $url; } - return 'style)?'style="'.$this->style.'"':'') - .' alt ="'.htmlentities($value,ENT_QUOTES,'utf-8').'"/>'; + return 'style) ? 'style="' . $this->style . '"' : '') + . ' alt ="' . htmlentities($value, ENT_QUOTES, 'utf-8') . '"/>'; } } //mask function to php -function masktophp ($mask, $value) +function masktophp($mask, $value) { $tmp = str_replace("%", "", $mask); - if (preg_match('/M/',$tmp)) { + if (preg_match('/M/', $tmp)) { $tmp = str_replace("M", "i", $tmp); } - if (preg_match('/b/',$tmp)) { + if (preg_match('/b/', $tmp)) { $tmp = str_replace("b", "M", $tmp); } - if (preg_match('/B/',$tmp)) { + if (preg_match('/B/', $tmp)) { $tmp = str_replace("B", "F", $tmp); } - if (preg_match('/S/',$tmp)) { + if (preg_match('/S/', $tmp)) { $tmp = str_replace("S", "s", $tmp); } - if (preg_match('/o/',$tmp)) { + if (preg_match('/o/', $tmp)) { $tmp = str_replace("o", "n", $tmp); } - if (preg_match('/a/',$tmp)) { + if (preg_match('/a/', $tmp)) { $tmp = str_replace("a", "D", $tmp); } - if (preg_match('/l/',$tmp)) { + if (preg_match('/l/', $tmp)) { $tmp = str_replace("l", "g", $tmp); } - if (preg_match('/A/',$tmp)) { + if (preg_match('/A/', $tmp)) { $tmp = str_replace("A", "l", $tmp); } - if (preg_match('/I/',$tmp)) { + if (preg_match('/I/', $tmp)) { $tmp = str_replace("I", "h", $tmp); } - if (preg_match('/j/',$tmp)) { + if (preg_match('/j/', $tmp)) { $tmp = str_replace("j", "z", $tmp); } - if (preg_match('/k/',$tmp)) { + if (preg_match('/k/', $tmp)) { $tmp = str_replace("k", "G", $tmp); } - if (preg_match('/e/',$tmp)) { + if (preg_match('/e/', $tmp)) { $tmp = str_replace("e", "j", $tmp); } - if (preg_match('/u/',$tmp)) { + if (preg_match('/u/', $tmp)) { $tmp = str_replace("u", "N", $tmp); } - if (preg_match('/p/',$tmp)) { + if (preg_match('/p/', $tmp)) { $tmp = str_replace("p", "A", $tmp); } - if (preg_match('/P/',$tmp)) { + if (preg_match('/P/', $tmp)) { $tmp = str_replace("P", "a", $tmp); } if ($value == 'today') { $value = date($tmp); } else { - $value = date($tmp, strtotime ($value)); + $value = date($tmp, strtotime($value)); } return $value; } if (!function_exists('strptime')) { - function strptime($date, $format) { + function strptime($date, $format) + { $masks = array( '%d' => '(?P[0-9]{2})', '%m' => '(?P[0-9]{2})', @@ -5793,56 +5780,55 @@ if (!function_exists('strptime')) { // usw.. ); - $rexep = "#".strtr(preg_quote($format), $masks)."#"; - if(!preg_match($rexep, $date, $out)) { + $rexep = "#" . strtr(preg_quote($format), $masks) . "#"; + if (!preg_match($rexep, $date, $out)) { return false; } if (!isset($out['S'])) { $out['S'] = 0; } else { - $out['S'] = (int) $out['S']; + $out['S'] = (int)$out['S']; } if (!isset($out['M'])) { $out['M'] = 0; } else { - $out['M'] = (int) $out['M']; + $out['M'] = (int)$out['M']; } if (!isset($out['H'])) { $out['H'] = 0; } else { - $out['H'] = (int) $out['H']; + $out['H'] = (int)$out['H']; } if (!isset($out['d'])) { $out['d'] = 0; } else { - $out['d'] = (int) $out['d']; + $out['d'] = (int)$out['d']; } if (!isset($out['m'])) { $out['m'] = 0; } else { - $out['m'] = (int) $out['m']; + $out['m'] = (int)$out['m']; } if (!isset($out['Y'])) { $out['Y'] = 0; } else { - $out['Y'] = (int) $out['Y']; + $out['Y'] = (int)$out['Y']; } $ret = array( - "tm_sec" => $out['S'], - "tm_min" => $out['M'], + "tm_sec" => $out['S'], + "tm_min" => $out['M'], "tm_hour" => $out['H'], "tm_mday" => $out['d'], - "tm_mon" => $out['m'] ? $out['m'] - 1 : 0, + "tm_mon" => $out['m'] ? $out['m'] - 1 : 0, "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0, ); return $ret; } } - diff --git a/phpunit.xml b/phpunit.xml index 241fcb099..e59678301 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -33,18 +33,31 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Feature/DBQueryTest.php b/tests/Feature/DBQueryTest.php new file mode 100644 index 000000000..f851feafb --- /dev/null +++ b/tests/Feature/DBQueryTest.php @@ -0,0 +1,97 @@ +assertCount(1, $results); + // Note, we check index 1 because results from executeQuery are 1 indexed, not 0 indexed. + $this->assertArraySubset([ + 'USR_UID' => '00000000000000000000000000000001', + 'USR_USERNAME' => 'admin' + ], $results[1]); + } + + public function testDBFacadeQuery() + { + $record = DB::table('USERS')->where([ + 'USR_UID' => '00000000000000000000000000000001' + ])->first(); + $this->assertEquals('admin', $record->USR_USERNAME); + } + + public function testStandardExecuteQueryWithExternalMySQLDatabase() + { + // Our test external database is created in our tests/bootstrap.php file + // We'll use our factories to create our process and database + $process = factory(Process::class)->create(); + // Let's create an external DB to ourselves + $externalDB = factory(DbSource::class)->create([ + 'DBS_SERVER' => 'localhost', + 'DBS_PORT' => '3306', + 'DBS_USERNAME' => env('DB_USERNAME'), + // Remember, we have to do some encryption here @see DbSourceFactory.php + 'DBS_PASSWORD' => \G::encrypt( env('DB_PASSWORD'), 'testexternal') . "_2NnV3ujj3w", + 'DBS_DATABASE_NAME' => 'testexternal', + 'PRO_UID' => $process->PRO_UID + ]); + + // Now set our process ID + /** + * @todo Migrate to non session based process store + */ + $_SESSION['PROCESS'] = $process->PRO_UID; + // Perform test + $results = executeQuery('SELECT * FROM test', $externalDB->DBS_UID); + $this->assertCount(1, $results); + $this->assertEquals('testvalue', $results[1]['value']); + } + + public function testStandardExecuteQueryWithExternalMSSqlDatabase() + { + if(!env('RUN_MSSQL_TESTS')) { + $this->markTestSkipped('MSSQL Related Test Skipped'); + } + // Our test external database is created in our tests/bootstrap.php file + // We'll use our factories to create our process and database + $process = factory(Process::class)->create(); + // Let's create an external DB to ourselves + $externalDB = factory(DbSource::class)->create([ + 'DBS_SERVER' => env('MSSQL_HOST'), + 'DBS_PORT' => env('MSSQL_PORT'), + 'DBS_TYPE' => 'mssql', + 'DBS_USERNAME' => env('MSSQL_USERNAME'), + // Remember, we have to do some encryption here @see DbSourceFactory.php + 'DBS_PASSWORD' => \G::encrypt( env('MSSQL_PASSWORD'), 'testexternal') . "_2NnV3ujj3w", + 'DBS_DATABASE_NAME' => 'testexternal', + 'PRO_UID' => $process->PRO_UID + ]); + // Now set our process ID + /** + * @todo Migrate to non session based process store + */ + $_SESSION['PROCESS'] = $process->PRO_UID; + // Perform test + $results = executeQuery('SELECT * FROM test', $externalDB->DBS_UID); + $this->assertCount(1, $results); + $this->assertEquals('testvalue', $results[1]['value']); + } +} \ No newline at end of file diff --git a/tests/TestCase.php b/tests/TestCase.php index 0e61740a2..41f485da0 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,9 +1,12 @@ make(Kernel::class)->bootstrap(); + +// Setup our testexternal database +config(['database.connections.testexternal' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'database' => env('DB_TESTEXTERNAL_DB', 'testexternal'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'strict' => true, + 'engine' => null, +]]); + +// Now, drop all test tables and repopulate with schema +Schema::connection('testexternal')->dropIfExists('test'); + +Schema::connection('testexternal')->create('test', function($table) { + $table->increments('id'); + $table->string('value'); +}); +DB::connection('testexternal')->table('test')->insert([ + 'value' => 'testvalue' +]); + +// Only do if we are supporting MSSql tests +if(env('RUN_MSSQL_TESTS')) { + config(['database.connections.mssql' => [ + 'driver' => 'sqlsrv', + 'host' => env('MSSQL_HOST', '127.0.0.1'), + 'database' => env('MSSQL_DATABASE', 'testexternal'), + 'username' => env('MSSQL_USERNAME', 'root'), + 'password' => env('MSSQL_PASSWORD', ''), + ]]); + + Schema::connection('mssql')->dropIfExists('test'); + Schema::connection('mssql')->create('test', function($table) { + $table->increments('id'); + $table->string('value'); + }); + DB::connection('mssql')->table('test')->insert([ + 'value' => 'testvalue' + ]); +} + + +// THIS IS FOR STANDARD PROCESSMAKER TABLES + +// Now, drop all test tables and repopulate with schema +DB::unprepared('SET FOREIGN_KEY_CHECKS = 0'); +$colname = 'Tables_in_' . env('DB_DATABASE'); +$tables = DB::select('SHOW TABLES'); +$drop = []; +foreach($tables as $table) { + $drop[] = $table->$colname; +} +if(count($drop)) { + $drop = implode(',', $drop); + DB::statement("DROP TABLE $drop"); + DB::unprepared('SET FOREIGN_KEY_CHECKS = 1'); +} + +// Repopulate with schema and standard inserts +DB::unprepared(file_get_contents(PATH_CORE.'data/mysql/schema.sql')); +DB::unprepared(file_get_contents(PATH_RBAC_CORE.'data/mysql/schema.sql')); +DB::unprepared(file_get_contents(PATH_CORE.'data/mysql/insert.sql')); +DB::unprepared(file_get_contents(PATH_RBAC_CORE.'data/mysql/insert.sql')); + +// Set our APP_SEQUENCE val +DB::table('APP_SEQUENCE')->insert([ + 'ID' => 1 +]); + +// Setup our initial oauth client for our web designer +DB::table('OAUTH_CLIENTS')->insert([ + 'CLIENT_ID' => 'x-pm-local-client', + 'CLIENT_SECRET' => '179ad45c6ce2cb97cf1029e212046e81', + 'CLIENT_NAME' => 'PM Web Designer', + 'CLIENT_DESCRIPTION' => 'ProcessMaker Web Designer App', + 'CLIENT_WEBSITE' => 'www.processmaker.com', + 'REDIRECT_URI' => config('app.url') . '/sys' . config('system.workspace').'/en/neoclassic/oauth2/grant', + 'USR_UID' => '00000000000000000000000000000001' +]); +DB::table('OAUTH_ACCESS_TOKENS')->insert([ + 'ACCESS_TOKEN' => '39704d17049f5aef45e884e7b769989269502f83', + 'CLIENT_ID' => 'x-pm-local-client', + 'USER_ID' => '00000000000000000000000000000001', + 'EXPIRES' => '2017-06-15 17:55:19', + 'SCOPE' => 'view_processes edit_processes *' +]); + +// We need to manually initialize Propel with our test database +Propel::initConfiguration([ + 'datasources' => [ + 'workflow' => [ + 'connection' => 'mysql://' . config('database.connections.workflow.username') . ':' . config('database.connections.workflow.password') . '@' . config('database.connections.workflow.host') . '/test?encoding=utf8', + 'adapter' => 'mysql' + ], + 'rbac' => [ + 'connection' => 'mysql://' . config('database.connections.workflow.username') . ':' . config('database.connections.workflow.password') . '@' . config('database.connections.workflow.host') . '/test?encoding=utf8', + 'adapter' => 'mysql' + ], + 'rp' => [ + 'connection' => 'mysql://' . config('database.connections.workflow.username') . ':' . config('database.connections.workflow.password') . '@' . config('database.connections.workflow.host') . '/test?encoding=utf8', + 'adapter' => 'mysql' + ] + ] +]); \ No newline at end of file diff --git a/thirdparty/creole/Statement.php b/thirdparty/creole/Statement.php index a41f5bf10..adea1bc91 100644 --- a/thirdparty/creole/Statement.php +++ b/thirdparty/creole/Statement.php @@ -21,20 +21,21 @@ /** * Class that represents a SQL statement. - * + * * This class is very generic and has no driver-specific implementations. In fact, * it wouldn't be possible to have driver-specific classes, since PHP doesn't support * multiple inheritance. I.e. you couldn't have MySQLPreparedStatement that extended * both the abstract PreparedStatement class and the MySQLStatement class. In Java * this isn't a concern since PreparedStatement is an interface, not a class. * - * + * * @author Hans Lellelid * @version $Revision: 1.17 $ * @package creole */ -interface Statement { - +interface Statement +{ + /** * Sets the maximum number of rows to return from db. * This will affect the SQL if the RDBMS supports native LIMIT; if not, @@ -43,45 +44,45 @@ interface Statement { * @return void */ public function setLimit($v); - + /** * Returns the maximum number of rows to return or 0 for all. * @return int */ public function getLimit(); - + /** * Sets the start row. * This will affect the SQL if the RDBMS supports native OFFSET; if not, - * it will be emulated. Offset only applies to queries (not update) and + * it will be emulated. Offset only applies to queries (not update) and * only is evaluated when LIMIT is set! * @param int $v * @return void - */ + */ public function setOffset($v); - + /** * Returns the start row. * Offset only applies when Limit is set! * @return int */ public function getOffset(); - + /** * Free resources associated with this statement. * Some drivers will need to implement this method to free - * database result resources. - * + * database result resources. + * * @return void */ public function close(); - + /** * Generic execute() function has to check to see whether SQL is an update or select query. - * + * * If you already know whether it's a SELECT or an update (manipulating) SQL, then use * the appropriate method, as this one will incurr overhead to check the SQL. - * + * * @param int $fetchmode Fetchmode (only applies to queries). * @return boolean True if it is a result set, false if not or if no more results (this is identical to JDBC return val). * @throws SQLException @@ -102,27 +103,27 @@ interface Statement { * * @return int Number of records affected, or null if not applicable. */ - public function getUpdateCount(); + public function getUpdateCount(); /** * Executes the SQL query in this PreparedStatement object and returns the resultset generated by the query. - * + * * @param string $sql This method may optionally be called with the SQL statement. * @param int $fetchmode The mode to use when fetching the results (e.g. ResultSet::FETCHMODE_NUM, ResultSet::FETCHMODE_ASSOC). * @return object Creole::ResultSet * @throws SQLException if a database access error occurs. */ public function executeQuery($sql, $fetchmode = null); - + /** * Executes the SQL INSERT, UPDATE, or DELETE statement in this PreparedStatement object. - * + * * @param string $sql This method may optionally be called with the SQL statement. * @return int Number of affected rows (or 0 for drivers that return nothing). * @throws SQLException if a database access error occurs. */ public function executeUpdate($sql); - + /** * Gets next result set (if this behavior is supported by driver). * Some drivers (e.g. MSSQL) support returning multiple result sets -- e.g. @@ -133,15 +134,15 @@ interface Statement { * Default behavior is for this function to return false. Driver-specific * implementations of this class can override this method if they actually * support multiple result sets. - * + * * @return boolean True if there is another result set, otherwise false. */ public function getMoreResults(); - + /** * Gets the db Connection that created this statement. * @return Connection */ public function getConnection(); - + } diff --git a/thirdparty/creole/contrib/DBArrayConnection.php b/thirdparty/creole/contrib/DBArrayConnection.php index e49a3e450..a7cbcff75 100644 --- a/thirdparty/creole/contrib/DBArrayConnection.php +++ b/thirdparty/creole/contrib/DBArrayConnection.php @@ -7,239 +7,232 @@ require_once 'creole/common/PreparedStatementCommon.php'; require_once 'creole/ResultSet.php'; require_once 'creole/common/ResultSetCommon.php'; -class DBArrayPreparedStatement extends PreparedStatementCommon implements PreparedStatement { +class DBArrayPreparedStatement extends PreparedStatementCommon implements PreparedStatement +{ - /** - * Quotes string using native mysql function (mysql_real_escape_string()). - * @param string $str - * @return string - */ - protected function escape($str) { - return $str; - } - - private function prepareStatement($sql) { - - return $sql; - } + /** + * Quotes string using native mysql function (mysqli_real_escape_string()). + * @param string $str + * @return string + */ + protected function escape($str) + { + return $str; + } + private function prepareStatement($sql) + { + return $sql; + } } -class DBArrayResultSet extends ResultSetCommon implements ResultSet { +class DBArrayResultSet extends ResultSetCommon implements ResultSet +{ + public $dbArray = null; - public $dbArray = null; - - public function seek($rownum) { - $this->cursorPos = $rownum; - return true; - } - - /** - * @see ResultSet::next() - */ - public function next() { - if ($this->cursorPos == 0) { - $this->cursorPos++; + public function seek($rownum) + { + $this->cursorPos = $rownum; + return true; } - if ($this->cursorPos >= count($this->dbArray)) { - $this->fields = NULL; - return false; - } else { - $this->fields = $this->dbArray[$this->cursorPos]; - $this->cursorPos++; - return true; - } - /* - * - $this->fields = mysql_fetch_array($this->result, $this->fetchmode); - - if (!$this->fields) { - $errno = mysql_errno($this->conn->getResource()); - if (!$errno) { - // We've advanced beyond end of recordset. - $this->afterLast(); - return false; - } else { - throw new SQLException("Error fetching result", mysql_error($this->conn->getResource())); - } - } - - if ($this->fetchmode === ResultSet::FETCHMODE_ASSOC && $this->lowerAssocCase) { - $this->fields = array_change_key_case($this->fields, CASE_LOWER); - } - - // Advance cursor position + /** + * @see ResultSet::next() */ - return true; - } + public function next() + { + if ($this->cursorPos == 0) { + $this->cursorPos++; + } - /** - * @see ResultSet::getRecordCount() - */ - function getRecordCount() { - return (int) count($this->dbArray) - 1; - } - - /** - * @see ResultSet::close() - */ - function close() { - if (is_resource($this->result)) { - @mysql_free_result($this->result); + if ($this->cursorPos >= count($this->dbArray)) { + $this->fields = null; + return false; + } else { + $this->fields = $this->dbArray[$this->cursorPos]; + $this->cursorPos++; + return true; + } + return true; } - $this->fields = array(); - } - /** - * Get string version of column. - * No rtrim() necessary for MySQL, as this happens natively. - * @see ResultSet::getString() - */ - public function getString($column) { - $idx = (is_int($column) ? $column - 1 : $column); - if (!array_key_exists($idx, $this->fields)) { - throw new SQLException("Invalid resultset column: " . $column); + /** + * @see ResultSet::getRecordCount() + */ + public function getRecordCount() + { + return (int)count($this->dbArray) - 1; } - if ($this->fields[$idx] === null) { - return null; - } - return (string) $this->fields[$idx]; - } + /** + * @see ResultSet::close() + */ + public function close() + { + if (is_resource($this->result)) { + mysqli_free_result($this->result); + } + $this->fields = array(); + } + + /** + * Get string version of column. + * No rtrim() necessary for MySQL, as this happens natively. + * @see ResultSet::getString() + */ + public function getString($column) + { + $idx = (is_int($column) ? $column - 1 : $column); + if (!array_key_exists($idx, $this->fields)) { + throw new SQLException("Invalid resultset column: " . $column); + } + if ($this->fields[$idx] === null) { + return null; + } + return (string)$this->fields[$idx]; + } } /** * DBArray implementation of Connection. * */ -class DBArrayConnection implements Connection { +class DBArrayConnection implements Connection +{ - /** @var Connection */ - private $childConnection = null; - /** @var int */ - private $numQueriesExecuted = 0; - /** @var string */ - private $lastExecutedQuery = ''; - /** - * @var object Instance of PEAR Log (or other class with log() method). - */ - private $logger; - private $_DBArray; - public $dataSql; + /** @var Connection */ + private $childConnection = null; + /** @var int */ + private $numQueriesExecuted = 0; + /** @var string */ + private $lastExecutedQuery = ''; + /** + * @var object Instance of PEAR Log (or other class with log() method). + */ + private $logger; + private $_DBArray; + public $dataSql; - /** - * Sets a Logger class (e.g. PEAR Log) to use for logging. - * The logger class must have a log() method. All messages are logged at default log level. - * @param object $logger - */ - public function setLogger($logger) { - krumo('DBArrayConnection setLogger '); - die; - $this->logger = $logger; - } - - /** - * connect() - */ - public function connect($dsninfo, $flags = 0) { - - if (!($driver = Creole::getDriver($dsninfo['phptype']))) { - throw new SQLException("No driver has been registered to handle connection type: $type"); + /** + * Sets a Logger class (e.g. PEAR Log) to use for logging. + * The logger class must have a log() method. All messages are logged at default log level. + * @param object $logger + */ + public function setLogger($logger) + { + krumo('DBArrayConnection setLogger '); + die; + $this->logger = $logger; } - global $_DBArray; - if ((!isset($_DBArray) ) && (isset($_SESSION['_DBArray']))) { - //throw new SQLException("No Database Array defined for this connection but exists in session"); - //Added by JHL to avoid errors trying to execute query of a dbarray on June 25, 2011 - $_DBArray = $_SESSION['_DBArray']; + + /** + * connect() + */ + public function connect($dsninfo, $flags = 0) + { + if (!($driver = Creole::getDriver($dsninfo['phptype']))) { + throw new SQLException("No driver has been registered to handle connection type: $type"); + } + global $_DBArray; + if ((!isset($_DBArray)) && (isset($_SESSION['_DBArray']))) { + //throw new SQLException("No Database Array defined for this connection but exists in session"); + //Added by JHL to avoid errors trying to execute query of a dbarray on June 25, 2011 + $_DBArray = $_SESSION['_DBArray']; + } + if (!isset($_DBArray)) { + throw new SQLException("No Database Array defined for this connection"); + } + $this->_DBArray = $_DBArray; + return true; } - if (!isset($_DBArray)) { - throw new SQLException("No Database Array defined for this connection"); + + /** + * @see Connection::getDatabaseInfo() + */ + public function getDatabaseInfo() + { + krumo('DBArrayConnection getDatabaseInfo '); + die; + return $this->childConnection->getDatabaseInfo(); } - $this->_DBArray = $_DBArray; - return true; - } - /** - * @see Connection::getDatabaseInfo() - */ - public function getDatabaseInfo() { - krumo('DBArrayConnection getDatabaseInfo '); - die; - return $this->childConnection->getDatabaseInfo(); - } + /** + * @see Connection::getIdGenerator() + */ + public function getIdGenerator() + { + krumo('DBArrayConnection getIdGenerator '); + die; + return $this->childConnection->getIdGenerator(); + } - /** - * @see Connection::getIdGenerator() - */ - public function getIdGenerator() { - krumo('DBArrayConnection getIdGenerator '); - die; - return $this->childConnection->getIdGenerator(); - } + /** + * @see Connection::isConnected() + */ + public function isConnected() + { + return true; + krumo('DBArrayConnection isConnected '); + die; + return $this->childConnection->isConnected(); + } - /** - * @see Connection::isConnected() - */ - public function isConnected() { - return true; - krumo('DBArrayConnection isConnected '); - die; - return $this->childConnection->isConnected(); - } + /** + * @see Connection::prepareStatement() + */ + public function prepareStatement($dataSql) + { + $this->dataSql = $dataSql; + return new DBArrayPreparedStatement($this, $this->dataSql); + } - /** - * @see Connection::prepareStatement() - */ - public function prepareStatement($dataSql) { - $this->dataSql = $dataSql; - return new DBArrayPreparedStatement($this, $this->dataSql); - } + /** + * @see Connection::createStatement() + */ + public function createStatement() + { + return new DBArrayPreparedStatement($this, null); + return new DBArrayPreparedStatement($this, $dataSql['sql']); + krumo('DBArrayConnection createStatement '); + die; + $obj = $this->childConnection->createStatement(); + $objClass = get_class($obj); + return new $objClass($this); + } - /** - * @see Connection::createStatement() - */ - public function createStatement() { - return new DBArrayPreparedStatement($this, null); - return new DBArrayPreparedStatement($this, $dataSql['sql']); - krumo('DBArrayConnection createStatement '); - die; - $obj = $this->childConnection->createStatement(); - $objClass = get_class($obj); - return new $objClass($this); - } + /** + * @see Connection::applyLimit() + */ + public function applyLimit(&$sql, $offset, $limit) + { + krumo('DBArrayConnection applyLimit '); + die; + $this->log("applyLimit(): $sql, offset: $offset, limit: $limit"); + return $this->childConnection->applyLimit($sql, $offset, $limit); + } - /** - * @see Connection::applyLimit() - */ - public function applyLimit(&$sql, $offset, $limit) { - krumo('DBArrayConnection applyLimit '); - die; - $this->log("applyLimit(): $sql, offset: $offset, limit: $limit"); - return $this->childConnection->applyLimit($sql, $offset, $limit); - } - - /** - * @see Connection::close() - */ - public function close() { - krumo('DBArrayConnection connect '); - die; - $this->log("close(): Closing connection."); - return $this->childConnection->close(); - } + /** + * @see Connection::close() + */ + public function close() + { + krumo('DBArrayConnection connect '); + die; + $this->log("close(): Closing connection."); + return $this->childConnection->close(); + } - /** - * Evaluate Clause - * @param type $clause - * @return type - */ - public function evaluateClause($clause) - { - $sqlStr = $clause; - $sqlStr = str_replace(array('\\\'','\\"',"\r\n","\n","()"), array("''",'""'," "," "," "), $sqlStr); - $regex = "/((?:)[@A-Za-z0-9_.-]+(?:\(\s*\)){0,1})" + /** + * Evaluate Clause + * @param type $clause + * @return type + */ + public function evaluateClause($clause) + { + $sqlStr = $clause; + $sqlStr = str_replace(array('\\\'', '\\"', "\r\n", "\n", "()"), array("''", '""', " ", " ", " "), $sqlStr); + $regex = "/((?:)[@A-Za-z0-9_.-]+(?:\(\s*\)){0,1})" . "|(\+|-|\*|\/|!=|>=|<=|<>|>|<|&&|\|\||=|\^)" . "|(\(.*?\))" . "|('(?:[^']|'')*'+)" @@ -247,394 +240,445 @@ class DBArrayConnection implements Connection { . "|([^ ,]+)" . "/ix"; - $tokens = preg_split($regex, $sqlStr, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - return $tokens; - } - - /** - * Evaluate Clause Where - * @param type $clauseWhere - * @return type - */ - public function evaluateClauseWhere($clauseWhere) - { - $aOperator = array("=", "!=", "<>", ">", "<", ">=", "<=", "LIKE", "AND", "OR", "NOT", "IN"); - $evalClause = $this->evaluateClause($clauseWhere); - $pos = 0; - foreach ($evalClause as $key => $value) { - $value = strtoupper(trim($value)); - $sSelect = strtoupper($this->dataSql['selectClause'][0]); - if( stripos($sSelect, $value) !== false ) { - $evalClause[$key] = "\$row['" . $evalClause[$key] . "']"; - } - if ( in_array($value, $aOperator) ) { - switch ( $value ) { - case "=" : - $evalClause[$key] = "=="; - break; - case "<>" : - $evalClause[$key] = "!="; - break; - case "AND" : - $evalClause[$key] = "&&"; - break; - case "OR" : - $evalClause[$key] = "||"; - break; - case "NOT" : - $evalClause[$key] = "!"; - break; - case "LIKE" : - $evalClause[$key] = ", "; - if (trim($evalClause[$key-1]) !== "" ) { - $evalClause[$key-1] = " stripos(" . $evalClause[$key-1]; - } - else { - if (trim($evalClause[$key-2]) !== "" ) { - $evalClause[$key-2] = " stripos(" . $evalClause[$key-2]; - } - } - - if (trim($evalClause[$key+1]) !== "" ) { - $evalClause[$key+1] = str_replace("%", "", $evalClause[$key+1]); - $evalClause[$key+1] = $evalClause[$key+1] . ") !== false"; - } - else { - if (trim($evalClause[$key+2]) !== "" ) { - $evalClause[$key+2] = str_replace("%", "", $evalClause[$key+2]); - $evalClause[$key+2] = $evalClause[$key+2] . ") !== false"; - } - } - break; - } - } - } - $$sEvalClause = implode("", $evalClause); - return $$sEvalClause; - } - - private function parseSqlString($query) { - //we need a SQL parse, for now we only search for text 'select * from' - /* $aux = str_ireplace ( 'select * from', '', trim($query) ); - $sql = array(); - $sql['fromClause'][0] = trim( $aux ); - $sql['limit'] = 0; - $sql['offset'] = 0; */ - // if (1 === preg_match('/^\s*SELECT\s+(.+?)(?:\s+FROM\s+(.+?))(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+BETWEEN\s+(.+?)\s+AND\s+(.+?))?\s*$/im', $query, $matches)) { - if (1 === preg_match('/^\s*SELECT\s+([\w\W]+?)(?:\s+FROM\s+`?([^`]+?)`?)(?:\s+WHERE\s+([\w\W]+?))?(?:\s+GROUP\s+BY\s+([\w\W]+?))?(?:\s+ORDER\s+BY\s+([\w\W]+?))?(?:\s+BETWEEN\s+([\w\W]+?)\s+AND\s+([\w\W]+?))?(?:\s+LIMIT\s+(\d+)\s*,\s*(\d+))?\s*$/im', $query, $matches)) { - //$sqlSelect='SELECT '.$matches[1].(($matches[2]!='')?' FROM '.$matches[2]:''); - } else { - return; - } - $sql = array(); - $sql['selectClause'][0] = isset($matches[1]) ? $matches[1] : '';//Include selectClause. By JHL - $sql['fromClause'][0] = isset($matches[2]) ? $matches[2] : ''; - //$sql['whereClause'][0] = isset($matches[3]) ? $matches[3] : ''; - if(isset($matches[3])){ - $sql['whereClause'][0] = $matches[3]; - } - if(isset($matches[4])){ - $sql['groupByClause'][0] = $matches[4]; - } - if(isset($matches[5])){ - $sql['orderByClause'][0] = $matches[5]; - } - - - $sql['limit'] = 0; - $sql['offset'] = 0; - return $sql; - } - - /** - * @see Connection::executeQuery() - */ - public function executeQuery($sql, $fetchmode = null) { - if (!is_array($sql) && strlen($sql) > 1) { - $this->dataSql=$sql = $this->parseSqlString($sql); - } - $resultSet = new DBArrayResultSet($this, $sql, $fetchmode); - $tableName = $sql['fromClause'][0]; - - //the table doesnt exists - if (!isset($this->_DBArray[$tableName])) { - $resultSet->dbArray = array(); - return $resultSet; + $tokens = preg_split($regex, $sqlStr, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + return $tokens; } - - foreach ($this->_DBArray[$tableName] as $key => $row) { - if ($key == 0) - continue; - $flag = 1; - if (isset($sql['whereClause'])){//If there is no where then return the row - foreach ($sql['whereClause'] as $keyClause => $valClause) { - if (isset($valClause) && $flag == 1) { - //$toEval = "\$flag = ( " . ($valClause != '' ? str_replace('=', '==', $valClause): '1') . ') ?1 :0;' ; - //if the eval is EQUAL add a double Equal - if (strpos($valClause, "\$row['*'] CUSTOM'(") !== false) { - $valClause = str_replace("\$row['*'] CUSTOM'(", '', $valClause); - $words = explode(' ', $valClause); - $valClause = str_replace($words[0], "\$row['" . $words[0] . "']", $valClause); - $valClause = str_replace(")'", "", $valClause); - } - - if (stripos($valClause, "\$row[") !== false ){ - if (stripos($valClause, "LIKE") !== false) { - $valClause = str_replace("%", "", $valClause); - $operands = explode('LIKE', $valClause); - if ($operands[1] == ' ""') { - $toEval = "\$flag = 1;"; - } else { - $toEval = "\$flag = ( stripos ( " . $operands[0] . ", " . $operands[1] . " ) !== false ? 1 : 0 ) ;"; - eval($toEval); - eval('$val = ' . $operands[0] . ';'); - } - } else {//this is for EQUAL, LESS_THAN_EQUAL, ETC, - $toEval = "\$flag = ( " . ($valClause != '' ? $valClause : '1') . ') ?1 :0;'; - } - } - else { - $valClause = $this->evaluateClauseWhere($valClause); - $toEval = "\$flag = ( " . ($valClause != '' ? $valClause : '1') . ') ?1 :0;'; - } - eval($toEval); - } - }}else{ - - } - - if ($flag) { - $resultRow[] = $row; - } - } - if ($this->dataSql['selectClause'][0] == 'COUNT(*)') { - $rows[] = array('1' => 'integer'); - if (isset($resultRow) && is_array($resultRow)) - $rows[] = array('1' => count($resultRow)); - else - $rows[] = array('1' => 0); - $resultSet->dbArray = $rows; - return $resultSet; - } - - if (!isset($resultRow)) { - $resultSet->dbArray = array(); - return $resultSet; - } - - - if (isset($this->dataSql['orderByClause'])&&is_array($this->dataSql['orderByClause']) && count($this->dataSql['orderByClause']) > 0) { - foreach ($resultRow as $key => $row) { - foreach ($this->dataSql['orderByClause'] as $keyOrder => $valOrder) { - if (isset($row[$valOrder['columnName']])) { - $column[$valOrder['columnName']][$key] = strtoupper($row[$valOrder['columnName']]); - } else { - $column[$valOrder['columnName']][$key] = ''; - } - } - } - foreach ($this->dataSql['orderByClause'] as $keyOrder => $valOrder) { - $direction[$keyOrder] = (trim($valOrder['direction']) != 'ASC') ? SORT_DESC : SORT_ASC; - } - $aOrderClause = $this->dataSql['orderByClause']; - switch (count($column)) { - case 1 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], $resultRow); - break; - case 2 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], - $column[$aOrderClause[1]['columnName']], $direction[1], - $resultRow); - break; - case 3 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], - $column[$aOrderClause[1]['columnName']], $direction[1], - $column[$aOrderClause[2]['columnName']], $direction[2], - $resultRow); - break; - case 4 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], - $column[$aOrderClause[1]['columnName']], $direction[1], - $column[$aOrderClause[2]['columnName']], $direction[2], - $column[$aOrderClause[3]['columnName']], $direction[3], - $resultRow); - break; - case 5 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], - $column[$aOrderClause[1]['columnName']], $direction[1], - $column[$aOrderClause[2]['columnName']], $direction[2], - $column[$aOrderClause[3]['columnName']], $direction[3], - $column[$aOrderClause[4]['columnName']], $direction[4], - $resultRow); - break; - case 6 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], - $column[$aOrderClause[1]['columnName']], $direction[1], - $column[$aOrderClause[2]['columnName']], $direction[2], - $column[$aOrderClause[3]['columnName']], $direction[3], - $column[$aOrderClause[4]['columnName']], $direction[4], - $column[$aOrderClause[5]['columnName']], $direction[5], - $resultRow); - break; - case 7 : - array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], - $column[$aOrderClause[1]['columnName']], $direction[1], - $column[$aOrderClause[2]['columnName']], $direction[2], - $column[$aOrderClause[3]['columnName']], $direction[3], - $column[$aOrderClause[4]['columnName']], $direction[4], - $column[$aOrderClause[5]['columnName']], $direction[5], - $column[$aOrderClause[6]['columnName']], $direction[6], - $resultRow); - break; - } - } - - //prepend the headers in the resultRow - array_unshift($resultRow, $this->_DBArray[$tableName][0]); - //$resultRow[0] = $this->_DBArray[ $tableName ][0]; - - /* algorith to order a multiarray - // Obtain a list of columns - foreach ($data as $key => $row) { - $volume[$key] = $row['volume']; - $edition[$key] = $row['edition']; - } - // Sort the data with volume descending, edition ascending - // Add $data as the last parameter, to sort by the common key - array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); */ - - /* - * Apply Limit and Offset + /** + * Evaluate Clause Where + * @param type $clauseWhere + * @return type */ - if ($sql['limit'] > 0) { - $header = $resultRow[0]; - $resultRow = array_slice($resultRow, $sql['offset'] + 1, $sql['limit']); - array_unshift($resultRow, $header); - } else { - $header = $resultRow[0]; - $resultRow = array_slice($resultRow, $sql['offset'] + 1); - array_unshift($resultRow, $header); + public function evaluateClauseWhere($clauseWhere) + { + $aOperator = array("=", "!=", "<>", ">", "<", ">=", "<=", "LIKE", "AND", "OR", "NOT", "IN"); + $evalClause = $this->evaluateClause($clauseWhere); + $pos = 0; + foreach ($evalClause as $key => $value) { + $value = strtoupper(trim($value)); + $sSelect = strtoupper($this->dataSql['selectClause'][0]); + if (stripos($sSelect, $value) !== false) { + $evalClause[$key] = "\$row['" . $evalClause[$key] . "']"; + } + if (in_array($value, $aOperator)) { + switch ($value) { + case "=": + $evalClause[$key] = "=="; + break; + case "<>": + $evalClause[$key] = "!="; + break; + case "AND": + $evalClause[$key] = "&&"; + break; + case "OR": + $evalClause[$key] = "||"; + break; + case "NOT": + $evalClause[$key] = "!"; + break; + case "LIKE": + $evalClause[$key] = ", "; + if (trim($evalClause[$key - 1]) !== "") { + $evalClause[$key - 1] = " stripos(" . $evalClause[$key - 1]; + } else { + if (trim($evalClause[$key - 2]) !== "") { + $evalClause[$key - 2] = " stripos(" . $evalClause[$key - 2]; + } + } + + if (trim($evalClause[$key + 1]) !== "") { + $evalClause[$key + 1] = str_replace("%", "", $evalClause[$key + 1]); + $evalClause[$key + 1] = $evalClause[$key + 1] . ") !== false"; + } else { + if (trim($evalClause[$key + 2]) !== "") { + $evalClause[$key + 2] = str_replace("%", "", $evalClause[$key + 2]); + $evalClause[$key + 2] = $evalClause[$key + 2] . ") !== false"; + } + } + break; + } + } + } + $$sEvalClause = implode("", $evalClause); + return $$sEvalClause; } - $resultSet->dbArray = $resultRow; - return $resultSet; - } - /** - * @see Connection::executeUpdate() - */ - public function executeUpdate($sql) { - krumo('DBArrayConnection executeUpdate '); - die; - $this->log("executeUpdate(): $sql"); - $this->lastExecutedQuery = $sql; - $this->numQueriesExecuted++; - return $this->childConnection->executeUpdate($sql); - } + private function parseSqlString($query) + { + //we need a SQL parse, for now we only search for text 'select * from' + /* $aux = str_ireplace ( 'select * from', '', trim($query) ); + $sql = array(); + $sql['fromClause'][0] = trim( $aux ); + $sql['limit'] = 0; + $sql['offset'] = 0; */ + // if (1 === preg_match('/^\s*SELECT\s+(.+?)(?:\s+FROM\s+(.+?))(?:\s+WHERE\s+(.+?))?(?:\s+GROUP\s+BY\s+(.+?))?(?:\s+ORDER\s+BY\s+(.+?))?(?:\s+BETWEEN\s+(.+?)\s+AND\s+(.+?))?\s*$/im', $query, $matches)) { + if (1 === preg_match('/^\s*SELECT\s+([\w\W]+?)(?:\s+FROM\s+`?([^`]+?)`?)(?:\s+WHERE\s+([\w\W]+?))?(?:\s+GROUP\s+BY\s+([\w\W]+?))?(?:\s+ORDER\s+BY\s+([\w\W]+?))?(?:\s+BETWEEN\s+([\w\W]+?)\s+AND\s+([\w\W]+?))?(?:\s+LIMIT\s+(\d+)\s*,\s*(\d+))?\s*$/im', $query, $matches)) { + //$sqlSelect='SELECT '.$matches[1].(($matches[2]!='')?' FROM '.$matches[2]:''); + } else { + return; + } + $sql = array(); + $sql['selectClause'][0] = isset($matches[1]) ? $matches[1] : '';//Include selectClause. By JHL + $sql['fromClause'][0] = isset($matches[2]) ? $matches[2] : ''; + //$sql['whereClause'][0] = isset($matches[3]) ? $matches[3] : ''; + if (isset($matches[3])) { + $sql['whereClause'][0] = $matches[3]; + } + if (isset($matches[4])) { + $sql['groupByClause'][0] = $matches[4]; + } + if (isset($matches[5])) { + $sql['orderByClause'][0] = $matches[5]; + } - /** - * @see Connection::getUpdateCount() - */ - public function getUpdateCount() { - krumo('DBArrayConnection getUpdateCount '); - die; - return $this->childConnection->getUpdateCount(); - } - /** - * @see Connection::prepareCall() - * */ - public function prepareCall($sql) { - krumo('DBArrayConnection prepareCall '); - die; - $this->log("prepareCall(): $sql"); - return $this->childConnection->prepareCall($sql); - } - - /** - * @see Connection::getResource() - */ - public function getResource() { - krumo('DBArrayConnection getResource '); - die; - return $this->childConnection->getResource(); - } - - /** - * @see Connection::connect() - */ - public function getDSN() { - krumo('DBArrayConnection getDSN '); - die; - return $this->childConnection->getDSN(); - } - - /** - * @see Connection::getFlags() - */ - public function getFlags() { - return; - } - - /** - * @see Connection::begin() - */ - public function begin() { - krumo('DBArrayConnection begin '); - die; - $this->log("Beginning transaction."); - return $this->childConnection->begin(); - } - - /** - * @see Connection::commit() - */ - public function commit() { - krumo('DBArrayConnection commit '); - die; - $this->log("Committing transaction."); - return $this->childConnection->commit(); - } - - /** - * @see Connection::rollback() - */ - public function rollback() { - krumo('DBArrayConnection rollback '); - die; - $this->log("Rolling back transaction."); - return $this->childConnection->rollback(); - } - - /** - * @see Connection::setAutoCommit() - */ - public function setAutoCommit($bit) { - krumo('DBArrayConnection connect '); - die; - $this->log("Setting autocommit to: " . var_export($bit, true)); - return $this->childConnection->setAutoCommit($bit); - } - - /** - * @see Connection::getAutoCommit() - */ - public function getAutoCommit() { - krumo('DBArrayConnection getAutoCommit '); - die; - return $this->childConnection->getAutoCommit(); - } - - /** - * Private function that logs message using specified logger (if provided). - * @param string $msg Message to log. - */ - private function log($msg) { - krumo('DBArrayConnection log '); - die; - if ($this->logger) { - $this->logger->log($msg); + $sql['limit'] = 0; + $sql['offset'] = 0; + return $sql; } - } -} \ No newline at end of file + /** + * @see Connection::executeQuery() + */ + public function executeQuery($sql, $fetchmode = null) + { + if (!is_array($sql) && strlen($sql) > 1) { + $this->dataSql = $sql = $this->parseSqlString($sql); + } + $resultSet = new DBArrayResultSet($this, $sql, $fetchmode); + $tableName = $sql['fromClause'][0]; + + //the table doesnt exists + if (!isset($this->_DBArray[$tableName])) { + $resultSet->dbArray = array(); + return $resultSet; + } + + + foreach ($this->_DBArray[$tableName] as $key => $row) { + if ($key == 0) { + continue; + } + $flag = 1; + if (isset($sql['whereClause'])) {//If there is no where then return the row + foreach ($sql['whereClause'] as $keyClause => $valClause) { + if (isset($valClause) && $flag == 1) { + //$toEval = "\$flag = ( " . ($valClause != '' ? str_replace('=', '==', $valClause): '1') . ') ?1 :0;' ; + //if the eval is EQUAL add a double Equal + if (strpos($valClause, "\$row['*'] CUSTOM'(") !== false) { + $valClause = str_replace("\$row['*'] CUSTOM'(", '', $valClause); + $words = explode(' ', $valClause); + $valClause = str_replace($words[0], "\$row['" . $words[0] . "']", $valClause); + $valClause = str_replace(")'", "", $valClause); + } + + if (stripos($valClause, "\$row[") !== false) { + if (stripos($valClause, "LIKE") !== false) { + $valClause = str_replace("%", "", $valClause); + $operands = explode('LIKE', $valClause); + if ($operands[1] == ' ""') { + $toEval = "\$flag = 1;"; + } else { + $toEval = "\$flag = ( stripos ( " . $operands[0] . ", " . $operands[1] . " ) !== false ? 1 : 0 ) ;"; + eval($toEval); + eval('$val = ' . $operands[0] . ';'); + } + } else {//this is for EQUAL, LESS_THAN_EQUAL, ETC, + $toEval = "\$flag = ( " . ($valClause != '' ? $valClause : '1') . ') ?1 :0;'; + } + } else { + $valClause = $this->evaluateClauseWhere($valClause); + $toEval = "\$flag = ( " . ($valClause != '' ? $valClause : '1') . ') ?1 :0;'; + } + eval($toEval); + } + } + } else { + } + + if ($flag) { + $resultRow[] = $row; + } + } + if ($this->dataSql['selectClause'][0] == 'COUNT(*)') { + $rows[] = array('1' => 'integer'); + if (isset($resultRow) && is_array($resultRow)) { + $rows[] = array('1' => count($resultRow)); + } else { + $rows[] = array('1' => 0); + } + $resultSet->dbArray = $rows; + return $resultSet; + } + + if (!isset($resultRow)) { + $resultSet->dbArray = array(); + return $resultSet; + } + + + if (isset($this->dataSql['orderByClause']) && is_array($this->dataSql['orderByClause']) && count($this->dataSql['orderByClause']) > 0) { + foreach ($resultRow as $key => $row) { + foreach ($this->dataSql['orderByClause'] as $keyOrder => $valOrder) { + if (isset($row[$valOrder['columnName']])) { + $column[$valOrder['columnName']][$key] = strtoupper($row[$valOrder['columnName']]); + } else { + $column[$valOrder['columnName']][$key] = ''; + } + } + } + foreach ($this->dataSql['orderByClause'] as $keyOrder => $valOrder) { + $direction[$keyOrder] = (trim($valOrder['direction']) != 'ASC') ? SORT_DESC : SORT_ASC; + } + $aOrderClause = $this->dataSql['orderByClause']; + switch (count($column)) { + case 1: + array_multisort($column[$aOrderClause[0]['columnName']], $direction[0], $resultRow); + break; + case 2: + array_multisort( + $column[$aOrderClause[0]['columnName']], + $direction[0], + $column[$aOrderClause[1]['columnName']], + $direction[1], + $resultRow + ); + break; + case 3: + array_multisort( + $column[$aOrderClause[0]['columnName']], + $direction[0], + $column[$aOrderClause[1]['columnName']], + $direction[1], + $column[$aOrderClause[2]['columnName']], + $direction[2], + $resultRow + ); + break; + case 4: + array_multisort( + $column[$aOrderClause[0]['columnName']], + $direction[0], + $column[$aOrderClause[1]['columnName']], + $direction[1], + $column[$aOrderClause[2]['columnName']], + $direction[2], + $column[$aOrderClause[3]['columnName']], + $direction[3], + $resultRow + ); + break; + case 5: + array_multisort( + $column[$aOrderClause[0]['columnName']], + $direction[0], + $column[$aOrderClause[1]['columnName']], + $direction[1], + $column[$aOrderClause[2]['columnName']], + $direction[2], + $column[$aOrderClause[3]['columnName']], + $direction[3], + $column[$aOrderClause[4]['columnName']], + $direction[4], + $resultRow + ); + break; + case 6: + array_multisort( + $column[$aOrderClause[0]['columnName']], + $direction[0], + $column[$aOrderClause[1]['columnName']], + $direction[1], + $column[$aOrderClause[2]['columnName']], + $direction[2], + $column[$aOrderClause[3]['columnName']], + $direction[3], + $column[$aOrderClause[4]['columnName']], + $direction[4], + $column[$aOrderClause[5]['columnName']], + $direction[5], + $resultRow + ); + break; + case 7: + array_multisort( + $column[$aOrderClause[0]['columnName']], + $direction[0], + $column[$aOrderClause[1]['columnName']], + $direction[1], + $column[$aOrderClause[2]['columnName']], + $direction[2], + $column[$aOrderClause[3]['columnName']], + $direction[3], + $column[$aOrderClause[4]['columnName']], + $direction[4], + $column[$aOrderClause[5]['columnName']], + $direction[5], + $column[$aOrderClause[6]['columnName']], + $direction[6], + $resultRow + ); + break; + } + } + + //prepend the headers in the resultRow + array_unshift($resultRow, $this->_DBArray[$tableName][0]); + //$resultRow[0] = $this->_DBArray[ $tableName ][0]; + + /* algorith to order a multiarray + // Obtain a list of columns + foreach ($data as $key => $row) { + $volume[$key] = $row['volume']; + $edition[$key] = $row['edition']; + } + // Sort the data with volume descending, edition ascending + // Add $data as the last parameter, to sort by the common key + array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); */ + + /* + * Apply Limit and Offset + */ + if ($sql['limit'] > 0) { + $header = $resultRow[0]; + $resultRow = array_slice($resultRow, $sql['offset'] + 1, $sql['limit']); + array_unshift($resultRow, $header); + } else { + $header = $resultRow[0]; + $resultRow = array_slice($resultRow, $sql['offset'] + 1); + array_unshift($resultRow, $header); + } + $resultSet->dbArray = $resultRow; + return $resultSet; + } + + /** + * @see Connection::executeUpdate() + */ + public function executeUpdate($sql) + { + krumo('DBArrayConnection executeUpdate '); + die; + $this->log("executeUpdate(): $sql"); + $this->lastExecutedQuery = $sql; + $this->numQueriesExecuted++; + return $this->childConnection->executeUpdate($sql); + } + + /** + * @see Connection::getUpdateCount() + */ + public function getUpdateCount() + { + krumo('DBArrayConnection getUpdateCount '); + die; + return $this->childConnection->getUpdateCount(); + } + + /** + * @see Connection::prepareCall() + * */ + public function prepareCall($sql) + { + krumo('DBArrayConnection prepareCall '); + die; + $this->log("prepareCall(): $sql"); + return $this->childConnection->prepareCall($sql); + } + + /** + * @see Connection::getResource() + */ + public function getResource() + { + krumo('DBArrayConnection getResource '); + die; + return $this->childConnection->getResource(); + } + + /** + * @see Connection::connect() + */ + public function getDSN() + { + krumo('DBArrayConnection getDSN '); + die; + return $this->childConnection->getDSN(); + } + + /** + * @see Connection::getFlags() + */ + public function getFlags() + { + return; + } + + /** + * @see Connection::begin() + */ + public function begin() + { + krumo('DBArrayConnection begin '); + die; + $this->log("Beginning transaction."); + return $this->childConnection->begin(); + } + + /** + * @see Connection::commit() + */ + public function commit() + { + krumo('DBArrayConnection commit '); + die; + $this->log("Committing transaction."); + return $this->childConnection->commit(); + } + + /** + * @see Connection::rollback() + */ + public function rollback() + { + krumo('DBArrayConnection rollback '); + die; + $this->log("Rolling back transaction."); + return $this->childConnection->rollback(); + } + + /** + * @see Connection::setAutoCommit() + */ + public function setAutoCommit($bit) + { + krumo('DBArrayConnection connect '); + die; + $this->log("Setting autocommit to: " . var_export($bit, true)); + return $this->childConnection->setAutoCommit($bit); + } + + /** + * @see Connection::getAutoCommit() + */ + public function getAutoCommit() + { + krumo('DBArrayConnection getAutoCommit '); + die; + return $this->childConnection->getAutoCommit(); + } + + /** + * Private function that logs message using specified logger (if provided). + * @param string $msg Message to log. + */ + private function log($msg) + { + krumo('DBArrayConnection log '); + die; + if ($this->logger) { + $this->logger->log($msg); + } + } +} diff --git a/thirdparty/creole/drivers/mssql/MSSQLCallableStatement.php b/thirdparty/creole/drivers/mssql/MSSQLCallableStatement.php index 54825bb98..8a05deb3f 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLCallableStatement.php +++ b/thirdparty/creole/drivers/mssql/MSSQLCallableStatement.php @@ -128,7 +128,7 @@ class MSSQLCallableStatement extends MSSQLPreparedStatement implements CallableS $this->set($i+1, $params[$i]); } } - + $this->result = mssql_execute($this->stmt); if (!$this->result) { throw new SQLException('unable to execute callable statement', mssql_get_last_message()); @@ -142,9 +142,9 @@ class MSSQLCallableStatement extends MSSQLPreparedStatement implements CallableS */ function getMoreResults() { - $this->rsFetchCount++; // we track this because + $this->rsFetchCount++; // we track this because $hasMore = mssql_next_result($this->result); - if ($this->resultSet) $this->resultSet->close(); + if ($this->resultSet) $this->resultSet->close(); if ($hasMore) { $clazz = $this->resultClass; $this->resultSet = new $clazz($this, $this->result); diff --git a/thirdparty/creole/drivers/mssql/MSSQLConnection.php b/thirdparty/creole/drivers/mssql/MSSQLConnection.php index 0c3e1db2c..b9097ee4f 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLConnection.php +++ b/thirdparty/creole/drivers/mssql/MSSQLConnection.php @@ -27,10 +27,10 @@ include_once 'creole/drivers/mssql/MSSQLResultSet.php'; /** * MS SQL Server implementation of Connection. - * + * * If you have trouble with BLOB / CLOB support * -------------------------------------------- - * + * * You may need to change some PHP ini settings. In particular, the following settings * set the text size to maximum which should get around issues with truncated data: * @@ -39,14 +39,16 @@ include_once 'creole/drivers/mssql/MSSQLResultSet.php'; * * We do not set these by default (anymore) because they do not apply to cases where MSSQL * is being used w/ FreeTDS. - * + * * @author Hans Lellelid - * @author Stig Bakken + * @author Stig Bakken * @author Lukas Smith * @version $Revision: 1.25 $ * @package creole.drivers.mssql - */ -class MSSQLConnection extends ConnectionCommon implements Connection { + */ +class MSSQLConnection extends ConnectionCommon implements Connection +{ + /** Current database (used in mssql_select_db()). */ private $database; @@ -55,9 +57,9 @@ class MSSQLConnection extends ConnectionCommon implements Connection { * @see Connection::connect() */ function connect($dsninfo, $flags = 0) - { - if (!extension_loaded('mssql') && !extension_loaded('sybase') && !extension_loaded('sybase_ct')) { - throw new SQLException('mssql extension not loaded'); + { + if (!extension_loaded('mssql') && !extension_loaded('sybase') && !extension_loaded('sybase_ct') && !extension_loaded('sqlsrv')) { + throw new SQLException('mssql/sqlsrv extension not loaded'); } $this->dsn = $dsninfo; @@ -68,60 +70,61 @@ class MSSQLConnection extends ConnectionCommon implements Connection { $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; - + /** - * MSSQL (http://php.net/manual/en/intro.mssql.php) - * These functions allow you to access MS SQL Server database. - * This extension is not available anymore on Windows with PHP 5.3 or later. - * SQLSRV, an alternative extension for MS SQL connectivity is available from - * Microsoft: » http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx. - * http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx - * - * Alternatively to use the mssql functions in Windows, use php_dblib.dll (FreeTDS) http://www.freetds.org/ - * e.g. php.ini setting - * extension=php_dblib.dll - * - * php_dblib.dll (FreeTDS) use ':' as the delimiter in all installations. + * Define our sql connect */ - /* - if (PHP_OS == "WINNT" || PHP_OS == "WIN32") { - $portDelimiter = ","; + if (extension_loaded('sqlsrv')) { + $portDelimiter = ", "; + if (!empty($dsninfo['port'])) { + $dbhost .= $portDelimiter.$dsninfo['port']; + } + + $opt = [ + 'UID' => $user, + 'PWD' => $pw, + 'Database' => $dsninfo['database'] + ]; + // SQLSrv is persistent always + $conn = sqlsrv_connect($dbhost, $opt); } else { $portDelimiter = ":"; - } - */ - $portDelimiter = ":"; - if(!empty($dsninfo['port'])) { - $dbhost .= $portDelimiter.$dsninfo['port']; - } else { - if(!strpos($dbhost, "\\")){ - $dbhost .= $portDelimiter.'1433'; + if (!empty($dsninfo['port'])) { + $dbhost .= $portDelimiter.$dsninfo['port']; + } else { + if (!strpos($dbhost, "\\")) { + $dbhost .= $portDelimiter.'1433'; + } + } + $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect'; + if ($dbhost && $user && $pw) { + $conn = @$connect_function($dbhost, $user, $pw); + } elseif ($dbhost && $user) { + $conn = @$connect_function($dbhost, $user); + } else { + $conn = @$connect_function($dbhost); } - } - $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect'; - - if ($dbhost && $user && $pw) { - $conn = @$connect_function($dbhost, $user, $pw); - } elseif ($dbhost && $user) { - $conn = @$connect_function($dbhost, $user); - } else { - $conn = @$connect_function($dbhost); } + if (!$conn) { throw new SQLException('connect failed', mssql_get_last_message()); } if ($dsninfo['database']) { - if (!@mssql_select_db($dsninfo['database'], $conn)) { - throw new SQLException('No database selected'); + if (!extension_loaded('sqlsrv')) { + // Only do this if not using sqlsrv extension. If using sqlsrv, the database is specified + // in the options + if (!@mssql_select_db($dsninfo['database'], $conn)) { + throw new SQLException('No database selected'); + } } $this->database = $dsninfo['database']; } - $this->dblink = $conn; - } + $this->dblink = $conn; + } /** * @see Connection::getDatabaseInfo() @@ -144,7 +147,7 @@ class MSSQLConnection extends ConnectionCommon implements Connection { /** * @see Connection::prepareStatement() */ - public function prepareStatement($sql) + public function prepareStatement($sql) { require_once 'creole/drivers/mssql/MSSQLPreparedStatement.php'; return new MSSQLPreparedStatement($this, $sql); @@ -172,7 +175,11 @@ class MSSQLConnection extends ConnectionCommon implements Connection { */ function close() { - $ret = @mssql_close($this->dblink); + if (extension_loaded('sqlsrv')) { + $ret = @sqlsrv_close($this->dblink); + } else { + $ret = @mssql_close($this->dblink); + } $this->dblink = null; return $ret; } @@ -181,12 +188,17 @@ class MSSQLConnection extends ConnectionCommon implements Connection { * @see Connection::executeQuery() */ function executeQuery($sql, $fetchmode = null) - { + { $this->lastQuery = $sql; - if (!@mssql_select_db($this->database, $this->dblink)) { - throw new SQLException('No database selected'); - } - $result = @mssql_query($sql, $this->dblink); + if (extension_loaded('sqlsrv')) { + $result = sqlsrv_query($this->dblink, $sql); + } else { + if (!@mssql_select_db($this->database, $this->dblink)) { + throw new SQLException('No database selected'); + } + + $result = @mssql_query($sql, $this->dblink); + } if (!$result) { throw new SQLException('Could not execute query', mssql_get_last_message()); } @@ -197,14 +209,18 @@ class MSSQLConnection extends ConnectionCommon implements Connection { * @see Connection::executeUpdate() */ function executeUpdate($sql) - { - - $this->lastQuery = $sql; - if (!mssql_select_db($this->database, $this->dblink)) { - throw new SQLException('No database selected'); + { + if (extension_loaded('sqlsrv')) { + $result = sqlsrv_query($this->dblink, $sql); + } else { + $this->lastQuery = $sql; + if (!mssql_select_db($this->database, $this->dblink)) { + throw new SQLException('No database selected'); + } + + $result = @mssql_query($sql, $this->dblink); } - - $result = @mssql_query($sql, $this->dblink); + if (!$result) { throw new SQLException('Could not execute update', mssql_get_last_message(), $sql); } @@ -220,7 +236,11 @@ class MSSQLConnection extends ConnectionCommon implements Connection { */ protected function beginTrans() { - $result = @mssql_query('BEGIN TRAN', $this->dblink); + if (extension_loaded('sqlsrv')) { + $result = sqlsrv_begin_transaction($this->dblink); + } else { + $result = @mssql_query('BEGIN TRAN', $this->dblink); + } if (!$result) { throw new SQLException('Could not begin transaction', mssql_get_last_message()); } @@ -233,10 +253,14 @@ class MSSQLConnection extends ConnectionCommon implements Connection { */ protected function commitTrans() { - if (!@mssql_select_db($this->database, $this->dblink)) { - throw new SQLException('No database selected'); + if (extension_loaded('sqlsrv')) { + $result = sqlsrv_commit($this->dblink); + } else { + if (!@mssql_select_db($this->database, $this->dblink)) { + throw new SQLException('No database selected'); + } + $result = @mssql_query('COMMIT TRAN', $this->dblink); } - $result = @mssql_query('COMMIT TRAN', $this->dblink); if (!$result) { throw new SQLException('Could not commit transaction', mssql_get_last_message()); } @@ -249,10 +273,14 @@ class MSSQLConnection extends ConnectionCommon implements Connection { */ protected function rollbackTrans() { - if (!@mssql_select_db($this->database, $this->dblink)) { - throw new SQLException('no database selected'); + if (extension_loaded('sqlsrv')) { + $result = sqlsrv_rollback($this->dblink); + } else { + if (!@mssql_select_db($this->database, $this->dblink)) { + throw new SQLException('no database selected'); + } + $result = @mssql_query('ROLLBACK TRAN', $this->dblink); } - $result = @mssql_query('ROLLBACK TRAN', $this->dblink); if (!$result) { throw new SQLException('Could not rollback transaction', mssql_get_last_message()); } @@ -266,37 +294,68 @@ class MSSQLConnection extends ConnectionCommon implements Connection { * @throws SQLException */ function getUpdateCount() - { - $res = @mssql_query('select @@rowcount', $this->dblink); - if (!$res) { - throw new SQLException('Unable to get affected row count', mssql_get_last_message()); - } - $ar = @mssql_fetch_row($res); - if (!$ar) { - $result = 0; + { + if (extension_loaded('sqlsrv')) { + $res = sqlsrv_query($this->dblink, 'select @@rowcount'); + $ar = @sqlsrv_fetch_array($res); + if (!$ar) { + $result = 0; + } else { + @sqlsrv_free_stmt($res); + $result = $ar[0]; + } } else { - @mssql_free_result($res); - $result = $ar[0]; + $res = @mssql_query('select @@rowcount', $this->dblink); + if (!$res) { + throw new SQLException('Unable to get affected row count', mssql_get_last_message()); + } + $ar = @mssql_fetch_row($res); + if (!$ar) { + $result = 0; + } else { + @mssql_free_result($res); + $result = $ar[0]; + } } + return $result; - } + } /** * Creates a CallableStatement object for calling database stored procedures. - * + * * @param string $sql * @return CallableStatement * @throws SQLException */ - function prepareCall($sql) - { - require_once 'creole/drivers/mssql/MSSQLCallableStatement.php'; - $stmt = mssql_init($sql); - if (!$stmt) { - throw new SQLException('Unable to prepare statement', mssql_get_last_message(), $sql); + function prepareCall($sql) + { + if (extension_loaded('sqlsrv')) { + throw new SQLException("Callable statements not supported using the sqlsrv extension and this version of Creole."); + } else { + require_once 'creole/drivers/mssql/SQLCallableStatement.php'; + $stmt = mssql_init($sql); + if (!$stmt) { + throw new SQLException('Unable to prepare statement', mssql_get_last_message(), $sql); + } + return new MSSQLCallableStatement($this, $stmt); } - return new MSSQLCallableStatement($this, $stmt); } -} \ No newline at end of file +} + +/** + * Stub to support mssql_get_last_message for sqlsrv extension + */ +if (!function_exists('mssql_get_last_message') && extension_loaded('sqlsrv')) { + function mssql_get_last_message() + { + $errors = sqlsrv_errors(); + if (count($errors)) { + return $errors[0]['message']; + } + return null; + } + +} diff --git a/thirdparty/creole/drivers/mssql/MSSQLResultSet.php b/thirdparty/creole/drivers/mssql/MSSQLResultSet.php index cb556a07b..b75c740e5 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLResultSet.php +++ b/thirdparty/creole/drivers/mssql/MSSQLResultSet.php @@ -28,12 +28,14 @@ require_once 'creole/common/ResultSetCommon.php'; * MS SQL does not support LIMIT or OFFSET natively so the methods * in here need to perform some adjustments and extra checking to make sure * that this behaves the same as RDBMS drivers using native OFFSET/LIMIT. - * + * * @author Hans Lellelid * @version $Revision: 1.21 $ * @package creole.drivers.mssql */ -class MSSQLResultSet extends ResultSetCommon implements ResultSet { +class MSSQLResultSet extends ResultSetCommon implements ResultSet +{ + /** * Offset at which to start reading rows. @@ -45,7 +47,7 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet { * Maximum rows to retrieve, or 0 if all. * @var int */ - private $limit = 0; + private $limit = 0; /** * This MSSQL-only function exists to set offset after ResultSet is instantiated. @@ -76,7 +78,7 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet { /** * @see ResultSet::seek() - */ + */ function seek($rownum) { // support emulated OFFSET @@ -90,8 +92,8 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet { // MSSQL rows start w/ 0, but this works, because we are // looking to move the position _before_ the next desired position - if (!@mssql_data_seek($this->result, $actual)) { - return false; + if (!@mssql_data_seek($this->result, $actual)) { + return false; } $this->cursorPos = $rownum; @@ -104,37 +106,38 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet { function next() { // support emulated LIMIT - if ( $this->limit > 0 && ($this->cursorPos >= $this->limit) ) { + if ($this->limit > 0 && ($this->cursorPos >= $this->limit)) { $this->afterLast(); return false; } - if ($this->result === true ) { - return false; + if ($this->result === true) { + return false; + } + + if (extension_loaded('sqlsrv')) { + // The modes for fetching are different when using sqlsrv. So we'll translate the mode + // as needed + $mode = SQLSRV_FETCH_BOTH; + if ($this->fetchmode == ResultSet::FETCHMODE_ASSOC) { + $mode = SQLSRV_FETCH_ASSOC; + } elseif ($this->fetchmode == ResultSet::FETCHMODE_NUM) { + $mode = SQLSRV_FETCH_NUMERIC; + } + $this->fields = sqlsrv_fetch_array($this->result, $mode); + } else { + $this->fields = mssql_fetch_array($this->result, $this->fetchmode); } - - $this->fields = mssql_fetch_array($this->result, $this->fetchmode); if (!$this->fields) { if ($errmsg = mssql_get_last_message()) { throw new SQLException("Error fetching result", $errmsg); - } else { + } else { // We've advanced beyond end of recordset. $this->afterLast(); return false; - } + } } - //else { - // if (is_array($this->fields)) { - // foreach ($this->fields as $sKey => $sValue) { - // if (function_exists('mb_detect_encoding')) { - // if (strtoupper(mb_detect_encoding($sValue)) == 'UTF-8') { - // $this->fields[$sKey] = utf8_encode($sValue); - // } - // } - // } - // } - //} - + if ($this->fetchmode === ResultSet::FETCHMODE_ASSOC && $this->lowerAssocCase) { $this->fields = array_change_key_case($this->fields, CASE_LOWER); } @@ -149,7 +152,12 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet { */ function getRecordCount() { - $rows = @mssql_num_rows($this->result); + if (extension_loaded('sqlsrv')) { + $rows = @sqlsrv_num_rows($this->result); + } else { + $rows = @mssql_num_rows($this->result); + } + if ($rows === null) { throw new SQLException('Error getting record count', mssql_get_last_message()); } @@ -160,14 +168,17 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet { /** * @see ResultSet::close() - */ + */ function close() { - $ret = @mssql_free_result($this->result); + if (extension_loaded('sqlsrv')) { + $ret = @sqlsrv_free_stmt($this->result); + } else { + $ret = @mssql_free_result($this->result); + } $this->result = false; $this->fields = array(); $this->limit = 0; - $this->offset = 0; - } - + $this->offset = 0; + } } diff --git a/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php b/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php index cf90f3a32..959c1e321 100644 --- a/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php +++ b/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php @@ -27,8 +27,9 @@ require_once 'creole/metadata/DatabaseInfo.php'; * @author Hans Lellelid * @version $Revision: 1.11 $ * @package creole.drivers.mssql.metadata - */ -class MSSQLDatabaseInfo extends DatabaseInfo { + */ +class MSSQLDatabaseInfo extends DatabaseInfo +{ /** * @throws SQLException @@ -40,30 +41,35 @@ class MSSQLDatabaseInfo extends DatabaseInfo { $dsn = $this->conn->getDSN(); - - if (!@mssql_select_db($this->dbname, $this->conn->getResource())) { - throw new SQLException('No database selected'); + + if (extension_loaded('sqlsrv')) { + $result = sqlsrv_query( + "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'", + $this->conn->getResource() + ); + } else { + if (!@mssql_select_db($this->dbname, $this->conn->getResource())) { + throw new SQLException('No database selected'); + } + $result = mssql_query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'", $this->conn->getResource()); } - - $result = mssql_query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'", $this->conn->getResource()); - + if (!$result) { - throw new SQLException("Could not list tables", mssql_get_last_message()); + throw new SQLException("Could not list tables", mssql_get_last_message()); } while ($row = mssql_fetch_row($result)) { - $this->tables[strtoupper($row[0])] = new MSSQLTableInfo($this, $row[0]); + $this->tables[strtoupper($row[0])] = new MSSQLTableInfo($this, $row[0]); } - } + } /** - * - * @return void + * + * @return void * @throws SQLException */ protected function initSequences() { // there are no sequences -- afaik -- in MSSQL. } - } diff --git a/thirdparty/pear/DB.php b/thirdparty/pear/DB.php index d866c4d25..1b93f0009 100644 --- a/thirdparty/pear/DB.php +++ b/thirdparty/pear/DB.php @@ -356,6 +356,7 @@ class DB function &connect($dsn, $options = array()) { $dsninfo = DB::parseDSN($dsn); + $dsninfo['phptype'] = $dsninfo['phptype'] === 'mysql' ? 'mysqli' : $dsninfo['phptype']; $type = $dsninfo['phptype']; if (!is_array($options)) { diff --git a/thirdparty/pear/DB/common.php b/thirdparty/pear/DB/common.php index 13bb1df8c..2f9cfb5a2 100644 --- a/thirdparty/pear/DB/common.php +++ b/thirdparty/pear/DB/common.php @@ -955,7 +955,7 @@ class DB_common extends PEAR if (DB::isError($result) || $result === DB_OK) { return $result; } else { - $tmp =& new DB_result($this, $result); + $tmp = new DB_result($this, $result); return $tmp; } } @@ -1147,7 +1147,7 @@ class DB_common extends PEAR if (DB::isError($result) || $result === DB_OK) { return $result; } else { - $tmp =& new DB_result($this, $result); + $tmp = new DB_result($this, $result); return $tmp; } } diff --git a/thirdparty/pear/PEAR.php b/thirdparty/pear/PEAR.php deleted file mode 100644 index 0cda6864d..000000000 --- a/thirdparty/pear/PEAR.php +++ /dev/null @@ -1,1056 +0,0 @@ - | -// | Stig Bakken | -// | Tomas V.V.Cox | -// +--------------------------------------------------------------------+ -// -// $Id: PEAR.php 3355 2005-06-11 22:14:40Z nbm $ -// - -define('PEAR_ERROR_RETURN', 1); -define('PEAR_ERROR_PRINT', 2); -define('PEAR_ERROR_TRIGGER', 4); -define('PEAR_ERROR_DIE', 8); -define('PEAR_ERROR_CALLBACK', 16); -/** - * WARNING: obsolete - * @deprecated - */ -define('PEAR_ERROR_EXCEPTION', 32); -define('PEAR_ZE2', (function_exists('version_compare') && - version_compare(zend_version(), "2-dev", "ge"))); - -if (substr(PHP_OS, 0, 3) == 'WIN') { - define('OS_WINDOWS', true); - define('OS_UNIX', false); - define('PEAR_OS', 'Windows'); -} else { - define('OS_WINDOWS', false); - define('OS_UNIX', true); - define('PEAR_OS', 'Unix'); // blatant assumption -} - -// instant backwards compatibility -if (!defined('PATH_SEPARATOR')) { - if (OS_WINDOWS) { - define('PATH_SEPARATOR', ';'); - } else { - define('PATH_SEPARATOR', ':'); - } -} - -$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; -$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; -$GLOBALS['_PEAR_destructor_object_list'] = array(); -$GLOBALS['_PEAR_shutdown_funcs'] = array(); -$GLOBALS['_PEAR_error_handler_stack'] = array(); - -ini_set('track_errors', true); - -/** - * Base class for other PEAR classes. Provides rudimentary - * emulation of destructors. - * - * If you want a destructor in your class, inherit PEAR and make a - * destructor method called _yourclassname (same name as the - * constructor, but with a "_" prefix). Also, in your constructor you - * have to call the PEAR constructor: $this->PEAR();. - * The destructor method will be called without parameters. Note that - * at in some SAPI implementations (such as Apache), any output during - * the request shutdown (in which destructors are called) seems to be - * discarded. If you need to get any debug information from your - * destructor, use error_log(), syslog() or something similar. - * - * IMPORTANT! To use the emulated destructors you need to create the - * objects by reference: $obj =& new PEAR_child; - * - * @since PHP 4.0.2 - * @author Stig Bakken - * @see http://pear.php.net/manual/ - */ -class PEAR -{ - // {{{ properties - - /** - * Whether to enable internal debug messages. - * - * @var bool - * @access private - */ - var $_debug = false; - - /** - * Default error mode for this object. - * - * @var int - * @access private - */ - var $_default_error_mode = null; - - /** - * Default error options used for this object when error mode - * is PEAR_ERROR_TRIGGER. - * - * @var int - * @access private - */ - var $_default_error_options = null; - - /** - * Default error handler (callback) for this object, if error mode is - * PEAR_ERROR_CALLBACK. - * - * @var string - * @access private - */ - var $_default_error_handler = ''; - - /** - * Which class to use for error objects. - * - * @var string - * @access private - */ - var $_error_class = 'PEAR_Error'; - - /** - * An array of expected errors. - * - * @var array - * @access private - */ - var $_expected_errors = array(); - - // }}} - - // {{{ constructor - - /** - * Constructor. Registers this object in - * $_PEAR_destructor_object_list for destructor emulation if a - * destructor object exists. - * - * @param string $error_class (optional) which class to use for - * error objects, defaults to PEAR_Error. - * @access public - * @return void - */ - function PEAR($error_class = null) - { - $classname = strtolower(get_class($this)); - if ($this->_debug) { - print "PEAR constructor called, class=$classname\n"; - } - if ($error_class !== null) { - $this->_error_class = $error_class; - } - while ($classname && strcasecmp($classname, "pear")) { - $destructor = "_$classname"; - if (method_exists($this, $destructor)) { - global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; - static $registered = false; - if (!$registered) { - register_shutdown_function("_PEAR_call_destructors"); - $registered = true; - } - break; - } else { - $classname = get_parent_class($classname); - } - } - } - - // }}} - // {{{ destructor - - /** - * Destructor (the emulated type of...). Does nothing right now, - * but is included for forward compatibility, so subclass - * destructors should always call it. - * - * See the note in the class desciption about output from - * destructors. - * - * @access public - * @return void - */ - function _PEAR() { - if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); - } - } - - // }}} - // {{{ getStaticProperty() - - /** - * If you have a class that's mostly/entirely static, and you need static - * properties, you can use this method to simulate them. Eg. in your method(s) - * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); - * You MUST use a reference, or they will not persist! - * - * @access public - * @param string $class The calling classname, to prevent clashes - * @param string $var The variable to retrieve. - * @return mixed A reference to the variable. If not set it will be - * auto initialised to NULL. - */ - function &getStaticProperty($class, $var) - { - static $properties; - return $properties[$class][$var]; - } - - // }}} - // {{{ registerShutdownFunc() - - /** - * Use this function to register a shutdown method for static - * classes. - * - * @access public - * @param mixed $func The function name (or array of class/method) to call - * @param mixed $args The arguments to pass to the function - * @return void - */ - function registerShutdownFunc($func, $args = array()) - { - $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); - } - - // }}} - // {{{ isError() - - /** - * Tell whether a value is a PEAR error. - * - * @param mixed $data the value to test - * @param int $code if $data is an error object, return true - * only if $code is a string and - * $obj->getMessage() == $code or - * $code is an integer and $obj->getCode() == $code - * @access public - * @return bool true if parameter is an error - */ - function isError($data, $code = null) - { - if (is_a($data, 'PEAR_Error')) { - if (is_null($code)) { - return true; - } elseif (is_string($code)) { - return $data->getMessage() == $code; - } else { - return $data->getCode() == $code; - } - } - return false; - } - - // }}} - // {{{ setErrorHandling() - - /** - * Sets how errors generated by this object should be handled. - * Can be invoked both in objects and statically. If called - * statically, setErrorHandling sets the default behaviour for all - * PEAR objects. If called in an object, setErrorHandling sets - * the default behaviour for that object. - * - * @param int $mode - * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION. - * - * @param mixed $options - * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one - * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * - * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected - * to be the callback function or method. A callback - * function is a string with the name of the function, a - * callback method is an array of two elements: the element - * at index 0 is the object, and the element at index 1 is - * the name of the method to call in the object. - * - * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is - * a printf format string used when printing the error - * message. - * - * @access public - * @return void - * @see PEAR_ERROR_RETURN - * @see PEAR_ERROR_PRINT - * @see PEAR_ERROR_TRIGGER - * @see PEAR_ERROR_DIE - * @see PEAR_ERROR_CALLBACK - * @see PEAR_ERROR_EXCEPTION - * - * @since PHP 4.0.5 - */ - - function setErrorHandling($mode = null, $options = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - $setmode = &$this->_default_error_mode; - $setoptions = &$this->_default_error_options; - } else { - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - } - - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - } - - // }}} - // {{{ expectError() - - /** - * This method is used to tell which errors you expect to get. - * Expected errors are always returned with error mode - * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, - * and this method pushes a new element onto it. The list of - * expected errors are in effect until they are popped off the - * stack with the popExpect() method. - * - * Note that this method can not be called statically - * - * @param mixed $code a single error code or an array of error codes to expect - * - * @return int the new depth of the "expected errors" stack - * @access public - */ - function expectError($code = '*') - { - if (is_array($code)) { - array_push($this->_expected_errors, $code); - } else { - array_push($this->_expected_errors, array($code)); - } - return sizeof($this->_expected_errors); - } - - // }}} - // {{{ popExpect() - - /** - * This method pops one element off the expected error codes - * stack. - * - * @return array the list of error codes that were popped - */ - function popExpect() - { - return array_pop($this->_expected_errors); - } - - // }}} - // {{{ _checkDelExpect() - - /** - * This method checks unsets an error code if available - * - * @param mixed error code - * @return bool true if the error code was unset, false otherwise - * @access private - * @since PHP 4.3.0 - */ - function _checkDelExpect($error_code) - { - $deleted = false; - - foreach ($this->_expected_errors AS $key => $error_array) { - if (in_array($error_code, $error_array)) { - unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); - $deleted = true; - } - - // clean up empty arrays - if (0 == count($this->_expected_errors[$key])) { - unset($this->_expected_errors[$key]); - } - } - return $deleted; - } - - // }}} - // {{{ delExpect() - - /** - * This method deletes all occurences of the specified element from - * the expected error codes stack. - * - * @param mixed $error_code error code that should be deleted - * @return mixed list of error codes that were deleted or error - * @access public - * @since PHP 4.3.0 - */ - function delExpect($error_code) - { - $deleted = false; - - if ((is_array($error_code) && (0 != count($error_code)))) { - // $error_code is a non-empty array here; - // we walk through it trying to unset all - // values - foreach($error_code as $key => $error) { - if ($this->_checkDelExpect($error)) { - $deleted = true; - } else { - $deleted = false; - } - } - return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } elseif (!empty($error_code)) { - // $error_code comes alone, trying to unset it - if ($this->_checkDelExpect($error_code)) { - return true; - } else { - return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } - } else { - // $error_code is empty - return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME - } - } - - // }}} - // {{{ raiseError() - - /** - * This method is a wrapper that returns an instance of the - * configured error class with this object's default error - * handling applied. If the $mode and $options parameters are not - * specified, the object's defaults are used. - * - * @param mixed $message a text error message or a PEAR error object - * - * @param int $code a numeric error code (it is up to your class - * to define these if you want to use codes) - * - * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION. - * - * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter - * specifies the PHP-internal error level (one of - * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * If $mode is PEAR_ERROR_CALLBACK, this - * parameter specifies the callback function or - * method. In other error modes this parameter - * is ignored. - * - * @param string $userinfo If you need to pass along for example debug - * information, this parameter is meant for that. - * - * @param string $error_class The returned error object will be - * instantiated from this class, if specified. - * - * @param bool $skipmsg If true, raiseError will only pass error codes, - * the error message parameter will be dropped. - * - * @access public - * @return object a PEAR error object - * @see PEAR::setErrorHandling - * @since PHP 4.0.5 - */ - function raiseError($message = null, - $code = null, - $mode = null, - $options = null, - $userinfo = null, - $error_class = null, - $skipmsg = false) - { - // The error is yet a PEAR error object - if (is_object($message)) { - $code = $message->getCode(); - $userinfo = $message->getUserInfo(); - $error_class = $message->getType(); - $message->error_message_prefix = ''; - $message = $message->getMessage(); - } - - if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) { - if ($exp[0] == "*" || - (is_int(reset($exp)) && in_array($code, $exp)) || - (is_string(reset($exp)) && in_array($message, $exp))) { - $mode = PEAR_ERROR_RETURN; - } - } - // No mode given, try global ones - if ($mode === null) { - // Class error handler - if (isset($this) && isset($this->_default_error_mode)) { - $mode = $this->_default_error_mode; - $options = $this->_default_error_options; - // Global error handler - } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) { - $mode = $GLOBALS['_PEAR_default_error_mode']; - $options = $GLOBALS['_PEAR_default_error_options']; - } - } - - if ($error_class !== null) { - $ec = $error_class; - } elseif (isset($this) && isset($this->_error_class)) { - $ec = $this->_error_class; - } else { - $ec = 'PEAR_Error'; - } - if ($skipmsg) { - return new $ec($code, $mode, $options, $userinfo); - } else { - return new $ec($message, $code, $mode, $options, $userinfo); - } - } - - // }}} - // {{{ throwError() - - /** - * Simpler form of raiseError with fewer options. In most cases - * message, code and userinfo are enough. - * - * @param string $message - * - */ - function throwError($message = null, - $code = null, - $userinfo = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - return $this->raiseError($message, $code, null, null, $userinfo); - } else { - return PEAR::raiseError($message, $code, null, null, $userinfo); - } - } - - // }}} - function staticPushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - $stack[] = array($def_mode, $def_options); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $def_mode = $mode; - $def_options = $options; - break; - - case PEAR_ERROR_CALLBACK: - $def_mode = $mode; - // class/object method callback - if (is_callable($options)) { - $def_options = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - $stack[] = array($mode, $options); - return true; - } - - function staticPopErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - return true; - } - - // {{{ pushErrorHandling() - - /** - * Push a new error handler on top of the error handler options stack. With this - * you can easily override the actual error handler for some code and restore - * it later with popErrorHandling. - * - * @param mixed $mode (same as setErrorHandling) - * @param mixed $options (same as setErrorHandling) - * - * @return bool Always true - * - * @see PEAR::setErrorHandling - */ - function pushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - if (isset($this) && is_a($this, 'PEAR')) { - $def_mode = &$this->_default_error_mode; - $def_options = &$this->_default_error_options; - } else { - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - } - $stack[] = array($def_mode, $def_options); - - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - $stack[] = array($mode, $options); - return true; - } - - // }}} - // {{{ popErrorHandling() - - /** - * Pop the last error handler used - * - * @return bool Always true - * - * @see PEAR::pushErrorHandling - */ - function popErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - return true; - } - - // }}} - // {{{ loadExtension() - - /** - * OS independant PHP extension load. Remember to take care - * on the correct extension name for case sensitive OSes. - * - * @param string $ext The extension name - * @return bool Success or not on the dl() call - */ - function loadExtension($ext) - { - if (!extension_loaded($ext)) { - // if either returns true dl() will produce a FATAL error, stop that - if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) { - return false; - } - if (OS_WINDOWS) { - $suffix = '.dll'; - } elseif (PHP_OS == 'HP-UX') { - $suffix = '.sl'; - } elseif (PHP_OS == 'AIX') { - $suffix = '.a'; - } elseif (PHP_OS == 'OSX') { - $suffix = '.bundle'; - } else { - $suffix = '.so'; - } - return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); - } - return true; - } - - // }}} -} - -// {{{ _PEAR_call_destructors() - -function _PEAR_call_destructors() -{ - global $_PEAR_destructor_object_list; - if (is_array($_PEAR_destructor_object_list) && - sizeof($_PEAR_destructor_object_list)) - { - reset($_PEAR_destructor_object_list); - if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) { - $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list); - } - while (list($k, $objref) = each($_PEAR_destructor_object_list)) { - $classname = get_class($objref); - while ($classname) { - $destructor = "_$classname"; - if (method_exists($objref, $destructor)) { - $objref->$destructor(); - break; - } else { - $classname = get_parent_class($classname); - } - } - } - // Empty the object list to ensure that destructors are - // not called more than once. - $_PEAR_destructor_object_list = array(); - } - - // Now call the shutdown functions - if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) { - foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { - call_user_func_array($value[0], $value[1]); - } - } -} - -// }}} - -class PEAR_Error -{ - // {{{ properties - - var $error_message_prefix = ''; - var $mode = PEAR_ERROR_RETURN; - var $level = E_USER_NOTICE; - var $code = -1; - var $message = ''; - var $userinfo = ''; - var $backtrace = null; - - // }}} - // {{{ constructor - - /** - * PEAR_Error constructor - * - * @param string $message message - * - * @param int $code (optional) error code - * - * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN, - * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION - * - * @param mixed $options (optional) error level, _OR_ in the case of - * PEAR_ERROR_CALLBACK, the callback function or object/method - * tuple. - * - * @param string $userinfo (optional) additional user/debug info - * - * @access public - * - */ - function PEAR_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - if ($mode === null) { - $mode = PEAR_ERROR_RETURN; - } - $this->message = $message; - $this->code = $code; - $this->mode = $mode; - $this->userinfo = $userinfo; - if (function_exists("debug_backtrace")) { - if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { - $this->backtrace = debug_backtrace(); - } - } - if ($mode & PEAR_ERROR_CALLBACK) { - $this->level = E_USER_NOTICE; - $this->callback = $options; - } else { - if ($options === null) { - $options = E_USER_NOTICE; - } - $this->level = $options; - $this->callback = null; - } - if ($this->mode & PEAR_ERROR_PRINT) { - if (is_null($options) || is_int($options)) { - $format = "%s"; - } else { - $format = $options; - } - printf($format, $this->getMessage()); - } - if ($this->mode & PEAR_ERROR_TRIGGER) { - trigger_error($this->getMessage(), $this->level); - } - if ($this->mode & PEAR_ERROR_DIE) { - $msg = $this->getMessage(); - if (is_null($options) || is_int($options)) { - $format = "%s"; - if (substr($msg, -1) != "\n") { - $msg .= "\n"; - } - } else { - $format = $options; - } - die(sprintf($format, $msg)); - } - if ($this->mode & PEAR_ERROR_CALLBACK) { - if (is_callable($this->callback)) { - call_user_func($this->callback, $this); - } - } - if ($this->mode & PEAR_ERROR_EXCEPTION) { - trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING); - eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);'); - } - } - - // }}} - // {{{ getMode() - - /** - * Get the error mode from an error object. - * - * @return int error mode - * @access public - */ - function getMode() { - return $this->mode; - } - - // }}} - // {{{ getCallback() - - /** - * Get the callback function/method from an error object. - * - * @return mixed callback function or object/method array - * @access public - */ - function getCallback() { - return $this->callback; - } - - // }}} - // {{{ getMessage() - - - /** - * Get the error message from an error object. - * - * @return string full error message - * @access public - */ - function getMessage() - { - return ($this->error_message_prefix . $this->message); - } - - - // }}} - // {{{ getCode() - - /** - * Get error code from an error object - * - * @return int error code - * @access public - */ - function getCode() - { - return $this->code; - } - - // }}} - // {{{ getType() - - /** - * Get the name of this error/exception. - * - * @return string error/exception name (type) - * @access public - */ - function getType() - { - return get_class($this); - } - - // }}} - // {{{ getUserInfo() - - /** - * Get additional user-supplied information. - * - * @return string user-supplied information - * @access public - */ - function getUserInfo() - { - return $this->userinfo; - } - - // }}} - // {{{ getDebugInfo() - - /** - * Get additional debug information supplied by the application. - * - * @return string debug information - * @access public - */ - function getDebugInfo() - { - return $this->getUserInfo(); - } - - // }}} - // {{{ getBacktrace() - - /** - * Get the call backtrace from where the error was generated. - * Supported with PHP 4.3.0 or newer. - * - * @param int $frame (optional) what frame to fetch - * @return array Backtrace, or NULL if not available. - * @access public - */ - function getBacktrace($frame = null) - { - if ($frame === null) { - return $this->backtrace; - } - return $this->backtrace[$frame]; - } - - // }}} - // {{{ addUserInfo() - - function addUserInfo($info) - { - if (empty($this->userinfo)) { - $this->userinfo = $info; - } else { - $this->userinfo .= " ** $info"; - } - } - - // }}} - // {{{ toString() - - /** - * Make a string representation of this object. - * - * @return string a string with an object summary - * @access public - */ - function toString() { - $modes = array(); - $levels = array(E_USER_NOTICE => 'notice', - E_USER_WARNING => 'warning', - E_USER_ERROR => 'error'); - if ($this->mode & PEAR_ERROR_CALLBACK) { - if (is_array($this->callback)) { - $callback = (is_object($this->callback[0]) ? - strtolower(get_class($this->callback[0])) : - $this->callback[0]) . '::' . - $this->callback[1]; - } else { - $callback = $this->callback; - } - return sprintf('[%s: message="%s" code=%d mode=callback '. - 'callback=%s prefix="%s" info="%s"]', - strtolower(get_class($this)), $this->message, $this->code, - $callback, $this->error_message_prefix, - $this->userinfo); - } - if ($this->mode & PEAR_ERROR_PRINT) { - $modes[] = 'print'; - } - if ($this->mode & PEAR_ERROR_TRIGGER) { - $modes[] = 'trigger'; - } - if ($this->mode & PEAR_ERROR_DIE) { - $modes[] = 'die'; - } - if ($this->mode & PEAR_ERROR_RETURN) { - $modes[] = 'return'; - } - return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. - 'prefix="%s" info="%s"]', - strtolower(get_class($this)), $this->message, $this->code, - implode("|", $modes), $levels[$this->level], - $this->error_message_prefix, - $this->userinfo); - } - - // }}} -} - -/* - * Local Variables: - * mode: php - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ -?> diff --git a/thirdparty/propel/Propel.php b/thirdparty/propel/Propel.php index 3ebef7a3e..22122f369 100644 --- a/thirdparty/propel/Propel.php +++ b/thirdparty/propel/Propel.php @@ -40,566 +40,567 @@ include_once 'adapter/DBAdapter.php'; * @version $Revision: 601 $ * @package propel */ -class Propel { - - /** - * A constant for default. - */ - const DEFAULT_NAME = "default"; - - /** - * A constant defining 'System is unusuable' logging level - */ - const LOG_EMERG = 0; - - /** - * A constant defining 'Immediate action required' logging level - */ - const LOG_ALERT = 1; - - /** - * A constant defining 'Critical conditions' logging level - */ - const LOG_CRIT = 2; - - /** - * A constant defining 'Error conditions' logging level - */ - const LOG_ERR = 3; - - /** - * A constant defining 'Warning conditions' logging level - */ - const LOG_WARNING = 4; - - /** - * A constant defining 'Normal but significant' logging level - */ - const LOG_NOTICE = 5; - - /** - * A constant defining 'Informational' logging level - */ - const LOG_INFO = 6; - - /** - * A constant defining 'Debug-level messages' logging level - */ - const LOG_DEBUG = 7; - - /** - * The Propel version. - */ - const VERSION = '1.2.1'; - - /** - * The db name that is specified as the default in the property file - */ - private static $defaultDBName; - - /** - * The global cache of database maps - */ - private static $dbMaps = array(); - - /** - * The cache of DB adapter keys - */ - private static $adapterMap; - - /** - * The logging category. - */ - private static $category; - - /** - * Propel-specific configuration. - */ - private static $configuration; - - /** - * flag to set to true once this class has been initialized - */ - private static $isInit = false; - - /** - * @var Log - */ - private static $logger = null; - - /** - * Store mapbuilder classnames for peers that have been referenced prior - * to Propel being initialized. This can happen if the OM Peer classes are - * included before the Propel::init() method has been called. - */ - private static $mapBuilders = array(); - - /** - * Cache of established connections (to eliminate overhead). - * @var array - */ - private static $connectionMap = array(); - - /** - * initialize Propel - * @return void - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function initialize() { - - if (self::$configuration === null) { - throw new PropelException("Propel cannot be initialized without " - . "a valid configuration. Please check the log files " - . "for further details."); - } - - self::configureLogging(); - // Now that we have dealt with processing the log properties - // that may be contained in the configuration we will make the - // configuration consist only of the remaining propel-specific - // properties that are contained in the configuration. First - // look for properties that are in the "propel" namespace. - - - $originalConf = self::$configuration; - self::$configuration = isset(self::$configuration['propel']) ? self::$configuration['propel'] : null; - - if (empty(self::$configuration)) { - // Assume the original configuration already had any - // prefixes stripped. - self::$configuration = $originalConf; - } - - - // reset the connection map (this should enable runtime changes of connection params) - self::$connectionMap = array(); - self::initAdapters(self::$configuration); - - self::$isInit = true; - - // map builders may be registered w/ Propel before Propel has - // been initialized; in this case they are stored in a static - // var of this class & now can be propertly initialized. - foreach(self::$mapBuilders as $mbClass) { - BasePeer::getMapBuilder($mbClass); - } - - // now that the pre-loaded map builders have been propertly initialized - // empty the array. - // any further mapBuilders will be build by the generated MapBuilder classes. - self::$mapBuilders = array(); - } - - /** - * Setup the adapters needed. An adapter must be defined for each database connection. - * Generally the adapter will be the same as the PEAR phpname; e.g. for MySQL, use the - * 'mysql' adapter. - * @param array $configuration the Configuration representing the properties file - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - private static function initAdapters($configuration) { - - self::$adapterMap = array(); - - $c = isset($configuration['datasources']) ? $configuration['datasources'] : null; - if (!empty($c)) { - try { - foreach($c as $handle => $properties) { - if (is_array($properties) && isset($properties['adapter'])) { - $db = DBAdapter::factory($properties['adapter']); - // register the adapter for this name - self::$adapterMap[$handle] = $db; - } - } - } catch (Exception $e) { - throw new PropelException("Unable to initialize adapters.", $e); - } - } else { - self::log("There were no adapters in the configuration.", self::LOG_WARNING); - } - } - - /** - * configure propel - * - * @param string $config Path (absolute or relative to include_path) to config file. - * @return void - * @throws PropelException If configuration file cannot be opened. (E_WARNING probably will also be raised in PHP) - */ - public static function krumo() - { - krumo ( self::$configuration); - } - - - public static function configure($configFile) - { - self::$configuration = include($configFile); - if (self::$configuration === false) { - throw new PropelException("Unable to open configuration file: " . var_export($configFile, true)); - } - //include($configFile ); - } - - /** - * Initialization of Propel with a properties file. - * - * @param string $c The Propel configuration file path. - * @return void - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function init($c) - { - self::configure($c); - self::initialize(); - } - - public static function initConfiguration($configuration) - { - self::$configuration = $configuration; - self::initialize(); - } - - /** - * Determine whether Propel has already been initialized. - * - * @return boolean True if Propel is already initialized. - */ - public static function isInit() - { - return self::$isInit; - } - - /** - * Sets the configuration for Propel and all dependencies. - * - * @param array $c the Configuration - * @return void - */ - public static function setConfiguration($c) - { - self::$configuration = $c; - } - - /** - * Get the configuration for this component. - * - * @return the Configuration - */ - public static function getConfiguration() - { - return self::$configuration; - } - - /** - * Configure the logging for this subsystem. - * The logging system is only configured if there is a 'log' - * section in the passed-in runtime configuration. - * @return void - */ - protected static function configureLogging() { - if (self::$logger === null) { - if (isset(self::$configuration['log']) && is_array(self::$configuration['log']) && count(self::$configuration['log'])) { - include_once 'Log.php'; // PEAR Log class - $c = self::$configuration['log']; - // array casting handles bug in PHP5b2 where the isset() checks - // below may return true if $c is not an array (e.g. is a string) - - $type = isset($c['type']) ? $c['type'] : 'file'; - $name = isset($c['name']) ? $c['name'] : './propel.log'; - $ident = isset($c['ident']) ? $c['ident'] : 'propel'; - $conf = isset($c['conf']) ? $c['conf'] : array(); - $level = isset($c['level']) ? $c['level'] : PEAR_LOG_DEBUG; - - self::$logger = Log::singleton($type, $name, $ident, $conf, $level); - } // if isset() - } - } - - /** - * Override the configured logger. - * - * This is primarily for things like unit tests / debugging where - * you want to change the logger without altering the configuration file. - * - * You can use any logger class that implements the propel.logger.BasicLogger - * interface. This interface is based on PEAR::Log, so you can also simply pass - * a PEAR::Log object to this method. - * - * @param object $logger The new logger to use. ([PEAR] Log or BasicLogger) - * @return void - */ - public static function setLogger($logger) - { - self::$logger = $logger; - } - - /** - * Returns true if a logger, for example PEAR::Log, has been configured, - * otherwise false. - * - * @return boolean True if Propel uses logging - */ - public static function hasLogger() - { - return self::$logger !== null; - } - - /** - * Get the configured logger. - * @return object Configured log class ([PEAR] Log or BasicLogger). - */ - public static function logger() - { - return self::$logger; - } - - /** - * Logs a message - * If a logger has been configured, the logger will be used, otherwrise the - * logging message will be discarded without any further action - * - * @param string $message The message that will be logged. - * @param string $level The logging level. - * @return boolean True if the message was logged successfully or no logger was used. - */ - public static function log($message, $level = self::LOG_DEBUG) - { - if(self::hasLogger()) - { - $logger = self::logger(); - switch($level) - { - case self::LOG_EMERG: - return $logger->log($message, $level); - case self::LOG_ALERT: - return $logger->alert($message); - case self::LOG_CRIT: - return $logger->crit($message); - case self::LOG_ERR: - return $logger->err($message); - case self::LOG_WARNING: - return $logger->warning($message); - case self::LOG_NOTICE: - return $logger->notice($message); - case self::LOG_INFO: - return $logger->info($message); - default: - return $logger->debug($message); - } - } - return true; - } - - /** - * Returns the database map information. Name relates to the name - * of the connection pool to associate with the map. - * - * The database maps are "registered" by the generated map builder classes. - * - * @param string $name The name of the database corresponding to the DatabaseMapto retrieve. - * @return DatabaseMap The named DatabaseMap. - * @throws PropelException - if database map is null or propel was not initialized properly. - */ - public static function getDatabaseMap($name = null) { - - if ($name === null) { - $name = self::getDefaultDB(); - if ($name === null) { - throw new PropelException("DatabaseMap name was null!"); - } - } - - // CACHEHOOK - this would be a good place - // to add shared memory caching options (database - // maps should be a pretty safe candidate for shared mem caching) - - if (isset(self::$dbMaps[$name])) { - $map = self::$dbMaps[$name]; - } else { - $map = self::initDatabaseMap($name); - } - - return $map; - } - - /** - * Creates and initializes the mape for the named database. - * - * The database maps are "registered" by the generated map builder classes - * by calling this method and then adding the tables, etc. to teh DatabaseMap - * object returned from this method. - * - * @param string $name The name of the database to map. - * @return DatabaseMap The desired map. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - private static function initDatabaseMap($name) - { - $map = new DatabaseMap($name); - self::$dbMaps[$name] = $map; - return $map; - } - - /** - * Register a MapBuilder - * - * @param string $className the MapBuilder - */ - public static function registerMapBuilder($className) - { - self::$mapBuilders[] = $className; - } - - /** - * Returns the specified property of the given database, or the empty - * string if no value is set for the property. - * - * @param string $db The name of the database whose property to get. - * @param string $prop The name of the property to get. - * @return mixed The property's value. - */ - private static function getDatabaseProperty($db, $prop) - { - return isset(self::$configuration['datasources'][$db][$prop]) ? self::$configuration['datasources'][$db][$prop] : null; - } - - /** - * - * @param string $name The database name. - * @return Connection A database connection - * @throws PropelException - if no conneciton params, or SQLException caught when trying to connect. - */ - public static function getConnection($name = null) { - if ($name === null) { - $name = self::getDefaultDB(); - } - $con = isset(self::$connectionMap[$name]) ? self::$connectionMap[$name] : null; - if ($con === null || $name === 'dbarray') { - - $dsn = isset(self::$configuration['datasources'][$name]['connection']) ? self::$configuration['datasources'][$name]['connection'] : null; - if ($dsn === null) { - if(isset($_SESSION['PROCESS'])) { - /** Added By Erik Amaru loadAdditionalConnections(); - $dsn = isset(self::$configuration['datasources'][$name]['connection']) ? self::$configuration['datasources'][$name]['connection'] : null; - } else { - throw new PropelException("No connection params set for " . $name); - } - } - // if specified, use custom driver - if (isset(self::$configuration['datasources'][$name]['driver'])) { - Creole::registerDriver($dsn['phptype'], self::$configuration['datasources'][$name]['driver']); - } - - try { - $con = Creole::getConnection($dsn); - } catch (SQLException $e) { - throw new PropelException($e); - } - self::$connectionMap[$name] = $con; - } - return $con; - } - - /** - * Returns database adapter for a specific connection pool. - * - * @param string $name A database name. - * @return DBAdapter The corresponding database adapter. - * @throws PropelException - if unable to find DBdapter for specified db. - */ - public static function getDB($name = null) - { - if ($name === null) { - $name = self::getDefaultDB(); - } - if (!isset(self::$adapterMap[$name])) { - //throw new PropelException("Unable to load DBAdapter for database '" . var_export($name, true) . "' (check your runtime properties file!)"); - throw new PropelException("Unable to load DBAdapter for database '' (check your runtime properties file!)"); - } - return self::$adapterMap[$name]; - } - - /** - * Returns the name of the default database. - * - * @return string Name of the default DB - */ - public static function getDefaultDB() - { - if (self::$configuration === null) { - return self::DEFAULT_NAME; - } elseif (self::$defaultDBName === null) { - // Determine default database name. - self::$defaultDBName = isset(self::$configuration['datasources']['default']) ? self::$configuration['datasources']['default'] : self::DEFAULT_NAME; - } - return self::$defaultDBName; - } - - /** - * Include once a file specified in DOT notation and reutrn unqualified clasname. - * - * Package notation is expected to be relative to a location - * on the PHP include_path. The dot-path classes are used as a way - * to represent both classname and filesystem location; there is - * an inherent assumption about filenaming. To get around these - * naming requirements you can include the class yourself - * and then just use the classname instead of dot-path. - * - * @param string $class dot-path to clas (e.g. path.to.my.ClassName). - * @return string unqualified classname - */ - public static function import($path) { - - // extract classname - if (($pos = strrpos($path, '.')) === false) { - $class = $path; - } else { - $class = substr($path, $pos + 1); - } - - // check if class exists - if (class_exists($class, false)) { - return $class; - } - - // turn to filesystem path - $path = strtr($path, '.', DIRECTORY_SEPARATOR) . '.php'; - - // include class - $ret = include_once($path); - if ($ret === false) { - throw new PropelException("Unable to import class: " . $class . " from " . $path); - } - - // return qualified name - return $class; - } - - /** - * Closes any associated resource handles. - * - * This method frees any database connection handles that have been - * opened by the getConnection() method. - * - * @return void - */ +class Propel +{ + + /** + * A constant for default. + */ + const DEFAULT_NAME = "default"; + + /** + * A constant defining 'System is unusuable' logging level + */ + const LOG_EMERG = 0; + + /** + * A constant defining 'Immediate action required' logging level + */ + const LOG_ALERT = 1; + + /** + * A constant defining 'Critical conditions' logging level + */ + const LOG_CRIT = 2; + + /** + * A constant defining 'Error conditions' logging level + */ + const LOG_ERR = 3; + + /** + * A constant defining 'Warning conditions' logging level + */ + const LOG_WARNING = 4; + + /** + * A constant defining 'Normal but significant' logging level + */ + const LOG_NOTICE = 5; + + /** + * A constant defining 'Informational' logging level + */ + const LOG_INFO = 6; + + /** + * A constant defining 'Debug-level messages' logging level + */ + const LOG_DEBUG = 7; + + /** + * The Propel version. + */ + const VERSION = '1.2.1'; + + /** + * The db name that is specified as the default in the property file + */ + private static $defaultDBName; + + /** + * The global cache of database maps + */ + private static $dbMaps = array(); + + /** + * The cache of DB adapter keys + */ + private static $adapterMap; + + /** + * The logging category. + */ + private static $category; + + /** + * Propel-specific configuration. + */ + private static $configuration; + + /** + * flag to set to true once this class has been initialized + */ + private static $isInit = false; + + /** + * @var Log + */ + private static $logger = null; + + /** + * Store mapbuilder classnames for peers that have been referenced prior + * to Propel being initialized. This can happen if the OM Peer classes are + * included before the Propel::init() method has been called. + */ + private static $mapBuilders = array(); + + /** + * Cache of established connections (to eliminate overhead). + * @var array + */ + private static $connectionMap = array(); + + /** + * initialize Propel + * @return void + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function initialize() + { + if (self::$configuration === null) { + throw new PropelException("Propel cannot be initialized without " + . "a valid configuration. Please check the log files " + . "for further details."); + } + + self::configureLogging(); + // Now that we have dealt with processing the log properties + // that may be contained in the configuration we will make the + // configuration consist only of the remaining propel-specific + // properties that are contained in the configuration. First + // look for properties that are in the "propel" namespace. + + + $originalConf = self::$configuration; + self::$configuration = isset(self::$configuration['propel']) ? self::$configuration['propel'] : null; + + if (empty(self::$configuration)) { + // Assume the original configuration already had any + // prefixes stripped. + self::$configuration = $originalConf; + } + + // reset the connection map (this should enable runtime changes of connection params) + self::$connectionMap = array(); + self::initAdapters(self::$configuration); + + self::$isInit = true; + + // map builders may be registered w/ Propel before Propel has + // been initialized; in this case they are stored in a static + // var of this class & now can be propertly initialized. + foreach (self::$mapBuilders as $mbClass) { + BasePeer::getMapBuilder($mbClass); + } + + // now that the pre-loaded map builders have been propertly initialized + // empty the array. + // any further mapBuilders will be build by the generated MapBuilder classes. + self::$mapBuilders = array(); + } + + /** + * Setup the adapters needed. An adapter must be defined for each database connection. + * Generally the adapter will be the same as the PEAR phpname; e.g. for MySQL, use the + * 'mysql' adapter. + * @param array $configuration the Configuration representing the properties file + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + private static function initAdapters($configuration) + { + self::$adapterMap = array(); + + $c = isset($configuration['datasources']) ? $configuration['datasources'] : null; + if (!empty($c)) { + try { + foreach ($c as $handle => $properties) { + if (is_array($properties) && isset($properties['adapter'])) { + $db = DBAdapter::factory($properties['adapter']); + // register the adapter for this name + self::$adapterMap[$handle] = $db; + } + } + } catch (Exception $e) { + throw new PropelException("Unable to initialize adapters.", $e); + } + } else { + self::log("There were no adapters in the configuration.", self::LOG_WARNING); + } + } + + /** + * configure propel + * + * @param string $config Path (absolute or relative to include_path) to config file. + * @return void + * @throws PropelException If configuration file cannot be opened. (E_WARNING probably will also be raised in PHP) + */ + public static function krumo() + { + krumo(self::$configuration); + } + + + public static function configure($configFile) + { + self::$configuration = include($configFile); + if (self::$configuration === false) { + throw new PropelException("Unable to open configuration file: " . var_export($configFile, true)); + } + //include($configFile ); + } + + /** + * Initialization of Propel with a properties file. + * + * @param string $c The Propel configuration file path. + * @return void + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function init($c) + { + self::configure($c); + self::initialize(); + } + + public static function initConfiguration($configuration) + { + self::$configuration = $configuration; + self::initialize(); + } + + /** + * Determine whether Propel has already been initialized. + * + * @return boolean True if Propel is already initialized. + */ + public static function isInit() + { + return self::$isInit; + } + + /** + * Sets the configuration for Propel and all dependencies. + * + * @param array $c the Configuration + * @return void + */ + public static function setConfiguration($c) + { + self::$configuration = $c; + } + + /** + * Get the configuration for this component. + * + * @return the Configuration + */ + public static function getConfiguration() + { + return self::$configuration; + } + + /** + * Configure the logging for this subsystem. + * The logging system is only configured if there is a 'log' + * section in the passed-in runtime configuration. + * @return void + */ + protected static function configureLogging() + { + if (self::$logger === null) { + if (isset(self::$configuration['log']) && is_array(self::$configuration['log']) && count(self::$configuration['log'])) { + include_once 'Log.php'; // PEAR Log class + $c = self::$configuration['log']; + // array casting handles bug in PHP5b2 where the isset() checks + // below may return true if $c is not an array (e.g. is a string) + + $type = isset($c['type']) ? $c['type'] : 'file'; + $name = isset($c['name']) ? $c['name'] : './propel.log'; + $ident = isset($c['ident']) ? $c['ident'] : 'propel'; + $conf = isset($c['conf']) ? $c['conf'] : array(); + $level = isset($c['level']) ? $c['level'] : PEAR_LOG_DEBUG; + + self::$logger = Log::singleton($type, $name, $ident, $conf, $level); + } // if isset() + } + } + + /** + * Override the configured logger. + * + * This is primarily for things like unit tests / debugging where + * you want to change the logger without altering the configuration file. + * + * You can use any logger class that implements the propel.logger.BasicLogger + * interface. This interface is based on PEAR::Log, so you can also simply pass + * a PEAR::Log object to this method. + * + * @param object $logger The new logger to use. ([PEAR] Log or BasicLogger) + * @return void + */ + public static function setLogger($logger) + { + self::$logger = $logger; + } + + /** + * Returns true if a logger, for example PEAR::Log, has been configured, + * otherwise false. + * + * @return boolean True if Propel uses logging + */ + public static function hasLogger() + { + return self::$logger !== null; + } + + /** + * Get the configured logger. + * @return object Configured log class ([PEAR] Log or BasicLogger). + */ + public static function logger() + { + return self::$logger; + } + + /** + * Logs a message + * If a logger has been configured, the logger will be used, otherwrise the + * logging message will be discarded without any further action + * + * @param string $message The message that will be logged. + * @param string $level The logging level. + * @return boolean True if the message was logged successfully or no logger was used. + */ + public static function log($message, $level = self::LOG_DEBUG) + { + if (self::hasLogger()) { + $logger = self::logger(); + switch ($level) { + case self::LOG_EMERG: + return $logger->log($message, $level); + case self::LOG_ALERT: + return $logger->alert($message); + case self::LOG_CRIT: + return $logger->crit($message); + case self::LOG_ERR: + return $logger->err($message); + case self::LOG_WARNING: + return $logger->warning($message); + case self::LOG_NOTICE: + return $logger->notice($message); + case self::LOG_INFO: + return $logger->info($message); + default: + return $logger->debug($message); + } + } + return true; + } + + /** + * Returns the database map information. Name relates to the name + * of the connection pool to associate with the map. + * + * The database maps are "registered" by the generated map builder classes. + * + * @param string $name The name of the database corresponding to the DatabaseMapto retrieve. + * @return DatabaseMap The named DatabaseMap. + * @throws PropelException - if database map is null or propel was not initialized properly. + */ + public static function getDatabaseMap($name = null) + { + if ($name === null) { + $name = self::getDefaultDB(); + if ($name === null) { + throw new PropelException("DatabaseMap name was null!"); + } + } + + // CACHEHOOK - this would be a good place + // to add shared memory caching options (database + // maps should be a pretty safe candidate for shared mem caching) + + if (isset(self::$dbMaps[$name])) { + $map = self::$dbMaps[$name]; + } else { + $map = self::initDatabaseMap($name); + } + + return $map; + } + + /** + * Creates and initializes the mape for the named database. + * + * The database maps are "registered" by the generated map builder classes + * by calling this method and then adding the tables, etc. to teh DatabaseMap + * object returned from this method. + * + * @param string $name The name of the database to map. + * @return DatabaseMap The desired map. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + private static function initDatabaseMap($name) + { + $map = new DatabaseMap($name); + self::$dbMaps[$name] = $map; + return $map; + } + + /** + * Register a MapBuilder + * + * @param string $className the MapBuilder + */ + public static function registerMapBuilder($className) + { + self::$mapBuilders[] = $className; + } + + /** + * Returns the specified property of the given database, or the empty + * string if no value is set for the property. + * + * @param string $db The name of the database whose property to get. + * @param string $prop The name of the property to get. + * @return mixed The property's value. + */ + private static function getDatabaseProperty($db, $prop) + { + return isset(self::$configuration['datasources'][$db][$prop]) ? self::$configuration['datasources'][$db][$prop] : null; + } + + /** + * + * @param string $name The database name. + * @return Connection A database connection + * @throws PropelException - if no conneciton params, or SQLException caught when trying to connect. + */ + public static function getConnection($name = null) + { + if ($name === null) { + $name = self::getDefaultDB(); + } + $con = isset(self::$connectionMap[$name]) ? self::$connectionMap[$name] : null; + if ($con === null || $name === 'dbarray') { + $dsn = isset(self::$configuration['datasources'][$name]['connection']) ? self::$configuration['datasources'][$name]['connection'] : null; + if ($dsn === null) { + if (isset($_SESSION['PROCESS'])) { + /*********************************************************************** + * @date: 27-05-08 11:48 * + * @Description: this was added for the additional database connections * + ***********************************************************************/ + DbConnections::loadAdditionalConnections(); + $dsn = isset(self::$configuration['datasources'][$name]['connection']) ? self::$configuration['datasources'][$name]['connection'] : null; + } else { + throw new PropelException("No connection params set for " . $name); + } + } + // if specified, use custom driver + if (isset(self::$configuration['datasources'][$name]['driver'])) { + Creole::registerDriver($dsn['phptype'], self::$configuration['datasources'][$name]['driver']); + } + + try { + // set Connection Creole default mysqli + $dsn = str_replace('mysql:', 'mysqli:', $dsn); + $con = Creole::getConnection($dsn); + } catch (SQLException $e) { + throw new PropelException($e); + } + self::$connectionMap[$name] = $con; + } + return $con; + } + + /** + * Returns database adapter for a specific connection pool. + * + * @param string $name A database name. + * @return DBAdapter The corresponding database adapter. + * @throws PropelException - if unable to find DBdapter for specified db. + */ + public static function getDB($name = null) + { + if ($name === null) { + $name = self::getDefaultDB(); + } + if (!isset(self::$adapterMap[$name])) { + //throw new PropelException("Unable to load DBAdapter for database '" . var_export($name, true) . "' (check your runtime properties file!)"); + throw new PropelException("Unable to load DBAdapter for database '' (check your runtime properties file!)"); + } + return self::$adapterMap[$name]; + } + + /** + * Returns the name of the default database. + * + * @return string Name of the default DB + */ + public static function getDefaultDB() + { + if (self::$configuration === null) { + return self::DEFAULT_NAME; + } elseif (self::$defaultDBName === null) { + // Determine default database name. + self::$defaultDBName = isset(self::$configuration['datasources']['default']) ? self::$configuration['datasources']['default'] : self::DEFAULT_NAME; + } + return self::$defaultDBName; + } + + /** + * Include once a file specified in DOT notation and reutrn unqualified clasname. + * + * Package notation is expected to be relative to a location + * on the PHP include_path. The dot-path classes are used as a way + * to represent both classname and filesystem location; there is + * an inherent assumption about filenaming. To get around these + * naming requirements you can include the class yourself + * and then just use the classname instead of dot-path. + * + * @param string $class dot-path to clas (e.g. path.to.my.ClassName). + * @return string unqualified classname + */ + public static function import($path) + { + + // extract classname + if (($pos = strrpos($path, '.')) === false) { + $class = $path; + } else { + $class = substr($path, $pos + 1); + } + + // check if class exists + if (class_exists($class, false)) { + return $class; + } + + // turn to filesystem path + $path = strtr($path, '.', DIRECTORY_SEPARATOR) . '.php'; + + // include class + $ret = include_once($path); + if ($ret === false) { + throw new PropelException("Unable to import class: " . $class . " from " . $path); + } + + // return qualified name + return $class; + } + + /** + * Closes any associated resource handles. + * + * This method frees any database connection handles that have been + * opened by the getConnection() method. + * + * @return void + */ public static function close() { $lastQuery = ""; foreach (self::$connectionMap as $cnn) { if (get_class($cnn) != "DBArrayConnection") { - if(isset($cnn->lastQuery)){ + if (isset($cnn->lastQuery)) { if (gettype($cnn->getResource()) == "resource" && $cnn->isConnected() && $cnn->lastQuery != $lastQuery) { $cnn->close(); } @@ -617,14 +618,14 @@ class Propel { public static function getDbConnection($name) { /*----------------------------------********---------------------------------*/ - if (!PMLicensedFeatures::getSingleton()->verifyfeature('02YeEFKNnVoOWFKMzN4ZmpXT0V3MU9SVklnOXNCcE9zcXJKa0tpemNmQkJ5OTUvOWlLdFhibGp0MHVHUlV0VmNpNw==')) { - /*----------------------------------********---------------------------------*/ - return null; - /*----------------------------------********---------------------------------*/ - } + if (!PMLicensedFeatures::getSingleton()->verifyfeature('02YeEFKNnVoOWFKMzN4ZmpXT0V3MU9SVklnOXNCcE9zcXJKa0tpemNmQkJ5OTUvOWlLdFhibGp0MHVHUlV0VmNpNw==')) { + /*----------------------------------********---------------------------------*/ + return null; + /*----------------------------------********---------------------------------*/ + } /*----------------------------------********---------------------------------*/ - if (! empty(self::$configuration['datasources'][$name]['connection'])) { + if (!empty(self::$configuration['datasources'][$name]['connection'])) { return self::getConnection($name); } @@ -634,10 +635,10 @@ class Propel { $defaultDbName = substr($name, 0, strrpos($name, '_')); - if (! empty(self::$configuration['datasources'][$defaultDbName]['connection'])) { + if (!empty(self::$configuration['datasources'][$defaultDbName]['connection'])) { return self::getConnection($defaultDbName); } - throw new PropelException('Error, database connection named "'.$name.'" is not defined for Propel.'); + throw new PropelException('Error, database connection named "' . $name . '" is not defined for Propel.'); } } diff --git a/thirdparty/smarty/BUGS b/thirdparty/smarty/BUGS deleted file mode 100644 index 9f1a80f31..000000000 --- a/thirdparty/smarty/BUGS +++ /dev/null @@ -1,7 +0,0 @@ -Smarty is supported only in PHP 4.0.6 or later. - -Smarty versions previous to 2.0 require the PEAR libraries. Be sure to include -the path to the PEAR libraries in your php include_path. Config_file.class.php -uses the PEAR library for its error handling routines. PEAR comes with the PHP -distribution. Unix users check /usr/local/lib/php, windows users check -C:/php/pear. diff --git a/thirdparty/smarty/COPYING.lib b/thirdparty/smarty/COPYING.lib deleted file mode 100644 index 3b204400c..000000000 --- a/thirdparty/smarty/COPYING.lib +++ /dev/null @@ -1,458 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/thirdparty/smarty/ChangeLog b/thirdparty/smarty/ChangeLog deleted file mode 100644 index 802891ac8..000000000 --- a/thirdparty/smarty/ChangeLog +++ /dev/null @@ -1,8667 +0,0 @@ -2007-03-06 Monte Ohrt - - * NEWS - libs/plugins/function.html_select_date.php: - fix html_select_date separator when parts are missing (thanks to kayk for - the patch) - -2007-03-06 Messju Mohr - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - bumped version number - - * NEWS: - added release headline - - * libs/internals/core.write_compiled_include.php: - fixed detection of non-cached block when writing compiled includes - -2007-03-01 Danilo Buerger - - * NEWS - libs/Smarty_Compiler.class.php: - Applied boots clean up patch and removed commented out code. - Updated NEWS file - -2007-02-27 Danilo Buerger - - * NEWS - docs/en/designers/language-modifiers/language-modifier-date-format.xml - libs/internals/core.write_file.php - libs/plugins/modifier.date_format.php: - Updated smarty_core_write_file() and smarty_modifier_date_format() to speed - up Windows detection. - Emulated more parameters for Windows in smarty_modifier_date_format() and - fixed some old ones. - Updated the docs to tell what parameters are emulated on Windows. - Updated NEWS file. - - * NEWS: - Updated NEWS file to reflect changes commited in the last revision - -2007-02-27 Monte Ohrt - - * docs/en/appendixes/troubleshooting.xml: - fix typo - -2007-02-27 Danilo Buerger - - * libs/Smarty_Compiler.class.php: - Modified _(push|pop)_cacheable_state() to embedd alternate syntax. See this - bug report: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=10502 - -2007-02-26 Peter 'Mash' Morgan - - * docs/en/designers/language-custom-functions/language-function-html-options.xml: - Fix incorrect var name - -2007-02-23 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - escape creating of language=php from interleaving - - * libs/Smarty_Compiler.class.php: - add removed line back in - - * libs/Smarty_Compiler.class.php: - fix up last patch, remove unnecessary lines - - * libs/Smarty_Compiler.class.php: - fix situation when no compiled tags are present - - * libs/Smarty_Compiler.class.php: - fix problem with php open tags generated from tag interleaving - -2007-02-06 boots - - * docs/en/programmers/advanced-features/template-resources.xml: - Correct default template handler function example. - -2007-01-17 Messju Mohr - - * NEWS - libs/plugins/modifier.truncate.php: - fixed handling of $etc in the truncate modifier when $etc is longer - than $length. - - thanks to Sylvinus! - -2007-01-10 boots - - * NEWS - libs/plugins/modifier.date_format.php - libs/plugins/modifier.date_format.php: - fix handling of %I with mysql timestamps - - Thanks to Danilo Buerger - - * NEWS - libs/internals/core.write_file.php: - Better recognize Windows filesystems to reduce warnings - - * NEWS - libs/plugins/modifier.date_format.php: - Emulate %R in the date_format modifier on Windows - - Thanks to Danilo Buerger - -2006-12-10 Yannick Torres - - * docs/fr/getting-started.xml: - fix build - - * docs/fr/language-snippets.ent - docs/fr/designers/language-builtin-functions/language-function-include-php.xml - docs/fr/designers/language-modifiers/language-modifier-truncate.xml - docs/fr/designers/language-variables/language-variables-smarty.xml: - sync with EN - -2006-12-02 Peter 'Mash' Morgan - - * docs/en/designers/language-builtin-functions/language-function-include-php.xml: - Tidy example, speeling andd add links - - * docs/en/getting-started.xml: - Add/correct entities - - * docs/entities/global.ent: - Fix entities (strange) - -2006-12-01 Monte Ohrt - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update dev version numbers - -2006-12-01 boots - - * (Smarty_2_6_16) - NEWS: - Fixed replacement bug introduced in trimwhitespaces output filter that - was introduced in the last release. - - Thanks to Spuerhund from the forums. - - * (Smarty_2_6_16) - libs/plugins/outputfilter.trimwhitespace.php: - Fixed replacement bug introduced by last changes. - - Thanks to Spuerhund from the forums. - -2006-11-30 Monte Ohrt - - * NEWS - docs/en/designers/language-modifiers/language-modifier-truncate.xml - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update dev version numbers, fix manual typo - -2006-11-22 George Miroshnikov - - * docs/ru/getting-started.xml - docs/ru/language-snippets.ent: - sync with EN - - * docs/en/getting-started.xml: - replaced hardcoded path separator with PATH_SEPARATOR constant - -2006-11-20 boots - - * libs/plugins/modifier.debug_print_var.php: - fix depth formatting of arrays and objects in modifier debug_print_var - -2006-11-10 Messju Mohr - - * docs/en/designers/language-variables/language-variables-smarty.xml: - fixed typo. thanks jonez. - -2006-11-08 boots - - * NEWS - libs/internals/core.write_file.php: - change file writing semantics in smarty_core_write_file() - - This avoids unlink() unless rename() fails or a Windows system is detected - - see: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=6956 - - Thanks to c960657 from the forums. - -2006-11-07 boots - - * NEWS - libs/debug.tpl: - update debug.tpl to xhtml 1.1 compliance, fix javascript escaping in debug - output and apply a Smarty based color scheme - - see: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=7178 - - thanks to cybot from the forums! - - * NEWS - libs/plugins/modifier.debug_print_var.php: - enhance reporting precision of debug_print_var modifier - - see: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=9281 - - thanks to cybot from the forums - -2006-11-01 boots - - * NEWS - libs/plugins/function.html_select_date.php: - make html_select_date work consistently with 0000-00-00 00:00:00 and - 0000-00-00 inputs - - Thanks to cybot from forums - -2006-10-16 George Miroshnikov - - * docs/en/language-snippets.ent: - minor typo fix - &$class doesn't make sense. - -2006-10-14 Yannick Torres - - * docs/fr/designers/language-basic-syntax.xml - docs/fr/designers/language-builtin-functions.xml - docs/fr/designers/language-basic-syntax/language-syntax-attributes.xml - docs/fr/designers/language-basic-syntax/language-syntax-comments.xml - docs/fr/designers/language-basic-syntax/language-syntax-quotes.xml - docs/fr/designers/language-builtin-functions/language-function-capture.xml - docs/fr/designers/language-builtin-functions/language-function-php.xml - docs/fr/designers/language-builtin-functions/language-function-section.xml - docs/fr/designers/language-custom-functions/language-function-popup-init.xml - docs/fr/designers/language-modifiers/language-modifier-escape.xml - docs/fr/programmers/api-functions/api-display.xml - docs/fr/programmers/plugins/plugins-inserts.xml: - sync with EN - -2006-10-14 Fernando Correa da Conceio - - * docs/pt_BR/programmers/api-variables/variable-error-reporting.xml: - New Translation - - * docs/pt_BR/designers/language-basic-syntax/language-escaping.xml - docs/pt_BR/designers/language-basic-syntax/language-syntax-variables.xml: - New Translations - - * docs/pt_BR/translation.xml: - Used in revcheck - - * docs/pt_BR/getting-started.xml - docs/pt_BR/language-snippets.ent - docs/pt_BR/make_chm_index.html - docs/pt_BR/preface.xml - docs/pt_BR/appendixes/resources.xml - docs/pt_BR/appendixes/troubleshooting.xml - docs/pt_BR/designers/language-modifiers/language-modifier-capitalize.xml - docs/pt_BR/designers/language-modifiers/language-modifier-cat.xml - docs/pt_BR/designers/language-modifiers/language-modifier-count-characters.xml - docs/pt_BR/designers/language-modifiers/language-modifier-count-paragraphs.xml - docs/pt_BR/designers/language-modifiers/language-modifier-count-sentences.xml - docs/pt_BR/designers/language-modifiers/language-modifier-count-words.xml - docs/pt_BR/designers/language-modifiers/language-modifier-date-format.xml - docs/pt_BR/designers/language-modifiers/language-modifier-default.xml - docs/pt_BR/designers/language-modifiers/language-modifier-escape.xml - docs/pt_BR/designers/language-modifiers/language-modifier-indent.xml - docs/pt_BR/designers/language-modifiers/language-modifier-lower.xml - docs/pt_BR/designers/language-modifiers/language-modifier-nl2br.xml - docs/pt_BR/designers/language-modifiers/language-modifier-regex-replace.xml - docs/pt_BR/designers/language-modifiers/language-modifier-replace.xml - docs/pt_BR/designers/language-modifiers/language-modifier-spacify.xml - docs/pt_BR/designers/language-modifiers/language-modifier-string-format.xml - docs/pt_BR/designers/language-modifiers/language-modifier-strip-tags.xml - docs/pt_BR/designers/language-modifiers/language-modifier-strip.xml - docs/pt_BR/designers/language-modifiers/language-modifier-truncate.xml - docs/pt_BR/designers/language-modifiers/language-modifier-upper.xml - docs/pt_BR/designers/language-modifiers/language-modifier-wordwrap.xml - docs/pt_BR/designers/language-variables/language-assigned-variables.xml - docs/pt_BR/designers/language-variables/language-config-variables.xml - docs/pt_BR/designers/language-variables/language-variables-smarty.xml - docs/pt_BR/programmers/advanced-features.xml - docs/pt_BR/programmers/api-functions.xml - docs/pt_BR/programmers/api-variables.xml - docs/pt_BR/programmers/caching.xml - docs/pt_BR/programmers/plugins.xml - docs/pt_BR/programmers/smarty-constants.xml - docs/pt_BR/programmers/advanced-features/advanced-features-objects.xml - docs/pt_BR/programmers/advanced-features/advanced-features-outputfilters.xml - docs/pt_BR/programmers/advanced-features/advanced-features-postfilters.xml - docs/pt_BR/programmers/advanced-features/advanced-features-prefilters.xml - docs/pt_BR/programmers/advanced-features/section-template-cache-handler-func.xml - docs/pt_BR/programmers/advanced-features/template-resources.xml - docs/pt_BR/programmers/api-functions/api-append-by-ref.xml - docs/pt_BR/programmers/api-functions/api-append.xml - docs/pt_BR/programmers/api-functions/api-assign-by-ref.xml - docs/pt_BR/programmers/api-functions/api-assign.xml - docs/pt_BR/programmers/api-functions/api-clear-all-assign.xml - docs/pt_BR/programmers/api-functions/api-clear-all-cache.xml - docs/pt_BR/programmers/api-functions/api-clear-assign.xml - docs/pt_BR/programmers/api-functions/api-clear-cache.xml - docs/pt_BR/programmers/api-functions/api-clear-compiled-tpl.xml - docs/pt_BR/programmers/api-functions/api-clear-config.xml - docs/pt_BR/programmers/api-functions/api-config-load.xml - docs/pt_BR/programmers/api-functions/api-display.xml - docs/pt_BR/programmers/api-functions/api-fetch.xml - docs/pt_BR/programmers/api-functions/api-get-config-vars.xml - docs/pt_BR/programmers/api-functions/api-get-registered-object.xml - docs/pt_BR/programmers/api-functions/api-get-template-vars.xml - docs/pt_BR/programmers/api-functions/api-is-cached.xml - docs/pt_BR/programmers/api-functions/api-load-filter.xml - docs/pt_BR/programmers/api-functions/api-register-block.xml - docs/pt_BR/programmers/api-functions/api-register-compiler-function.xml - docs/pt_BR/programmers/api-functions/api-register-function.xml - docs/pt_BR/programmers/api-functions/api-register-modifier.xml - docs/pt_BR/programmers/api-functions/api-register-object.xml - docs/pt_BR/programmers/api-functions/api-register-outputfilter.xml - docs/pt_BR/programmers/api-functions/api-register-postfilter.xml - docs/pt_BR/programmers/api-functions/api-register-prefilter.xml - docs/pt_BR/programmers/api-functions/api-register-resource.xml - docs/pt_BR/programmers/api-functions/api-template-exists.xml - docs/pt_BR/programmers/api-functions/api-trigger-error.xml - docs/pt_BR/programmers/api-functions/api-unregister-block.xml - docs/pt_BR/programmers/api-functions/api-unregister-compiler-function.xml - docs/pt_BR/programmers/api-functions/api-unregister-function.xml - docs/pt_BR/programmers/api-functions/api-unregister-modifier.xml - docs/pt_BR/programmers/api-functions/api-unregister-object.xml - docs/pt_BR/programmers/api-functions/api-unregister-outputfilter.xml - docs/pt_BR/programmers/api-functions/api-unregister-postfilter.xml - docs/pt_BR/programmers/api-functions/api-unregister-prefilter.xml - docs/pt_BR/programmers/api-functions/api-unregister-resource.xml - docs/pt_BR/programmers/api-variables/variable-autoload-filters.xml - docs/pt_BR/programmers/api-variables/variable-cache-dir.xml - docs/pt_BR/programmers/api-variables/variable-cache-handler-func.xml - docs/pt_BR/programmers/api-variables/variable-cache-lifetime.xml - docs/pt_BR/programmers/api-variables/variable-cache-modified-check.xml - docs/pt_BR/programmers/api-variables/variable-caching.xml - docs/pt_BR/programmers/api-variables/variable-compile-check.xml - docs/pt_BR/programmers/api-variables/variable-compile-dir.xml - docs/pt_BR/programmers/api-variables/variable-compile-id.xml - docs/pt_BR/programmers/api-variables/variable-compiler-class.xml - docs/pt_BR/programmers/api-variables/variable-config-booleanize.xml - docs/pt_BR/programmers/api-variables/variable-config-dir.xml - docs/pt_BR/programmers/api-variables/variable-config-fix-newlines.xml - docs/pt_BR/programmers/api-variables/variable-config-overwrite.xml - docs/pt_BR/programmers/api-variables/variable-config-read-hidden.xml - docs/pt_BR/programmers/api-variables/variable-debug-tpl.xml - docs/pt_BR/programmers/api-variables/variable-debugging-ctrl.xml - docs/pt_BR/programmers/api-variables/variable-debugging.xml - docs/pt_BR/programmers/api-variables/variable-default-modifiers.xml - docs/pt_BR/programmers/api-variables/variable-default-resource-type.xml - docs/pt_BR/programmers/api-variables/variable-default-template-handler-func.xml - docs/pt_BR/programmers/api-variables/variable-force-compile.xml - docs/pt_BR/programmers/api-variables/variable-global-assign.xml - docs/pt_BR/programmers/api-variables/variable-left-delimiter.xml - docs/pt_BR/programmers/api-variables/variable-php-handling.xml - docs/pt_BR/programmers/api-variables/variable-plugins-dir.xml - docs/pt_BR/programmers/api-variables/variable-request-use-auto-globals.xml - docs/pt_BR/programmers/api-variables/variable-request-vars-order.xml - docs/pt_BR/programmers/api-variables/variable-right-delimiter.xml - docs/pt_BR/programmers/api-variables/variable-secure-dir.xml - docs/pt_BR/programmers/api-variables/variable-security-settings.xml - docs/pt_BR/programmers/api-variables/variable-security.xml - docs/pt_BR/programmers/api-variables/variable-template-dir.xml - docs/pt_BR/programmers/api-variables/variable-trusted-dir.xml - docs/pt_BR/programmers/api-variables/variable-undefined.xml - docs/pt_BR/programmers/api-variables/variable-use-sub-dirs.xml - docs/pt_BR/programmers/caching/caching-cacheable.xml - docs/pt_BR/programmers/caching/caching-groups.xml - docs/pt_BR/programmers/caching/caching-multiple-caches.xml - docs/pt_BR/programmers/caching/caching-setting-up.xml - docs/pt_BR/programmers/plugins/plugins-block-functions.xml - docs/pt_BR/programmers/plugins/plugins-compiler-functions.xml - docs/pt_BR/programmers/plugins/plugins-functions.xml - docs/pt_BR/programmers/plugins/plugins-howto.xml - docs/pt_BR/programmers/plugins/plugins-inserts.xml - docs/pt_BR/programmers/plugins/plugins-modifiers.xml - docs/pt_BR/programmers/plugins/plugins-naming-conventions.xml - docs/pt_BR/programmers/plugins/plugins-outputfilters.xml - docs/pt_BR/programmers/plugins/plugins-prefilters-postfilters.xml - docs/pt_BR/programmers/plugins/plugins-resources.xml - docs/pt_BR/programmers/plugins/plugins-writing.xml: - Big update. Revision tag for all files. Some updates. Now I can update it - -2006-10-09 Peter 'Mash' Morgan - - * docs/en/getting-started.xml - docs/en/designers/language-basic-syntax.xml - docs/en/designers/language-custom-functions/language-function-popup-init.xml - docs/en/designers/language-modifiers/language-modifier-escape.xml - docs/en/programmers/api-functions/api-display.xml - docs/en/programmers/plugins/plugins-inserts.xml: - Minor changes and corrections - - * docs/en/designers/language-basic-syntax.xml - docs/en/designers/language-builtin-functions.xml - docs/en/designers/language-basic-syntax/language-syntax-attributes.xml - docs/en/designers/language-basic-syntax/language-syntax-comments.xml - docs/en/designers/language-basic-syntax/language-syntax-quotes.xml - docs/en/designers/language-modifiers/language-modifier-escape.xml: - Minor formatting and error correction - - * docs/en/designers/language-builtin-functions/language-function-capture.xml - docs/en/designers/language-builtin-functions/language-function-php.xml - docs/en/designers/language-builtin-functions/language-function-section.xml: - minor formatting and changes - - * docs/en/getting-started.xml: - Tidied up formatting so more readable, tidied up the install to the paths - are more clear (ta jj) - -2006-10-09 Yannick Torres - - * docs/fr/designers/language-builtin-functions/language-function-section.xml: - sync with EN - -2006-10-08 Yannick Torres - - * docs/fr/designers/language-builtin-functions/language-function-php.xml - docs/fr/designers/language-modifiers/language-modifier-escape.xml - docs/fr/designers/language-variables/language-variables-smarty.xml - docs/fr/programmers/api-variables/variable-request-use-auto-globals.xml: - fix build - - * docs/fr/designers/language-builtin-functions/language-function-strip.xml - docs/fr/programmers/caching.xml - docs/fr/programmers/smarty-constants.xml - docs/fr/programmers/api-variables/variable-autoload-filters.xml - docs/fr/programmers/api-variables/variable-cache-dir.xml - docs/fr/programmers/api-variables/variable-cache-handler-func.xml - docs/fr/programmers/api-variables/variable-cache-lifetime.xml - docs/fr/programmers/api-variables/variable-cache-modified-check.xml - docs/fr/programmers/api-variables/variable-caching.xml - docs/fr/programmers/api-variables/variable-compile-check.xml - docs/fr/programmers/api-variables/variable-compile-dir.xml - docs/fr/programmers/api-variables/variable-compile-id.xml - docs/fr/programmers/api-variables/variable-compiler-class.xml - docs/fr/programmers/api-variables/variable-config-booleanize.xml - docs/fr/programmers/api-variables/variable-config-dir.xml - docs/fr/programmers/api-variables/variable-config-fix-newlines.xml - docs/fr/programmers/api-variables/variable-config-overwrite.xml - docs/fr/programmers/api-variables/variable-config-read-hidden.xml - docs/fr/programmers/api-variables/variable-debug-tpl.xml - docs/fr/programmers/api-variables/variable-debugging-ctrl.xml - docs/fr/programmers/api-variables/variable-debugging.xml - docs/fr/programmers/api-variables/variable-default-modifiers.xml - docs/fr/programmers/api-variables/variable-default-resource-type.xml - docs/fr/programmers/api-variables/variable-default-template-handler-func.xml - docs/fr/programmers/api-variables/variable-error-reporting.xml - docs/fr/programmers/api-variables/variable-force-compile.xml - docs/fr/programmers/api-variables/variable-left-delimiter.xml - docs/fr/programmers/api-variables/variable-php-handling.xml - docs/fr/programmers/api-variables/variable-plugins-dir.xml - docs/fr/programmers/api-variables/variable-request-use-auto-globals.xml - docs/fr/programmers/api-variables/variable-request-vars-order.xml - docs/fr/programmers/api-variables/variable-right-delimiter.xml - docs/fr/programmers/api-variables/variable-secure-dir.xml - docs/fr/programmers/api-variables/variable-security-settings.xml - docs/fr/programmers/api-variables/variable-security.xml - docs/fr/programmers/api-variables/variable-template-dir.xml - docs/fr/programmers/api-variables/variable-trusted-dir.xml - docs/fr/programmers/api-variables/variable-use-sub-dirs.xml - docs/fr/programmers/caching/caching-cacheable.xml - docs/fr/programmers/caching/caching-groups.xml - docs/fr/programmers/caching/caching-multiple-caches.xml - docs/fr/programmers/caching/caching-setting-up.xml - docs/fr/programmers/plugins/plugins-block-functions.xml - docs/fr/programmers/plugins/plugins-compiler-functions.xml - docs/fr/programmers/plugins/plugins-functions.xml - docs/fr/programmers/plugins/plugins-inserts.xml - docs/fr/programmers/plugins/plugins-modifiers.xml - docs/fr/programmers/plugins/plugins-naming-conventions.xml - docs/fr/programmers/plugins/plugins-outputfilters.xml - docs/fr/programmers/plugins/plugins-prefilters-postfilters.xml - docs/fr/programmers/plugins/plugins-resources.xml - docs/fr/programmers/plugins/plugins-writing.xml: - sync with EN - -2006-10-07 Yannick Torres - - * docs/fr/programmers/advanced-features/advanced-features-objects.xml - docs/fr/programmers/advanced-features/advanced-features-outputfilters.xml - docs/fr/programmers/advanced-features/advanced-features-postfilters.xml - docs/fr/programmers/advanced-features/advanced-features-prefilters.xml - docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml - docs/fr/programmers/advanced-features/template-resources.xml - docs/fr/programmers/api-functions/api-append-by-ref.xml - docs/fr/programmers/api-functions/api-append.xml - docs/fr/programmers/api-functions/api-assign-by-ref.xml - docs/fr/programmers/api-functions/api-assign.xml - docs/fr/programmers/api-functions/api-clear-all-assign.xml - docs/fr/programmers/api-functions/api-clear-all-cache.xml - docs/fr/programmers/api-functions/api-clear-assign.xml - docs/fr/programmers/api-functions/api-clear-cache.xml - docs/fr/programmers/api-functions/api-clear-compiled-tpl.xml - docs/fr/programmers/api-functions/api-clear-config.xml - docs/fr/programmers/api-functions/api-config-load.xml - docs/fr/programmers/api-functions/api-display.xml - docs/fr/programmers/api-functions/api-fetch.xml - docs/fr/programmers/api-functions/api-get-config-vars.xml - docs/fr/programmers/api-functions/api-get-registered-object.xml - docs/fr/programmers/api-functions/api-get-template-vars.xml - docs/fr/programmers/api-functions/api-is-cached.xml - docs/fr/programmers/api-functions/api-load-filter.xml - docs/fr/programmers/api-functions/api-register-block.xml - docs/fr/programmers/api-functions/api-register-compiler-function.xml - docs/fr/programmers/api-functions/api-register-function.xml - docs/fr/programmers/api-functions/api-register-modifier.xml - docs/fr/programmers/api-functions/api-register-object.xml - docs/fr/programmers/api-functions/api-register-outputfilter.xml - docs/fr/programmers/api-functions/api-register-postfilter.xml - docs/fr/programmers/api-functions/api-register-prefilter.xml - docs/fr/programmers/api-functions/api-register-resource.xml - docs/fr/programmers/api-functions/api-template-exists.xml - docs/fr/programmers/api-functions/api-trigger-error.xml - docs/fr/programmers/api-functions/api-unregister-block.xml - docs/fr/programmers/api-functions/api-unregister-compiler-function.xml - docs/fr/programmers/api-functions/api-unregister-function.xml - docs/fr/programmers/api-functions/api-unregister-modifier.xml - docs/fr/programmers/api-functions/api-unregister-object.xml - docs/fr/programmers/api-functions/api-unregister-outputfilter.xml - docs/fr/programmers/api-functions/api-unregister-postfilter.xml - docs/fr/programmers/api-functions/api-unregister-prefilter.xml - docs/fr/programmers/api-functions/api-unregister-resource.xml: - sync with EN - -2006-10-03 Yannick Torres - - * docs/fr/designers/language-custom-functions/language-function-html-select-time.xml - docs/fr/designers/language-custom-functions/language-function-html-table.xml - docs/fr/designers/language-custom-functions/language-function-mailto.xml - docs/fr/designers/language-custom-functions/language-function-math.xml - docs/fr/designers/language-custom-functions/language-function-popup-init.xml - docs/fr/designers/language-custom-functions/language-function-popup.xml - docs/fr/designers/language-custom-functions/language-function-textformat.xml - docs/fr/designers/language-modifiers/language-modifier-capitalize.xml - docs/fr/designers/language-modifiers/language-modifier-cat.xml - docs/fr/designers/language-modifiers/language-modifier-count-characters.xml - docs/fr/designers/language-modifiers/language-modifier-count-paragraphs.xml - docs/fr/designers/language-modifiers/language-modifier-count-sentences.xml - docs/fr/designers/language-modifiers/language-modifier-count-words.xml - docs/fr/designers/language-modifiers/language-modifier-date-format.xml - docs/fr/designers/language-modifiers/language-modifier-default.xml - docs/fr/designers/language-modifiers/language-modifier-escape.xml - docs/fr/designers/language-modifiers/language-modifier-indent.xml - docs/fr/designers/language-modifiers/language-modifier-lower.xml - docs/fr/designers/language-modifiers/language-modifier-nl2br.xml - docs/fr/designers/language-modifiers/language-modifier-regex-replace.xml - docs/fr/designers/language-modifiers/language-modifier-replace.xml - docs/fr/designers/language-modifiers/language-modifier-spacify.xml - docs/fr/designers/language-modifiers/language-modifier-string-format.xml - docs/fr/designers/language-modifiers/language-modifier-strip-tags.xml - docs/fr/designers/language-modifiers/language-modifier-strip.xml - docs/fr/designers/language-modifiers/language-modifier-truncate.xml - docs/fr/designers/language-modifiers/language-modifier-upper.xml - docs/fr/designers/language-modifiers/language-modifier-wordwrap.xml - docs/fr/designers/language-variables/language-assigned-variables.xml - docs/fr/designers/language-variables/language-config-variables.xml - docs/fr/designers/language-variables/language-variables-smarty.xml: - sync with EN - -2006-10-01 Yannick Torres - - * docs/fr/designers/language-builtin-functions/language-function-include-php.xml - docs/fr/designers/language-builtin-functions/language-function-include.xml - docs/fr/designers/language-builtin-functions/language-function-insert.xml - docs/fr/designers/language-builtin-functions/language-function-ldelim.xml - docs/fr/designers/language-builtin-functions/language-function-literal.xml - docs/fr/designers/language-builtin-functions/language-function-php.xml - docs/fr/designers/language-custom-functions/language-function-assign.xml - docs/fr/designers/language-custom-functions/language-function-counter.xml - docs/fr/designers/language-custom-functions/language-function-cycle.xml - docs/fr/designers/language-custom-functions/language-function-debug.xml - docs/fr/designers/language-custom-functions/language-function-eval.xml - docs/fr/designers/language-custom-functions/language-function-fetch.xml - docs/fr/designers/language-custom-functions/language-function-html-checkboxes.xml - docs/fr/designers/language-custom-functions/language-function-html-image.xml - docs/fr/designers/language-custom-functions/language-function-html-options.xml - docs/fr/designers/language-custom-functions/language-function-html-radios.xml - docs/fr/designers/language-custom-functions/language-function-html-select-date.xml: - sync with EN - -2006-09-30 Yannick Torres - - * docs/fr/getting-started.xml: - fix build - - * docs/fr/designers/chapter-debugging-console.xml - docs/fr/designers/config-files.xml - docs/fr/designers/language-builtin-functions.xml - docs/fr/designers/language-modifiers.xml - docs/fr/designers/language-variables.xml - docs/fr/designers/language-basic-syntax/language-escaping.xml - docs/fr/designers/language-basic-syntax/language-math.xml - docs/fr/designers/language-basic-syntax/language-syntax-comments.xml - docs/fr/designers/language-basic-syntax/language-syntax-functions.xml - docs/fr/designers/language-basic-syntax/language-syntax-quotes.xml - docs/fr/designers/language-basic-syntax/language-syntax-variables.xml - docs/fr/designers/language-builtin-functions/language-function-capture.xml - docs/fr/designers/language-builtin-functions/language-function-config-load.xml - docs/fr/designers/language-builtin-functions/language-function-foreach.xml - docs/fr/designers/language-builtin-functions/language-function-if.xml: - sync with EN - - * docs/fr/getting-started.xml - docs/fr/language-snippets.ent - docs/fr/appendixes/resources.xml - docs/fr/appendixes/tips.xml - docs/fr/appendixes/troubleshooting.xml: - sync with EN - -2006-09-27 Peter 'Mash' Morgan - - * docs/en/designers/language-builtin-functions/language-function-section.xml: - Minor tweaks and corrections - - * docs/en/getting-started.xml - docs/en/designers/chapter-debugging-console.xml - docs/en/designers/language-basic-syntax/language-syntax-comments.xml - docs/en/designers/language-custom-functions/language-function-html-image.xml - docs/en/designers/language-custom-functions/language-function-html-options.xml - docs/en/designers/language-custom-functions/language-function-html-radios.xml - docs/en/designers/language-custom-functions/language-function-html-select-date.xml - docs/en/designers/language-custom-functions/language-function-html-select-time.xml - docs/en/designers/language-custom-functions/language-function-html-table.xml - docs/en/designers/language-custom-functions/language-function-mailto.xml - docs/en/designers/language-custom-functions/language-function-popup-init.xml - docs/en/designers/language-custom-functions/language-function-textformat.xml - docs/en/designers/language-variables/language-config-variables.xml - docs/en/designers/language-variables/language-variables-smarty.xml: - Add literal tags to html, general formatting - - * docs/en/getting-started.xml - docs/en/appendixes/resources.xml - docs/en/appendixes/tips.xml - docs/en/appendixes/troubleshooting.xml - docs/en/designers/config-files.xml - docs/en/programmers/caching.xml - docs/en/programmers/smarty-constants.xml - docs/en/programmers/advanced-features/advanced-features-objects.xml - docs/en/programmers/advanced-features/advanced-features-outputfilters.xml - docs/en/programmers/advanced-features/advanced-features-postfilters.xml - docs/en/programmers/advanced-features/advanced-features-prefilters.xml - docs/en/programmers/advanced-features/section-template-cache-handler-func.xml - docs/en/programmers/advanced-features/template-resources.xml - docs/en/programmers/api-variables/variable-autoload-filters.xml - docs/en/programmers/api-variables/variable-cache-dir.xml - docs/en/programmers/api-variables/variable-cache-handler-func.xml - docs/en/programmers/api-variables/variable-cache-lifetime.xml - docs/en/programmers/api-variables/variable-cache-modified-check.xml - docs/en/programmers/api-variables/variable-caching.xml - docs/en/programmers/api-variables/variable-compile-check.xml - docs/en/programmers/api-variables/variable-compile-dir.xml - docs/en/programmers/api-variables/variable-compile-id.xml - docs/en/programmers/api-variables/variable-config-booleanize.xml - docs/en/programmers/api-variables/variable-config-dir.xml - docs/en/programmers/api-variables/variable-config-fix-newlines.xml - docs/en/programmers/api-variables/variable-config-overwrite.xml - docs/en/programmers/api-variables/variable-config-read-hidden.xml - docs/en/programmers/api-variables/variable-debug-tpl.xml - docs/en/programmers/api-variables/variable-debugging-ctrl.xml - docs/en/programmers/api-variables/variable-debugging.xml - docs/en/programmers/api-variables/variable-default-modifiers.xml - docs/en/programmers/api-variables/variable-default-resource-type.xml - docs/en/programmers/api-variables/variable-error-reporting.xml - docs/en/programmers/api-variables/variable-force-compile.xml - docs/en/programmers/api-variables/variable-left-delimiter.xml - docs/en/programmers/api-variables/variable-php-handling.xml - docs/en/programmers/api-variables/variable-plugins-dir.xml - docs/en/programmers/api-variables/variable-request-use-auto-globals.xml - docs/en/programmers/api-variables/variable-request-vars-order.xml - docs/en/programmers/api-variables/variable-right-delimiter.xml - docs/en/programmers/api-variables/variable-secure-dir.xml - docs/en/programmers/api-variables/variable-security-settings.xml - docs/en/programmers/api-variables/variable-security.xml - docs/en/programmers/api-variables/variable-template-dir.xml - docs/en/programmers/api-variables/variable-trusted-dir.xml - docs/en/programmers/api-variables/variable-use-sub-dirs.xml - docs/en/programmers/caching/caching-cacheable.xml - docs/en/programmers/caching/caching-groups.xml - docs/en/programmers/caching/caching-multiple-caches.xml - docs/en/programmers/caching/caching-setting-up.xml: - Tidy up of formatting - - * docs/entities/global.ent: - Adding some more resources - - * docs/en/programmers/plugins/plugins-block-functions.xml - docs/en/programmers/plugins/plugins-compiler-functions.xml - docs/en/programmers/plugins/plugins-functions.xml - docs/en/programmers/plugins/plugins-inserts.xml - docs/en/programmers/plugins/plugins-modifiers.xml - docs/en/programmers/plugins/plugins-naming-conventions.xml - docs/en/programmers/plugins/plugins-outputfilters.xml - docs/en/programmers/plugins/plugins-prefilters-postfilters.xml - docs/en/programmers/plugins/plugins-resources.xml - docs/en/programmers/plugins/plugins-writing.xml: - Tidy up some formatting - -2006-09-26 Peter 'Mash' Morgan - - * docs/en/programmers/api-functions/api-append-by-ref.xml - docs/en/programmers/api-functions/api-append.xml - docs/en/programmers/api-functions/api-assign-by-ref.xml - docs/en/programmers/api-functions/api-assign.xml - docs/en/programmers/api-functions/api-clear-all-assign.xml - docs/en/programmers/api-functions/api-clear-all-cache.xml - docs/en/programmers/api-functions/api-clear-assign.xml - docs/en/programmers/api-functions/api-clear-cache.xml - docs/en/programmers/api-functions/api-clear-compiled-tpl.xml - docs/en/programmers/api-functions/api-clear-config.xml - docs/en/programmers/api-functions/api-config-load.xml - docs/en/programmers/api-functions/api-display.xml - docs/en/programmers/api-functions/api-fetch.xml - docs/en/programmers/api-functions/api-get-config-vars.xml - docs/en/programmers/api-functions/api-get-registered-object.xml - docs/en/programmers/api-functions/api-get-template-vars.xml - docs/en/programmers/api-functions/api-is-cached.xml - docs/en/programmers/api-functions/api-load-filter.xml - docs/en/programmers/api-functions/api-register-block.xml - docs/en/programmers/api-functions/api-register-compiler-function.xml - docs/en/programmers/api-functions/api-register-function.xml - docs/en/programmers/api-functions/api-register-modifier.xml - docs/en/programmers/api-functions/api-register-object.xml - docs/en/programmers/api-functions/api-register-outputfilter.xml - docs/en/programmers/api-functions/api-register-postfilter.xml - docs/en/programmers/api-functions/api-register-prefilter.xml - docs/en/programmers/api-functions/api-register-resource.xml - docs/en/programmers/api-functions/api-template-exists.xml - docs/en/programmers/api-functions/api-trigger-error.xml - docs/en/programmers/api-functions/api-unregister-block.xml - docs/en/programmers/api-functions/api-unregister-compiler-function.xml - docs/en/programmers/api-functions/api-unregister-function.xml - docs/en/programmers/api-functions/api-unregister-modifier.xml - docs/en/programmers/api-functions/api-unregister-object.xml - docs/en/programmers/api-functions/api-unregister-outputfilter.xml - docs/en/programmers/api-functions/api-unregister-postfilter.xml - docs/en/programmers/api-functions/api-unregister-prefilter.xml - docs/en/programmers/api-functions/api-unregister-resource.xml: - Tidy up formatting and examples - - * docs/en/language-snippets.ent: - Moved recurring para for register_* - - * docs/en/designers/language-modifiers.xml: - Spelling on modifiers - - * docs/en/designers/language-builtin-functions.xml - docs/en/designers/language-modifiers.xml - docs/en/designers/language-custom-functions/language-function-html-options.xml - docs/en/designers/language-modifiers/language-modifier-capitalize.xml - docs/en/designers/language-modifiers/language-modifier-cat.xml - docs/en/designers/language-modifiers/language-modifier-count-characters.xml - docs/en/designers/language-modifiers/language-modifier-count-paragraphs.xml - docs/en/designers/language-modifiers/language-modifier-count-sentences.xml - docs/en/designers/language-modifiers/language-modifier-count-words.xml - docs/en/designers/language-modifiers/language-modifier-date-format.xml - docs/en/designers/language-modifiers/language-modifier-default.xml - docs/en/designers/language-modifiers/language-modifier-escape.xml - docs/en/designers/language-modifiers/language-modifier-indent.xml - docs/en/designers/language-modifiers/language-modifier-lower.xml - docs/en/designers/language-modifiers/language-modifier-nl2br.xml - docs/en/designers/language-modifiers/language-modifier-regex-replace.xml - docs/en/designers/language-modifiers/language-modifier-replace.xml - docs/en/designers/language-modifiers/language-modifier-spacify.xml - docs/en/designers/language-modifiers/language-modifier-string-format.xml - docs/en/designers/language-modifiers/language-modifier-strip-tags.xml - docs/en/designers/language-modifiers/language-modifier-strip.xml - docs/en/designers/language-modifiers/language-modifier-truncate.xml - docs/en/designers/language-modifiers/language-modifier-upper.xml - docs/en/designers/language-modifiers/language-modifier-wordwrap.xml: - Tidying up some markup - - * docs/en/designers/language-variables.xml: - typo - - * docs/en/designers/language-variables.xml - docs/en/designers/language-variables/language-assigned-variables.xml - docs/en/designers/language-variables/language-config-variables.xml - docs/en/designers/language-variables/language-variables-smarty.xml: - Tidy up formatting on variables - - * docs/en/designers/language-basic-syntax/language-escaping.xml - docs/en/designers/language-basic-syntax/language-math.xml - docs/en/designers/language-basic-syntax/language-syntax-comments.xml - docs/en/designers/language-basic-syntax/language-syntax-functions.xml - docs/en/designers/language-basic-syntax/language-syntax-quotes.xml - docs/en/designers/language-basic-syntax/language-syntax-variables.xml: - Formatting of the basic-syntax dir - - * docs/en/designers/language-custom-functions/language-function-assign.xml - docs/en/designers/language-custom-functions/language-function-counter.xml - docs/en/designers/language-custom-functions/language-function-cycle.xml - docs/en/designers/language-custom-functions/language-function-debug.xml - docs/en/designers/language-custom-functions/language-function-eval.xml - docs/en/designers/language-custom-functions/language-function-fetch.xml - docs/en/designers/language-custom-functions/language-function-html-checkboxes.xml - docs/en/designers/language-custom-functions/language-function-html-image.xml - docs/en/designers/language-custom-functions/language-function-html-options.xml - docs/en/designers/language-custom-functions/language-function-html-radios.xml - docs/en/designers/language-custom-functions/language-function-html-select-date.xml - docs/en/designers/language-custom-functions/language-function-html-select-time.xml - docs/en/designers/language-custom-functions/language-function-html-table.xml - docs/en/designers/language-custom-functions/language-function-mailto.xml - docs/en/designers/language-custom-functions/language-function-math.xml - docs/en/designers/language-custom-functions/language-function-popup-init.xml - docs/en/designers/language-custom-functions/language-function-popup.xml - docs/en/designers/language-custom-functions/language-function-textformat.xml: - More formatting and cleaning up examples - -2006-09-25 Peter 'Mash' Morgan - - * docs/en/designers/language-builtin-functions/language-function-foreach.xml - docs/en/designers/language-builtin-functions/language-function-section.xml: - Doh! removing tabs - - * docs/en/designers/language-builtin-functions/language-function-capture.xml - docs/en/designers/language-builtin-functions/language-function-config-load.xml - docs/en/designers/language-builtin-functions/language-function-foreach.xml - docs/en/designers/language-builtin-functions/language-function-if.xml - docs/en/designers/language-builtin-functions/language-function-include-php.xml - docs/en/designers/language-builtin-functions/language-function-include.xml - docs/en/designers/language-builtin-functions/language-function-insert.xml - docs/en/designers/language-builtin-functions/language-function-ldelim.xml - docs/en/designers/language-builtin-functions/language-function-literal.xml - docs/en/designers/language-builtin-functions/language-function-php.xml - docs/en/designers/language-builtin-functions/language-function-section.xml - docs/en/designers/language-builtin-functions/language-function-strip.xml: - A lot of formatting, tagging and tidy up. Some consistency at last - - * docs/en/designers/language-builtin-functions/language-function-section.xml: - Major tidy up - - * docs/en/designers/language-builtin-functions/language-function-foreach.xml: - Major tidy up, added index property and some examples - -2006-09-03 Yannick Torres - - * docs/fr/designers/language-custom-functions/language-function-popup-init.xml - docs/fr/programmers/advanced-features/advanced-features-outputfilters.xml - docs/fr/programmers/advanced-features/advanced-features-postfilters.xml - docs/fr/programmers/advanced-features/advanced-features-prefilters.xml: - sync with EN - -2006-09-01 George Miroshnikov - - * docs/ru/programmers/api-functions/api-append-by-ref.xml - docs/ru/programmers/api-functions/api-append.xml - docs/ru/programmers/api-functions/api-assign-by-ref.xml - docs/ru/programmers/api-functions/api-assign.xml - docs/ru/programmers/api-functions/api-clear-all-assign.xml - docs/ru/programmers/api-functions/api-clear-all-cache.xml - docs/ru/programmers/api-functions/api-clear-assign.xml - docs/ru/programmers/api-functions/api-clear-cache.xml - docs/ru/programmers/api-functions/api-clear-compiled-tpl.xml - docs/ru/programmers/api-functions/api-clear-config.xml - docs/ru/programmers/api-functions/api-config-load.xml - docs/ru/programmers/api-functions/api-display.xml: - sync with EN - -2006-08-25 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed wrong handling of name attribute in {insert} - thanks to Ivan Kravets for reporting this - - * libs/Smarty_Compiler.class.php: - fixed typo - -2006-08-21 George Miroshnikov - - * docs/ru/designers/language-custom-functions/language-function-popup-init.xml - docs/ru/programmers/advanced-features/advanced-features-objects.xml - docs/ru/programmers/advanced-features/advanced-features-outputfilters.xml - docs/ru/programmers/advanced-features/advanced-features-postfilters.xml - docs/ru/programmers/advanced-features/advanced-features-prefilters.xml - docs/ru/programmers/advanced-features/section-template-cache-handler-func.xml - docs/ru/programmers/advanced-features/template-resources.xml: - sync with EN - - * docs/en/programmers/advanced-features/advanced-features-prefilters.xml: - another missing dot - - * docs/en/programmers/advanced-features/advanced-features-postfilters.xml: - missing dot - - * docs/en/programmers/advanced-features/advanced-features-outputfilters.xml: - missing comma - -2006-08-19 Peter 'Mash' Morgan - - * docs/en/designers/language-custom-functions/language-function-popup-init.xml: - avoid dupes and added remote paths - -2006-08-06 Yannick Torres - - * docs/fr/designers/language-custom-functions/language-function-html-table.xml - docs/fr/designers/language-custom-functions/language-function-mailto.xml: - sync with EN - -2006-08-03 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fix false replacement of "$t" inside double quotes - thanks to checat for reporting this - -2006-07-20 George Miroshnikov - - * docs/ru/designers/language-custom-functions/language-function-html-table.xml - docs/ru/designers/language-custom-functions/language-function-mailto.xml: - incrementing EN-Revision - - * docs/ru/designers/language-custom-functions/language-function-assign.xml - docs/ru/designers/language-custom-functions/language-function-eval.xml - docs/ru/designers/language-custom-functions/language-function-fetch.xml - docs/ru/designers/language-custom-functions/language-function-html-checkboxes.xml - docs/ru/designers/language-custom-functions/language-function-html-image.xml - docs/ru/designers/language-custom-functions/language-function-html-options.xml - docs/ru/designers/language-custom-functions/language-function-html-radios.xml - docs/ru/designers/language-custom-functions/language-function-html-table.xml - docs/ru/designers/language-custom-functions/language-function-mailto.xml - docs/ru/designers/language-custom-functions/language-function-popup-init.xml - docs/ru/designers/language-custom-functions/language-function-popup.xml - docs/ru/designers/language-modifiers/language-modifier-date-format.xml - docs/ru/designers/language-modifiers/language-modifier-default.xml - docs/ru/designers/language-modifiers/language-modifier-escape.xml - docs/ru/designers/language-modifiers/language-modifier-indent.xml - docs/ru/designers/language-modifiers/language-modifier-lower.xml - docs/ru/designers/language-modifiers/language-modifier-nl2br.xml - docs/ru/designers/language-modifiers/language-modifier-strip.xml - docs/ru/designers/language-modifiers/language-modifier-truncate.xml - docs/ru/designers/language-modifiers/language-modifier-upper.xml - docs/ru/designers/language-modifiers/language-modifier-wordwrap.xml - docs/ru/designers/language-variables/language-variables-smarty.xml: - sync with EN - - * docs/en/designers/language-custom-functions/language-function-mailto.xml: - typo - -2006-07-10 boots - - * libs/plugins/function.html_table.php: - fixed email address in comments - - * NEWS - libs/plugins/function.html_table.php: - html_table: fixed th/tr output, added hdir support for column - headings,update docs to reflect new features - -2006-07-08 Messju Mohr - - * libs/plugins/function.html_table.php: - fix occasional notices on undefined variables - -2006-07-08 boots - - * libs/plugins/function.html_table.php: - Added ability to specify column headings in {html_table} - - Added th_attrs attribute which works similary to td_attr and tr_attr but - for TH elements. Changes the cols attribute to allow mixed values; a - numeric still specifies the number of columns to render but now an array - of values can be used to specify TH column values. The number of columns - is determine from the size of the array. Further, a comma-separated - string of column names can be used which is internally coverted to an - array and used as if it was specified as a normal array. - - Thanks for lynlyn for the feature request. - -2006-06-23 boots - - * libs/plugins/outputfilter.trimwhitespace.php: - fix comments in outputfilter.trimwhitespace - - * NEWS - libs/plugins/outputfilter.trimwhitespace.php: - fixed ordering of replacements in trimwhitespace output filter - - Thanks to Getty from IRC for reporting this. - -2006-06-20 boots - - * NEWS - libs/plugins/function.mailto.php: - update mailto function plugin to work around a firefox/thunderbird escaping - bug - - Thanks to elijahlofgren from the forums for reporting this and providing - the necessary patch - - * NEWS - libs/plugins/modifier.date_format.php: - emulate %l in the date_format modifier on windows - - thanks to Gibberish from the forums for reporting this - -2006-06-14 boots - - * NEWS - libs/plugins/modifier.capitalize.php: - Fix handling of apostrophes in the capitalize modifier. - - Thanks to asmecher from the forums for reporting this and providing a - partial solution. - -2006-05-28 Monte Ohrt - - * NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers - -2006-05-25 boots - - * NEWS - libs/Smarty_Compiler.class.php: - un-hide hidden xml open tags - -2006-05-09 boots - - * NEWS - libs/Smarty_Compiler.class.php: - separate handling of comment blocks from "special blocks" - - * NEWS - libs/plugins/function.popup_init.php: - reverted {popup_init} as proposed change to insertion behviour was not BC - -2006-05-04 boots - - * NEWS - libs/plugins/function.popup_init.php: - changed {popup_init} to only emit code once during a request - - Thanks to TGKnIght from forums - -2006-04-22 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fix handling of block-methods of registered objects - thanks to El Hombre Gris - -2006-04-04 Monte Ohrt - - * libs/plugins/function.html_select_date.php: - fix typo - -2006-03-09 Monte Ohrt - - * (Smarty_2_6_13) - NEWS: - update for release - -2006-03-08 Monte Ohrt - - * libs/plugins/modifier.regex_replace.php: - remove delim quote - - * libs/plugins/modifier.regex_replace.php: - fix delimiter issue - -2006-03-03 Monte Ohrt - - * libs/plugins/modifier.regex_replace.php: - use preg_replace to cover any space chars - - * libs/plugins/modifier.regex_replace.php: - fix problem with allowing "e" modifier - -2006-01-29 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed possiblity for E_NOTICE on an undefined variable in - Smarty_Compiler::_compile_if_tag() - thanks to sbeh - -2006-01-18 Monte Ohrt - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers - - * (Smarty_2_6_12) - NEWS: - commit 2.6.12 release - -2006-01-15 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed use of references $cache_attrs and $repeat in Smarty_Compiler. - - php does not allow to pass an assigned by reference to a function. since - php-5.1.2 - the reference to the lval gets lost when passing an assignment. - -2005-12-31 Messju Mohr - - * NEWS - libs/Smarty.class.php: - fixed incompatible use of fread() in Smarty::_read_file() - it choke on php-5.1.1 and later. - thanks to andig for pointing this out. - -2005-12-21 boots - - * NEWS - libs/Smarty_Compiler.class.php: - Fix improper tokenization of certain inline math expressions. - - Thanks to gerard at forums for reporting this. - -2005-12-19 Messju Mohr - - * libs/plugins/function.math.php: - fixed problem with math in certain LC_NUMERIC locales. - thanks to wiebren for providing problem+solution. - -2005-12-14 Messju Mohr - - * NEWS: - fixed iso-latin1 special chars - -2005-12-14 Monte Ohrt - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers - - * (Smarty_2_6_11) - NEWS: - commit NEWS file for 2.6.11 - -2005-12-08 Messju Mohr - - * docs/de/getting-started.xml: - sync with en - -2005-11-29 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed code generation of non-cacheable blocks to play well with php's - "Alternative syntax" used for example in compiled {if}..{else}..{/if} - blocks. - - (see: http://php.net/manual/en/control-structures.alternative-syntax.php - on "Alternative syntax") - - thanks to kihara from the forum. - -2005-11-26 Messju Mohr - - * NEWS: - fixed handling of multiple identical calls to {insert}. - - the function was called multiple times, but all inserts where replaced - by the results of the first call to the insert function. - - * libs/plugins/compiler.assign.php - libs/plugins/function.config_load.php: - added credits - - * libs/plugins/function.popup.php: - added "closeclick" from - http://www.bosrup.com/web/overlib/?Command_Reference - -2005-11-23 boots - - * NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/modifier.escape.php: - replace {} string access with equivalent substr() to avoid E_STRICT - warnings in PHP 5.1 - -2005-11-09 boots - - * NEWS - libs/Smarty.class.php: - return valid reference in get_config_vars() when given var is non-existant - -2005-10-11 Monte Ohrt - - * libs/plugins/block.textformat.php - libs/plugins/compiler.assign.php - libs/plugins/function.assign_debug_info.php - libs/plugins/function.config_load.php - libs/plugins/function.counter.php - libs/plugins/function.eval.php - libs/plugins/function.fetch.php - libs/plugins/function.html_options.php - libs/plugins/function.html_select_date.php - libs/plugins/function.html_select_time.php - libs/plugins/function.math.php - libs/plugins/function.popup.php - libs/plugins/function.popup_init.php - libs/plugins/modifier.capitalize.php - libs/plugins/modifier.count_characters.php - libs/plugins/modifier.count_paragraphs.php - libs/plugins/modifier.count_sentences.php - libs/plugins/modifier.count_words.php - libs/plugins/modifier.date_format.php - libs/plugins/modifier.debug_print_var.php - libs/plugins/modifier.default.php - libs/plugins/modifier.escape.php - libs/plugins/modifier.indent.php - libs/plugins/modifier.lower.php - libs/plugins/modifier.regex_replace.php - libs/plugins/modifier.replace.php - libs/plugins/modifier.spacify.php - libs/plugins/modifier.string_format.php - libs/plugins/modifier.strip_tags.php - libs/plugins/modifier.truncate.php - libs/plugins/modifier.upper.php - libs/plugins/modifier.wordwrap.php - libs/plugins/shared.escape_special_chars.php - libs/plugins/shared.make_timestamp.php: - Added author title to plugins where they don't exist. I put my name where I - was the original or co-author. If there needs to be more credit given - somewhere, speak up! - -2005-10-10 Monte Ohrt - - * NEWS - libs/plugins/function.html_image.php: - add path_prefix to html_image, fix incorrect secure_dir error when image - file is missing - -2005-10-04 Monte Ohrt - - * demo/templates/index.tpl: - remove popup example, update section var syntax - -2005-09-16 Nuno Lopes - - * docs/de/getting-started.xml: - more fixes - - * docs/de/getting-started.xml: - fix php bug #34520: broken example display (de only) - -2005-08-30 Monte Ohrt - - * libs/plugins/modifier.escape.php: - change default charset from utf8 to iso-8859-1 - - * NEWS - libs/plugins/modifier.escape.php: - add char_set param - -2005-08-17 Monte Ohrt - - * NEWS: - fix notice in debug security check - - * libs/Smarty.class.php: - fix typo - - * NEWS - libs/Smarty.class.php: - return valid reference in get_template_vars() when given var is - non-existant - -2005-08-12 Monte Ohrt - - * NEWS - libs/plugins/modifier.escape.php: - add "urlpathinfo" escape type to escape modifier. (apache does not like %2F - in the PATH_INFO) - -2005-08-05 Monte Ohrt - - * NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers - -2005-08-04 Monte Ohrt - - * NEWS: - update secure_dir notes - - * NEWS: - allow debug.tpl to work from arbitrary dir - -2005-08-04 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed proper escaping for literal strings passed to - Smarty_Compiler::_expand_quoted_text() by - Smarty_Compiler::_parse_var_props() - -2005-07-27 Messju Mohr - - * NEWS - libs/plugins/shared.make_timestamp.php: - removed ambiguity for numeric values passed to smarty_make_timestamp(). - numeric values are *always* treated as timestamps now. - -2005-07-18 Messju Mohr - - * libs/Config_File.class.php: - removed E_NOTICE from Config_File::get() - - * libs/Smarty.class.php: - removed E_NOTICE - -2005-07-10 Yannick Torres - - * docs/fr/getting-started.xml: - sync with EN - -2005-07-08 Monte Ohrt - - * NEWS: - correct username in NEWS file - - * NEWS - libs/plugins/function.html_select_date.php: - added passthru attribute feature to html_select_date - -2005-07-03 Yannick Torres - - * docs/fr/language-snippets.ent - docs/fr/preface.xml: - sync with EN - -2005-06-16 Messju Mohr - - * docs/de/preface.xml - docs/de/preface.xml: - sync with en - -2005-06-13 Monte Ohrt - - * NEWS - libs/plugins/modifier.truncate.php: - add "middle" parameter to truncate modifier - -2005-06-10 Messju Mohr - - * docs/de/livedocs.ent: - added german livedocs.ent - - * docs/de/language-snippets.ent - docs/de/preface.xml: - sync with en - -2005-06-09 Messju Mohr - - * docs/de/bookinfo.xml - docs/de/getting-started.xml - docs/de/getting-started.xml: - sync with en - -2005-05-24 Yannick Torres - - * docs/fr/getting-started.xml - docs/fr/language-snippets.ent: - sync with EN - -2005-05-20 Monte Ohrt - - * libs/plugins/function.html_radios.php: - fix allowable label id characters - -2005-05-06 Monte Ohrt - - * NEWS - libs/plugins/function.html_radios.php: - make form input label ids optional (monte) - -2005-05-02 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - add error message for empty if/elseif statements - -2005-04-15 Monte Ohrt - - * NEWS - libs/plugins/function.html_radios.php: - cast selected value to string for comparison in html_radios - -2005-04-07 Messju Mohr - - * NEWS - libs/plugins/function.html_select_date.php: - added xhtml compliance to html_select_date's year_as_text-feature - thanks to Mark West - - * NEWS - libs/plugins/function.html_select_date.php: - fixed handling of selected month html_select_date - thanks to Yuri Weseman for providing problem+solution - -2005-04-07 Nuno Lopes - - * docs/configure.in: - sync configure and file-entities scripts with phpdoc, for better - windows/cygwin support - -2005-03-31 Monte Ohrt - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers - - * (Smarty_2_6_9) - NEWS: - update NEWS file - -2005-03-30 Messju Mohr - - * libs/plugins/function.math.php: - re-enabled hex-constant. i hope in a sane way this time. - -2005-03-30 Monte Ohrt - - * libs/plugins/function.math.php: - fix function testing logic - - * libs/Smarty_Compiler.class.php: - disable variable func calls completely - - * libs/Smarty_Compiler.class.php: - disallow variable func calls when security is enabled - -2005-03-22 Messju Mohr - - * NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - bumped version-number to 2.6.9-dev - added headline of 2.6.6 release to NEWS file - -2005-03-21 Messju Mohr - - * (Smarty_2_6_8) - NEWS: - maybe even better this way. thanks monte :) - - * NEWS: - little more clear news-entry - -2005-03-21 Monte Ohrt - - * NEWS: - update NEWS with e-modifier removal - - * (Smarty_2_6_8) - libs/plugins/modifier.regex_replace.php: - remove e-modifier - -2005-03-19 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - objects don't get casted to arrays anymore in {foreach} - -2005-02-26 Messju Mohr - - * NEWS - libs/Smarty.class.php: - add "null" as a valid token for {if} when security is enabled - -2005-02-25 Monte Ohrt - - * NEWS - libs/plugins/function.mailto.php: - add javascript_charcode option to mailto - -2005-02-24 Monte Ohrt - - * NEWS: - update NEWS file - - * QUICK_START - libs/plugins/function.html_radios.php: - add label ids to html_radios - -2005-02-10 Monte Ohrt - - * QUICK_START: - update with directory structure - -2005-02-10 Nuno Lopes - - * docs/Makefile.in: - fix chm generation - -2005-02-10 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed too agressive {strip} around delimiters inside strip-blocks - -2005-02-10 Monte Ohrt - - * QUICK_START: - fix a couple errors - -2005-02-10 Nuno Lopes - - * docs/Makefile.in - docs/README: - commiting the new tools to make the CHM manual. - -2005-02-09 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed handling of strip-tags with non-default delimiters - -2005-02-04 Messju Mohr - - * libs/plugins/function.html_radios.php: - fixed syntax error. shame on me. - -2005-02-03 Monte Ohrt - - * QUICK_START: - fix example - - * QUICK_START: - initial commit - - * RELEASE_NOTES - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers in cvs - - * (Smarty_2_6_7) - NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - commit version numbers for new release - -2005-02-03 Messju Mohr - - * (Smarty_2_6_7) - libs/plugins/function.html_image.php: - fixed comment (thanks to CirTap) - -2005-02-01 Monte Ohrt - - * libs/plugins/function.html_image.php: - remove border tag - -2005-02-01 Messju Mohr - - * libs/Smarty.class.php: - fixed serialization of values containing newlines (like _cache_attrs) - in core_write_cache_file() - - bumped version to 2.6.6-dev-3 to indicate that the fileformat of cache - has changed - -2005-01-30 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed handling of hashed opening php-tags inside strip-blocks - (reported by titi_rafa) - -2005-01-30 Nuno Lopes - - * docs/fr/language-snippets.ent: - fix build - -2005-01-28 Messju Mohr - - * NEWS - libs/plugins/modifier.escape.php: - escape:url now uses the (RFC 1738 compliant) rawurlencode() - -2005-01-23 Messju Mohr - - * libs/Smarty.class.php: - replaced ? true : false and removed intermediate $_cookie_var in the - handling of the SMARTY_DEBUG-cookie - -2005-01-22 Yannick Torres - - * docs/fr/bookinfo.xml: - update EN-Revision tag - -2005-01-21 Monte Ohrt - - * README - RELEASE_NOTES - docs/de/bookinfo.xml - docs/fr/bookinfo.xml - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/function.cycle.php - libs/plugins/function.debug.php - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_image.php - libs/plugins/function.html_radios.php - libs/plugins/function.html_table.php - libs/plugins/function.mailto.php - libs/plugins/modifier.cat.php - libs/plugins/modifier.nl2br.php - libs/plugins/modifier.strip.php - libs/plugins/outputfilter.trimwhitespace.php: - de-spammify e-mails - - * README - RELEASE_NOTES - docs/de/bookinfo.xml - docs/fr/bookinfo.xml - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/function.cycle.php - libs/plugins/function.debug.php - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_image.php - libs/plugins/function.html_radios.php - libs/plugins/function.html_table.php - libs/plugins/function.mailto.php - libs/plugins/modifier.cat.php - libs/plugins/modifier.nl2br.php - libs/plugins/modifier.strip.php - libs/plugins/outputfilter.trimwhitespace.php: - update copyright notices, e-mail addresses - -2005-01-06 Messju Mohr - - * libs/Smarty_Compiler.class.php: - reduced the code that is generated on a {foreach}-block that has a - name. - - instead of pre-computing all foreach-properties (like first, last, - show) on each iteration, they are computed on demand as soon as - {$smarty.foreach.*}-variables are used. - - * NEWS - libs/Smarty_Compiler.class.php: - slight optimization in the compilation of $smarty.const.FOO . - - more complex consts like $smarty.const.$name still compile to - constant($this->_tpl_vars['name']) - -2005-01-05 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - make block functions and registered objects' block methods use a - local variable for block_content instead of $this->_block_content - - it's not necessary to have $smarty->_block_content accessible. - -2005-01-04 Yannick Torres - - * docs/fr/bookinfo.xml: - sync with EN - -2005-01-01 Messju Mohr - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - Happy new year from germany. - -2004-12-28 Monte Ohrt - - * libs/Smarty.class.php: - fix _read_file comments - -2004-12-26 Yannick Torres - - * docs/fr/getting-started.xml - docs/fr/preface.xml: - typo - - * docs/fr/language-defs.ent - docs/fr/language-snippets.ent - docs/fr/livedocs.ent: - sync with EN & typo - -2004-12-21 Yannick Torres - - * docs/fr/bookinfo.xml - docs/fr/getting-started.xml - docs/fr/translation.xml: - sync with EN - -2004-12-17 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed escaping of template-filenames in the generated code that loads - needed plugins - -2004-12-15 Monte Ohrt - - * NEWS - libs/plugins/function.popup.php: - fix invalid HTML issue with popup - -2004-12-06 boots - - * NEWS - libs/plugins/function.popup.php: - - fixed {popup} to properly handle inarray and function parameters and - added support for mouseoff and followmouse options - -2004-11-21 Mehdi Achour - - * docs/fr/livedocs.ent: - add livedocs specific entities files - -2004-11-16 Messju Mohr - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php: - cleaned up typecasting - -2004-11-15 Messju Mohr - - * libs/plugins/function.html_options.php: - fixed semantically misleading check for $options (use isset() instead - of is_array() because it is always an array). - - thanks to albert almeida. - -2004-11-08 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed unused code - -2004-10-25 Mehdi Achour - - * docs/fr/bookinfo.xml - docs/fr/getting-started.xml: - sync with en - -2004-10-13 Monte Ohrt - - * NEWS: - update header - -2004-10-02 Messju Mohr - - * NEWS: - fixed nocache-handling with nested includes. there was a logical error - in the replacement of internal nocache-tags to dynamic content that - lead to false results with deeply nested includes or with - nocache-blocks inside nocache-blocks. - - many thanks to Lars Jankowfsky for providing big help on reproducing - and tracking down this bug! - -2004-10-01 Messju Mohr - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - - better header for compiled includes (more in line with compiled - templates) - - - reuse cache_serials if a file is compiled more than once in one - process (force_compile) - - - don't print nocache-delimiters wenn already inside - process_cached_inserts() - -2004-09-29 Messju Mohr - - * libs/Smarty.class.php: - switched from @count() to !empty() . this was pointed out a few times - by a few people with buggy error-handlers - - * libs/Smarty_Compiler.class.php: - added some property declarations - -2004-09-28 Messju Mohr - - * libs/Smarty.class.php: - bumped up version number to reflect incompatibility in tempfiles of - 'core' vs. 'internals' - -2004-09-24 Messju Mohr - - * libs/plugins/function.html_select_date.php: - fixed $start_year when no value for the year in $time is given. - -2004-09-21 Messju Mohr - - * libs/plugins/function.html_table.php: - fixed handling of "inner"-attribute - - * libs/Smarty_Compiler.class.php: - fixed handling of object derefence inside backticks - -2004-09-20 Monte Ohrt - - * libs/debug.tpl: - add tags - -2004-09-18 boots - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/function.config_load.php - libs/plugins/function.debug.php - libs/plugins/function.fetch.php - libs/plugins/function.html_image.php: - Fixed \\r\\n line endings mistakenly introduced in last commit. d'oh. - -2004-09-16 boots - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.assemble_plugin_filepath.php - libs/core/core.assign_smarty_interface.php - libs/core/core.create_dir_structure.php - libs/core/core.display_debug_console.php - libs/core/core.get_include_path.php - libs/core/core.get_microtime.php - libs/core/core.get_php_resource.php - libs/core/core.is_secure.php - libs/core/core.is_trusted.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php - libs/core/core.process_cached_inserts.php - libs/core/core.process_compiled_include.php - libs/core/core.read_cache_file.php - libs/core/core.rm_auto.php - libs/core/core.rmdir.php - libs/core/core.run_insert_handler.php - libs/core/core.smarty_include_php.php - libs/core/core.write_cache_file.php - libs/core/core.write_compiled_include.php - libs/core/core.write_compiled_resource.php - libs/core/core.write_file.php - libs/plugins/function.config_load.php - libs/plugins/function.debug.php - libs/plugins/function.fetch.php - libs/plugins/function.html_image.php: - Moved /libs/core to /libs/internals and created new constant, - SMARTY_CORE_DIR which defaults to SMARTY_DIR/internals. This should help - CVS and rsynch users butupgrades will require changes and this may affect - 3rd party plugins that use the /core dir. - -2004-09-15 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - moved $this->_num_const_regexp out of $this->_var_regexp and added it - to the places that affect $this->_var_regexp - - this should fix some problems parsing plugin-names endings with digits - -2004-09-14 Messju Mohr - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update files to 2.6.6-dev - -2004-09-13 Messju Mohr - - * NEWS: - fixed typo - -2004-09-13 Monte Ohrt - - * (Smarty_2_6_5) - NEWS: - update NEWS file with parsing correction note - -2004-09-11 Messju Mohr - - * libs/plugins/function.debug.php: - removed notice from {debug} - thanks to Peter Billen for pointing this one out! - -2004-09-11 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - fix more object calling syntax issues - -2004-09-10 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - added $smarty->security_settings['ALLOW_CONSTANTS'] - including test-cases for them - -2004-09-09 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - break down regex to digestable chunks, fix multiple param problem with - method calls, - add object method testing to unit_test cases - - * libs/Smarty_Compiler.class.php: - update code comment with more examples - - * libs/Smarty_Compiler.class.php: - allow objects in arbitrary param positions - - * libs/Smarty_Compiler.class.php: - fix object parameter regex, allow one level of object indirection - - * libs/Smarty_Compiler.class.php: - fix compile problem with numeric constants and math operator matching - -2004-09-07 Monte Ohrt - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update files to 2.6.5-dev - - * (Smarty_2_6_4) - NEWS: - update NEWS file with 2.6.4 header - -2004-08-31 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - fix preg_quote - - * libs/Smarty_Compiler.class.php: - fix math in object params, clean up some regex on the way, change - preg_ delimiters to ~ to avoid character clashes with ! and % - -2004-08-30 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - add $smarty.ldelim and $smarty.rdelim to smarty special var - -2004-08-29 Messju Mohr - - * NEWS - libs/core/core.write_file.php: - tempnam() seems to be borken on many installation. - - now we try tempnam first and if that fails we generate our own - temp-filename with uniqid() - -2004-08-23 Monte Ohrt - - * libs/plugins/modifier.capitalize.php: - dont use constant, use static var instead - - * libs/plugins/modifier.capitalize.php: - implement optional param to capitalize for digit behavior - - * libs/plugins/modifier.capitalize.php: - another commit to capitalize, taking special chars into account - -2004-08-23 Messju Mohr - - * libs/Smarty_Compiler.class.php: - cleaned up attribute-handling in Smarty_Compiler::_compile_foreach_start() - -2004-08-23 Monte Ohrt - - * NEWS - libs/plugins/function.html_select_date.php - libs/plugins/modifier.capitalize.php: - fix capitalize modifier to not rely on buggy ucwords() func - -2004-08-20 Monte Ohrt - - * libs/plugins/function.html_select_date.php: - update version - - * NEWS - libs/plugins/function.html_select_date.php: - make time param work with negative timestamps, force year range to include - given date unless explicitly set - -2004-08-19 Monte Ohrt - - * NEWS - libs/plugins/function.fetch.php: - fix bug with fetch, passing user/pass in url did not work - -2004-08-13 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed handling of {foreachelse} and {sectionelse} that got borked with - the latest commit (v 1.330) - -2004-08-12 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed occasional wrong error messages on mismatched tags when - {else}, {elseif}, {foreachelse} or {sectionelse} is involved - - thanks to Ooypunk for pointing me on this - -2004-08-12 Nuno Lopes - - * docs/.cvsignore - docs/Makefile.in - docs/configure.in: - enable russian PDF builds - -2004-07-30 Nuno Lopes - - * docs/configure.in: - typo - - * docs/Makefile.in - docs/README - docs/configure.in: - add make test_xml - this is usefull to detect XML problems - -2004-07-29 Nuno Lopes - - * docs/configure.in: - avoid warnings in head - - * docs/.cvsignore - docs/Makefile.in - docs/README - docs/configure.in: - build pdf files - just type make pdf - -2004-07-27 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed handling of methods arguments. - - thanks to Manfred Wischin for finding this one and providing the - conceptual fix. - -2004-07-23 Messju Mohr - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php: - there was little flaw in smarty_function_html_radios() and - smarty_function_html_checkboxes(): - - the newly introduced assign-attribute was still added to the - tag-output as an extra-attribute. - - fixed. - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_image.php - libs/plugins/function.html_options.php - libs/plugins/function.html_radios.php - libs/plugins/function.html_select_date.php - libs/plugins/function.html_select_time.php - libs/plugins/modifier.date_format.php: - backed out renaming of _get_plugin_filepath() to get_plugin_filepath() - - we'll stick to _get_plugin_filepath() and look for a more viable - solution to be exposed to plugin-writers. - -2004-07-20 Messju Mohr - - * libs/Smarty_Compiler.class.php - libs/core/core.is_trusted.php - libs/plugins/compiler.assign.php: - Some fixes on PhpDocumentor comments. Thanks go to Ruben Vermeersch. - -2004-07-16 andreas halter - - * docs/de/bookinfo.xml - docs/de/getting-started.xml - docs/de/language-defs.ent - docs/de/language-snippets.ent - docs/de/preface.xml: - - updated for 2.6.3 - - updates for new build system - - added missing files - - corrections from users - - revcheck comments for all files - - big up to didou and nuno, brilliant work - - make test: ok - - make: ok - -2004-07-16 Nuno Lopes - - * docs/de/getting-started.xml: - fix the revision tracking tag - the revision number might not be right. just check it, please - -2004-07-16 andreas halter - - * docs/de/getting-started.xml: - - updated version (incl revcheck comment) for revcheck testing - -2004-07-14 Monte Ohrt - - * libs/Smarty.class.php: - replace " with ' where literal strings are quoted (ever so slight speedup) - -2004-07-12 Messju Mohr - - * libs/plugins/modifier.date_format.php: - changed call from $smarty->_get_plugin_filepath() to - $smarty->get_plugin_filepath() - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_image.php - libs/plugins/function.html_options.php - libs/plugins/function.html_radios.php - libs/plugins/function.html_select_date.php - libs/plugins/function.html_select_time.php: - renamed calls to $smarty->_get_plugin_filepath() to - $smarty->get_plugin_filepath() - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php: - renamed Smarty::_get_plugin_filepath() to Smarty::get_plugin_filepath() - - * NEWS - libs/Smarty.class.php - libs/core/core.write_compiled_include.php - libs/core/core.write_compiled_resource.php - libs/core/core.write_file.php: - removed touch() call. changing the timestamp of the compiled-template - to the source template's may be irritating for certain - source-code-caches. now a newly compiled template gets the current - time as timestamp. - -2004-07-02 gerald croes - - * docs/fr/getting-started.xml - docs/fr/preface.xml: - Fixed missing tags to be able to make doc again - - * docs/fr/preface.xml: - added the "is a good thing [TM]" as in en docs - - * docs/fr/getting-started.xml: - added ctags, updated screen => programm listing. - added the technical note founded on the en doc - -2004-07-02 Monte Ohrt - - * NEWS - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php - libs/plugins/function.mailto.php: - add assign attribute to html_checkboxes and html_radios - -2004-07-01 Messju Mohr - - * NEWS - libs/Smarty.class.php: - removed use of get_include_filepath() inside - get_auto_filename(). thanks go to c960657 - - * NEWS - libs/Smarty_Compiler.class.php: - enhanced error-reporting for {foreach} - - * NEWS - libs/Smarty_Compiler.class.php: - fixed handling of digits inside tagnames. this problem slipped into - the regexps by adding support for numeric contants next to string - constants as variables. - -2004-06-27 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed escaping of backslashes in Smarty_Compiler::_quote_replace() - -2004-06-23 Monte Ohrt - - * libs/plugins/modifier.date_format.php: - display date_format %e, %T and %D as expected for windows - -2004-06-17 Messju Mohr - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - changed version-number to 2.6.4-dev - -2004-06-16 Monte Ohrt - - * (Smarty_2_6_3) - NEWS: - update NEWS file with version number - -2004-06-09 Monte Ohrt - - * NEWS - libs/plugins/modifier.escape.php: - added escapement of ' - - * docs/fr/translation.xml: - Add other translators. - -2004-06-08 Messju Mohr - - * libs/Smarty.class.php: - made the correct value of "use_sub_dirs" available to the compiler. - (not worth a NEWS-entry, i think) - -2004-06-01 Messju Mohr - - * libs/plugins/function.fetch.php: - fix: proper initialistaion of $content. - thanks to Dmitry Koteroff for pointing this out. - -2004-05-29 Mehdi Achour - - * docs/fr/translation.xml: - oups :) - - * docs/fr/translation.xml: - added translation file - -2004-05-28 Nuno Lopes - - * docs/Makefile.in: - clean also file-entities.php - -2004-05-28 Messju Mohr - - * NEWS - libs/plugins/function.mailto.php: - added obfuscation of protocol-string in {mailto} when using - hex-encoding (thanks to bharat) - -2004-05-26 Messju Mohr - - * NEWS - libs/Smarty.class.php: - enhanced auto-generated filenames for templates_c and cache - - incremented Smarty::_version because the tempfiles' structure changed - a little - -2004-05-23 Mehdi Achour - - * docs/fr/bookinfo.xml - docs/fr/getting-started.xml - docs/fr/preface.xml: - WS and added revcheck - -2004-05-21 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed typo in error-messages - - * docs/de/language-snippets.ent - docs/fr/language-snippets.ent: - added empty language-snippets.ent to fix "make web" - -2004-05-12 Monte Ohrt - - * NEWS - libs/plugins/modifier.escape.php: - add 'nonstd' escape modifier - -2004-05-07 Monte Ohrt - - * NEWS - libs/plugins/block.textformat.php: - update textformat to not output wrap chars after last para - -2004-05-06 Messju Mohr - - * NEWS - libs/core/core.write_file.php: - use tempnam() instead of unqid() to create better temporary files in - smarty_core_write_file(). - - (thanks to xces for finding this race-condition and his work on - fixing it) - -2004-05-04 Messju Mohr - - * libs/Smarty.class.php: - added check if for file_exists() to Smarty::_read_file() - -2004-04-30 Monte Ohrt - - * NEWS - libs/plugins/modifier.escape.php: - add 'mail' attribute to escape modifier - -2004-04-20 Mehdi Achour - - * docs/manual.xml.in: - added the language-snippets.ent file and started using entities for notes - under en/programmers/api-functions - -2004-04-18 Mehdi Achour - - * docs/de/getting-started.xml - docs/fr/getting-started.xml: - new global entity for zend and php-accelerator - - * docs/fr/bookinfo.xml - docs/fr/getting-started.xml - docs/fr/preface.xml: - added myself as translator and added vim comments and xml tags - -2004-04-16 Messju Mohr - - * NEWS: - added entry for numeric constants - - * libs/Smarty_Compiler.class.php: - removed unused 2nd param in call to _parse_var() - - * libs/Smarty_Compiler.class.php: - added explanation for $this->_num_const_regexp - - * NEWS - libs/plugins/modifier.escape.php: - added escape type "decentity" to smarty_modifier_escape() - - * libs/Smarty_Compiler.class.php: - enabled numerical constants be parsed as statements. - (like {10} or {10|@range:12} ) - - * libs/Smarty_Compiler.class.php: - removed unused $smarty_compiler->_dvar_num_var_regexp - - * libs/Smarty.class.php: - reverted Stuff - - * libs/debug.tpl - libs/core/core.assemble_plugin_filepath.php - libs/core/core.read_cache_file.php - libs/core/core.write_file.php - libs/plugins/function.eval.php - libs/plugins/function.popup.php - libs/plugins/modifier.escape.php - libs/plugins/shared.make_timestamp.php: - reverted stuff - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/debug.tpl - libs/core/core.assemble_plugin_filepath.php - libs/core/core.read_cache_file.php - libs/core/core.write_file.php - libs/plugins/function.eval.php - libs/plugins/function.popup.php - libs/plugins/modifier.escape.php - libs/plugins/shared.make_timestamp.php: - Smarty_Compiler.class.php - -2004-04-15 Messju Mohr - - * NEWS - libs/core/core.write_compiled_include.php: - made smarty_core_write_compiled_include() php5-aware - - if someone knows a better way than patching the source with the - tokenizer, please stand up! - -2004-04-14 Nuno Lopes - - * docs/Makefile.in: - remove file-entities.ent also - - * docs/.cvsignore - docs/Makefile.in - docs/README: - allow make revcheck - -2004-04-13 Nuno Lopes - - * docs/configure.in: - do not need inipath - -2004-04-13 Mehdi Achour - - * docs/TODO: - done - - * docs/configure.in - docs/manual.xml.in: - now the files entites are generated dynamically - -2004-04-12 Messju Mohr - - * NEWS - libs/Config_File.class.php - libs/Smarty.class.php: - removed unused functionality to load a subset of lines from a file in - Smarty::_read_file() - - additionally removed a warning that is emitted since php-4.3.5 when - fread() is called on an empty file (with filesize()==0). thanks to - Andreas Streichardt who pointed this out. - - * NEWS - libs/core/core.is_secure.php: - smarty_core_is_secure() only checks the file for readability now, not - the directory where is in. - - * libs/Smarty.class.php: - removed unused security_setting 'ALLOW_CONSTANTS' - -2004-04-07 Messju Mohr - - * libs/plugins/function.assign_debug_info.php - libs/plugins/function.cycle.php - libs/plugins/function.mailto.php: - removed trailing spaces - - * libs/Smarty.class.php: - removed unused $smarty->_error_msg - -2004-04-04 Nuno Lopes - - * docs/configure.in: - fixing my crap - put build_date back on-line - -2004-04-03 Nuno Lopes - - * docs/Makefile.in - docs/configure.in - docs/manual.xml.in: - trying to fix ru problems - -2004-03-30 Monte Ohrt - - * libs/core/core.display_debug_console.php: - fix problem with debug_tpl path and security - - * NEWS - libs/core/core.display_debug_console.php: - fix problem displaying debug console when $default_resource_type is not - "file:" - -2004-03-29 Mehdi Achour - - * docs/TODO: - and finally, add a TODO here - - * docs/de/bookinfo.xml - docs/de/manual.sgml - docs/fr/bookinfo.xml - docs/fr/manual.xml: - translate bookinfo.xml and put back the translators - -2004-03-28 Mehdi Achour - - * docs/manual.xml.in: - add global.ent and define some general entities - - * docs/de/bookinfo.xml - docs/de/getting-started.xml - docs/de/language-defs.ent - docs/de/preface.xml: - add new de files - - * docs/de/appendixes.sgml - docs/de/designers.sgml - docs/de/getting-started.sgml - docs/de/html-common.dsl - docs/de/preface.sgml - docs/de/programmers.sgml: - drop old de files - - * docs/fr/bookinfo.xml - docs/fr/getting-started.xml - docs/fr/manual.xml - docs/fr/preface.xml: - add ommited files - - * docs/fr/language-defs.ent: - split the french dir - - * docs/fr/appendixes.sgml - docs/fr/designers.sgml - docs/fr/getting-started.sgml - docs/fr/html-common.dsl - docs/fr/manual.sgml - docs/fr/preface.sgml - docs/fr/programmers.sgml: - drop old french files - - * docs/manual.xml.in: - let's put the new build system - -2004-03-26 Mehdi Achour - - * docs/de/common.dsl - docs/de/html.dsl - docs/fr/common.dsl - docs/fr/html.dsl - docs/fr/php.dsl: - not needed anymore - -2004-03-24 Nuno Lopes - - * docs/Makefile.in: - updated stylesheets - highlight PHP automatically - - * docs/Makefile.in - docs/html.dsl: - remove unneeded file - -2004-03-23 Nuno Lopes - - * docs/version.ent.in: - remove this also - - * docs/getting-started.sgml: - remove this one too - - * docs/appendixes.sgml - docs/common.dsl - docs/designers.sgml - docs/html-common.dsl - docs/manual.sgml - docs/php.dsl - docs/preface.sgml - docs/programmers.sgml: - removing uneeded files - - * docs/.cvsignore: - commiting missing files for docbook - - * docs/.cvsignore - docs/Makefile.in - docs/configure.in - docs/manual.xml.in: - bundling docbook 4 - now make and make web works - -2004-03-23 Messju Mohr - - * NEWS - libs/plugins/function.config_load.php: - unrolled call to the is_compiled()-check to be able to supply the - correct resource_base_path for config_load. this avoids errors when - config-files are accessed where security is enabled. - - thanks to shuther for pointing out this bug. - -2004-03-20 Nuno Lopes - - * docs/manual.xml.in: - fix build date - -2004-03-18 Messju Mohr - - * libs/core/core.is_secure.php: - removed merging of $smarty->template_dir into $smarty->secure_dir - - the resource_base_path is considerd secure instead. this change should - have absolutely no impact on smarty's security's behaviour - -2004-03-18 Nuno Lopes - - * docs/configure.in: - correcting non-existent var - - * docs/.cvsignore - docs/Makefile.in - docs/configure.in - docs/manual.xml.in - docs/version.ent.in: - generate build date - - * docs/.cvsignore - docs/Makefile.in - docs/README - docs/configure.in - docs/manual.xml.in: - new build/test system - -2004-03-18 Messju Mohr - - * libs/Smarty.class.php: - moved setting of a default resource_base_path from - Smarty::_parse_resource_name() to Smarty::_fetch_resource_info() - - this shouldn't affect anything, since all calls to - _parse_resource_name() that are not done from within - _fetch_resource_info() all pass their own resource_base_path - -2004-03-17 Messju Mohr - - * NEWS - libs/Smarty.class.php: - removed '.' from the list of default resource_base_paths in - _parse_resource_name() - - this should only affect _parse_resource_name() for templates, not for - php-resources and not for config_files. the latter pass two their own - resource_base_path. - -2004-03-16 Mehdi Achour - - * docs/appendixes.sgml - docs/getting-started.sgml - docs/preface.sgml: - adding editor comments - - * docs/appendixes.sgml - docs/getting-started.sgml: - cleaning words spacing, killing tabulations, using roles for - programlisting.. - -2004-03-15 Messju Mohr - - * libs/Smarty.class.php: - simplified Smarty::clear_all_cache(); - -2004-03-12 boots - - * docs/programmers.sgml: - Updated is_cached prototype to indicate proper return type. (thanks to - Geoffrey Hoffman) - -2004-03-11 Messju Mohr - - * libs/core/core.assemble_plugin_filepath.php: - fixed little bug that prevented plugins filepaths that are found in - php's include_path (and not in one of the plugins_dirs) from being - cached in the internal plugins-filepath-cache - -2004-03-01 Monte Ohrt - - * docs/designers.sgml: - update include_php docs:wq - :q - - * docs/appendixes.sgml: - update componentized template example to something useful - -2004-02-24 Messju Mohr - - * NEWS - libs/Smarty.class.php: - _parse_resource_name() returned true on non-existant absolute - paths. This caused a warning on _fetch_resource_info() when used in - conjunction with template_exists(). It should be fixed now without - negative effects. - -2004-02-24 Monte Ohrt - - * docs/designers.sgml: - one more typo - - * docs/designers.sgml: - fix typo - -2004-02-24 Messju Mohr - - * NEWS - libs/core/core.is_secure.php: - smarty_resource_*_secure got &$smarty passed errornously as 3rd - parameter and not as 2nd. this is fixed. - -2004-02-23 Messju Mohr - - * NEWS: - fix handling of integer values like width and delay im - smarty_function_popup() - - * libs/plugins/function.popup.php: - fixed handling of integer-attributes - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - updated version to 2.6.3-dev - -2004-02-22 Messju Mohr - - * libs/plugins/function.html_select_date.php: - removed notice on html_select_date with the month_empty-attribute - - * libs/plugins/function.mailto.php: - removed 2 notices of undefined vars (thanks Cit) - -2004-02-17 Monte Ohrt - - * NEWS: - add header - - * (Smarty_2_6_2) - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - change some info in headers, remove fluff - -2004-02-13 Messju Mohr - - * NEWS - libs/plugins/function.html_select_date.php: - correctly handle partially empty dates (like "2004--" or "-12-"). - - * docs/programmers.sgml: - learned something about and sgml and applied this to the - use.sub.dirs-section :) - - * docs/designers.sgml: - changed attribute-name "checked" to "selected" in the docs for - html_radios and html_checkboxes. "checked" is deprecated for ages - AFAIK and selected is recommended for consistency with {html_options} - - * docs/programmers.sgml: - added note about use_sub_dirs and Smarty-2.6.2 . - fixed markup for section about clear_compiled_tpl() . - -2004-02-12 Messju Mohr - - * NEWS - libs/Config_File.class.php: - YES and NO should not be booleanized inside triple-quotes in a - config-file. this behaviour changed by accident in 2.6.1 and is now - reverted to pre-2.6.1 behaviour - -2004-02-10 Messju Mohr - - * NEWS - libs/Config_File.class.php: - fixed slurping of a the next line following a triple-quoted value in a - config-file - -2004-02-07 Messju Mohr - - * libs/Config_File.class.php: - avoid @-operator for handling empty lines in Config_File.class.php - - * libs/Smarty_Compiler.class.php: - removed two notices from Smarty_Compiler::_parse_is_expr() - (thanks shuther!) - - * NEWS - libs/Smarty.class.php: - changed default for use_sub_dirs to false - - * libs/plugins/function.mailto.php: - removed notice of undefined variable. (thanks shuther!) - -2004-01-29 Messju Mohr - - * libs/Smarty_Compiler.class.php: - added file and line-number-information to error-messages regarding - assigned objects an an error messages regarding modifiers with - security. - -2004-01-27 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed use of temporary var $_params in compiled code of block-plugins - - * NEWS - libs/plugins/function.popup.php: - fixed quoting of values in smarty_function_popup() - -2004-01-25 Messju Mohr - - * docs/programmers.sgml: - documented parameters of Smarty::clear_compiled_tpl() - - * libs/Smarty_Compiler.class.php: - Smarty_Compiler::_syntax_error() uses Smarty::_trigger_fatal_error() now - instead of the trigger_error()-function - - * libs/Smarty.class.php: - Smarty::_trigger_fatal_error() uses Smarty::trigger_error() now, - instead of the native trigger_error()-function - - * libs/Smarty_Compiler.class.php: - unrecognized custom-functions trigger an error at compile now, not at - display-time. - -2004-01-23 Monte Ohrt - - * docs/getting-started.sgml: - reword a paragraph - -2004-01-22 Messju Mohr - - * libs/plugins/function.config_load.php: - removed emission of unnecessary notices for unavailable config-files - in config_load() - - * NEWS - libs/Config_File.class.php: - fixed handling of hidden sections in Config_File - -2004-01-21 Messju Mohr - - * NEWS - libs/plugins/function.config_load.php: - added handling of resources for {config_load} - -2004-01-19 Messju Mohr - - * NEWS - libs/plugins/function.html_table.php: - fixed bug when using arrays with tr_attr and td_attr in {html_table} - -2004-01-16 Monte Ohrt - - * NEWS: - add unit testing - - * NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers, add initial unit test directory - - * (Smarty_2_6_1) - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers for 2.6.1 release - -2004-01-16 Messju Mohr - - * (Smarty_2_6_1) - NEWS - docs/programmers.sgml - libs/Smarty.class.php: - renamed $smarty->tpl_rror_reporting to $smarty->error_reporting - "tpl_" is a bit redundant here (it's a TemPLate-engine overall :) - -2004-01-15 Messju Mohr - - * libs/plugins/function.html_image.php: - forgot to remove duplicate is_secure()-check - - * NEWS - libs/plugins/function.html_image.php: - fix: $smarty->security is now correctly handled - - minor optimizations: - core/core.is_secure.php is only included when needed - $dpi_default is only determined when needed - -2004-01-14 Messju Mohr - - * docs/appendixes.sgml - docs/programmers.sgml: - removed suggestions to use extract() from the manual - - * docs/designers.sgml: - fixed typo - -2004-01-12 Messju Mohr - - * docs/designers.sgml: - mention SCRIPT_NAME below {$smarty} reserved variable because it got - lost in the docs for $smarty->global_assign - - * docs/designers.sgml: - added docs for {$smarty.version} special variable - - * docs/programmers.sgml: - removed docs for $global_assign - - * docs/programmers.sgml: - added docs for tpl_error_reporting - - * docs/designers.sgml: - added docs for year_empty-, month_empty- and day_emtpy-attributes of - html_select_date. maybe an example is needed to better explain empty - values in YYY-MM-DD. - -2004-01-10 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed handling of {php}-tags - -2004-01-10 Monte Ohrt - - * docs/designers.sgml: - fix html_checkboxes examples - -2004-01-08 Messju Mohr - - * NEWS - libs/core/core.assemble_plugin_filepath.php: - added caching of requested paths to smarty_core_assemble_plugin_filepath() - - * NEWS: - fix handling of comments inside {php}- and {literal}-blocks - - * libs/Smarty_Compiler.class.php: - fixed handling of comments inside {php} and {literal} - -2004-01-06 Messju Mohr - - * NEWS - libs/Config_File.class.php: - fixed bug handling triple-quotes in config-files - - * libs/Config_File.class.php: - fixed bugs with triple-quotes in config-files - thanks BRDude for finding them testing! - -2004-01-02 Messju Mohr - - * libs/Smarty.class.php: - removed unnecessary param in call to _fetch_resource_info() - -2003-12-30 Messju Mohr - - * libs/Smarty.class.php: - oops! removed tabs. - -2003-12-27 Messju Mohr - - * NEWS - libs/Smarty.class.php: - made $SCRIPT_NAME available again - changes default for request_use_auto_global to prefer autoglobals - - * libs/Smarty.class.php: - removed tabs and trailing spaces - - * NEWS - libs/Smarty_Compiler.class.php: - readded default_modifiers. who removed that? - -2003-12-23 Monte Ohrt - - * NEWS: - add portuguese docs - -2003-12-22 Monte Ohrt - - * docs/designers.sgml: - fix counter example - -2003-12-19 Monte Ohrt - - * libs/Smarty.class.php: - add debug console persistance feature - -2003-12-19 Messju Mohr - - * libs/plugins/block.textformat.php - libs/plugins/function.html_table.php - libs/plugins/function.popup.php: - removed extract(). enhanced parameter parsing. - - * libs/plugins/function.counter.php - libs/plugins/function.fetch.php - libs/plugins/function.popup_init.php - libs/plugins/modifier.capitalize.php - libs/plugins/modifier.cat.php - libs/plugins/modifier.date_format.php - libs/plugins/modifier.debug_print_var.php - libs/plugins/modifier.escape.php - libs/plugins/modifier.indent.php - libs/plugins/modifier.lower.php - libs/plugins/modifier.nl2br.php - libs/plugins/modifier.strip.php - libs/plugins/modifier.upper.php - libs/plugins/modifier.wordwrap.php - libs/plugins/outputfilter.trimwhitespace.php - libs/plugins/shared.escape_special_chars.php: - removed tabs. fixed indentiation. - - * libs/plugins/modifier.truncate.php: - removed tabs - - * libs/plugins/function.counter.php - libs/plugins/function.cycle.php: - removed extract() from parameter-parsing - -2003-12-17 Messju Mohr - - * libs/plugins/function.html_select_date.php: - fix plugin-name in error message - - * libs/plugins/function.html_select_time.php: - remove extract-call from {html_select_time} - - * NEWS - libs/plugins/function.html_select_date.php: - allow single-digit days and months without smarty_make_timestamp() - this makes dates like "1968-11-6" work correctly since no strtotime() - is involved - - add warning when unknown parameter is passed - -2003-12-16 Messju Mohr - - * NEWS - libs/Smarty.class.php: - fix headers sent erroneously with cache_modified_check and fetch() - -2003-12-12 Monte Ohrt - - * libs/plugins/function.config_load.php: - move set_path() call below the conditional bracket - - * NEWS - libs/plugins/function.config_load.php: - fix config_load filepath bug - -2003-12-12 boots - - * docs/designers.sgml: - Updated language.function.if with additional annotation and to fix error - that broke docs build process - -2003-12-11 Messju Mohr - - * libs/Smarty_Compiler.class.php: - little optimization for "is odd" and "is even" - -2003-12-11 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - fix 'is even by' and 'is odd by' logic - -2003-12-11 Messju Mohr - - * docs/designers.sgml: - update example-output of {mailto} - - * libs/plugins/function.mailto.php: - removed extract-call -> cleaner parameter-handling - - * libs/plugins/function.mailto.php: - fixed indentiation - - * TODO: - removed two done topics - -2003-12-11 boots - - * docs/designers.sgml: - Updated language.function.if to describe qualifiers (thanks andre) - -2003-12-10 Messju Mohr - - * NEWS - libs/plugins/function.html_select_date.php: - added day_empty, month_empty, year_empty and all_empty attributes - to pass an undefined date use {html_select_date time="--" ...} - - * libs/plugins/function.html_select_date.php: - removed extract()-call - - * libs/plugins/function.html_select_date.php: - fixed indetiation - -2003-12-10 boots - - * NEWS - docs/designers.sgml: - Added table to language.function.if to describe qualifiers - -2003-12-09 Messju Mohr - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_options.php: - strict comparason didn't work in all cases. use type-casting now. - - * NEWS - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_options.php: - fix bug when comparing array-keys to "selected" in html_options and - html_checkboxes - - in_array() uses "strict" comparason now. - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_options.php - libs/plugins/function.html_radios.php: - removed tabs, fixed indentiation - -2003-12-08 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - add better checks for correctly nested tags when compiling - -2003-12-04 Messju Mohr - - * libs/Smarty.class.php - libs/plugins/function.html_image.php: - fix: check $smarty->request_use_auto_globals at the last occurences of - HTTP_*_VARS - -2003-12-03 Messju Mohr - - * NEWS - libs/Smarty.class.php: - remove $global_assign property from Smarty and $global_assign-handling - from the constructor. the only visible change is, that $SCRIPT_NAME is - not available in the tempates anymore. $smarty.server.SCRIPT_NAME has - to be used from now. - -2003-12-03 boots - - * docs/designers.sgml: - Fixed example for count_characters - -2003-12-01 boots - - * docs/designers.sgml: - Added section "Escaping Smarty Parsing" under Basic Syntax. - -2003-12-01 Messju Mohr - - * libs/core/core.create_dir_structure.php: - thought again about my latest commit and backed it out. - - * libs/core/core.create_dir_structure.php: - fix root-dir-handling on windows filepath - -2003-11-29 boots - - * libs/plugins/function.config_load.php: - really make the fixes the last patch was supposed to do - - * libs/plugins/function.config_load.php: - removed tabs and killed trailing white-space - - * libs/plugins/function.config_load.php: - changed $smarty->_syntax_error to $smarty->trigger_error - -2003-11-27 Messju Mohr - - * NEWS - libs/plugins/modifier.debug_print_var.php: - remove warning in debug_print_var on php-resources - - * README: - fix version number - -2003-11-26 Messju Mohr - - * libs/Smarty_Compiler.class.php: - raise max_level for $smarty.config... to 3 to allow arrays of config-vars - -2003-11-25 Messju Mohr - - * libs/Smarty.class.php: - changed version-tag to indicate incompatibility to older compiled - templates - -2003-11-24 Messju Mohr - - * NEWS - libs/plugins/compiler.assign.php - libs/plugins/function.assign.php: - move function.assign.php to compiler.assign.php - - * libs/core/core.get_include_path.php: - silence occasional warnings of open_basedir- and - safe_mode-restrictions in core.get_include_path.php - -2003-11-23 Messju Mohr - - * libs/core/core.write_compiled_resource.php - libs/core/core.write_file.php: - avoid touch()-ing of recently unlinked files by touch()-ing the - tempfile before rename instead of touch()-ing the resulting file after - rename. - - * NEWS - libs/Smarty.class.php: - add property $tpl_error_reporting - -2003-11-22 Messju Mohr - - * libs/plugins/function.assign.php: - remove use of extract() in smarty_function_assign() - - * NEWS - libs/Smarty.class.php: - remove property $undefined. "null" is used literally instead - -2003-11-21 Messju Mohr - - * libs/Smarty_Compiler.class.php: - remove two E_NOTICES - -2003-11-20 Messju Mohr - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - change version to 2.6.1-dev - -2003-11-19 Monte Ohrt - - * (Smarty_2_6_0) - NEWS: - update NEWS file - - * (Smarty_2_6_0) - docs/designers.sgml - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - change version numbers to 2.6.0 - -2003-11-19 Messju Mohr - - * docs/designers.sgml - docs/de/designers.sgml - docs/fr/designers.sgml: - fix examples of escape-modifier (in docs, docs/de and docs/fr !) - -2003-11-18 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - move Smarty::quote_replace() to Smarty_Compiler::_quote_replace() - - * libs/Smarty.class.php: - removed extract-calls from _include()- and _eval()-wrappers - variables passed with {include_php} have to accessed as members of $params - now - -2003-11-17 Messju Mohr - - * docs/designers.sgml: - fixed typo - -2003-11-13 Messju Mohr - - * libs/Config_File.class.php: - fix occasional notice - -2003-11-13 andreas halter - - * docs/de/designers.sgml: - - added cat modifier, thanks messju :-) - -2003-11-13 Monte Ohrt - - * (Smarty_2_6_0-RC3) - NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - commit RC3 tags - -2003-11-13 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fix handling of $var.key inside [] - - * libs/Smarty.class.php: - fix unnecessary loading of core.load_resource_plugin.php - - * (Smarty_2_6_0-RC3) - docs/fr/designers.sgml: - fixed example of html_table - -2003-11-11 Messju Mohr - - * NEWS - libs/core/core.process_cached_inserts.php: - fix handling of assign inside {insert}-tags - -2003-11-06 Messju Mohr - - * libs/core/core.read_cache_file.php: - added $exp_time-parameter - - * docs/programmers.sgml: - added $exp_time to cache_handler_func-example - - * libs/Smarty.class.php - libs/core/core.write_cache_file.php: - added $exp_time-parameter of clear_cache() and clear_all_cache() to - cache_handler_func. - -2003-11-05 Messju Mohr - - * NEWS - libs/Config_File.class.php: - fix handling if [...] inside triple-quotes in config-files - -2003-11-04 Messju Mohr - - * libs/Smarty.class.php: - fixed little bug in _parse_resource_name() (jlgunter, messju) - -2003-11-03 andreas halter - - * docs/designers.sgml - docs/de/designers.sgml - docs/fr/designers.sgml: - - changed Smarty.php.class occurences to Smarty.class.php - -2003-10-29 boots - - * docs/appendixes.sgml - docs/designers.sgml - docs/manual.sgml - docs/programmers.sgml - docs/de/appendixes.sgml - docs/de/designers.sgml - docs/de/programmers.sgml - docs/fr/appendixes.sgml - docs/fr/designers.sgml - docs/fr/getting-started.sgml - docs/fr/manual.sgml - docs/fr/preface.sgml - docs/fr/programmers.sgml: - Fixes to documentation syntax so that all content can be processed used - xsltproc docbook-xsl tools. In particular, fixes unescaped entities, - broken tags, unquoted attributes. - -2003-10-27 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fix handling of simple-math-operators inside modifiers - -2003-10-25 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed unused property _output_type - removed unused param $tag_attrs of _parse_var_props() - cleaned up alignment of class-properties - -2003-10-23 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed notice in php-tag handling in Smarty_Compiler::_compile_file() - - * libs/Smarty_Compiler.class.php: - removed two occasional E_NOTICES from - Smarty_Compiler::_compile_include_php_tag() - - * NEWS - libs/core/core.create_dir_structure.php: - fix handling of trailing-slashes in open_basedir in - smarty_core_create_dir_structure() - -2003-10-20 Messju Mohr - - * libs/Smarty_Compiler.class.php: - elements inside `` are bracketed now inside the compiled-tpl. this - fixes some issues with simple-math inside backticks. - -2003-10-16 Monte Ohrt - - * docs/designers.sgml: - update overlib docs, no working examples - -2003-10-12 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.is_secure.php: - move check for template_dir in secure_dir-array into core.is_secure.php - - this makes template_exists() work correctly with security=true even if - template_dir is not inside the secure_dir-array - -2003-10-11 Messju Mohr - - * libs/plugins/shared.make_timestamp.php: - tightened check for YYYYMMDDHHMMSS-format. thanks konstantin for - pointing this out. - - removed a few tabs. - - * libs/Smarty_Compiler.class.php: - fix precedence of simple-math-operators before modifiers. - thanks dominik! - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.assemble_plugin_filepath.php - libs/core/core.assign_smarty_interface.php - libs/core/core.create_dir_structure.php - libs/core/core.display_debug_console.php - libs/core/core.get_include_path.php - libs/core/core.get_microtime.php - libs/core/core.get_php_resource.php - libs/core/core.is_secure.php - libs/core/core.is_trusted.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php - libs/core/core.process_cached_inserts.php - libs/core/core.process_compiled_include.php - libs/core/core.read_cache_file.php - libs/core/core.rm_auto.php - libs/core/core.rmdir.php - libs/core/core.run_insert_handler.php - libs/core/core.smarty_include_php.php - libs/core/core.write_compiled_include.php - libs/core/core.write_compiled_resource.php - libs/core/core.write_file.php: - removed tabs from the main and the core/*.php files - -2003-10-08 Monte Ohrt - - * (Smarty_2_6_0-RC2) - NEWS - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - update version numbers to RC2 - -2003-09-18 Messju Mohr - - * docs/designers.sgml - docs/de/designers.sgml: - fixed description of cycle's advance-attribute - -2003-09-16 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - apply modifiers only once to section-loop and foreach-from attributes - -2003-09-15 Messju Mohr - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.write_cache_paths_file.php: - backed out _smarty_cached_paths-file-handling - - * libs/Smarty.class.php - libs/core/core.rm_auto.php: - fixed clear_compiled_tpl with explicit $tpl_file given - fixed return value of smarty_core_rm_auto() + Smarty::_unlink() - - * libs/Smarty.class.php: - little fix in _get_auto_filename() - -2003-09-14 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.assemble_auto_filename.php: - removed auto-filenames from path-cache. merged assemble_auto_filename - back into Smarty::_get_auto_filename() - -2003-09-12 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed quoting of modifier parameters - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.get_php_resource.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php: - remove Smarty::_plugin_implementation_exists() - use php's native - is_callable() - -2003-09-11 Messju Mohr - - * libs/Smarty.class.php: - silenced two notices acces HTTP_SERVER_VARS - -2003-09-10 andreas halter - - * docs/de/designers.sgml - docs/de/getting-started.sgml - docs/de/programmers.sgml: - - minor fixes (2 rep), slight wording changes - - jade transform problem fixed - -2003-09-08 andreas halter - - * docs/de/designers.sgml - docs/de/getting-started.sgml - docs/de/manual.sgml - docs/de/preface.sgml - docs/de/programmers.sgml: - all updated for 2.6.0 release, translated everything from 2_5_0 branch to - 20030908 - -2003-09-04 Messju Mohr - - * libs/Smarty.class.php: - proper checking for files in _fetch_resource_info() - -2003-09-02 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - ignore {strip}/{/strip) inside {strip}-blocks - - * libs/plugins/function.mailto.php: - fixed 2 notices in smarty_function_mailto() - -2003-09-01 Messju Mohr - - * libs/Smarty.class.php: - re-include cache_paths on multiple calls to fetch() to avoid - inconsistencies - at multiple calls to fetch() in one script - - * libs/Smarty_Compiler.class.php: - fixed handling of \r in {strip} - renamed $_trailing_lf to $_additional_newline - - * libs/Smarty_Compiler.class.php: - the weekly fix for {strip} :) - - * docs/designers.sgml: - fixed example for simple math. - -2003-08-29 Messju Mohr - - * libs/core/core.assign_smarty_interface.php - libs/core/core.display_debug_console.php - libs/plugins/function.assign.php - libs/plugins/function.html_options.php - libs/plugins/function.html_table.php: - fixed PHPDocumentor-comments (thanks Konstantin) - - * libs/core/core.rmdir.php: - made rmdir a bit more optimistic. especially it now removes - directories correctly that where created accidently by "safe_mode=On - && $use_sub_dirs=true" - -2003-08-27 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed removal of leading/trailing newlines in {strip}-blocks - -2003-08-25 Messju Mohr - - * INSTALL: - added note emphasizing the introduction of "libs/" with 2.5.0 - - * NEWS - libs/plugins/modifier.escape.php: - fixed proper escaping of " and ' with escape:javascript - -2003-08-22 Messju Mohr - - * NEWS - libs/core/core.assemble_plugin_filepath.php: - fixed bug in traversal of $smarty->plugins_dir-array in - smarty_core_assemble_plugin_filepath(). the first matching plugin in - the path should be used, not the last one. - - * libs/core/core.read_cache_file.php: - discard $_cache_info when the cache should be regenerated - -2003-08-20 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php - libs/plugins/block.strip.php: - reverted {strip} from a block-plugin back into the compiler - - * docs/programmers.sgml: - fixed examples for register_function() and register_block() - - * libs/Smarty.class.php: - made template_exists() quiet when the template does not exist (thanks - to konstatin for pointing this out) - -2003-08-18 Monte Ohrt - - * docs/getting-started.sgml: - fix example title - - * docs/README - docs/getting-started.sgml: - change installation wording confusion - -2003-08-18 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.read_cache_file.php: - fixed unnecessary load of source in template_exists() and the - compile-check of smarty_core_read_cache_file() - - * libs/Smarty_Compiler.class.php: - allow section-, array- and object-dereference in $smarty-references - -2003-08-15 Messju Mohr - - * docs/designers.sgml: - added parameter-descriptions for count_characters (thanks Konstantin - A. Pelepelin) - - fixed docs for {html_checkboxes} - -2003-08-14 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.read_cache_file.php: - fixed timestamp-check of config-files in smarty_core_read_cache_file() - - * libs/Smarty.class.php: - fixed typecasting for arrays in _parse_resource_name() - - * NEWS - libs/plugins/function.config_load.php: - fixes in config_load: - - handling of section-attribute - - reusing the same config-file multiple times - - serialization of config-data for php<4.2.0 (no var_export) - - many thanks to atu for pointing this out and for testing - -2003-08-13 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.smarty_include_php.php: - fixed problem with vars as attributes in {include_php} - -2003-08-13 Monte Ohrt - - * docs/README: - commit README file for documentation compiling - -2003-08-13 Messju Mohr - - * libs/debug.tpl - libs/plugins/modifier.debug_print_var.php: - removed '\r' from debug_print_vars' output - properly escape vars in javascript-version of debug.tpl - -2003-08-11 Monte Ohrt - - * (Smarty_2_6_0_RC1) - NEWS - docs/designers.sgml - docs/html.dsl - docs/php.dsl - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - get ready for 2.6.0-RC1 release - -2003-08-10 Messju Mohr - - * NEWS - libs/Smarty.class.php: - fixed status-header for cache_modified_check under cgi-sapi - -2003-08-09 Messju Mohr - - * libs/core/core.is_secure.php - libs/core/core.is_trusted.php: - synced secure_dir-checking with trusted_dir-checking - - * libs/core/core.is_secure.php: - tightenend path checking in smarty_core_is_secure() - -2003-08-08 Messju Mohr - - * libs/Smarty.class.php: - fix: proper nesting of $smarty->_cache_including flag in cascaded - cached/not-cached/fetched/inserted/foo-templates - - * libs/debug.tpl: - better escaping for $_debug_tpls[templates].filenames - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - removed redundant $smarty from Smarty::_smarty_include() - - * libs/debug.tpl: - proper escaping of filenames in debug-console (thanks to prossel). - -2003-08-07 Messju Mohr - - * docs/programmers.sgml: - added docs for block-methods of registered objects - - * docs/programmers.sgml: - fixed typo in example for registered objects - - * docs/designers.sgml: - fixed exampls of html_image and html_checkboxes - - * libs/plugins/function.debug.php: - fixed {debug} and removed tabs in function.debug.php - - * docs/programmers.sgml: - fixed example for register_object - - * docs/designers.sgml - docs/programmers.sgml: - updated docs for capture, html_table, html_image and register_object - -2003-08-07 Monte Ohrt - - * docs/designers.sgml - docs/programmers.sgml: - add math and default_resource_type to docs - - * docs/getting-started.sgml: - add core to example, add tech note - -2003-08-07 Messju Mohr - - * docs/manual.sgml - docs/fr/manual.sgml: - upd copyright in the docs - -2003-08-07 Monte Ohrt - - * docs/getting-started.sgml: - added core directory to install instructions - -2003-08-07 Messju Mohr - - * docs/designers.sgml - docs/programmers.sgml: - added docs for php-functions as modifiers - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - better caching of attributes for $cacheable=false-plugins - - * docs/programmers.sgml: - added section "caching.cacheable" to the docs, explaining the usage of - the $cacheable-flag of the register_(block|compiler|function)-functions - - * libs/Smarty_Compiler.class.php: - fixed output of custom-functions with cached attributes - - * docs/programmers.sgml: - docs update on callbacks to the register_*-functions - -2003-08-06 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.process_compiled_include.php: - added optional parameter $cache_attrs to register_function() and - register_block(). $cache_attrs is an array containing attribute- names - that should be cached on calls to functions that have $cacheable set - to false. - - * libs/Smarty.class.php: - fixed bug in _run_mod_handler - - * libs/Smarty_Compiler.class.php: - fixed bug with autoload-handling of modifiers. thanks ndre. - -2003-08-05 Messju Mohr - - * libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - updated copyright notice - - * libs/Smarty.class.php - libs/core/core.load_plugins.php: - fixed bug that occurred when using the same not-cacheable plugin in - multiple includes - - * docs/programmers.sgml: - docs-update for plugins.writing - -2003-08-04 Messju Mohr - - * docs/designers.sgml - docs/programmers.sgml: - updated docs for register_block_function(), block-functions, - $request_use_auto_globals and html_checkboxes - -2003-07-31 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - enabled registration of class-methods as callbacks for the - register_*-functions - - use: array('classname', 'method_name')) as callback - -2003-07-29 Messju Mohr - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - modifiers are resolved at compile-time now. _run_mod_handler() is - still used for modifiers with map_array=true (== no preceeding '@') - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.smarty_include.php: - moved _smarty_include() back into Smarty.class.php - - * libs/Smarty.class.php - libs/core/core.load_plugins.php: - prevent unnecessary calls to _read_file() in _is_compiled() - converted method-call to internal function-call in - smarty_core_load_plugins() - -2003-07-28 Messju Mohr - - * libs/Smarty_Compiler.class.php: - quote smarty-header properly to prevent resource-names from escaping from - the comment - -2003-07-25 Messju Mohr - - * libs/core/core.create_dir_structure.php: - weakend race-condition and removed bogus error-message caused by that - in smarty_core_create_dir_structure(). - -2003-07-23 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.display_debug_console.php - libs/core/core.fetch_resource_info.php - libs/core/core.get_php_resource.php - libs/core/core.parse_resource_name.php - libs/core/core.process_cached_inserts.php - libs/core/core.read_cache_file.php - libs/core/core.run_insert_handler.php - libs/core/core.smarty_include.php - libs/core/core.smarty_include_php.php - libs/plugins/function.eval.php: - moved _fetch_resource_info and _parse_resource_name back into - Smarty.class.php - renamed smarty_include and smarty_eval wrappers to _include and _eval - -2003-07-17 Messju Mohr - - * libs/core/core.process_compiled_include.php - libs/core/core.read_cache_file.php: - improved checking of compiled_include against cached-template with - non-cached-chunks - - * libs/core/core.write_compiled_include.php: - fixed too short open-tag - - * libs/plugins/function.eval.php: - fixed assign parameter for eval (must have gotton lost on its way to 2.5.0) - cleaned up indentiation - -2003-07-03 Messju Mohr - - * libs/Smarty_Compiler.class.php: - resurrected $foo->$bar syntax - - * libs/Smarty_Compiler.class.php: - i'm so stupid. kick me. - - * libs/Smarty_Compiler.class.php: - fixed initialisation of $this->_plugins in compile_block_tag() - -2003-07-03 Monte Ohrt - - * libs/Config_File.class.php: - add preg_quote delimiter - -2003-07-03 Messju Mohr - - * libs/Smarty_Compiler.class.php: - applied fix for {$var1->p1|modifier:$var2->p2}-syntax - thanks Dominik - -2003-07-02 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed duplicate generation of arg-list in _compile_block_tag() - - * libs/Smarty_Compiler.class.php: - fixed off-by-one-error in nocache-tag-handling - -2003-06-30 Messju Mohr - - * libs/Smarty_Compiler.class.php: - backed out errornously committed support for $foo->$bar - - * libs/core/core.write_file.php: - fixed indentiation, silenced occasional warning - - * libs/plugins/function.html_image.php: - match first character of file-attribute against "/" instead of - DIRECTORY_SEPARATOR since it is a url-path and not a file-path. - - * libs/Smarty_Compiler.class.php - libs/core/core.write_file.php - libs/plugins/function.html_image.php: - libs/plugins/function.html_image.php - - * libs/Smarty_Compiler.class.php: - re-fixed cacheable_state-handling - - * libs/core/core.display_debug_console.php - libs/core/core.process_cached_inserts.php - libs/core/core.process_compiled_include.php - libs/core/core.run_insert_handler.php: - extincting $this out of smarty_core_*-functions - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - fixed handling of nocache-state - -2003-06-29 Messju Mohr - - * libs/Smarty.class.php - libs/core/core.smarty_include.php - libs/core/core.smarty_include_php.php - libs/plugins/function.eval.php: - removed $this from smarty_include and smarty_include_php - added cleaner handling of $this to {eval} - - * libs/core/core.load_resource_plugin.php: - fixed inlude_once-call - - * docs/de/designers.sgml - docs/fr/designers.sgml: - fixed examples of html_radios and html_checkboxes in german and french docs - -2003-06-25 Monte Ohrt - - * libs/core/core.assemble_auto_filename.php - libs/core/core.write_cache_paths_file.php: - fix typo, fix write_cache_paths logic - - * libs/Smarty.class.php - libs/core/core.assemble_auto_filename.php: - fix SMARTY_COMPILE_DIR_SEP problem, make local var - -2003-06-24 Monte Ohrt - - * libs/Smarty.class.php - libs/core/core.assemble_auto_filename.php - libs/core/core.write_cache_paths_file.php: - fixed cache_paths bug, simplified filename assembly logic - -2003-06-24 Messju Mohr - - * libs/plugins/function.html_image.php: - added parsing of forgotton param "basedir" - - * libs/Smarty_Compiler.class.php: - fixed $smarty.get-reference - - * libs/plugins/block.textformat.php: - removed warning - - * libs/Smarty_Compiler.class.php: - fixed value of _cacheable_state on compiler-startup - -2003-06-23 Monte Ohrt - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.write_cache_paths_file.php: - make cache_path per resource, fix a couple directory path issues - -2003-06-23 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed warning when compiling empty template - - * libs/core/core.write_compiled_include.php: - fixed bug in write_compiled_include - - * libs/core/core.assemble_plugin_filepath.php: - fixed warning - -2003-06-22 Messju Mohr - - * libs/plugins/function.eval.php: - fixed propagation of $this into evald code in smarty_function_eval() - - * libs/core/core.write_cache_paths_file.php - libs/core/core.write_compiled_include.php: - fix in compiled-include-handling - - * libs/core/core.assemble_auto_filename.php - libs/core/core.assemble_plugin_filepath.php - libs/core/core.assign_smarty_interface.php - libs/core/core.create_dir_structure.php - libs/core/core.fetch_resource_info.php - libs/core/core.get_include_path.php - libs/core/core.get_microtime.php - libs/core/core.get_php_resource.php - libs/core/core.is_secure.php - libs/core/core.is_trusted.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php - libs/core/core.parse_resource_name.php - libs/core/core.read_cache_file.php - libs/core/core.rm_auto.php - libs/core/core.rmdir.php - libs/core/core.write_cache_file.php - libs/core/core.write_cache_paths_file.php - libs/core/core.write_compiled_include.php - libs/core/core.write_compiled_resource.php - libs/core/core.write_file.php - libs/plugins/modifier.date_format.php: - started moving from $this to $smarty in core.*.php - -2003-06-21 Monte Ohrt - - * libs/core/core.create_dir_structure.php - libs/core/core.write_file.php - libs/plugins/function.config_load.php: - fix more dir paths - - * NEWS - libs/Smarty.class.php - libs/core/core.assemble_auto_filename.php - libs/core/core.assemble_plugin_filepath.php - libs/core/core.fetch_resource_info.php - libs/core/core.get_php_resource.php - libs/core/core.parse_resource_name.php - libs/core/core.process_cached_inserts.php - libs/core/core.read_cache_file.php - libs/core/core.rm_auto.php - libs/core/core.rmdir.php - libs/core/core.run_insert_handler.php - libs/core/core.smarty_include.php - libs/core/core.smarty_include_php.php - libs/core/core.write_cache_file.php - libs/core/core.write_cache_paths_file.php - libs/core/core.write_compiled_include.php - libs/core/core.write_compiled_resource.php - libs/core/core.write_file.php - libs/plugins/function.config_load.php - libs/plugins/function.fetch.php - libs/plugins/function.html_image.php: - fix filepaths to core files to use DIRECTORY_SEPARATOR - -2003-06-21 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed {plugin|modifier} syntax - - * libs/Smarty.class.php - libs/core/core.write_compiled_include.php: - fixed compiled include handling - -2003-06-21 Monte Ohrt - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.assemble_auto_filename.php - libs/core/core.assemble_plugin_filepath.php - libs/core/core.write_cache_paths_file.php: - added filepath caching - -2003-06-20 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - update more varnames - - * libs/Smarty.class.php - libs/core/core.display_debug_console.php - libs/core/core.fetch_file_info.php - libs/core/core.fetch_resource_info.php - libs/core/core.get_php_resource.php - libs/core/core.parse_file_path.php - libs/core/core.parse_resource_name.php - libs/core/core.process_cached_inserts.php - libs/core/core.read_cache_file.php - libs/core/core.run_insert_handler.php - libs/core/core.smarty_include.php - libs/core/core.smarty_include_php.php - libs/core/core.write_compiled_resource.php - libs/core/core.write_compiled_template.php - libs/plugins/function.config_load.php: - refactored var naming to better reflect "resource" instead of "file" where - appropriate - -2003-06-19 Messju Mohr - - * libs/Smarty.class.php: - updated version-number to 2.5.0-cvs - - * libs/core/core.write_cache_file.php: - omit is-cache_dir-writable-check if a cache_handler_function is in use - - * libs/core/core.smarty_include_php.php: - fixed comments in smarty_include_php - -2003-06-19 Monte Ohrt - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.display_debug_console.php - libs/core/core.smarty_include.php - libs/plugins/function.eval.php: - split up _compile_template to _compile_file and _compile_source, fix eval - function - VS: ---------------------------------------------------------------------- - - * libs/plugins/function.config_load.php: - fix logic for _is_compiled() - -2003-06-19 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - added optional assign-attribute to {capture}-tag - - * NEWS - libs/Smarty.class.php: - added $cacheable-parameter to register_compiler_function() - -2003-06-18 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.load_plugins.php - libs/core/core.process_compiled_include.php - libs/core/core.read_cache_file.php - libs/core/core.write_cache_file.php - libs/core/core.write_compiled_include.php: - added $cacheable-parameter to register_function() and register_block() - - * libs/Smarty.class.php: - append '.php' to all compiled templates regardless of the settings of - $use_sub_dirs - - * libs/Smarty.class.php - libs/core/core.read_cache_file.php: - fixed $file_path-parameters passed to smarty_core_fetch_file_info() - -2003-06-17 Monte Ohrt - - * NEWS: - fix name - - * libs/Smarty_Compiler.class.php: - change varnames to follow coding methods - - * NEWS - libs/Smarty_Compiler.class.php: - add math patch to core - -2003-06-17 Messju Mohr - - * libs/core/core.smarty_include.php: - switched _process_template() to _is_compiled()-logic - -2003-06-17 Monte Ohrt - - * libs/Smarty.class.php: - fix _is_compiled logic - - * NEWS: - update news file - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - fix _run_mod_handler routine - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.display_debug_console.php - libs/core/core.fetch_file_info.php - libs/core/core.parse_file_path.php - libs/core/core.write_compiled_template.php - libs/plugins/function.config_load.php: - fix path problems, rename some varibles from "template" to "file" - -2003-06-16 Monte Ohrt - - * libs/core/core.fetch_file_info.php - libs/core/core.fetch_template_info.php: - rename file, commit - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.parse_file_path.php - libs/core/core.read_cache_file.php - libs/plugins/block.strip.php - libs/plugins/block.textformat.php - libs/plugins/compiler.config_load.php - libs/plugins/function.config_load.php - libs/plugins/function.eval.php - libs/plugins/function.fetch.php - libs/plugins/function.html_image.php: - fix config_load, compile fetched arrays to compile_dir, switch display - back to runtime. clean up var names and function names, split up compile - testing and compiling to separate funcs, rename some template_* functions - to - file_* functions and update logic so they can be used for file resources - other than templates. - -2003-06-16 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed little bug in _compile_custom_tag() - -2003-06-16 Monte Ohrt - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/core/core.assign_smarty_interface.php - libs/core/core.create_dir_structure.php - libs/core/core.display_debug_console.php - libs/core/core.fetch_template_info.php - libs/core/core.get_include_path.php - libs/core/core.get_microtime.php - libs/core/core.get_php_resource.php - libs/core/core.is_secure.php - libs/core/core.is_trusted.php - libs/core/core.load_plugins.php - libs/core/core.load_resource_plugin.php - libs/core/core.parse_file_path.php - libs/core/core.process_cached_inserts.php - libs/core/core.read_cache_file.php - libs/core/core.rm_auto.php - libs/core/core.rmdir.php - libs/core/core.run_insert_handler.php - libs/core/core.smarty_include.php - libs/core/core.smarty_include_php.php - libs/core/core.write_cache_file.php - libs/core/core.write_compiled_template.php - libs/core/core.write_file.php - libs/plugins/core.assign_smarty_interface.php - libs/plugins/core.create_dir_structure.php - libs/plugins/core.display_debug_console.php - libs/plugins/core.fetch_template_info.php - libs/plugins/core.get_include_path.php - libs/plugins/core.get_microtime.php - libs/plugins/core.get_php_resource.php - libs/plugins/core.is_secure.php - libs/plugins/core.is_trusted.php - libs/plugins/core.load_plugins.php - libs/plugins/core.load_resource_plugin.php - libs/plugins/core.parse_file_path.php - libs/plugins/core.process_cached_inserts.php - libs/plugins/core.read_cache_file.php - libs/plugins/core.rm_auto.php - libs/plugins/core.rmdir.php - libs/plugins/core.run_insert_handler.php - libs/plugins/core.smarty_include.php - libs/plugins/core.smarty_include_php.php - libs/plugins/core.write_cache_file.php - libs/plugins/core.write_compiled_template.php - libs/plugins/core.write_file.php: - move core files into their own directory under SMARTY_DIR, - remove abstraction function _execute_core_function - - * libs/Smarty_Compiler.class.php: - fix newline handling for template for all template tags - -2003-06-11 Monte Ohrt - - * libs/plugins/compiler.config_load.php: - add compiler function to cvs repository - -2003-06-11 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - added config-option "request_use_auto_globals" to make auto-globals be - used as request vars instead of HTTP_*_VARS - -2003-06-11 Monte Ohrt - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/function.config_load.php: - make config vars compile statically - -2003-06-11 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - backed out newlines patch - - * NEWS - libs/Smarty_Compiler.class.php: - removed newlines in compiled templates after closing tags - -2003-06-10 Messju Mohr - - * docs/de/designers.sgml: - fixed german note on html_image and disk-access - -2003-06-10 Monte Ohrt - - * libs/plugins/core.parse_file_path.php: - fix bug with resource_type resolving - -2003-06-09 Monte Ohrt - - * docs/designers.sgml: - replace example with more practical one - -2003-06-08 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - added block-methods for registered objects - -2003-06-07 Messju Mohr - - * docs/programmers.sgml: - fixed bug in documentation for $smarty->default_modifiers - -2003-06-06 Monte Ohrt - - * libs/plugins/core.parse_file_path.php: - fix problem with new default_resource_type changes - - * NEWS: - update NEWS file info - - * NEWS - libs/Smarty.class.php - libs/plugins/core.parse_file_path.php: - add default_resource_type, ignore 1 char resource names - - * NEWS - libs/Config_File.class.php: - fix bug where config file starts with hidden section - -2003-06-04 Monte Ohrt - - * NEWS - libs/Smarty.class.php: - -** empty log message *** - -2003-06-03 Monte Ohrt - - * libs/plugins/function.html_image.php: - fix example in code comments - -2003-06-03 Messju Mohr - - * NEWS - libs/plugins/function.counter.php: - fixed behaviour of start=... for {counter} - -2003-06-02 Messju Mohr - - * NEWS - libs/plugins/function.counter.php: - fixed assign for {counter} - -2003-05-30 Monte Ohrt - - * libs/plugins/core.write_cache_file.php - libs/plugins/core.write_compiled_template.php: - add discrete error checking pertaining to $cache_dir - and $compile_dir, their existance and writability - -2003-05-28 Messju Mohr - - * NEWS - libs/plugins/function.html_table.php: - added params vdir, hdir and inner to html_table to allow looping over - the data in various directions - -2003-05-28 Monte Ohrt - - * libs/plugins/core.compile_template.php - libs/plugins/core.display_debug_console.php: - fix problem with security and debug.tpl file - -2003-05-23 Monte Ohrt - - * NEWS: - upd NEWS file - - * libs/Smarty_Compiler.class.php: - allow spaces in literal tags - -2003-05-22 Monte Ohrt - - * docs/fr/programmers.sgml: - fix special chars - -2003-05-19 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - speed up compiled templates, hardcode plugin filepaths instead of - recalculate at runtime - -2003-05-19 Messju Mohr - - * docs/designers.sgml: - fixed example of {html_image} - - * docs/designers.sgml: - fixed typo - -2003-05-12 Messju Mohr - - * libs/Smarty.class.php - libs/plugins/core.read_cache_file.php - libs/plugins/core.smarty_include.php - libs/plugins/function.config_load.php: - fixed multiple redundant occurrences for 'config' and 'template' in - $smarty->_cache_info - -2003-05-10 Messju Mohr - - * libs/plugins/core.create_dir_structure.php: - refurbished create_dir_structure to use '/' internally - - * libs/plugins/core.create_dir_structure.php: - fixed windows absolute-paths in smarty_core_create_dir_structure() - - * libs/plugins/core.create_dir_structure.php: - fixed error-message - -2003-05-09 Messju Mohr - - * libs/Smarty_Compiler.class.php: - fixed warning due to missing param to _execute_core_function() - - * libs/Smarty_Compiler.class.php: - fixed quoting in _compile_include_php - - * libs/Smarty_Compiler.class.php: - fixed quoting of "file"-parameter in _compile_include_tag() - -2003-05-08 Monte Ohrt - - * docs/programmers.sgml: - fix typo - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/core.compile_template.php - libs/plugins/core.create_dir_structure.php - libs/plugins/core.fetch_template_info.php - libs/plugins/core.get_include_path.php - libs/plugins/core.get_microtime.php - libs/plugins/core.get_php_resource.php - libs/plugins/core.is_secure.php - libs/plugins/core.is_trusted.php - libs/plugins/core.load_plugins.php - libs/plugins/core.load_resource_plugin.php - libs/plugins/core.parse_file_path.php - libs/plugins/core.process_cached_inserts.php - libs/plugins/core.read_cache_file.php - libs/plugins/core.rm_auto.php - libs/plugins/core.rmdir.php - libs/plugins/core.run_insert_handler.php - libs/plugins/core.smarty_include.php - libs/plugins/core.smarty_include_php.php - libs/plugins/core.write_cache_file.php - libs/plugins/core.write_compiled_template.php - libs/plugins/core.write_file.php - libs/plugins/function.config_load.php - libs/plugins/function.fetch.php - libs/plugins/function.html_image.php: - abstract more private functions to plugin directory - - * libs/Config_File.class.php: - only add DIRECTORY_SEPARATOR if it isn't already present - - * libs/Config_File.class.php: - fix directory separator code, use DIRECTORY_SEPARATOR - -2003-05-08 Messju Mohr - - * docs/designers.sgml: - fixed example of html_checkboxes - - * NEWS - libs/Smarty.class.php: - fixed bug in _create_dir_structure() when used with - open_basedir-restriction and relative paths - - * docs/designers.sgml: - fixed example for html_radios - -2003-05-07 Monte Ohrt - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php - libs/plugins/core.assign_smarty_interface.php - libs/plugins/core.display_debug_console.php - libs/plugins/function.display_debug_console.php: - abstracted display_debug_console and assign_smarty_interface to plugin dir - as a test - - * libs/Smarty.class.php - libs/plugins/function.display_debug_console.php: - correct misc varnames, abstract debug console display to plugin function - - * libs/plugins/modifier.escape.php: - fix typo - -2003-05-05 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - add % to math - - * libs/Smarty.class.php: - clean up comments, formatting - - * NEWS - libs/Smarty.class.php: - keep DIR_SEP for 3rd party compatability - - * NEWS - libs/Smarty.class.php: - remove DIR_SEP, use DIRECTORY_SEPARATOR exclusively - - * libs/Smarty_Compiler.class.php: - remove ++ and -- math operators on template vars - -2003-05-04 Messju Mohr - - * libs/Smarty_Compiler.class.php: - removed unused parameter $quote from Smarty_Compiler::_parse_attrs() - - * libs/plugins/function.html_image.php: - fixed DIR_SEP in html_image-plugin - -2003-05-04 Monte Ohrt - - * NEWS - libs/Smarty.class.php: - rename DIR_SEP to SMARTY_DIR_SEP to avoid varname collisions - -2003-05-04 Messju Mohr - - * NEWS - libs/plugins/function.html_image.php: - changed "link" to "href" in html_image. "link" is still working but - deprecated - html_image always renders an alt-tag now (default alt="") - cleaned up indentiation of function.html_image.php - -2003-05-03 Monte Ohrt - - * libs/debug.tpl: - fix typo - -2003-05-02 Messju Mohr - - * NEWS - libs/plugins/function.counter.php: - fixed assign attribute for multiple counters - -2003-05-02 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - allow math on negative number - - * NEWS - libs/Smarty_Compiler.class.php: - added simple math operators to variables - -2003-05-02 Messju Mohr - - * docs/designers.sgml: - fixed typos - -2003-04-30 Monte Ohrt - - * docs/fr/appendixes.sgml - docs/fr/common.dsl - docs/fr/designers.sgml - docs/fr/getting-started.sgml - docs/fr/html-common.dsl - docs/fr/html.dsl - docs/fr/manual.sgml - docs/fr/php.dsl - docs/fr/preface.sgml - docs/fr/programmers.sgml: - add frech docs to cvs repository - -2003-04-29 Messju Mohr - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - reverted patch for case-insensitive tag-names - -2003-04-28 Messju Mohr - - * docs/programmers.sgml: - reverted back to humerous redundancy in the docs :). although we all - know we are here to generate template-based output, and not to have - fun ;-) - - * docs/getting-started.sgml: - fixed default user and group for max os x installation - - * libs/Smarty.class.php: - made $function[2] and $function[3] options for register_resource - - * libs/Smarty.class.php: - fixed issue with object-callback when fetching a php-resource - - * NEWS - libs/Smarty.class.php: - enabled array(&$obj. 'source', 'timestamp', 'secure', 'trusted') as - callback for register_resource() - - enabled array(&$obj, 'method') as callback for - $default_template_handler_func - -2003-04-27 Messju Mohr - - * docs/designers.sgml - docs/programmers.sgml: - fixed some typos, thank to mehdi - - * libs/plugins/function.counter.php: - prevent assign from overruling print-attribute in function.counter.php - - * libs/plugins/function.counter.php: - fixed problem with counter and assign - - * libs/Smarty.class.php: - fixed notice in _load_plugins() - - * NEWS - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - made plugin-names case-insensitive. this affects - compiler/block/custom-functions and modifers. - -2003-04-26 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - remove unnecessary close/open tags from compiled templates - -2003-04-26 Messju Mohr - - * docs/designers.sgml: - added documentation for foreach.property.* - -2003-04-24 Messju Mohr - - * docs/designers.sgml: - fixed example table_attr and tr_attr in html_table-example - -2003-04-21 Greg Beaver - - * libs/Smarty.class.php: - fixed small bug in doc comments - -2003-04-21 Messju Mohr - - * NEWS - libs/plugins/function.html_image.php: - fixed errornous creation of '//' in image_path in html_image - -2003-04-21 Monte Ohrt - - * libs/plugins/modifier.debug_print_var.php: - fix htmlspecialchars() conflict - - * NEWS - libs/plugins/modifier.debug_print_var.php: - fix escapement of special chars in key values of debug console - - * NEWS - libs/plugins/function.config_load.php: - fixed debug timing logic for config_load - - * docs/designers.sgml: - fix example text - - -2003-04-20 Greg Beaver - * plugins/* - Smarty.class.php - Smarty_Compiler.class.php - Config_File.class.php: - updated all doc comments to phpDocumentor format (whew!) - -2003-04-06 Messju Mohr - - * libs/plugins/function.math.php: - allowed "_" in the name of variable-parameters to {math}-function - -2003-04-04 Monte Ohrt - - * NEWS - docs/designers.sgml - libs/Smarty_Compiler.class.php: - change backtic syntax from $`foo` to `$foo` - - * NEWS - libs/Smarty_Compiler.class.php: - recognize $foo[][] syntax in embedded quotes without backticks - -2003-04-03 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - name=123 is passed as an integer (not a string) to plugins now - -2003-04-01 Messju Mohr - - * libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - added CVS $Id: ChangeLog,v 1.459 2007/03/07 01:31:23 changelog Exp $ - -2003-03-31 Messju Mohr - - * libs/Smarty.class.php: - added missing compile_id inside Smarty_Compiler - - * libs/Smarty_Compiler.class.php: - fixed flaw when generating an error for missing postfilter - -2003-03-31 Monte Ohrt - - * docs/getting-started.sgml - docs/programmers.sgml: - fix typos - -2003-03-27 Messju Mohr - - * NEWS - libs/plugins/modifier.debug_print_var.php: - $length is now propagated to sub-values in debug_print_var - -2003-03-26 Monte Ohrt - - * NEWS: - update header - - * RELEASE_NOTES: - commit changes to release notes - - * (Smarty_2_5_0_RC2) - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - committing RC2 - -2003-03-24 Messju Mohr - - * NEWS - libs/Smarty.class.php: - made clear_cache() ignore compile_id when clearing cache_groups - - * libs/plugins/function.popup.php: - made onmouseout XHTML-compatible in function.popup.php - -2003-03-21 Messju Mohr - - * NEWS - libs/Smarty.class.php: - applied new var-names to fetch() - - * NEWS - libs/Smarty.class.php: - renamed $localvars to $_localvars in cache-file-handling-functions, - added _get_auto_id()-function - -2003-03-21 Monte Ohrt - - * libs/plugins/function.mailto.php - libs/plugins/function.popup.php: - update functions for XHTML compatability - -2003-03-21 Messju Mohr - - * libs/Smarty.class.php: - fixed wrong $auto_id in _read_cache_file() - - * NEWS - libs/Smarty.class.php: - swapped compile_id and cache_id in read_cache_file and write_cache_file - - * libs/Smarty.class.php: - reverted patch for ignoring compile-id back to -r1.364, due to problems - - * NEWS - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php: - html_radios and html_checkboxes accept "selected" instead of "checked" - optionally now - - * NEWS - libs/Smarty.class.php: - swapped compile_id and cache_id for cache-file-handling again - -2003-03-20 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - fix notice when no parameter is passed to default - -2003-03-20 Messju Mohr - - * NEWS - libs/Smarty.class.php: - removed notice of undefined var in _rm_auto() - -2003-03-19 Monte Ohrt - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php - libs/plugins/function.html_table.php: - fix a few error messages, follow consistancy format plugin_name: errormsg - - * libs/plugins/function.html_radios.php: - update error messages - - * NEWS - libs/plugins/function.html_radios.php: - add a warning when an array is passed as the 'checked' value of html_radios - -2003-03-19 Messju Mohr - - * NEWS - libs/Smarty_Compiler.class.php: - fixed errormessage in _compile_smarty_ref() - - * NEWS - docs/designers.sgml: - updated docs for html_image - -2003-03-18 Messju Mohr - - * NEWS - libs/Smarty.class.php: - cleaned up calls to readdir() - - * libs/plugins/function.html_options.php: - fixed label for optgroup in html_options - -2003-03-18 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - fix (newly introduced) bug with passing multiple modifiers to a parameter - -2003-03-18 Messju Mohr - - * NEWS - docs/designers.sgml: - updated docs for html_checkboxes, html_options and html_radios - - * libs/plugins/function.html_options.php: - fixed wrong default-"name" in function.html_options.php - - * NEWS - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php: - renamed "checkbox" and "radios" to "options" in {html_checkboxes} and - {html_radios} - - * libs/plugins/outputfilter.trimwhitespace.php: - tried to optimize re-replacement in outputfilter.trimwhitespace.php a - little - - * libs/plugins/outputfilter.trimwhitespace.php: - fixed greedy str_replace in outputfilter.trimwhitespace.php - - * NEWS - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_options.php - libs/plugins/function.html_radios.php: - html_options, html_checkboxes and html_radios now pass-thru all unknown - paramters - -2003-03-17 Messju Mohr - - * NEWS - libs/plugins/function.html_options.php: - html_options passthru all unknown paramters now - -2003-03-17 Monte Ohrt - - * NEWS - libs/plugins/function.html_image.php: - Fix link bug in html_image function, also make output XHTML compatible - - * libs/Smarty_Compiler.class.php: - fix issue of embedded var and escaped double quotes - -2003-03-15 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - back out "@" logic, apply only to default modifier special case - - * libs/Smarty_Compiler.class.php: - fix @ logic, only use upon an echo - - * NEWS - libs/Smarty_Compiler.class.php: - append "@" to template var echoes to supress possible notices - - * NEWS - libs/Smarty_Compiler.class.php: - append "@" to _run_mod_handler to supress warnings - -2003-03-14 Monte Ohrt - - * NEWS - libs/Smarty_Compiler.class.php: - fix problem with escaped double quotes - - * NEWS - libs/plugins/function.html_radios.php: - fixed html_options to not return an array - -2003-03-12 Messju Mohr - - * NEWS - libs/plugins/modifier.truncate.php: - fixed length in modifier.truncate.php - - * NEWS - libs/plugins/outputfilter.trimwhitespace.php: - fixed handling of '$'-signs in trimwhitespace outputfilter (messju) - -2003-03-12 Monte Ohrt - - * docs/programmers.sgml: - update technical explanation of assign_by_ref and append_by_ref - -2003-03-11 Monte Ohrt - - * NEWS - libs/Smarty.class.php: - fix config file recompiling code - -2003-03-07 Monte Ohrt - - * libs/plugins/function.html_image.php: - change E_USER_ERROR to E_USER_NOTICE - - * libs/plugins/function.html_image.php: - suppress warning in html_image - - * NEWS - libs/plugins/function.html_image.php: - update changes to html_image - -2003-03-06 Monte Ohrt - - * docs/designers.sgml - docs/de/appendixes.sgml - docs/de/common.dsl - docs/de/designers.sgml - docs/de/getting-started.sgml - docs/de/html-common.dsl - docs/de/html.dsl - docs/de/manual.sgml - docs/de/preface.sgml - docs/de/programmers.sgml: - add german docs to dist - - * NEWS: - update news file - - * libs/plugins/function.html_image.php: - fix width/height parameter index - - * NEWS - libs/Smarty.class.php: - get rid of unsetting name and script attributes to insert tags - -2003-03-05 Monte Ohrt - - * NEWS - RELEASE_NOTES: - update NEWS file - - * libs/plugins/modifier.string_format.php: - fix argument order, erroneously swapped a while back - - * (Smarty_2_5_0_RC1) - NEWS - README - RELEASE_NOTES - libs/Config_File.class.php - libs/Smarty.class.php - libs/Smarty_Compiler.class.php: - commit final changes for 2.5.0-RC1 - -2003-03-04 Monte Ohrt - - * docs/programmers.sgml: - remove $show_info_header and $show_info_include property vars from docs - -2003-03-03 Monte Ohrt - - * NEWS - libs/plugins/function.popup.php: - fixed PHP notice - -2003-02-28 Monte Ohrt - - * libs/Smarty_Compiler.class.php: - simplify smarty.const.foo and smarty.const.$foo logic - - * libs/Smarty_Compiler.class.php: - only allow $foo syntax in embedded quotes, unless escaped with backticks - then allow any dollar var - - * NEWS - libs/Smarty_Compiler.class.php: - fix "once" var compiling to work with new attr compiling methods for - include_php - - * FAQ - NEWS - README - docs/designers.sgml - docs/getting-started.sgml - libs/Smarty_Compiler.class.php - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_image.php - libs/plugins/function.html_options.php - libs/plugins/function.html_radios.php - libs/plugins/function.html_select_date.php - libs/plugins/function.html_select_time.php - libs/plugins/function.html_table.php: - fix $smarty.const.foo compiling, clean up double quoted strings, - allow full dollar var syntax in quotes again - -2003-02-27 Monte Ohrt - - * docs/designers.sgml - docs/programmers.sgml - libs/Smarty_Compiler.class.php: - update docs, fix smarty var compiling, allow any $smarty.*.$foo syntax, - add $`foobar` for embedded variables - - * libs/plugins/function.html_image.php: - update functionality - -2003-02-26 Monte Ohrt - - * NEWS - libs/plugins/modifier.nl2br.php: - add nl2br modifier - - * libs/plugins/function.html_image.php: - add link parameter - -2003-02-24 Monte Ohrt - - * libs/Smarty.class.php - libs/plugins/function.html_image.php: - fix rename problem in windows, unlink first - - * libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_image.php - libs/plugins/function.html_options.php - libs/plugins/function.html_radios.php - libs/plugins/shared.escape_special_chars.php: - update functions with separate escape_special_chars routine - - * NEWS - libs/plugins/function.html_checkboxes.php - libs/plugins/function.html_radios.php: - commit checkboxes, update radios - - * NEWS - libs/Smarty.class.php - libs/plugins/function.html_image.php: - fix bug with get_registered_object - - * NEWS - libs/plugins/modifier.cat.php: - added cat modifier to distribution - - * NEWS - libs/Smarty_Compiler.class.php: - added << >> <> support to IF statements - - * libs/plugins/function.html_radios.php: - apply patch to initial html_radios function - - * NEWS - libs/Smarty.class.php: - fix _assign_smarty_interface to not overwrite keys other than 'request' - - * NEWS - libs/plugins/function.html_radios.php: - added html_radios to distribution - - * NEWS - libs/plugins/modifier.string_format.php: - fixed arg order of string_format - - * NEWS - libs/Smarty.class.php: - use tmp file for file writes, avoid race condition - - * NEWS - libs/Smarty_Compiler.class.php: - add $smarty.config.foo var, handle embedded smarty var correctly - - * NEWS - libs/plugins/function.fetch.php: - silence warnings in fetch plugin - -2003-02-21 Monte Ohrt - - * INSTALL: - update wording - - * INSTALL: - update install instructions - - * AUTHORS - BUGS - CREDITS - QUICKSTART - README - RESOURCES - TESTIMONIALS: - remove some files already in docs or elsewhere - - * demo/index.php: - add templates_c to repository - - * index.php: - move demo files to demo directory - - * Config_File.class.php - Smarty.class.php - Smarty_Compiler.class.php - debug.tpl: - moved lib files under libs directory - -2003-02-20 Monte Ohrt - - * NEWS - Smarty.class.php: - add get_config_vars() method, update get_template_vars() functionality - - * NEWS - Smarty.class.php: - fix minor logic in _fetch_template_info() - - * NEWS - Smarty.class.php: - support merging appended vars - - * NEWS - Smarty.class.php: - fix cache groups behavior with compile_id set - -2003-02-19 Monte Ohrt - - * Smarty.class.php: - back out third parameter, extend functionality of append - - * NEWS - Smarty_Compiler.class.php: - update imbedded vars, allow special $smarty vars - - * plugins/function.html_table.php: - add plugin html_table - - * NEWS - Smarty.class.php: - support appending key=>val pairs - - * NEWS - Smarty_Compiler.class.php: - change embedded variable logic to only recognize $foo and $foo[0][bar] - syntax - - * NEWS - Smarty_Compiler.class.php: - allow null as function attribute value - -2003-02-18 Monte Ohrt - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - support foo->bar[index] syntax - - * Smarty_Compiler.class.php: - allow $foo->bar[0] syntax - -2003-02-17 Monte Ohrt - - * plugins/modifier.escape.php: - fix syntax error from previous commit - - * NEWS - Smarty.class.php: - add error msgs to get_registered_object - - * Smarty.class.php: - add function for getting reference to registered object - - * Smarty_Compiler.class.php: - back out patches for object and objref calls on $smarty var - - * NEWS - Smarty_Compiler.class.php: - treat unrecognized param attribute syntax as a string - - * NEWS - Smarty_Compiler.class.php: - support $smarty.const.$foo syntax - - * NEWS - debug.tpl - plugins/modifier.count_words.php - plugins/modifier.escape.php: - fix E_NOTICE messages - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - add @ and === to if tokens, few param cleanups - -2003-02-16 Greg Beaver - - * ChangeLog - Smarty.class.php - Smarty_Compiler.class.php: - many more phpdoc comment upgrades - -2003-02-15 Greg Beaver - * Smarty.class.php - Smarty_Compiler.class.php - continue cleaning of phpdoc comments. All that is needed is the - addition of @return tags and perhaps a bit more verbose comments - and they are finished. - -2003-02-14 Monte Ohrt - - * NEWS - Smarty.class.php: - enable config_load error messages - - * NEWS - plugins/function.html_options.php: - fix html_options to not escape already escaped entities - - * NEWS - Smarty.class.php: - send Last-Modified header on cache creation, misc tab/spacing cleanup - -2003-02-13 Monte Ohrt - - * Smarty_Compiler.class.php - docs/designers.sgml: - allow dash in plain text - - * NEWS - Smarty_Compiler.class.php: - check strict syntax of function attributes - -2003-02-12 Monte Ohrt - - * NEWS - Smarty_Compiler.class.php: - dropped support for modifiers on object parameters, - added support for objects as modifier parameters - - * NEWS - Smarty_Compiler.class.php - docs/designers.sgml: - fix bug with decimal numbers in if statements, misc doc updates - -2003-02-11 Monte Ohrt - - * (Smarty_2_4_2) - Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php: - update version numbers - -2003-02-10 Monte Ohrt - - * NEWS - Smarty_Compiler.class.php: - add support for $foo->$bar syntax - - * NEWS: - update NEWS file - - * NEWS - Smarty_Compiler.class.php: - support full var syntax in quoted text, fix problem with const var access, - clean up some more regex code, fix object problem with no properties - -2003-02-06 Monte Ohrt - - * (Smarty_2_4_1) - Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php: - committed 2.4.1 changes - - * NEWS - Smarty_Compiler.class.php: - ignore case in IF statements - -2003-02-05 Monte Ohrt - - * NEWS - Smarty_Compiler.class.php: - treat undefined constants as null - - * NEWS - Smarty.class.php: - fix problem with inserts and nested fetches - - * Smarty_Compiler.class.php: - fix "if" regex for math tokens - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - docs/getting-started.sgml: - added support for extracting params to include_php - -2003-02-04 Monte Ohrt - - * RELEASE_NOTES: - reformat text - -2003-02-03 Monte Ohrt - - * NEWS: - update news file - -2003-02-03 Greg Beaver - - * ChangeLog - Smarty.class.php: - begin fixing phpdoc comments in Smarty.class.php - - * ChangeLog - Config_File.class.php: - fixed phpdoc comments - -2003-02-03 Monte Ohrt - - * Smarty_Compiler.class.php: - allow $foo->bar[$x].foo syntax - - * Smarty_Compiler.class.php - index.php - configs/test.conf - templates/index.tpl: - fix accidental commit - - * index.php - configs/test.conf - templates/index.tpl: - allow $foo->bar[$j].blah type of syntax - -2003-02-02 Greg Beaver - - * Smarty.class.php - begin fixing of phpdoc comments - - * Config_File.class.php - fix phpdoc comments, add phpDocumentor docblock templates - -2003-02-02 Monte Ohrt - - * Smarty.class.php - docs/html.dsl - docs/php.dsl: - fix version number - - * (Smarty_2_4_0) - Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php - docs/appendixes.sgml - docs/designers.sgml - docs/programmers.sgml: - update Smarty version numbers - -2003-01-30 Monte Ohrt - - * NEWS - Smarty_Compiler.class.php - TODO: - fix order of php tag comparisons - - * NEWS - Smarty_Compiler.class.php: - fix known php tag handling problems - -2003-01-29 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php: - change comments to phpdoc style - -2003-01-28 Monte Ohrt - - * Smarty.class.php - docs/programmers.sgml: - make separate var for compiler file - - * plugins/function.fetch.php: - fix error call - -2003-01-25 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php: - add support for restriction to registered methods - - * plugins/outputfilter.trimwhitespace.php: - update with textarea support - -2003-01-24 Monte Ohrt - - * Smarty_Compiler.class.php: - fix compiling problem with {foreach} tags - - * Smarty.class.php - Smarty_Compiler.class.php: - put objects in own array, add object param format support, change - object syntax from foo.bar to foo->bar - -2003-01-23 Monte Ohrt - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - add support for object registration - -2003-01-22 Monte Ohrt - - * Smarty.class.php: - add file & line number of calling error to error message - -2003-01-21 Monte Ohrt - - * Smarty_Compiler.class.php: - put php style object syntax back in - -2003-01-20 Monte Ohrt - - * Smarty.class.php: - move security settings to fetch function for template_dir - - * NEWS - Smarty.class.php: - fix debug template and security, add template_dir to secure_dir at runtime - -2003-01-17 Monte Ohrt - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - added new object support without new template syntax - -2003-01-15 Monte Ohrt - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - fix if statement syntax for negative integers, fix issue with directories - named '0' - -2003-01-08 Monte Ohrt - - * Smarty.class.php - plugins/function.counter.php - plugins/function.cycle.php - plugins/function.debug.php - plugins/function.eval.php - plugins/function.fetch.php - plugins/function.html_options.php - plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/function.mailto.php - plugins/function.math.php - plugins/function.popup.php - plugins/function.popup_init.php: - update plugins to return values instead of echo, fix config file cache - to include global config variables in cache file - - * Smarty_Compiler.class.php: - fix bug with >= tests in if statements, comment out full object support - -2003-01-06 Monte Ohrt - - * NEWS - docs/html.dsl - plugins/modifier.escape.php: - add javascript escape parameter to escape modifier - -2003-01-02 Monte Ohrt - - * templates/header.tpl: - move the title into head where it should be - -2002-12-24 Monte Ohrt - - * Smarty_Compiler.class.php: - added correct line numbers to smarty syntax error messages - - * docs/programmers.sgml: - update append documentation, make more clear on its function - - * Smarty_Compiler.class.php: - fix modifier matching regexp - -2002-12-23 Monte Ohrt - - * Smarty_Compiler.class.php: - support nested function calls in IF statements - -2002-12-20 Monte Ohrt - - * Smarty_Compiler.class.php: - few more fixes, spaces around function parameters - - * Smarty_Compiler.class.php: - fix misc syntax issues with {if} tags - -2002-12-20 Monte Ohrt - - * Smarty_Compiler.class.php: - fix misc syntax issues with {if} tags - -2002-12-19 Monte Ohrt - - * Smarty_Compiler.class.php: - commit updates, passes all smoke tests - - * NEWS: - update NEWS file - - * Smarty_Compiler.class.php: - fixed literal string not in quotes as parameters - - * NEWS - Smarty_Compiler.class.php: - fix misc syntax issues, add ability to pass modifiers to functions - -2002-12-18 Monte Ohrt - - * NEWS: - update NEWS - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - update compiler code, clean up regex, add new syntax features - -2002-12-16 Monte Ohrt - - * NEWS: - update NEWS file - - * Smarty_Compiler.class.php: - commit updates for objects - -2002-12-14 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php: - fix bug with compiling config files with caching on - -2002-12-13 Monte Ohrt - - * Smarty_Compiler.class.php: - fix problem with matching single quoted strings - - * Smarty_Compiler.class.php: - update embedded variable logic, get rid of ."" at end of output - - * NEWS - docs/designers.sgml - plugins/function.html_select_date.php: - add day_value_format to html_select_date - -2002-12-12 Monte Ohrt - - * plugins/modifier.debug_print_var.php: - fix bug, double escaped values in display - - * Smarty.class.php: - move debug test back into fetch() - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - plugins/outputfilter.trimwhitespace.php: - assigned vars are no longer in global name space, few debug cleanups - -2002-12-11 Monte Ohrt - - * plugins/function.popup.php: - fix error in newline code - - * plugins/function.popup.php: - fix popup to allow newlines in text data - -2002-12-10 Monte Ohrt - - * Smarty.class.php: - fix plugin error logic - - * docs/designers.sgml - docs/programmers.sgml: - edit examples, make more verbose - - * NEWS - plugins/function.html_options.php: - escape html entities in the option values and output - - * NEWS - plugins/function.html_options.php: - fixed bug with label of html_options - -2002-12-09 Monte Ohrt - - * Smarty.class.php: - add support for var_export() - - * Config_File.class.php - Smarty.class.php: - clean up code, respect force_compile and compile_check flags - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - docs/designers.sgml - plugins/function.mailto.php: - add caching feature to config loading, document update, add mailto plugin - -2002-12-08 Monte Ohrt - - * plugins/function.fetch.php: - fix query part of URL - -2002-12-05 Monte Ohrt - - * docs/designers.sgml: - fix typos - -2002-11-22 Monte Ohrt - - * Smarty_Compiler.class.php: - patch for warning message - -2002-11-21 Monte Ohrt - - * RELEASE_NOTES - Smarty.class.php: - get rid of testing for a set value with assign function, just set to - whatever is passed into the template - - * docs/programmers.sgml: - fix typo - -2002-11-19 Monte Ohrt - - * Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php: - commit changes, ready for 2.3.1 release - -2002-11-01 Monte Ohrt - - * plugins/function.html_options.php: - added label attribute to all option outputs, cover w3c spec. - - * NEWS: update NEWS file - - * docs/designers.sgml: update docs for optgroup output - - * plugins/function.html_options.php: - make html_options work with optgroup, make func modular and recursive. - -2002-10-29 Monte Ohrt - - * NEWS - Smarty.class.php: set mtime on compile files so they match source files - -2002-10-18 Monte Ohrt - - * NEWS - Smarty.class.php: added proper support for open_basedir setting - - * docs/designers.sgml: clear up docs on index, iteration and rownum - -2002-10-16 Monte Ohrt - - * plugins/modifier.default.php: fix warning message in default modifier - -2002-09-25 Monte Ohrt - - * docs/designers.sgml - plugins/modifier.strip.php - NEWS: added strip variable modifier - -2002-09-24 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Smarty_Compiler.class.php: - Fix to be able to use $smarty.x variables as arrays. - -2002-09-23 Monte Ohrt - - * Config_File.class.php: - add support for mac/dos formatted config files (fix newlines) - - * docs/programmers.sgml: add optional tags to clear_cache parameters - - * docs/designers.sgml: - fix error with include_php description, add $this to description - -2002-09-20 Monte Ohrt - - * NEWS - docs/getting-started.sgml: fixed errors with example setup docs - -2002-09-16 Monte Ohrt - - * plugins/block.textformat.php - docs/designers.sgml - NEWS: add textformat block function - -2002-09-10 Monte Ohrt - - * docs/designers.sgml: - add assign attribute to cycle function documentation - - * docs/designers.sgml - docs/programmers.sgml: fix typos - -2002-09-09 Monte Ohrt - - * plugins/function.debug.php - templates/header.tpl: - fix header in debug template, fix typo in header.tpl example - -2002-08-15 mohrt - - * docs/programmers.sgml: fix typos - -2002-08-08 mohrt - - * RELEASE_NOTES - Smarty.class.php: - supress warnings from unlink() and is_dir(), let error handler deal with it - -2002-08-07 mohrt - - * docs/appendixes.sgml - docs/designers.sgml - docs/programmers.sgml - Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php: update files with new version numbers - -2002-08-02 mohrt - - * NEWS: update NEWS file with credits - - * NEWS - Smarty.class.php: added assign_by_ref() and append_by_ref() functions - -2002-08-01 mohrt - - * TODO - NEWS - Smarty.class.php: - changed default warning type for plugin errors from E_USER_WARNING to E_USER_ERROR - -2002-07-29 mohrt - - * plugins/function.html_select_time.php - docs/designers.sgml - NEWS: added paramters to html_select_time plugin - -2002-07-25 Andrei Zmievski - - * TODO: *** empty log message *** - -2002-07-24 mohrt - - * QUICKSTART: update QUICKSTART guide - - * NEWS - debug.tpl - plugins/modifier.debug_print_var.php: - update debug console to show objects, fix warning in debug.tpl - -2002-07-23 mohrt - - * docs/programmers.sgml: fix load_filter examples - - * Config_File.class.php - NEWS: fix error when there are no sections in config file - -2002-07-19 mohrt - - * docs/getting-started.sgml: fix error in install guide - -2002-07-18 mohrt - - * Smarty_Compiler.class.php: - correct the expression match for smarty:nodefaults - -2002-07-17 mohrt - - * Smarty_Compiler.class.php: fix default modifier to work with config vars - - * Smarty_Compiler.class.php: got args to strstr backwards... - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - change default modifiers to array instead of string - - * Smarty_Compiler.class.php - docs/designers.sgml - Smarty.class.php: add default modifier logic, minor doc updates - - * NEWS - Smarty.class.php - plugins/function.popup_init.php: - make popup_init xhtml compliant, minor variable name changes for consistancy - -2002-07-16 mohrt - - * NEWS: update NEWS file - - * plugins/function.debug.php - Smarty.class.php - debug.tpl - NEWS: - fix problem with filenames on windows, add ability to supply expire time in seconds when clearing cache or compiled files - -2002-07-15 mohrt - - * Smarty.class.php: - fixed problem with insert tags when loading function from script attribute - and caching enabled (Monte) - -2002-07-14 mohrt - - * NEWS - Smarty.class.php: fix bug with debug_tpl file path for Windows - -2002-07-12 Monte Ohrt - - * Smarty.class.php: fix append function with array/string issue - -2002-07-11 Monte Ohrt - - * RELEASE_NOTES: update release notes - - * NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php - Config_File.class.php: update files to 2.2.0 tags, get ready for release - -2002-07-09 Monte Ohrt - - * NEWS - Smarty.class.php: make debug.tpl work with any delimiter - - * NEWS - Smarty.class.php: - change tests in append and assign to != '' instead of empty(), which is more accurate - -2002-07-08 Monte Ohrt - - * docs/designers.sgml: minor doc update - - * Smarty.class.php: - cast var as an array, simplify and get rid of PHP warning messages - -2002-07-03 Monte Ohrt - - * Smarty.class.php: one more N - - * Smarty.class.php: - prepend "N" to filenames to avoid possible OS issues with dir names starting with "-" - - * Smarty.class.php: only set $debug_tpl in constructor if empty - - * Smarty.class.php - docs/designers.sgml - docs/getting-started.sgml - docs/programmers.sgml: - make use_sub_dirs go back to crc32 for subdir separation - -2002-06-29 Monte Ohrt - - * plugins/function.eval.php: do nothing if $val is empty - - * TODO - plugins/function.eval.php - plugins/function.popup_init.php: - add zindex to popup init, fix error message for eval. - -2002-06-27 Monte Ohrt - - * Smarty.class.php: - only loop through relative paths for PHP include_path, remove $_relative variable - - * Smarty_Compiler.class.php: added {$smarty.version} variable - -2002-06-26 Monte Ohrt - - * docs/appendixes.sgml - docs/designers.sgml - docs/getting-started.sgml - docs/programmers.sgml - Smarty.class.php: - update plugin loading logic, look in SMARTY_DIR, then cwd. If all fail, then retry all with include_path - - * templates/header.tpl - Smarty.class.php: update get_include_path, get _path_array only once - - * Smarty.class.php: fix get_include_path function for windows - - * Smarty.class.php: update plugin search logic - - * Smarty.class.php: only search include_path if relative path - - * plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/modifier.date_format.php - Smarty_Compiler.class.php - NEWS - Smarty.class.php: allow plugins_dir to be an array of directories - -2002-06-25 Monte Ohrt - - * docs/programmers.sgml - docs/getting-started.sgml: update installation docs - - * debug.tpl - docs/getting-started.sgml - templates/debug.tpl - NEWS - Smarty.class.php: move debug.tpl to SMARTY_DIR, add to constructor - -2002-06-24 Monte Ohrt - - * plugins/function.assign_debug_info.php - NEWS: fixed warning message in function.assign_debug_info - - * Smarty.class.php: update include_path fixes - - * NEWS: - fixed $template_dir, $compile_dir, $cache_dir, $config_dir to respect include_path - -2002-06-23 Monte Ohrt - - * plugins/shared.make_timestamp.php: - update timestamp plugin to work when passed a timestamp - -2002-06-19 Monte Ohrt - - * NEWS: update NEWS file - - * plugins/modifier.date_format.php - docs/designers.sgml: - update date_format, allow optional 2nd paramater as default date if passed date is empty. update docs. - - * plugins/modifier.date_format.php: - fix date_format modifier, return nothing if given empty string - -2002-06-18 Monte Ohrt - - * NEWS - plugins/function.cycle.php: - gave $reset a default value in cycle function - - * plugins/function.html_select_date.php - plugins/shared.make_timestamp.php - NEWS: - corrected warnings in html_select_time function, made make timestamp always return a timestamp - -2002-06-17 Monte Ohrt - - * Smarty.class.php: swapped around cache_id and compile_id order - -2002-06-14 Monte Ohrt - - * docs/programmers.sgml - plugins/function.popup_init.php - Smarty.class.php: - change directory delimiter to "^" for cache and compile files - -2002-06-13 Andrei Zmievski - - * TODO: done. - - * Smarty_Compiler.class.php: - Optimize the calculation of section 'total' property. - -2002-06-11 Monte Ohrt - - * NEWS - Smarty.class.php: - added support for subdir exclusion, deletion by full or partial cache_id and compile_id, change file format to urlencoded values instead of crc32 - -2002-06-07 Monte Ohrt - - * Smarty.class.php: fix bug with last_modified_check code - - * NEWS - Smarty.class.php: - updated $GLOBALS refererence for HTTP_IF_MODIFIED_SINCE - -2002-06-06 Monte Ohrt - - * docs/designers.sgml - overlib.js: - remove overlib.js file from distribution, update plugin and docs - -2002-06-05 Monte Ohrt - - * docs/designers.sgml - NEWS - Smarty.class.php: fix 304 Not Modified, don't send content - -2002-06-03 Monte Ohrt - - * plugins/function.cycle.php: update version number - - * plugins/function.cycle.php - NEWS: - fixed cycle function to respect delimiter setting after initial setting - - * Smarty.class.php - NEWS: - update $GLOBALS references to work properly with track_globals settings - - * plugins/function.math.php: fixed bug with call $assign - - * docs/appendixes.sgml - docs/designers.sgml - plugins/function.html_options.php - plugins/function.html_select_time.php - NEWS - Smarty.class.php - Smarty_Compiler.class.php: - optimized for loops with count() function calls - -2002-06-01 Andrei Zmievski - - * TODO: *** empty log message *** - -2002-05-21 Monte Ohrt - - * NEWS: update NEWS file - - * plugins/function.html_select_date.php - RESOURCES - docs/designers.sgml - Config_File.class.php: - update html_select_date with month_value_format attribute for controlling the format of the month values. - -2002-05-17 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php: - Made it possible to use simple variables inside [] for indexing. - -2002-05-16 Monte Ohrt - - * docs/designers.sgml - docs/getting-started.sgml - NEWS - Smarty.class.php - Smarty_Compiler.class.php - TESTIMONIALS: add "once" attribute to php_include, update docs - -2002-05-09 Andrei Zmievski - - * NEWS - TODO: *** empty log message *** - -2002-05-07 Monte Ohrt - - * plugins/function.cycle.php: remove \n from cycle function - - * docs/designers.sgml - plugins/function.cycle.php - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php - NEWS: - update cycle function to handle array as input, update files to 2.1.1 - -2002-05-06 Monte Ohrt - - * plugins/function.fetch.php: - update fetch function with more error checking - -2002-05-03 Monte Ohrt - - * docs/designers.sgml - plugins/function.counter.php: - update counter to use name instead of id (id still works though) - - * plugins/function.cycle.php - docs/designers.sgml: rename id to name for cycle function - - * plugins/function.cycle.php: - update cycle function to allow blank values parameter after initialized - - * plugins/function.cycle.php: fix syntax error - -2002-05-02 Monte Ohrt - - * plugins/function.cycle.php: ugh, another typo - - * plugins/function.cycle.php: update comments - - * docs/designers.sgml - plugins/function.cycle.php - NEWS: added function cycle - - * FAQ - Smarty.class.php: fix register_outputfilter function - -2002-05-01 Monte Ohrt - - * docs/designers.sgml - NEWS - Smarty.class.php: fixed bug with resource testing and include_path - -2002-04-30 Monte Ohrt - - * NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php: update files for 2.1.0 release - -2002-04-30 Andrei Zmievski - - * plugins/function.fetch.php - docs/programmers.sgml - Smarty.class.php: Fix. - -2002-04-29 Andrei Zmievski - - * docs/programmers.sgml - docs/designers.sgml: A whole bunch of docs. - -2002-04-26 Monte Ohrt - - * FAQ - QUICKSTART - docs/programmers.sgml: update FAQ, QUICKSTART, small doc syntax fix - -2002-04-24 Monte Ohrt - - * docs/programmers.sgml - templates/debug.tpl - Smarty.class.php: changed doc structure a bit - -2002-04-16 Andrei Zmievski - - * Smarty.class.php: Add register/unregister API for output filters. - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - TODO: - Changed the way filters are loaded, which now has to be done explicitly, - either through load_filter() API or by filling in $autoload_filters variable. - Also renamed internal variable to avoid namespace pollution. - -2002-04-15 Andrei Zmievski - - * Smarty.class.php: - Fixed _get_php_resource() to take include_path into account. - -2002-04-15 Monte Ohrt - - * docs/designers.sgml: - update docs, get modifiers and functions into index for easy access - - * docs/programmers.sgml - NEWS - Smarty.class.php: update caching documentation - -2002-04-15 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Smarty.class.php: Only turn down error notices if $debugging is false. - -2002-04-15 Monte Ohrt - - * NEWS: update NEWS file - - * plugins/function.html_select_date.php: - fixed logic so this works right when field_separator = "/" - - * plugins/function.html_select_date.php: - fix regular expression for matching date - -2002-04-13 Monte Ohrt - - * docs/designers.sgml: updated html_select_date docs to reflect changes - - * NEWS - plugins/function.html_select_date.php: - added YYYY-MM-DD support to html_select_date - -2002-04-12 Andrei Zmievski - - * TESTIMONIALS: New entry. - -2002-04-12 Monte Ohrt - - * plugins/modifier.strip_tags.php: back out changes to strip_tags - - * docs/programmers.sgml: update docs regarding cache_lifetime - - * plugins/modifier.strip_tags.php - Smarty.class.php: - update cache_lifetime logic: -1 = never expire, 0 = always expire - -2002-04-11 Andrei Zmievski - - * BUGS - FAQ - INSTALL - NEWS - Smarty.class.php - Smarty_Compiler.class.php - docs/getting-started.sgml: - Fixed directory separtor issue. Requiring PHP 4.0.6 now. - - * NEWS - Smarty_Compiler.class.php: - Added ability to use simple variables for array indices or object properties. - - * TESTIMONIALS: Another one. - - * TESTIMONIALS: Adding one from Mark P. - -2002-04-05 Andrei Zmievski - - * Smarty_Compiler.class.php - NEWS - Smarty.class.php: Make it possible to unregister pre/postfilter plugins. - -2002-04-05 Monte Ohrt - - * INSTALL: Remove addons file from INSTALL instructions - -2002-04-04 Monte Ohrt - - * docs/designers.sgml: update doc error - - * docs/designers.sgml - plugins/modifier.escape.php - NEWS - Smarty.class.php: added htmlall attribute to escape modifier - -2002-04-03 Andrei Zmievski - - * Smarty_Compiler.class.php: Fixed undefined offset warning in {if} tag. - - * Smarty.class.php - NEWS: Added template_exists() API. - - * Smarty.class.php - Smarty_Compiler.class.php - NEWS: - - Added $smarty.template variable. - - Fixed {include_php} tag when dynamic values were used for 'file' attribute. - - * Config_File.class.php: Separator setting fix. - -2002-03-28 Monte Ohrt - - * FAQ - README: add digest address - - * FAQ - README - Smarty.class.php: update mailing list addresses - -2002-03-28 Andrei Zmievski - - * NEWS: *** empty log message *** - - * plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/modifier.date_format.php: - Fix for when plugins directory is not the default one. - -2002-03-28 Andrei Zmievski - - * NEWS: *** empty log message *** - - * plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/modifier.date_format.php: - Fix for when plugins directory is not the default one. - -2002-03-27 Monte Ohrt - - * FAQ: update FAQ page - -2002-03-26 Andrei Zmievski - - * CREDITS - NEWS - Smarty.class.php - Smarty_Compiler.class.php - TODO: Block functions changes. - - * Config_File.class.php: *** empty log message *** - -2002-03-25 Andrei Zmievski - - * Smarty.class.php - Smarty_Compiler.class.php: Initial implementation of block functions. - -2002-03-22 Monte Ohrt - - * docs/designers.sgml: fix documentation error in capture - -2002-03-22 Andrei Zmievski - - * Smarty.class.php: *** empty log message *** - - * Smarty.class.php: Turn off notices. - -2002-03-21 Andrei Zmievski - - * Smarty_Compiler.class.php: Make _current_file available to prefilters. - - * NEWS - Smarty.class.php: - Made is possible to assign variables in pre/postfilters. - -2002-03-20 Andrei Zmievski - - * plugins/function.html_select_date.php: Fixed +/- functionality. - - * NEWS: *** empty log message *** - -2002-03-20 Monte Ohrt - - * Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.class.php - Smarty_Compiler.class.php: update version numbers - - * plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/modifier.date_format.php: - move .make_timestamp.php to shared.make_timestamp.php - - * NEWS - Smarty.class.php - docs/designers.sgml - plugins/function.fetch.php - plugins/function.html_select_date.php: - update file generation, replace crc32() '-' with 'N' - -2002-03-20 Andrei Zmievski - - * Smarty_Compiler.class.php: *** empty log message *** - -2002-03-19 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Smarty.class.php - Smarty_Compiler.class.php: - Fix plugin behavior for inserts with script attribute. - - * NEWS: *** empty log message *** - - * Smarty_Compiler.class.php: Fix bug with $smarty.cookies. - - * TESTIMONIALS: *** empty log message *** - -2002-03-15 Monte Ohrt - - * NEWS - docs/designers.sgml: update Changelog - - * plugins/modifier.indent.php - plugins/modifier.wordwrap.php: add wordwrap and indent to repository - -2002-03-14 Monte Ohrt - - * Smarty.class.php: - remove show_info_include and show_info_header functions - -2002-03-13 Monte Ohrt - - * plugins/function.fetch.php: update fetch function - - * plugins/function.fetch.php: update fetch function with new parameters - -2002-03-12 Monte Ohrt - - * docs/designers.sgml: update doc tables - - * docs/designers.sgml: update docs columns - - * docs/getting-started.sgml - docs/appendixes.sgml: update docs - - * TESTIMONIALS - docs/appendixes.sgml: update syntax error in docs, add to testimonials - -2002-03-04 Monte Ohrt - - * FAQ - README: update FAQ, README with digest mode info - -2002-03-02 Monte Ohrt - - * QUICKSTART: update quickstart - - * Smarty.class.php: - change behavior so cache_lifetime = 0 never expires (instead of always regenerate) - -2002-03-01 Monte Ohrt - - * docs/designers.sgml: update doc example - -2002-03-01 Andrei Zmievski - - * CREDITS - RELEASE_NOTES - TODO - NEWS: *** empty log message *** - -2002-03-01 Monte Ohrt - - * docs/appendixes.sgml - docs/designers.sgml - docs/getting-started.sgml - docs/programmers.sgml: update document id tags - - * docs.sgml: remove docs.sgml - - * RESOURCES - Smarty.class.php: update resources - -2002-02-28 Andrei Zmievski - - * TESTIMONIALS - docs/appendixes.sgml - docs/designers.sgml - docs/programmers.sgml: *** empty log message *** - -2002-02-27 Andrei Zmievski - - * plugins/function.eval.php - docs/designers.sgml: *** empty log message *** - -2002-02-27 Monte Ohrt - - * plugins/function.eval.php: added eval function to plugin dir - -2002-02-27 Andrei Zmievski - - * NEWS: *** empty log message *** - -2002-02-27 Monte Ohrt - - * docs/designers.sgml: fix syntax error - - * docs/appendixes.sgml - docs/designers.sgml - docs/getting-started.sgml - docs/programmers.sgml: convert technical notes to docbook format - - * NEWS - docs/designers.sgml: added "eval" plugin docs - -2002-02-26 Andrei Zmievski - - * docs/programmers.sgml - docs/designers.sgml - docs/appendixes.sgml - docs/getting-started.sgml - docs/html-common.dsl - docs/.cvsignore: *** empty log message *** - - * docs/appendixes.sgml - docs/common.dsl - docs/designers.sgml - docs/getting-started.sgml - docs/html-common.dsl - docs/html.dsl - docs/manual.sgml - docs/preface.sgml - docs/programmers.sgml: Split up docs. - -2002-02-25 Andrei Zmievski - - * docs.sgml: *** empty log message *** - -2002-02-22 Monte Ohrt - - * docs.sgml: update docs - -2002-02-22 Andrei Zmievski - - * docs.sgml - AUTHORS - NEWS: *** empty log message *** - -2002-02-21 Monte Ohrt - - * Config_File.class.php - NEWS - Smarty.class.php - Smarty_Compiler.class.php - docs.sgml: update misc changes - -2002-02-21 Andrei Zmievski - - * docs.sgml: *** empty log message *** - -2002-02-20 Monte Ohrt - - * docs.sgml: misc updates - -2002-02-20 Andrei Zmievski - - * docs.sgml: *** empty log message *** - - * Smarty.class.php - plugins/function.assign.php - plugins/function.assign_debug_info.php - plugins/function.counter.php - plugins/function.fetch.php - plugins/function.math.php - plugins/function.popup.php - plugins/function.popup_init.php - plugins/modifier.escape.php: Fixup some naming. - -2002-02-20 Monte Ohrt - - * docs.sgml: update docs - -2002-02-20 Andrei Zmievski - - * docs.sgml: *** empty log message *** - -2002-02-20 Monte Ohrt - - * NEWS - docs.sgml - plugins/modifier.escape.php: - removed global vars from fetch function, added attrs to escape modifier - - * docs.sgml: add plugin chapter outline - -2002-02-19 Monte Ohrt - - * README - RELEASE_NOTES - RESOURCES - Smarty.class.php - docs.sgml - BUGS - FAQ - INSTALL - QUICKSTART: update docs - -2002-02-19 Andrei Zmievski - - * docs.sgml: Updated resources docs. - - * README: *** empty log message *** - - * docs.sgml: Updated description of {$smarty} variable. - - * BUGS - FAQ - INSTALL - QUICKSTART - RELEASE_NOTES - docs.sgml: Remove PEAR notes. - -2002-02-18 Andrei Zmievski - - * Config_File.class.php - NEWS: Removed dependency on PEAR. - -2002-02-18 Monte Ohrt - - * NEWS - docs.sgml - plugins/function.popup_init.php: add src attribute to popup_init - -2002-02-15 Andrei Zmievski - - * Smarty_Compiler.class.php - plugins/modifier.debug_print_var.php - NEWS - Smarty.class.php: Performance enhancements. - -2002-02-06 Andrei Zmievski - - * plugins/function.html_options.php: - Fix html_options output to be XHTML compatible. - -2002-02-05 Andrei Zmievski - - * Smarty.class.php - Smarty_Compiler.class.php: Fix up plugin inclusion. - - * Smarty.class.php - Smarty_Compiler.class.php - TODO - plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/modifier.date_format.php: Fix plugin directory access. - -2002-02-04 Andrei Zmievski - - * .cvsignore - Smarty_Compiler.class.php: *** empty log message *** - -2002-01-31 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - TODO - plugins/function.assign.php - plugins/function.assign_debug_info.php - plugins/function.counter.php - plugins/function.fetch.php - plugins/function.html_options.php - plugins/function.html_select_date.php - plugins/function.html_select_time.php - plugins/function.math.php - plugins/function.popup.php - plugins/function.popup_init.php - plugins/modifier.capitalize.php - plugins/modifier.count_characters.php - plugins/modifier.count_paragraphs.php - plugins/modifier.count_sentences.php - plugins/modifier.count_words.php - plugins/modifier.date_format.php - plugins/modifier.debug_print_var.php - plugins/modifier.default.php - plugins/modifier.escape.php - plugins/modifier.lower.php - plugins/modifier.regex_replace.php - plugins/modifier.replace.php - plugins/modifier.spacify.php - plugins/modifier.string_format.php - plugins/modifier.strip_tags.php - plugins/modifier.truncate.php - plugins/modifier.upper.php - plugins/shared.make_timestamp.php - templates/index.tpl - AUTHORS - CREDITS - Config_File.class.php - README: Implemented plugin architecture. - - * NEWS: *** empty log message *** - -2002-01-30 Monte Ohrt - - * NEWS - Smarty.addons.php - Smarty.class.php - docs.sgml: added modifiers wordwrap and indent - -2002-01-28 Monte Ohrt - - * Smarty.class.php - docs.sgml: - add support for is-modified-since headers, adjust a doc example - -2002-01-24 Monte Ohrt - - * Smarty.class.php: cleanup formatting - - * NEWS - Smarty.class.php - docs.sgml: update ChangeLog, remove insert_tag_check parameter - -2002-01-24 Andrei Zmievski - - * plugins/standard.plugin.php: *** empty log message *** - -2002-01-24 Monte Ohrt - - * Smarty.class.php: fix syntax error - - * Smarty.class.php: removed unneccesary test from fetch() - -2002-01-23 Monte Ohrt - - * Smarty.addons.php: update overlib fixes - - * NEWS: update changelog - - * FAQ - NEWS - RESOURCES - Smarty.addons.php: updated overlib fixes - -2001-12-31 Andrei Zmievski - - * NEWS - Smarty.class.php: Fixed compile_id problem. - -2001-12-28 Monte Ohrt - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - fixed problem with using assigned var with include_php filepath - -2001-12-21 Monte Ohrt - - * RESOURCES: update RESOURCES - -2001-12-20 Monte Ohrt - - * FAQ - README: update FAQ - -2001-12-18 Monte Ohrt - - * Smarty_Compiler.class.php - docs.sgml - Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php: update version numbers - -2001-12-18 Andrei Zmievski - - * NEWS - Smarty.class.php: Fixed clear_cache(). - -2001-12-14 Monte Ohrt - - * NEWS - Smarty.addons.php: - fixed bug in smarty_make_timestamp introduced in PHP 4.1.0 - -2001-12-13 Monte Ohrt - - * NEWS - Smarty.class.php - docs.sgml: update default function args, fix cached insert debug timing - -2001-12-12 Monte Ohrt - - * docs.sgml: fix syntax error in documentation - - * Smarty.class.php: update default template handling functionality - -2001-12-11 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php: update file fetching logic - -2001-12-11 Andrei Zmievski - - * NEWS - Smarty.class.php: Added 'script' attribute to {insert..}. - -2001-12-10 Monte Ohrt - - * NEWS - Smarty.class.php: added default template function handler - - * Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: update version numbers in files to 1.5.1 - -2001-12-10 Andrei Zmievski - - * NEWS - Smarty.class.php: Removed error message from the _read_file() method. - - * Smarty.class.php: Fix check for compile and cache IDs. - -2001-12-06 Monte Ohrt - - * QUICKSTART: fix spelling error in QUICKSTART - - * docs.sgml: fixed spelling errors in documenation - - * Smarty_Compiler.class.php - docs.sgml - Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php: commit 1.5.0 release - - * RESOURCES - docs.sgml: added RESOURCES file - -2001-12-05 Andrei Zmievski - - * Smarty_Compiler.class.php: Refactor. - -2001-12-05 Monte Ohrt - - * NEWS - Smarty_Compiler.class.php - docs.sgml: added assign to include and php_include - - * Smarty.class.php - Smarty_Compiler.class.php - docs.sgml: *** empty log message *** - -2001-12-04 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php: Formatting. - -2001-12-04 Monte Ohrt - - * Smarty_Compiler.class.php - NEWS - Smarty.class.php: update ChangeLog - -2001-12-04 Andrei Zmievski - - * NEWS - Smarty.class.php: Formatting. - -2001-12-04 Monte Ohrt - - * Smarty.class.php: removed SMARTY_DIR setting in constructor - - * Smarty.class.php: fix Smarty.class.php indention error - - * Smarty.class.php: update trusted logic - -2001-12-03 Monte Ohrt - - * Smarty.class.php: - fix up is_secure, is_trusted, make _parse_tpl_path function - - * Smarty.class.php: fix problem with testing SMARTY_DIR as empty - - * NEWS - docs.sgml: update documentation, change log - - * Smarty.class.php: - update constructor to check for SMARTY_DIR before assigning - -2001-12-03 Andrei Zmievski - - * NEWS - Smarty.class.php: *** empty log message *** - -2001-12-03 Monte Ohrt - - * FAQ - INSTALL - RELEASE_NOTES: update a few files - - * NEWS - QUICKSTART - Smarty.class.php - docs.sgml: added trusted_dir functionality, cleaned up secure_dir logic - -2001-12-03 Andrei Zmievski - - * NEWS: *** empty log message *** - - * NEWS - Smarty.class.php: - Introduced $compile_id class variable. - - Fixed a situation where if $cache_id and $compile_id were both null - they were passed to auto functions as empty string instead of null. - -2001-11-30 Monte Ohrt - - * NEWS - Smarty.class.php: - change variable names in fetch() fuction to smarty_* to avoid namespace conflicts - - * NEWS - Smarty.class.php: fixed bug in _rm_auto with catenated null values - -2001-11-29 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php: Added $smarty.section.* syntax. - - * Smarty_Compiler.class.php: Made 'name' attribute optional for {foreach}. - -2001-11-29 Monte Ohrt - - * Smarty.class.php - index.php: remove assign "now" in index.tpl - -2001-11-29 Andrei Zmievski - - * NEWS - Smarty.addons.php - Smarty.class.php: Fix formatting. - -2001-11-28 Monte Ohrt - - * NEWS - Smarty.class.php - docs.sgml: - removed return statements from _read_cache_file (how did they get in there?) - -2001-11-27 Monte Ohrt - - * docs.sgml - NEWS - Smarty.addons.php - Smarty.class.php: - fixed bugs and added assign attribute to several functions - -2001-11-27 Andrei Zmievski - - * NEWS: Some rewording. - - * Smarty_Compiler.class.php: Fix $smarty.capture access. - - * TODO: *** empty log message *** - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - Made {config_load ..} merge globals from each config file only once per scope. - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - Added {foreach ...}. - - Made certain $smarty.* references handled at compilation time. - -2001-11-26 Monte Ohrt - - * Config_File.class.php - NEWS - Smarty.class.php - Smarty_Compiler.class.php - docs.sgml: commit cache handler functionality - -2001-11-20 Andrei Zmievski - - * NEWS - Smarty.addons.php - Smarty_Compiler.class.php: Various fixes and additions. - - * NEWS - index.php: *** empty log message *** - -2001-11-05 Monte Ohrt - - * Smarty.class.php: changed _read_file parameter from $end to $lines - - * NEWS - Smarty.class.php: fixed is_cache, make cache reading more efficient - -2001-11-02 Monte Ohrt - - * FAQ - NEWS: update FAQ with mailing list Reply-To header FAQ - - * NEWS - Smarty.class.php - index.php: supress fopen errors, return false if cache file won't load - -2001-11-01 Monte Ohrt - - * QUICKSTART - docs.sgml - index.php: update QUICKSTART guide with index key example - - * Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - docs.sgml: commit all updates for 1.4.6 - -2001-11-01 Andrei Zmievski - - * NEWS: *** empty log message *** - -2001-10-30 Monte Ohrt - - * Smarty.addons.php: fix assign function problem with empty value passed - - * NEWS - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - templates/debug.tpl: - fixed bug in assign function when passing an empty value - -2001-10-26 Monte Ohrt - - * Smarty.addons.php - Smarty.class.php - index.php: fix minor typo in debug code - -2001-10-26 Andrei Zmievski - - * Smarty.class.php: Typo. - -2001-10-26 Monte Ohrt - - * Smarty.addons.php: - update debug console output, handle html encoding correctly - -2001-10-26 Andrei Zmievski - - * Smarty.addons.php - templates/debug.tpl: Debug formatting. - - * Smarty.class.php: Disable rmdir warning. - -2001-10-26 Monte Ohrt - - * Smarty.addons.php - Smarty.class.php - templates/debug.tpl: update debugging to expand array variables - - * Smarty.class.php - docs.sgml: - update docs for fetching only timestamp with custom template source functions - - * Smarty.addons.php: fix debug console error - -2001-10-26 Andrei Zmievski - - * docs.sgml: Typos. - - * Smarty.addons.php: Cleanup whitespace. - - * Smarty_Compiler.class.php: Clean up whitespace. - - * Smarty.class.php: Cleaning up code, formatting mostly. - - * NEWS: *** empty log message *** - -2001-10-25 Monte Ohrt - - * NEWS - docs.sgml: update documentation to current version - - * NEWS - Smarty.addons.php: - updated fetch to give proper warning when fetching unreadable or nonexistant files - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - fixed problem with newline at the end of compiled templates - - * NEWS - Smarty.class.php: recompile cache if config file gets modified too. - - * NEWS - Smarty.class.php: - added feature to regenerate cache if compile_check is enabled and an - involved template is modified - -2001-10-23 Monte Ohrt - - * Smarty.class.php: fix indent for insert tags in debug console - - * templates/debug.tpl: update debug.tpl file format - - * NEWS - Smarty.addons.php - Smarty.class.php - templates/debug.tpl: - update execution time debugging, move into include list - -2001-10-10 Monte Ohrt - - * NEWS - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: - fixed up execution time output in debug console - -2001-10-09 Andrei Zmievski - - * Config_File.class.php - NEWS - Smarty.class.php - TODO: Added support for hidden config vars. - -2001-10-04 Monte Ohrt - - * NEWS - Smarty.addons.php - Smarty.class.php - templates/debug.tpl: added execution times to debug console - -2001-10-02 Andrei Zmievski - - * Smarty_Compiler.class.php: Add space. - -2001-10-01 Andrei Zmievski - - * Smarty.class.php: Fix reference to compile_id. - -2001-09-28 Andrei Zmievski - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: Added postfilter functions. - -2001-09-26 Andrei Zmievski - - * NEWS - Smarty.class.php - docs.sgml: Rename to clear_compiled_tpl(). - -2001-09-25 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php: - Fixed line number reporting when removing comments. - -2001-09-20 Monte Ohrt - - * NEWS - RELEASE_NOTES - Smarty.addons.php: made html_options output xhtml compatible - -2001-09-19 Monte Ohrt - - * Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - templates/debug.tpl: updated version numbers - -2001-09-16 Monte Ohrt - - * FAQ - NEWS - docs.sgml: fix doc error with insert function - -2001-09-06 Andrei Zmievski - - * NEWS: *** empty log message *** - -2001-08-31 Monte Ohrt - - * NEWS: update ChangeLog - - * overlib.js - Smarty.addons.php - Smarty.class.php - docs.sgml: - update overlib to 3.50, adjust addon code so that the overlib.js file isn't modified - -2001-08-31 Andrei Zmievski - - * Smarty.class.php: - compile_id changes - - * NEWS - Smarty.addons.php: - compile_id support - - new options for html_select_date - -2001-08-23 Andrei Zmievski - - * TODO: *** empty log message *** - -2001-08-10 Andrei Zmievski - - * NEWS - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: - Modified to pass Smarty object as second parameter to insert functions. - Also moved _smarty_mod_handler() and _smarty_insert_handler() into the class. - - * NEWS - Smarty_Compiler.class.php: - Passing Smarty as second parameter to prefilter functions. - -2001-08-09 Andrei Zmievski - - * NEWS: *** empty log message *** - -2001-08-09 Monte Ohrt - - * templates/index.tpl - Smarty.class.php: add smarty.now variable to template - -2001-08-06 Monte Ohrt - - * templates/index.tpl: change config_load section back to setup - -2001-08-06 Andrei Zmievski - - * Smarty.addons.php: Optimize a bit. - -2001-08-04 Monte Ohrt - - * docs.sgml: update capture documentation - -2001-08-03 Monte Ohrt - - * FAQ - NEWS - Smarty.class.php: - fix bug with URL controlled debugging, works now (Monte) - -2001-08-01 Andrei Zmievski - - * Config_File.class.php: *** empty log message *** - - * Smarty_Compiler.class.php - Smarty.class.php: - Fixed some E_NOTICE stuff in compiler. - - Generalized assign_smarty_interface() a bit. - -2001-07-24 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php - TODO: See ChangeLog for details. - -2001-07-20 Andrei Zmievski - - * Config_File.class.php: Booleanize case-insensitively. - -2001-07-17 Monte Ohrt - - * NEWS: update ChangeLog - - * Smarty.class.php - docs.sgml: put SMARTY_DIR on Config_File require - -2001-07-11 Monte Ohrt - - * docs.sgml - FAQ - NEWS - Smarty.class.php: - updated security to not include insecure docs, only warning - -2001-07-10 Andrei Zmievski - - * Smarty.class.php: Adding 'sizeof' as an allowed {if} function. - -2001-07-06 Andrei Zmievski - - * NEWS: *** empty log message *** - -2001-07-06 Monte Ohrt - - * Config_File.class.php - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: update version number to 1.4.4 - - * NEWS - Smarty.addons.php - Smarty_Compiler.class.php - docs.sgml - templates/header.tpl - templates/index.tpl: update documenatation, template examples - -2001-07-03 Andrei Zmievski - - * NEWS - Smarty.class.php: Implemented access to request vars via $smarty var. - - * NEWS - Smarty_Compiler.class.php: - Fixed a bug with parsing function arguments in {if} tags. - -2001-06-30 Monte Ohrt - - * NEWS: update ChangeLog - -2001-06-29 Monte Ohrt - - * Smarty.addons.php - Smarty.class.php - docs.sgml - overlib.js: - moved overlib to separate file, added SMARTY_DIR, documented. added much documentation - -2001-06-29 Andrei Zmievski - - * NEWS - RELEASE_NOTES - TODO: *** empty log message *** - -2001-06-29 Monte Ohrt - - * NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - docs.sgml - index.php - templates/debug.tpl - templates/header.tpl - templates/index.tpl: update release notes - -2001-06-27 Andrei Zmievski - - * Smarty_Compiler.class.php: *** empty log message *** - - * NEWS - Smarty_Compiler.class.php: Implemented 'step' section attribute. - - * Smarty_Compiler.class.php: Negative values of 'max' will mean no max. - - * AUTHORS - NEWS: *** empty log message *** - -2001-06-26 Andrei Zmievski - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - index.php: Added 'max' and 'start' section attributes. - Added 'total' and 'iteration' section properties. - -2001-06-25 Andrei Zmievski - - * Config_File.class.php - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: Update version numbers. - -2001-06-23 Andrei Zmievski - - * TODO: *** empty log message *** - -2001-06-21 Andrei Zmievski - - * Config_File.class.php - NEWS: Fixed booleanization bug. - -2001-06-20 Monte Ohrt - - * docs.sgml: - update documents to reflect changes to cached content & debugging - -2001-06-20 Andrei Zmievski - - * Smarty.addons.php - Smarty.class.php: Remove debug output for cached and fetched cases. - -2001-06-20 Monte Ohrt - - * Smarty.class.php: update include_info to false - - * Smarty.class.php - docs.sgml - index.php - templates/footer.tpl: - moved debug logic into Smarty completely, created flags for it - -2001-06-19 Andrei Zmievski - - * Smarty.addons.php - Smarty.class.php - templates/debug.tpl: *** empty log message *** - - * NEWS - Smarty.class.php: Remove unneeded debug functions. - -2001-06-19 Monte Ohrt - - * NEWS - Smarty.addons.php - Smarty.class.php - docs.sgml - templates/debug.tpl - templates/footer.tpl: commit updates, add debug template - -2001-06-19 Andrei Zmievski - - * Smarty.class.php - Smarty_Compiler.class.php - TODO: - Moved config loading code inside main class, the compiled template now - simply calls that method. - -2001-06-15 Andrei Zmievski - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - templates/index.tpl: * moved config array into class itself - * added 'scope' attribute for config_load - - * Smarty_Compiler.class.php - Smarty.addons.php - Smarty.class.php: Finishing up secure mode. - -2001-06-15 Monte Ohrt - - * NEWS: update ChangeLog - - * Smarty_Compiler.class.php: cleaned up logic of if statement security - - * Smarty_Compiler.class.php: update if logic to cover more situations - - * Smarty_Compiler.class.php - docs.sgml: update if statement security feature - -2001-06-14 Andrei Zmievski - - * Smarty.addons.php - Smarty.class.php: *** empty log message *** - - * NEWS - Smarty_Compiler.class.php: - Fixed a bug with quoted strings inside if statements. - -2001-06-13 Monte Ohrt - - * Smarty.addons.php - Smarty.class.php: added secure_dir array for multiple secure directories - - * Smarty.addons.php: update fetch funtion to respect security setting - - * NEWS - Smarty.addons.php - Smarty.class.php - docs.sgml: update documentation, changelog - - * Smarty.addons.php - Smarty.class.php: moved _extract setting to assign functions - - * Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: - added assign/unassign custom functions, ability to re-extract tpl_vars - - * Smarty.class.php - Smarty_Compiler.class.php - docs.sgml - index.php: commit security features - -2001-06-11 Andrei Zmievski - - * Smarty.class.php: Version variable typo. - -2001-06-05 Andrei Zmievski - - * Smarty.class.php: - Create config object in fetch() or just set the config path if it already - exists. - -2001-06-04 Andrei Zmievski - - * Smarty.class.php: *** empty log message *** - - * NEWS - Smarty_Compiler.class.php: - Fixed a problem with $ inside strip tags. - -2001-05-31 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Config_File.class.php: Allow empty config_path. - -2001-05-29 Monte Ohrt - - * Smarty_Compiler.class.php - docs.sgml - NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php: update version numbers - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - docs.sgml: moved version variable to internal variable - -2001-05-22 Andrei Zmievski - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php: - Moved $_smarty_sections and $_smarty_conf_obj into Smarty class. - -2001-05-18 Monte Ohrt - - * NEWS: update ChangeLog - - * FAQ - QUICKSTART: update FAQ, QUICKSTART for windows include_path setup - - * configs/test.conf: added configs directory to cvs - -2001-05-18 Andrei Zmievski - - * Smarty.class.php: Use compiler_class for including the file. - -2001-05-18 Monte Ohrt - - * docs.sgml: fix typo - -2001-05-16 Monte Ohrt - - * README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: update files to version 1.4.1 - - * NEWS: update ChangeLog - -2001-05-15 Andrei Zmievski - - * NEWS: *** empty log message *** - - * index.php: forget that! - - * NEWS - Smarty_Compiler.class.php - index.php: Fixed a few E_NOTICE warnings. - -2001-05-09 Monte Ohrt - - * NEWS - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - docs.sgml: update dates versions - -2001-05-09 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Smarty.class.php: - Use absolute paths when requiring/including Smart components. - - * NEWS: *** empty log message *** - - * Smarty.class.php: Use write mode instead of append. - -2001-05-02 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php: Fix indexing by section properties. - -2001-05-02 Monte Ohrt - - * NEWS: update changelog - - * Smarty.class.php: remove period from syntax error - -2001-05-02 Andrei Zmievski - - * Smarty_Compiler.class.php: Double-quote the attribute values by default. - -2001-04-30 Monte Ohrt - - * Smarty_Compiler.class.php - NEWS: added simple {capture} logic - -2001-04-30 Andrei Zmievski - - * TODO: *** empty log message *** - - * Smarty_Compiler.class.php - Smarty.class.php: Fix passing config vars to included files. - - * Smarty.class.php - Smarty_Compiler.class.php: Fix inclusion again. - -2001-04-30 Monte Ohrt - - * FAQ - RELEASE_NOTES - Smarty.class.php - misc/fix_vars.php - NEWS: update paths for windows (c:) - -2001-04-28 Andrei Zmievski - - * Smarty.class.php - Smarty_Compiler.class.php: Fix passing variables to included files. - - * templates/index.tpl: *** empty log message *** - -2001-04-27 Andrei Zmievski - - * Smarty_Compiler.class.php: Fix includes. - -2001-04-26 Andrei Zmievski - - * Smarty_Compiler.class.php - docs.sgml - Smarty.class.php: Formatting mostly. - - * Smarty_Compiler.class.php - Config_File.class.php: *** empty log message *** - -2001-04-26 Monte Ohrt - - * Smarty_Compiler.class.php - docs.sgml - FAQ - NEWS - QUICKSTART - RELEASE_NOTES - Smarty.class.php: update docs with new changes - -2001-04-26 Andrei Zmievski - - * RELEASE_NOTES: *** empty log message *** - - * docs.sgml - templates/index.tpl - NEWS - Smarty_Compiler.class.php: Added ability to reference object properties. - -2001-04-25 Andrei Zmievski - - * README - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - docs.sgml - AUTHORS - Config_File.class.php - CREDITS - RELEASE_NOTES - NEWS: *** empty log message *** - - * docs.sgml: Docs on new parameter to custom functions. - - * NEWS: *** empty log message *** - - * Smarty_Compiler.class.php: - Changing the way tpl vars are referenced and passing smarty object - to custom functions. - - * RELEASE_NOTES - docs.sgml: Fixing docs a bit. - -2001-04-24 Andrei Zmievski - - * docs.sgml: Docs for $compiler_class and compiler functions. - - * templates/index.tpl: *** empty log message *** - - * Smarty_Compiler.class.php: Remove debugging. - -2001-04-24 Monte Ohrt - - * docs.sgml: update compiler function docs - -2001-04-24 Andrei Zmievski - - * NEWS - Smarty.class.php - Smarty_Compiler.class.php - templates/index.tpl: Added compiler function support. - -2001-04-24 Monte Ohrt - - * RELEASE_NOTES - Smarty.class.php: - update notes, change show_info_header to false by default - - * Smarty.class.php - Smarty_Compiler.class.php - docs.sgml - CREDITS - FAQ - NEWS - README - RELEASE_NOTES: update documenation, bug fixes - -2001-04-24 Andrei Zmievski - - * misc/fix_vars.php: Hopefully fix for sure. - -2001-04-23 Monte Ohrt - - * misc/fix_vars.php: uncomment copy/unlink - -2001-04-23 Andrei Zmievski - - * misc/fix_vars.php: Do it more thoroughly. - - * misc/fix_vars.php: check for } - -2001-04-22 Andrei Zmievski - - * misc/fix_vars.php: Fix variable parsing. - -2001-04-20 Monte Ohrt - - * misc/fix_vars.php: fix problem with 4.0.5-dev and preg_replace_callback - -2001-04-19 Monte Ohrt - - * Smarty_Compiler.class.php - docs.sgml - misc/fix_vars.php - NEWS - RELEASE_NOTES - Smarty.class.php: update notes/documentation - - * NEWS - README - RELEASE_NOTES - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - docs.sgml: update files for 1.4.0 release - -2001-04-16 Andrei Zmievski - - * misc/fix_vars.php: Added fix_vars.php script. - -2001-04-16 Monte Ohrt - - * QUICKSTART - RELEASE_NOTES - docs.sgml - templates/index.tpl: - update RELEASE_NOTES & scripts with new section var syntax - -2001-04-13 Andrei Zmievski - - * Smarty_Compiler.class.php: * Implement new variable format parser. - * Optimizing config load a bit. - -2001-04-13 Monte Ohrt - - * FAQ - NEWS - RELEASE_NOTES - Smarty.class.php: - added $check_cached_insert_tags to speed up cached pages if - {insert ...} is not used (Monte) - -2001-04-12 Andrei Zmievski - - * NEWS - Smarty.class.php - RELEASE_NOTES: *** empty log message *** - - * Smarty_Compiler.class.php: Remove redundant functions. - - * Smarty.class.php: Formatting. - -2001-04-12 Monte Ohrt - - * Smarty.class.php: update file: parsing - - * Smarty.class.php - docs.sgml: update documentation - -2001-04-12 Andrei Zmievski - - * Smarty.class.php - Smarty_Compiler.class.php - TODO: *** empty log message *** - -2001-04-11 Monte Ohrt - - * FAQ - QUICKSTART - RELEASE_NOTES: added RELEASE_NOTES file to cvs - - * NEWS - docs.sgml: update ChangeLog, update documentation - - * Smarty.class.php - Smarty_Compiler.class.php - templates/index.tpl: - update Smarty to compile at run-time. added ability to get files from - absolute paths, added work around for LOCK_EX and windows, changed a few - file permissions to be more secure. - -2001-03-29 Monte Ohrt - - * NEWS - Smarty.addons.php: - allow arbitrary date strings instead of just timestamps - -2001-03-28 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php - docs.sgml - FAQ - NEWS - README - Smarty.addons.php: - update version in class, update docs for count_ and new vars - - * templates/index.tpl - docs.sgml: update docs, example template - -2001-03-28 Andrei Zmievski - - * Smarty_Compiler.class.php: Some variable renaming. - -2001-03-23 Andrei Zmievski - - * Smarty_Compiler.class.php - NEWS: Fixed nested include infinite repeat bug. - -2001-03-23 Monte Ohrt - - * Smarty.class.php: fix version number - - * Smarty.class.php - NEWS: added optional HTML header to output - -2001-03-22 Andrei Zmievski - - * Smarty_Compiler.class.php: Fixed inclusion of dynamic files. - -2001-03-16 Andrei Zmievski - - * Smarty_Compiler.class.php: Fixing the config_load scoping. - - * Smarty_Compiler.class.php: making config variables global for now. - -2001-03-15 Andrei Zmievski - - * NEWS: *** empty log message *** - - * Smarty_Compiler.class.php: - * Includes are now always done via generated function call to protect - namespace. - * config_load now always uses global config object to improve - performance. - -2001-03-13 Monte Ohrt - - * docs.sgml: update math documentation with format attribute - -2001-03-11 Monte Ohrt - - * docs.sgml - NEWS - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: update math function with format attribute - -2001-03-10 Andrei Zmievski - - * Smarty.addons.php: *** empty log message *** - - * NEWS - Smarty.addons.php - Smarty.class.php: Added html_select_time custom function. - -2001-03-08 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php - NEWS - README - Smarty.addons.php: rename 1.3.1b to 1.3.1pl1 - - * NEWS - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php: update version numbers, changelog - - * Smarty.class.php - Smarty_Compiler.class.php: - moved _syntax_error to Smarty_Compiler.class.php - - * Smarty.class.php - docs.sgml: - missing _syntax_error function recovered. fixed minor syntax in docs - -2001-03-07 Monte Ohrt - - * QUICKSTART - README - Smarty.addons.php - Smarty.class.php - Smarty_Compiler.class.php - BUGS - INSTALL - NEWS: update everything to 1.3.1 - -2001-03-03 Monte Ohrt - - * Smarty_Compiler.class.php - Smarty.class.php: fixed bug with cached insert tags - -2001-03-02 Monte Ohrt - - * Smarty.class.php - Smarty_Compiler.class.php: - fix cache fuctions with separated compiled class - - * FAQ - NEWS - docs.sgml: update changelog - -2001-03-02 Andrei Zmievski - - * NEWS - Smarty_Compiler.class.php: Added 'first' and 'last' section properties. - -2001-03-02 Monte Ohrt - - * TODO: remove compiling separation TODO - - * Smarty_Compiler.class.php - Smarty.addons.php - Smarty.class.php: update function headers - - * templates/index.tpl - NEWS - Smarty.class.php - Smarty_Compiler.class.php - index.php: split out compiling code for faster execution - - * Smarty.class.php: fixed a few warning messages - - * Smarty.addons.php - Smarty.class.php - docs.sgml - NEWS: added fetch, unregister mod/fun, updated docs - -2001-03-01 Monte Ohrt - - * Smarty.addons.php: added "int" to available list - - * docs.sgml - FAQ - Smarty.class.php: update FAQ, add math functions & update documetation - - * index.php - Smarty.addons.php - Smarty.class.php - docs.sgml: fixed literal tags and other optional delimiters - -2001-02-26 Andrei Zmievski - - * NEWS - Smarty.class.php: - Added index_prev, index_next section properties and ability to - index by them. - - * NEWS - Smarty.addons.php - Smarty.class.php: Reverting the plugins patch - needs more thought. - - * Smarty.class.php: Fixing plugin loading. - -2001-02-23 Andrei Zmievski - - * Smarty.addons.php - Smarty.class.php - plugins/standard.plugin.php - NEWS: Added plugin functionality. - -2001-02-22 Monte Ohrt - - * docs.sgml - templates/index.tpl - NEWS - README - Smarty.class.php: fixed issue with php tags executed in literal blocks - -2001-02-21 Monte Ohrt - - * NEWS: update changelog for LGPL change - - * Smarty.class.php - docs.sgml - README - Smarty.addons.php: updated version numbers to 1.3.0 - - * NEWS - templates/index.tpl: update changelog, rearrange index.tpl file - -2001-02-21 Andrei Zmievski - - * NEWS - Smarty.class.php: *** empty log message *** - -2001-02-21 Monte Ohrt - - * docs.sgml: update parameters for is_cached and fetch - -2001-02-21 Andrei Zmievski - - * NEWS - Smarty.class.php: *** empty log message *** - -2001-02-21 Monte Ohrt - - * NEWS - Smarty.addons.php - docs.sgml: update docs, remove header function from addons - -2001-02-20 Monte Ohrt - - * FAQ - NEWS: update changelog - - * TODO: update todo - - * TODO: update todo list - - * Smarty.class.php: update php tag handling logic - -2001-02-19 Monte Ohrt - - * index.php - Config_File.class.php - FAQ - Smarty.class.php - docs.sgml: fixed - - * Smarty.addons.php: *** empty log message *** - -2001-02-13 Andrei Zmievski - - * TODO: *** empty log message *** - -2001-02-12 Andrei Zmievski - - * templates/index.tpl - Smarty.class.php: *** empty log message *** - -2001-02-10 Monte Ohrt - - * Smarty.class.php: remove unneeded preg_match - - * Smarty.class.php: remove comment - - * Smarty.class.php: updated php escape to handle -{/if} \ No newline at end of file diff --git a/thirdparty/smarty/libs/internals/core.assemble_plugin_filepath.php b/thirdparty/smarty/libs/internals/core.assemble_plugin_filepath.php deleted file mode 100644 index 690d3ddbc..000000000 --- a/thirdparty/smarty/libs/internals/core.assemble_plugin_filepath.php +++ /dev/null @@ -1,67 +0,0 @@ -plugins_dir as $_plugin_dir) { - - $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; - - // see if path is relative - if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { - $_relative_paths[] = $_plugin_dir; - // relative path, see if it is in the SMARTY_DIR - if (@is_readable(SMARTY_DIR . $_plugin_filepath)) { - $_return = SMARTY_DIR . $_plugin_filepath; - break; - } - } - // try relative to cwd (or absolute) - if (@is_readable($_plugin_filepath)) { - $_return = $_plugin_filepath; - break; - } - } - - if($_return === false) { - // still not found, try PHP include_path - if(isset($_relative_paths)) { - foreach ((array)$_relative_paths as $_plugin_dir) { - - $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; - - $_params = array('file_path' => $_plugin_filepath); - require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); - if(smarty_core_get_include_path($_params, $smarty)) { - $_return = $_params['new_file_path']; - break; - } - } - } - } - $_filepaths_cache[$_plugin_filename] = $_return; - return $_return; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.assign_smarty_interface.php b/thirdparty/smarty/libs/internals/core.assign_smarty_interface.php deleted file mode 100644 index 7e65a73ec..000000000 --- a/thirdparty/smarty/libs/internals/core.assign_smarty_interface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * Name: assign_smarty_interface
- * Purpose: assign the $smarty interface variable - * @param array Format: null - * @param Smarty - */ -function smarty_core_assign_smarty_interface($params, &$smarty) -{ - if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) { - return; - } - - $_globals_map = array('g' => 'HTTP_GET_VARS', - 'p' => 'HTTP_POST_VARS', - 'c' => 'HTTP_COOKIE_VARS', - 's' => 'HTTP_SERVER_VARS', - 'e' => 'HTTP_ENV_VARS'); - - $_smarty_vars_request = array(); - - foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) { - if (isset($_globals_map[$_c])) { - $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]); - } - } - $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']); - - $smarty->_smarty_vars['request'] = $_smarty_vars_request; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.create_dir_structure.php b/thirdparty/smarty/libs/internals/core.create_dir_structure.php deleted file mode 100644 index 3eecc4972..000000000 --- a/thirdparty/smarty/libs/internals/core.create_dir_structure.php +++ /dev/null @@ -1,79 +0,0 @@ -_dir_perms) && !is_dir($_new_dir)) { - $smarty->trigger_error("problem creating directory '" . $_new_dir . "'"); - return false; - } - $_new_dir .= '/'; - } - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.display_debug_console.php b/thirdparty/smarty/libs/internals/core.display_debug_console.php deleted file mode 100644 index 1a80f3909..000000000 --- a/thirdparty/smarty/libs/internals/core.display_debug_console.php +++ /dev/null @@ -1,61 +0,0 @@ - - * Name: display_debug_console
- * Purpose: display the javascript debug console window - * @param array Format: null - * @param Smarty - */ -function smarty_core_display_debug_console($params, &$smarty) -{ - // we must force compile the debug template in case the environment - // changed between separate applications. - - if(empty($smarty->debug_tpl)) { - // set path to debug template from SMARTY_DIR - $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl'; - if($smarty->security && is_file($smarty->debug_tpl)) { - $smarty->secure_dir[] = realpath($smarty->debug_tpl); - } - $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl'; - } - - $_ldelim_orig = $smarty->left_delimiter; - $_rdelim_orig = $smarty->right_delimiter; - - $smarty->left_delimiter = '{'; - $smarty->right_delimiter = '}'; - - $_compile_id_orig = $smarty->_compile_id; - $smarty->_compile_id = null; - - $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl); - if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) - { - ob_start(); - $smarty->_include($_compile_path); - $_results = ob_get_contents(); - ob_end_clean(); - } else { - $_results = ''; - } - - $smarty->_compile_id = $_compile_id_orig; - - $smarty->left_delimiter = $_ldelim_orig; - $smarty->right_delimiter = $_rdelim_orig; - - return $_results; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.get_include_path.php b/thirdparty/smarty/libs/internals/core.get_include_path.php deleted file mode 100644 index 43432412b..000000000 --- a/thirdparty/smarty/libs/internals/core.get_include_path.php +++ /dev/null @@ -1,44 +0,0 @@ - diff --git a/thirdparty/smarty/libs/internals/core.get_microtime.php b/thirdparty/smarty/libs/internals/core.get_microtime.php deleted file mode 100644 index f1a28e042..000000000 --- a/thirdparty/smarty/libs/internals/core.get_microtime.php +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/thirdparty/smarty/libs/internals/core.get_php_resource.php b/thirdparty/smarty/libs/internals/core.get_php_resource.php deleted file mode 100644 index 786d4e78e..000000000 --- a/thirdparty/smarty/libs/internals/core.get_php_resource.php +++ /dev/null @@ -1,80 +0,0 @@ -trusted_dir; - $smarty->_parse_resource_name($params, $smarty); - - /* - * Find out if the resource exists. - */ - - if ($params['resource_type'] == 'file') { - $_readable = false; - if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) { - $_readable = true; - } else { - // test for file in include_path - $_params = array('file_path' => $params['resource_name']); - require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); - if(smarty_core_get_include_path($_params, $smarty)) { - $_include_path = $_params['new_file_path']; - $_readable = true; - } - } - } else if ($params['resource_type'] != 'file') { - $_template_source = null; - $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0]) - && call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0], - array($params['resource_name'], &$_template_source, &$smarty)); - } - - /* - * Set the error function, depending on which class calls us. - */ - if (method_exists($smarty, '_syntax_error')) { - $_error_funcc = '_syntax_error'; - } else { - $_error_funcc = 'trigger_error'; - } - - if ($_readable) { - if ($smarty->security) { - require_once(SMARTY_CORE_DIR . 'core.is_trusted.php'); - if (!smarty_core_is_trusted($params, $smarty)) { - $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted'); - return false; - } - } - } else { - $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable'); - return false; - } - - if ($params['resource_type'] == 'file') { - $params['php_resource'] = $params['resource_name']; - } else { - $params['php_resource'] = $_template_source; - } - return true; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.is_secure.php b/thirdparty/smarty/libs/internals/core.is_secure.php deleted file mode 100644 index d54abd432..000000000 --- a/thirdparty/smarty/libs/internals/core.is_secure.php +++ /dev/null @@ -1,59 +0,0 @@ -security || $smarty->security_settings['INCLUDE_ANY']) { - return true; - } - - if ($params['resource_type'] == 'file') { - $_rp = realpath($params['resource_name']); - if (isset($params['resource_base_path'])) { - foreach ((array)$params['resource_base_path'] as $curr_dir) { - if ( ($_cd = realpath($curr_dir)) !== false && - strncmp($_rp, $_cd, strlen($_cd)) == 0 && - substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { - return true; - } - } - } - if (!empty($smarty->secure_dir)) { - foreach ((array)$smarty->secure_dir as $curr_dir) { - if ( ($_cd = realpath($curr_dir)) !== false) { - if($_cd == $_rp) { - return true; - } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 && - substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { - return true; - } - } - } - } - } else { - // resource is not on local file system - return call_user_func_array( - $smarty->_plugins['resource'][$params['resource_type']][0][2], - array($params['resource_name'], &$smarty)); - } - - return false; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.is_trusted.php b/thirdparty/smarty/libs/internals/core.is_trusted.php deleted file mode 100644 index 429973158..000000000 --- a/thirdparty/smarty/libs/internals/core.is_trusted.php +++ /dev/null @@ -1,47 +0,0 @@ -trusted_dir)) { - $_rp = realpath($params['resource_name']); - foreach ((array)$smarty->trusted_dir as $curr_dir) { - if (!empty($curr_dir) && is_readable ($curr_dir)) { - $_cd = realpath($curr_dir); - if (strncmp($_rp, $_cd, strlen($_cd)) == 0 - && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { - $_smarty_trusted = true; - break; - } - } - } - } - - } else { - // resource is not on local file system - $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3], - array($params['resource_name'], $smarty)); - } - - return $_smarty_trusted; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.load_plugins.php b/thirdparty/smarty/libs/internals/core.load_plugins.php deleted file mode 100644 index 6db1dc51d..000000000 --- a/thirdparty/smarty/libs/internals/core.load_plugins.php +++ /dev/null @@ -1,125 +0,0 @@ -_plugins[$_type][$_name]; - - /* - * We do not load plugin more than once for each instance of Smarty. - * The following code checks for that. The plugin can also be - * registered dynamically at runtime, in which case template file - * and line number will be unknown, so we fill them in. - * - * The final element of the info array is a flag that indicates - * whether the dynamically registered plugin function has been - * checked for existence yet or not. - */ - if (isset($_plugin)) { - if (empty($_plugin[3])) { - if (!is_callable($_plugin[0])) { - $smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__); - } else { - $_plugin[1] = $_tpl_file; - $_plugin[2] = $_tpl_line; - $_plugin[3] = true; - if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */ - } - } - continue; - } else if ($_type == 'insert') { - /* - * For backwards compatibility, we check for insert functions in - * the symbol table before trying to load them as a plugin. - */ - $_plugin_func = 'insert_' . $_name; - if (function_exists($_plugin_func)) { - $_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false); - continue; - } - } - - $_plugin_file = $smarty->_get_plugin_filepath($_type, $_name); - - if (! $_found = ($_plugin_file != false)) { - $_message = "could not load plugin file '$_type.$_name.php'\n"; - } - - /* - * If plugin file is found, it -must- provide the properly named - * plugin function. In case it doesn't, simply output the error and - * do not fall back on any other method. - */ - if ($_found) { - include_once $_plugin_file; - - $_plugin_func = 'smarty_' . $_type . '_' . $_name; - if (!function_exists($_plugin_func)) { - $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", $_tpl_file, $_tpl_line, __FILE__, __LINE__); - continue; - } - } - /* - * In case of insert plugins, their code may be loaded later via - * 'script' attribute. - */ - else if ($_type == 'insert' && $_delayed_loading) { - $_plugin_func = 'smarty_' . $_type . '_' . $_name; - $_found = true; - } - - /* - * Plugin specific processing and error checking. - */ - if (!$_found) { - if ($_type == 'modifier') { - /* - * In case modifier falls back on using PHP functions - * directly, we only allow those specified in the security - * context. - */ - if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) { - $_message = "(secure mode) modifier '$_name' is not allowed"; - } else { - if (!function_exists($_name)) { - $_message = "modifier '$_name' is not implemented"; - } else { - $_plugin_func = $_name; - $_found = true; - } - } - } else if ($_type == 'function') { - /* - * This is a catch-all situation. - */ - $_message = "unknown tag - '$_name'"; - } - } - - if ($_found) { - $smarty->_plugins[$_type][$_name] = array($_plugin_func, $_tpl_file, $_tpl_line, true, true); - } else { - // output error - $smarty->_trigger_fatal_error('[plugin] ' . $_message, $_tpl_file, $_tpl_line, __FILE__, __LINE__); - } - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.load_resource_plugin.php b/thirdparty/smarty/libs/internals/core.load_resource_plugin.php deleted file mode 100644 index a7d37d1af..000000000 --- a/thirdparty/smarty/libs/internals/core.load_resource_plugin.php +++ /dev/null @@ -1,74 +0,0 @@ -_plugins['resource'][$params['type']]; - if (isset($_plugin)) { - if (!$_plugin[1] && count($_plugin[0])) { - $_plugin[1] = true; - foreach ($_plugin[0] as $_plugin_func) { - if (!is_callable($_plugin_func)) { - $_plugin[1] = false; - break; - } - } - } - - if (!$_plugin[1]) { - $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__); - } - - return; - } - - $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']); - $_found = ($_plugin_file != false); - - if ($_found) { /* - * If the plugin file is found, it -must- provide the properly named - * plugin functions. - */ - include_once($_plugin_file); - - /* - * Locate functions that we require the plugin to provide. - */ - $_resource_ops = array('source', 'timestamp', 'secure', 'trusted'); - $_resource_funcs = array(); - foreach ($_resource_ops as $_op) { - $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op; - if (!function_exists($_plugin_func)) { - $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__); - return; - } else { - $_resource_funcs[] = $_plugin_func; - } - } - - $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true); - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.process_cached_inserts.php b/thirdparty/smarty/libs/internals/core.process_cached_inserts.php deleted file mode 100644 index 1d78edd93..000000000 --- a/thirdparty/smarty/libs/internals/core.process_cached_inserts.php +++ /dev/null @@ -1,71 +0,0 @@ -_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis', - $params['results'], $match); - list($cached_inserts, $insert_args) = $match; - - for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) { - if ($smarty->debugging) { - $_params = array(); - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); - $debug_start_time = smarty_core_get_microtime($_params, $smarty); - } - - $args = unserialize($insert_args[$i]); - $name = $args['name']; - - if (isset($args['script'])) { - $_params = array('resource_name' => $smarty->_dequote($args['script'])); - require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); - if(!smarty_core_get_php_resource($_params, $smarty)) { - return false; - } - $resource_type = $_params['resource_type']; - $php_resource = $_params['php_resource']; - - - if ($resource_type == 'file') { - $smarty->_include($php_resource, true); - } else { - $smarty->_eval($php_resource); - } - } - - $function_name = $smarty->_plugins['insert'][$name][0]; - if (empty($args['assign'])) { - $replace = $function_name($args, $smarty); - } else { - $smarty->assign($args['assign'], $function_name($args, $smarty)); - $replace = ''; - } - - $params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i])); - if ($smarty->debugging) { - $_params = array(); - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); - $smarty->_smarty_debug_info[] = array('type' => 'insert', - 'filename' => 'insert_'.$name, - 'depth' => $smarty->_inclusion_depth, - 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time); - } - } - - return $params['results']; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.process_compiled_include.php b/thirdparty/smarty/libs/internals/core.process_compiled_include.php deleted file mode 100644 index d539423bf..000000000 --- a/thirdparty/smarty/libs/internals/core.process_compiled_include.php +++ /dev/null @@ -1,37 +0,0 @@ -_cache_including; - $smarty->_cache_including = true; - - $_return = $params['results']; - - foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) { - $smarty->_include($_include_file_path, true); - } - - foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) { - $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s', - array(&$smarty, '_process_compiled_include_callback'), - $_return); - } - $smarty->_cache_including = $_cache_including; - return $_return; -} - -?> diff --git a/thirdparty/smarty/libs/internals/core.read_cache_file.php b/thirdparty/smarty/libs/internals/core.read_cache_file.php deleted file mode 100644 index c60e113a7..000000000 --- a/thirdparty/smarty/libs/internals/core.read_cache_file.php +++ /dev/null @@ -1,101 +0,0 @@ -force_compile) { - // force compile enabled, always regenerate - return false; - } - - if (isset($content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']])) { - list($params['results'], $smarty->_cache_info) = $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']]; - return true; - } - - if (!empty($smarty->cache_handler_func)) { - // use cache_handler function - call_user_func_array($smarty->cache_handler_func, - array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); - } else { - // use local cache file - $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); - $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id); - $params['results'] = $smarty->_read_file($_cache_file); - } - - if (empty($params['results'])) { - // nothing to parse (error?), regenerate cache - return false; - } - - $_contents = $params['results']; - $_info_start = strpos($_contents, "\n") + 1; - $_info_len = (int)substr($_contents, 0, $_info_start - 1); - $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len)); - $params['results'] = substr($_contents, $_info_start + $_info_len); - - if ($smarty->caching == 2 && isset ($_cache_info['expires'])){ - // caching by expiration time - if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) { - // cache expired, regenerate - return false; - } - } else { - // caching by lifetime - if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) { - // cache expired, regenerate - return false; - } - } - - if ($smarty->compile_check) { - $_params = array('get_source' => false, 'quiet'=>true); - foreach (array_keys($_cache_info['template']) as $_template_dep) { - $_params['resource_name'] = $_template_dep; - if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) { - // template file has changed, regenerate cache - return false; - } - } - - if (isset($_cache_info['config'])) { - $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true); - foreach (array_keys($_cache_info['config']) as $_config_dep) { - $_params['resource_name'] = $_config_dep; - if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) { - // config file has changed, regenerate cache - return false; - } - } - } - } - - $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info); - - $smarty->_cache_info = $_cache_info; - return true; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.rm_auto.php b/thirdparty/smarty/libs/internals/core.rm_auto.php deleted file mode 100644 index b251f6491..000000000 --- a/thirdparty/smarty/libs/internals/core.rm_auto.php +++ /dev/null @@ -1,71 +0,0 @@ - $params['auto_base'], - 'level' => 0, - 'exp_time' => $params['exp_time'] - ); - require_once(SMARTY_CORE_DIR . 'core.rmdir.php'); - $_res = smarty_core_rmdir($_params, $smarty); - } else { - $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']); - - if(isset($params['auto_source'])) { - if (isset($params['extensions'])) { - $_res = false; - foreach ((array)$params['extensions'] as $_extension) - $_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']); - } else { - $_res = $smarty->_unlink($_tname, $params['exp_time']); - } - } elseif ($smarty->use_sub_dirs) { - $_params = array( - 'dirname' => $_tname, - 'level' => 1, - 'exp_time' => $params['exp_time'] - ); - require_once(SMARTY_CORE_DIR . 'core.rmdir.php'); - $_res = smarty_core_rmdir($_params, $smarty); - } else { - // remove matching file names - $_handle = opendir($params['auto_base']); - $_res = true; - while (false !== ($_filename = readdir($_handle))) { - if($_filename == '.' || $_filename == '..') { - continue; - } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) { - $_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']); - } - } - } - } - - return $_res; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.rmdir.php b/thirdparty/smarty/libs/internals/core.rmdir.php deleted file mode 100644 index 2166c44d2..000000000 --- a/thirdparty/smarty/libs/internals/core.rmdir.php +++ /dev/null @@ -1,54 +0,0 @@ - keep root) - * WARNING: no tests, it will try to remove what you tell it! - * - * @param string $dirname - * @param integer $level - * @param integer $exp_time - * @return boolean - */ - -// $dirname, $level = 1, $exp_time = null - -function smarty_core_rmdir($params, &$smarty) -{ - if(!isset($params['level'])) { $params['level'] = 1; } - if(!isset($params['exp_time'])) { $params['exp_time'] = null; } - - if($_handle = @opendir($params['dirname'])) { - - while (false !== ($_entry = readdir($_handle))) { - if ($_entry != '.' && $_entry != '..') { - if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) { - $_params = array( - 'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry, - 'level' => $params['level'] + 1, - 'exp_time' => $params['exp_time'] - ); - smarty_core_rmdir($_params, $smarty); - } - else { - $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']); - } - } - } - closedir($_handle); - } - - if ($params['level']) { - return @rmdir($params['dirname']); - } - return (bool)$_handle; - -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.run_insert_handler.php b/thirdparty/smarty/libs/internals/core.run_insert_handler.php deleted file mode 100644 index 71c384508..000000000 --- a/thirdparty/smarty/libs/internals/core.run_insert_handler.php +++ /dev/null @@ -1,71 +0,0 @@ -debugging) { - $_params = array(); - $_debug_start_time = smarty_core_get_microtime($_params, $smarty); - } - - if ($smarty->caching) { - $_arg_string = serialize($params['args']); - $_name = $params['args']['name']; - if (!isset($smarty->_cache_info['insert_tags'][$_name])) { - $smarty->_cache_info['insert_tags'][$_name] = array('insert', - $_name, - $smarty->_plugins['insert'][$_name][1], - $smarty->_plugins['insert'][$_name][2], - !empty($params['args']['script']) ? true : false); - } - return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5; - } else { - if (isset($params['args']['script'])) { - $_params = array('resource_name' => $smarty->_dequote($params['args']['script'])); - require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); - if(!smarty_core_get_php_resource($_params, $smarty)) { - return false; - } - - if ($_params['resource_type'] == 'file') { - $smarty->_include($_params['php_resource'], true); - } else { - $smarty->_eval($_params['php_resource']); - } - unset($params['args']['script']); - } - - $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0]; - $_content = $_funcname($params['args'], $smarty); - if ($smarty->debugging) { - $_params = array(); - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); - $smarty->_smarty_debug_info[] = array('type' => 'insert', - 'filename' => 'insert_'.$params['args']['name'], - 'depth' => $smarty->_inclusion_depth, - 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); - } - - if (!empty($params['args']["assign"])) { - $smarty->assign($params['args']["assign"], $_content); - } else { - return $_content; - } - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.smarty_include_php.php b/thirdparty/smarty/libs/internals/core.smarty_include_php.php deleted file mode 100644 index 30c6e7654..000000000 --- a/thirdparty/smarty/libs/internals/core.smarty_include_php.php +++ /dev/null @@ -1,50 +0,0 @@ - $params['smarty_file']); - require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); - smarty_core_get_php_resource($_params, $smarty); - $_smarty_resource_type = $_params['resource_type']; - $_smarty_php_resource = $_params['php_resource']; - - if (!empty($params['smarty_assign'])) { - ob_start(); - if ($_smarty_resource_type == 'file') { - $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); - } else { - $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); - } - $smarty->assign($params['smarty_assign'], ob_get_contents()); - ob_end_clean(); - } else { - if ($_smarty_resource_type == 'file') { - $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); - } else { - $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); - } - } -} - - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.write_cache_file.php b/thirdparty/smarty/libs/internals/core.write_cache_file.php deleted file mode 100644 index 72f785b74..000000000 --- a/thirdparty/smarty/libs/internals/core.write_cache_file.php +++ /dev/null @@ -1,96 +0,0 @@ -_cache_info['timestamp'] = time(); - if ($smarty->cache_lifetime > -1){ - // expiration set - $smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime; - } else { - // cache will never expire - $smarty->_cache_info['expires'] = -1; - } - - // collapse nocache.../nocache-tags - if (preg_match_all('!\{(/?)nocache\:[0-9a-f]{32}#\d+\}!', $params['results'], $match, PREG_PATTERN_ORDER)) { - // remove everything between every pair of outermost noache.../nocache-tags - // and replace it by a single nocache-tag - // this new nocache-tag will be replaced by dynamic contents in - // smarty_core_process_compiled_includes() on a cache-read - - $match_count = count($match[0]); - $results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE); - - $level = 0; - $j = 0; - for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) { - if ($results[$i] == $match[0][$j]) { - // nocache tag - if ($match[1][$j]) { // closing tag - $level--; - unset($results[$i]); - } else { // opening tag - if ($level++ > 0) unset($results[$i]); - } - $j++; - } elseif ($level > 0) { - unset($results[$i]); - } - } - $params['results'] = implode('', $results); - } - $smarty->_cache_info['cache_serials'] = $smarty->_cache_serials; - - // prepend the cache header info into cache file - $_cache_info = serialize($smarty->_cache_info); - $params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results']; - - if (!empty($smarty->cache_handler_func)) { - // use cache_handler function - call_user_func_array($smarty->cache_handler_func, - array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); - } else { - // use local cache file - - if(!@is_writable($smarty->cache_dir)) { - // cache_dir not writable, see if it exists - if(!@is_dir($smarty->cache_dir)) { - $smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); - return false; - } - $smarty->trigger_error('unable to write to $cache_dir \'' . realpath($smarty->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR); - return false; - } - - $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); - $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id); - $_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true); - require_once(SMARTY_CORE_DIR . 'core.write_file.php'); - smarty_core_write_file($_params, $smarty); - return true; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.write_compiled_include.php b/thirdparty/smarty/libs/internals/core.write_compiled_include.php deleted file mode 100644 index c14adb5f4..000000000 --- a/thirdparty/smarty/libs/internals/core.write_compiled_include.php +++ /dev/null @@ -1,91 +0,0 @@ -caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; endif;'; - $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;'; - - preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us', - $params['compiled_content'], $_match_source, PREG_SET_ORDER); - - // no nocache-parts found: done - if (count($_match_source)==0) return; - - // convert the matched php-code to functions - $_include_compiled = "_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; - $_include_compiled .= " compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n"; - - $_compile_path = $params['include_file_path']; - - $smarty->_cache_serials[$_compile_path] = $params['cache_serial']; - $_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>"; - - $_include_compiled .= $params['plugins_code']; - $_include_compiled .= "= 5.0) ? '_smarty' : 'this'; - for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) { - $_match =& $_match_source[$_i]; - $source = $_match[4]; - if ($this_varname == '_smarty') { - /* rename $this to $_smarty in the sourcecode */ - $tokens = token_get_all('\n"; - - $_params = array('filename' => $_compile_path, - 'contents' => $_include_compiled, 'create_dirs' => true); - - require_once(SMARTY_CORE_DIR . 'core.write_file.php'); - smarty_core_write_file($_params, $smarty); - return true; -} - - -?> diff --git a/thirdparty/smarty/libs/internals/core.write_compiled_resource.php b/thirdparty/smarty/libs/internals/core.write_compiled_resource.php deleted file mode 100644 index b902eff3c..000000000 --- a/thirdparty/smarty/libs/internals/core.write_compiled_resource.php +++ /dev/null @@ -1,35 +0,0 @@ -compile_dir)) { - // compile_dir not writable, see if it exists - if(!@is_dir($smarty->compile_dir)) { - $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); - return false; - } - $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); - return false; - } - - $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); - require_once(SMARTY_CORE_DIR . 'core.write_file.php'); - smarty_core_write_file($_params, $smarty); - return true; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/internals/core.write_file.php b/thirdparty/smarty/libs/internals/core.write_file.php deleted file mode 100644 index 8a3a3b398..000000000 --- a/thirdparty/smarty/libs/internals/core.write_file.php +++ /dev/null @@ -1,54 +0,0 @@ - $_dirname); - require_once(SMARTY_CORE_DIR . 'core.create_dir_structure.php'); - smarty_core_create_dir_structure($_params, $smarty); - } - - // write to tmp file, then rename it to avoid file locking race condition - $_tmp_file = tempnam($_dirname, 'wrt'); - - if (!($fd = @fopen($_tmp_file, 'wb'))) { - $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt'); - if (!($fd = @fopen($_tmp_file, 'wb'))) { - $smarty->trigger_error("problem writing temporary file '$_tmp_file'"); - return false; - } - } - - fwrite($fd, $params['contents']); - fclose($fd); - - if (DIRECTORY_SEPARATOR == '\\' || !@rename($_tmp_file, $params['filename'])) { - // On platforms and filesystems that cannot overwrite with rename() - // delete the file before renaming it -- because windows always suffers - // this, it is short-circuited to avoid the initial rename() attempt - @unlink($params['filename']); - @rename($_tmp_file, $params['filename']); - } - @chmod($params['filename'], $smarty->_file_perms); - - return true; -} - -/* vim: set expandtab: */ - -?> \ No newline at end of file diff --git a/thirdparty/smarty/libs/plugins/block.textformat.php b/thirdparty/smarty/libs/plugins/block.textformat.php deleted file mode 100644 index 8cd010acb..000000000 --- a/thirdparty/smarty/libs/plugins/block.textformat.php +++ /dev/null @@ -1,103 +0,0 @@ - - * Name: textformat
- * Purpose: format text a certain way with preset styles - * or custom wrap/indent settings
- * @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat} - * (Smarty online manual) - * @param array - *
- * Params:   style: string (email)
- *           indent: integer (0)
- *           wrap: integer (80)
- *           wrap_char string ("\n")
- *           indent_char: string (" ")
- *           wrap_boundary: boolean (true)
- * 
- * @author Monte Ohrt - * @param string contents of the block - * @param Smarty clever simulation of a method - * @return string string $content re-formatted - */ -function smarty_block_textformat($params, $content, &$smarty) -{ - if (is_null($content)) { - return; - } - - $style = null; - $indent = 0; - $indent_first = 0; - $indent_char = ' '; - $wrap = 80; - $wrap_char = "\n"; - $wrap_cut = false; - $assign = null; - - foreach ($params as $_key => $_val) { - switch ($_key) { - case 'style': - case 'indent_char': - case 'wrap_char': - case 'assign': - $$_key = (string)$_val; - break; - - case 'indent': - case 'indent_first': - case 'wrap': - $$_key = (int)$_val; - break; - - case 'wrap_cut': - $$_key = (bool)$_val; - break; - - default: - $smarty->trigger_error("textformat: unknown attribute '$_key'"); - } - } - - if ($style == 'email') { - $wrap = 72; - } - - // split into paragraphs - $_paragraphs = preg_split('![\r\n][\r\n]!',$content); - $_output = ''; - - for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { - if ($_paragraphs[$_x] == '') { - continue; - } - // convert mult. spaces & special chars to single space - $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]); - // indent first line - if($indent_first > 0) { - $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x]; - } - // wordwrap sentences - $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut); - // indent lines - if($indent > 0) { - $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]); - } - } - $_output = implode($wrap_char . $wrap_char, $_paragraphs); - - return $assign ? $smarty->assign($assign, $_output) : $_output; - -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/compiler.assign.php b/thirdparty/smarty/libs/plugins/compiler.assign.php deleted file mode 100644 index be1729850..000000000 --- a/thirdparty/smarty/libs/plugins/compiler.assign.php +++ /dev/null @@ -1,40 +0,0 @@ - - * Name: assign
- * Purpose: assign a value to a template variable - * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} - * (Smarty online manual) - * @author Monte Ohrt (initial author) - * @auther messju mohr (conversion to compiler function) - * @param string containing var-attribute and value-attribute - * @param Smarty_Compiler - */ -function smarty_compiler_assign($tag_attrs, &$compiler) -{ - $_params = $compiler->_parse_attrs($tag_attrs); - - if (!isset($_params['var'])) { - $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING); - return; - } - - if (!isset($_params['value'])) { - $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING); - return; - } - - return "\$this->assign({$_params['var']}, {$_params['value']});"; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.assign_debug_info.php b/thirdparty/smarty/libs/plugins/function.assign_debug_info.php deleted file mode 100644 index 654049876..000000000 --- a/thirdparty/smarty/libs/plugins/function.assign_debug_info.php +++ /dev/null @@ -1,40 +0,0 @@ - - * Name: assign_debug_info
- * Purpose: assign debug info to the template
- * @author Monte Ohrt - * @param array unused in this plugin, this plugin uses {@link Smarty::$_config}, - * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info} - * @param Smarty - */ -function smarty_function_assign_debug_info($params, &$smarty) -{ - $assigned_vars = $smarty->_tpl_vars; - ksort($assigned_vars); - if (@is_array($smarty->_config[0])) { - $config_vars = $smarty->_config[0]; - ksort($config_vars); - $smarty->assign("_debug_config_keys", array_keys($config_vars)); - $smarty->assign("_debug_config_vals", array_values($config_vars)); - } - - $included_templates = $smarty->_smarty_debug_info; - - $smarty->assign("_debug_keys", array_keys($assigned_vars)); - $smarty->assign("_debug_vals", array_values($assigned_vars)); - - $smarty->assign("_debug_tpls", $included_templates); -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.config_load.php b/thirdparty/smarty/libs/plugins/function.config_load.php deleted file mode 100644 index db89f638c..000000000 --- a/thirdparty/smarty/libs/plugins/function.config_load.php +++ /dev/null @@ -1,142 +0,0 @@ - - * Name: config_load
- * Purpose: load config file vars - * @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load} - * (Smarty online manual) - * @author Monte Ohrt - * @author messju mohr (added use of resources) - * @param array Format: - *
- * array('file' => required config file name,
- *       'section' => optional config file section to load
- *       'scope' => local/parent/global
- *       'global' => overrides scope, setting to parent if true)
- * 
- * @param Smarty - */ -function smarty_function_config_load($params, &$smarty) -{ - if ($smarty->debugging) { - $_params = array(); - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); - $_debug_start_time = smarty_core_get_microtime($_params, $smarty); - } - - $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null; - $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null; - $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global'; - $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false; - - if (!isset($_file) || strlen($_file) == 0) { - $smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__); - } - - if (isset($_scope)) { - if ($_scope != 'local' && - $_scope != 'parent' && - $_scope != 'global') { - $smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__); - } - } else { - if ($_global) { - $_scope = 'parent'; - } else { - $_scope = 'local'; - } - } - - $_params = array('resource_name' => $_file, - 'resource_base_path' => $smarty->config_dir, - 'get_source' => false); - $smarty->_parse_resource_name($_params); - $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; - if (isset($_section)) - $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); - else - $_compile_file = $smarty->_get_compile_path($_file_path); - - if($smarty->force_compile || !file_exists($_compile_file)) { - $_compile = true; - } elseif ($smarty->compile_check) { - $_params = array('resource_name' => $_file, - 'resource_base_path' => $smarty->config_dir, - 'get_source' => false); - $_compile = $smarty->_fetch_resource_info($_params) && - $_params['resource_timestamp'] > filemtime($_compile_file); - } else { - $_compile = false; - } - - if($_compile) { - // compile config file - if(!is_object($smarty->_conf_obj)) { - require_once SMARTY_DIR . $smarty->config_class . '.class.php'; - $smarty->_conf_obj = new $smarty->config_class(); - $smarty->_conf_obj->overwrite = $smarty->config_overwrite; - $smarty->_conf_obj->booleanize = $smarty->config_booleanize; - $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; - $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; - } - - $_params = array('resource_name' => $_file, - 'resource_base_path' => $smarty->config_dir, - $_params['get_source'] = true); - if (!$smarty->_fetch_resource_info($_params)) { - return; - } - $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']); - $_config_vars = array_merge($smarty->_conf_obj->get($_file), - $smarty->_conf_obj->get($_file, $_section)); - if(function_exists('var_export')) { - $_output = ''; - } else { - $_output = ''\\\'', '\\'=>'\\\\')) . '\'); ?>'; - } - $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp'])); - require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); - smarty_core_write_compiled_resource($_params, $smarty); - } else { - include($_compile_file); - } - - if ($smarty->caching) { - $smarty->_cache_info['config'][$_file] = true; - } - - $smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars); - $smarty->_config[0]['files'][$_file] = true; - - if ($_scope == 'parent') { - $smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars); - $smarty->_config[1]['files'][$_file] = true; - } else if ($_scope == 'global') { - for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) { - $smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars); - $smarty->_config[$i]['files'][$_file] = true; - } - } - - if ($smarty->debugging) { - $_params = array(); - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); - $smarty->_smarty_debug_info[] = array('type' => 'config', - 'filename' => $_file.' ['.$_section.'] '.$_scope, - 'depth' => $smarty->_inclusion_depth, - 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); - } - -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.counter.php b/thirdparty/smarty/libs/plugins/function.counter.php deleted file mode 100644 index 1f26db5fb..000000000 --- a/thirdparty/smarty/libs/plugins/function.counter.php +++ /dev/null @@ -1,80 +0,0 @@ - - * Name: counter
- * Purpose: print out a counter value - * @author Monte Ohrt - * @link http://smarty.php.net/manual/en/language.function.counter.php {counter} - * (Smarty online manual) - * @param array parameters - * @param Smarty - * @return string|null - */ -function smarty_function_counter($params, &$smarty) -{ - static $counters = array(); - - $name = (isset($params['name'])) ? $params['name'] : 'default'; - if (!isset($counters[$name])) { - $counters[$name] = array( - 'start'=>1, - 'skip'=>1, - 'direction'=>'up', - 'count'=>1 - ); - } - $counter =& $counters[$name]; - - if (isset($params['start'])) { - $counter['start'] = $counter['count'] = (int)$params['start']; - } - - if (!empty($params['assign'])) { - $counter['assign'] = $params['assign']; - } - - if (isset($counter['assign'])) { - $smarty->assign($counter['assign'], $counter['count']); - } - - if (isset($params['print'])) { - $print = (bool)$params['print']; - } else { - $print = empty($counter['assign']); - } - - if ($print) { - $retval = $counter['count']; - } else { - $retval = null; - } - - if (isset($params['skip'])) { - $counter['skip'] = $params['skip']; - } - - if (isset($params['direction'])) { - $counter['direction'] = $params['direction']; - } - - if ($counter['direction'] == "down") - $counter['count'] -= $counter['skip']; - else - $counter['count'] += $counter['skip']; - - return $retval; - -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.cycle.php b/thirdparty/smarty/libs/plugins/function.cycle.php deleted file mode 100644 index fe78bb87d..000000000 --- a/thirdparty/smarty/libs/plugins/function.cycle.php +++ /dev/null @@ -1,102 +0,0 @@ - - * Name: cycle
- * Date: May 3, 2002
- * Purpose: cycle through given values
- * Input: - * - name = name of cycle (optional) - * - values = comma separated list of values to cycle, - * or an array of values to cycle - * (this can be left out for subsequent calls) - * - reset = boolean - resets given var to true - * - print = boolean - print var or not. default is true - * - advance = boolean - whether or not to advance the cycle - * - delimiter = the value delimiter, default is "," - * - assign = boolean, assigns to template var instead of - * printed. - * - * Examples:
- *
- * {cycle values="#eeeeee,#d0d0d0d"}
- * {cycle name=row values="one,two,three" reset=true}
- * {cycle name=row}
- * 
- * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle} - * (Smarty online manual) - * @author Monte Ohrt - * @author credit to Mark Priatel - * @author credit to Gerard - * @author credit to Jason Sweat - * @version 1.3 - * @param array - * @param Smarty - * @return string|null - */ -function smarty_function_cycle($params, &$smarty) -{ - static $cycle_vars; - - $name = (empty($params['name'])) ? 'default' : $params['name']; - $print = (isset($params['print'])) ? (bool)$params['print'] : true; - $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true; - $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false; - - if (!in_array('values', array_keys($params))) { - if(!isset($cycle_vars[$name]['values'])) { - $smarty->trigger_error("cycle: missing 'values' parameter"); - return; - } - } else { - if(isset($cycle_vars[$name]['values']) - && $cycle_vars[$name]['values'] != $params['values'] ) { - $cycle_vars[$name]['index'] = 0; - } - $cycle_vars[$name]['values'] = $params['values']; - } - - $cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ','; - - if(is_array($cycle_vars[$name]['values'])) { - $cycle_array = $cycle_vars[$name]['values']; - } else { - $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); - } - - if(!isset($cycle_vars[$name]['index']) || $reset ) { - $cycle_vars[$name]['index'] = 0; - } - - if (isset($params['assign'])) { - $print = false; - $smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); - } - - if($print) { - $retval = $cycle_array[$cycle_vars[$name]['index']]; - } else { - $retval = null; - } - - if($advance) { - if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { - $cycle_vars[$name]['index'] = 0; - } else { - $cycle_vars[$name]['index']++; - } - } - - return $retval; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.debug.php b/thirdparty/smarty/libs/plugins/function.debug.php deleted file mode 100644 index 43452307b..000000000 --- a/thirdparty/smarty/libs/plugins/function.debug.php +++ /dev/null @@ -1,35 +0,0 @@ - - * Name: debug
- * Date: July 1, 2002
- * Purpose: popup debug window - * @link http://smarty.php.net/manual/en/language.function.debug.php {debug} - * (Smarty online manual) - * @author Monte Ohrt - * @version 1.0 - * @param array - * @param Smarty - * @return string output from {@link Smarty::_generate_debug_output()} - */ -function smarty_function_debug($params, &$smarty) -{ - if (isset($params['output'])) { - $smarty->assign('_smarty_debug_output', $params['output']); - } - require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); - return smarty_core_display_debug_console(null, $smarty); -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.eval.php b/thirdparty/smarty/libs/plugins/function.eval.php deleted file mode 100644 index ff0472de2..000000000 --- a/thirdparty/smarty/libs/plugins/function.eval.php +++ /dev/null @@ -1,49 +0,0 @@ - - * Name: eval
- * Purpose: evaluate a template variable as a template
- * @link http://smarty.php.net/manual/en/language.function.eval.php {eval} - * (Smarty online manual) - * @author Monte Ohrt - * @param array - * @param Smarty - */ -function smarty_function_eval($params, &$smarty) -{ - - if (!isset($params['var'])) { - $smarty->trigger_error("eval: missing 'var' parameter"); - return; - } - - if($params['var'] == '') { - return; - } - - $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled); - - ob_start(); - $smarty->_eval('?>' . $_var_compiled); - $_contents = ob_get_contents(); - ob_end_clean(); - - if (!empty($params['assign'])) { - $smarty->assign($params['assign'], $_contents); - } else { - return $_contents; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.fetch.php b/thirdparty/smarty/libs/plugins/function.fetch.php deleted file mode 100644 index 8b36ce3c2..000000000 --- a/thirdparty/smarty/libs/plugins/function.fetch.php +++ /dev/null @@ -1,221 +0,0 @@ - - * Name: fetch
- * Purpose: fetch file, web or ftp data and display results - * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch} - * (Smarty online manual) - * @author Monte Ohrt - * @param array - * @param Smarty - * @return string|null if the assign parameter is passed, Smarty assigns the - * result to a template variable - */ -function smarty_function_fetch($params, &$smarty) -{ - if (empty($params['file'])) { - $smarty->_trigger_fatal_error("[plugin] parameter 'file' cannot be empty"); - return; - } - - $content = ''; - if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) { - $_params = array('resource_type' => 'file', 'resource_name' => $params['file']); - require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); - if(!smarty_core_is_secure($_params, $smarty)) { - $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed'); - return; - } - - // fetch the file - if($fp = @fopen($params['file'],'r')) { - while(!feof($fp)) { - $content .= fgets ($fp,4096); - } - fclose($fp); - } else { - $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\''); - return; - } - } else { - // not a local file - if(preg_match('!^http://!i',$params['file'])) { - // http fetch - if($uri_parts = parse_url($params['file'])) { - // set defaults - $host = $server_name = $uri_parts['host']; - $timeout = 30; - $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; - $agent = "Smarty Template Engine ".$smarty->_version; - $referer = ""; - $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; - $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; - $_is_proxy = false; - if(empty($uri_parts['port'])) { - $port = 80; - } else { - $port = $uri_parts['port']; - } - if(!empty($uri_parts['user'])) { - $user = $uri_parts['user']; - } - if(!empty($uri_parts['pass'])) { - $pass = $uri_parts['pass']; - } - // loop through parameters, setup headers - foreach($params as $param_key => $param_value) { - switch($param_key) { - case "file": - case "assign": - case "assign_headers": - break; - case "user": - if(!empty($param_value)) { - $user = $param_value; - } - break; - case "pass": - if(!empty($param_value)) { - $pass = $param_value; - } - break; - case "accept": - if(!empty($param_value)) { - $accept = $param_value; - } - break; - case "header": - if(!empty($param_value)) { - if(!preg_match('![\w\d-]+: .+!',$param_value)) { - $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'"); - return; - } else { - $extra_headers[] = $param_value; - } - } - break; - case "proxy_host": - if(!empty($param_value)) { - $proxy_host = $param_value; - } - break; - case "proxy_port": - if(!preg_match('!\D!', $param_value)) { - $proxy_port = (int) $param_value; - } else { - $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); - return; - } - break; - case "agent": - if(!empty($param_value)) { - $agent = $param_value; - } - break; - case "referer": - if(!empty($param_value)) { - $referer = $param_value; - } - break; - case "timeout": - if(!preg_match('!\D!', $param_value)) { - $timeout = (int) $param_value; - } else { - $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); - return; - } - break; - default: - $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'"); - return; - } - } - if(!empty($proxy_host) && !empty($proxy_port)) { - $_is_proxy = true; - $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); - } else { - $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); - } - - if(!$fp) { - $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)"); - return; - } else { - if($_is_proxy) { - fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); - } else { - fputs($fp, "GET $uri HTTP/1.0\r\n"); - } - if(!empty($host)) { - fputs($fp, "Host: $host\r\n"); - } - if(!empty($accept)) { - fputs($fp, "Accept: $accept\r\n"); - } - if(!empty($agent)) { - fputs($fp, "User-Agent: $agent\r\n"); - } - if(!empty($referer)) { - fputs($fp, "Referer: $referer\r\n"); - } - if(isset($extra_headers) && is_array($extra_headers)) { - foreach($extra_headers as $curr_header) { - fputs($fp, $curr_header."\r\n"); - } - } - if(!empty($user) && !empty($pass)) { - fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); - } - - fputs($fp, "\r\n"); - while(!feof($fp)) { - $content .= fgets($fp,4096); - } - fclose($fp); - $csplit = explode("\r\n\r\n",$content,2); - - $content = $csplit[1]; - - if(!empty($params['assign_headers'])) { - $smarty->assign($params['assign_headers'],explode("\r\n",$csplit[0])); - } - } - } else { - $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax"); - return; - } - } else { - // ftp fetch - if($fp = @fopen($params['file'],'r')) { - while(!feof($fp)) { - $content .= fgets ($fp,4096); - } - fclose($fp); - } else { - $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\''); - return; - } - } - - } - - - if (!empty($params['assign'])) { - $smarty->assign($params['assign'],$content); - } else { - return $content; - } -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.html_checkboxes.php b/thirdparty/smarty/libs/plugins/function.html_checkboxes.php deleted file mode 100644 index ed8ad7f33..000000000 --- a/thirdparty/smarty/libs/plugins/function.html_checkboxes.php +++ /dev/null @@ -1,143 +0,0 @@ - - * Type: function
- * Name: html_checkboxes
- * Date: 24.Feb.2003
- * Purpose: Prints out a list of checkbox input types
- * Input:
- * - name (optional) - string default "checkbox" - * - values (required) - array - * - options (optional) - associative array - * - checked (optional) - array default not set - * - separator (optional) - ie
or   - * - output (optional) - the output next to each checkbox - * - assign (optional) - assign the output as an array to this variable - * Examples: - *
- * {html_checkboxes values=$ids output=$names}
- * {html_checkboxes values=$ids name='box' separator='
' output=$names} - * {html_checkboxes values=$ids checked=$checked separator='
' output=$names} - *
- * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} - * (Smarty online manual) - * @author Christopher Kvarme - * @author credits to Monte Ohrt - * @version 1.0 - * @param array - * @param Smarty - * @return string - * @uses smarty_function_escape_special_chars() - */ -function smarty_function_html_checkboxes($params, &$smarty) -{ - require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); - - $name = 'checkbox'; - $values = null; - $options = null; - $selected = null; - $separator = ''; - $labels = true; - $output = null; - - $extra = ''; - - foreach($params as $_key => $_val) { - switch($_key) { - case 'name': - case 'separator': - $$_key = $_val; - break; - - case 'labels': - $$_key = (bool)$_val; - break; - - case 'options': - $$_key = (array)$_val; - break; - - case 'values': - case 'output': - $$_key = array_values((array)$_val); - break; - - case 'checked': - case 'selected': - $selected = array_map('strval', array_values((array)$_val)); - break; - - case 'checkboxes': - $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING); - $options = (array)$_val; - break; - - case 'assign': - break; - - default: - if(!is_array($_val)) { - $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; - } else { - $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); - } - break; - } - } - - if (!isset($options) && !isset($values)) - return ''; /* raise error here? */ - - settype($selected, 'array'); - $_html_result = array(); - - if (isset($options)) { - - foreach ($options as $_key=>$_val) - $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); - - - } else { - foreach ($values as $_i=>$_key) { - $_val = isset($output[$_i]) ? $output[$_i] : ''; - $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); - } - - } - - if(!empty($params['assign'])) { - $smarty->assign($params['assign'], $_html_result); - } else { - return implode("\n",$_html_result); - } - -} - -function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) { - $_output = ''; - if ($labels) $_output .= ''; - $_output .= $separator; - - return $_output; -} - -?> diff --git a/thirdparty/smarty/libs/plugins/function.html_image.php b/thirdparty/smarty/libs/plugins/function.html_image.php deleted file mode 100644 index 9abae72ef..000000000 --- a/thirdparty/smarty/libs/plugins/function.html_image.php +++ /dev/null @@ -1,142 +0,0 @@ - - * Name: html_image
- * Date: Feb 24, 2003
- * Purpose: format HTML tags for the image
- * Input:
- * - file = file (and path) of image (required) - * - height = image height (optional, default actual height) - * - width = image width (optional, default actual width) - * - basedir = base directory for absolute paths, default - * is environment variable DOCUMENT_ROOT - * - path_prefix = prefix for path output (optional, default empty) - * - * Examples: {html_image file="/images/masthead.gif"} - * Output: - * @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image} - * (Smarty online manual) - * @author Monte Ohrt - * @author credits to Duda - wrote first image function - * in repository, helped with lots of functionality - * @version 1.0 - * @param array - * @param Smarty - * @return string - * @uses smarty_function_escape_special_chars() - */ -function smarty_function_html_image($params, &$smarty) -{ - require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); - - $alt = ''; - $file = ''; - $height = ''; - $width = ''; - $extra = ''; - $prefix = ''; - $suffix = ''; - $path_prefix = ''; - $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS']; - $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : ''; - foreach($params as $_key => $_val) { - switch($_key) { - case 'file': - case 'height': - case 'width': - case 'dpi': - case 'path_prefix': - case 'basedir': - $$_key = $_val; - break; - - case 'alt': - if(!is_array($_val)) { - $$_key = smarty_function_escape_special_chars($_val); - } else { - $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); - } - break; - - case 'link': - case 'href': - $prefix = ''; - $suffix = ''; - break; - - default: - if(!is_array($_val)) { - $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; - } else { - $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); - } - break; - } - } - - if (empty($file)) { - $smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE); - return; - } - - if (substr($file,0,1) == '/') { - $_image_path = $basedir . $file; - } else { - $_image_path = $file; - } - - if(!isset($params['width']) || !isset($params['height'])) { - if(!$_image_data = @getimagesize($_image_path)) { - if(!file_exists($_image_path)) { - $smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE); - return; - } else if(!is_readable($_image_path)) { - $smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE); - return; - } else { - $smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE); - return; - } - } - if ($smarty->security && - ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) && - (require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) && - (!smarty_core_is_secure($_params, $smarty)) ) { - $smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE); - } - - if(!isset($params['width'])) { - $width = $_image_data[0]; - } - if(!isset($params['height'])) { - $height = $_image_data[1]; - } - - } - - if(isset($params['dpi'])) { - if(strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) { - $dpi_default = 72; - } else { - $dpi_default = 96; - } - $_resize = $dpi_default/$params['dpi']; - $width = round($width * $_resize); - $height = round($height * $_resize); - } - - return $prefix . ''.$alt.'' . $suffix; -} - -/* vim: set expandtab: */ - -?> diff --git a/thirdparty/smarty/libs/plugins/function.html_options.php b/thirdparty/smarty/libs/plugins/function.html_options.php deleted file mode 100644 index cebadde47..000000000 --- a/thirdparty/smarty/libs/plugins/function.html_options.php +++ /dev/null @@ -1,122 +0,0 @@ - - * Name: html_options
- * Input:
- * - name (optional) - string default "select" - * - values (required if no options supplied) - array - * - options (required if no values supplied) - associative array - * - selected (optional) - string default not set - * - output (required if not options supplied) - array - * Purpose: Prints the list of