From ba9c65f936c374390a63226533172121b9ae3f45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 25 Jun 2008 18:59:57 +0000 Subject: [PATCH] Packager script for latest dev version added, misc fixes, captcha verifier filter added with stubs --- .gitattributes | 2 + .../selector/class_ApplicationSelector.php | 2 +- application/ship-simu/config.php | 6 ++ .../class_WebShipsimuGuestLoginCommand.php | 5 +- .../web/class_WebShipsimuUserLoginCommand.php | 3 + .../personell/class_SimulatorPersonell.php | 4 +- .../templates/de/code/captch_graphic_code.ctp | 2 +- docs/COPYING | 6 +- inc/classes/main/cache/class_MemoryCache.php | 2 +- .../main/class_BaseFrameworkSystem.php | 27 +++----- .../commands/web/class_WebHomeCommand.php | 14 ++-- .../web/class_WebLoginAreaCommand.php | 14 ++-- .../commands/web/class_WebLoginCommand.php | 12 ++-- .../web/class_WebLoginFailedCommand.php | 12 ++-- .../web/class_WebLogoutDoneCommand.php | 12 ++-- .../commands/web/class_WebRegisterCommand.php | 12 ++-- .../web/class_WebResendLinkCommand.php | 2 +- .../databases/class_LocalFileDatabase.php | 4 +- .../main/extended/class_ObjectLimits.php | 2 +- .../factories/cache/class_CacheFactory.php | 2 +- ...ass_GraphicalCodeCaptchaVerifierFilter.php | 67 +++++++++++++++++++ .../captcha/images/class_ImageHelper.php | 28 ++++---- .../web/class_GraphicalCodeCaptcha.php | 2 +- .../main/helper/web/class_WebFormHelper.php | 8 +-- .../main/images/extended/class_PngImage.php | 4 +- inc/classes/main/io/class_FileIoStream.php | 4 +- .../class_BaseControllerResolver.php | 8 +-- .../image/class_ImageControllerResolver.php | 4 +- .../web/class_WebControllerResolver.php | 8 +-- .../template/class_BaseTemplateEngine.php | 20 +++--- .../image/class_ImageTemplateEngine.php | 40 +++++------ .../template/web/class_WebTemplateEngine.php | 4 -- package.sh | 14 ++++ 33 files changed, 220 insertions(+), 136 deletions(-) create mode 100644 inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php create mode 100755 package.sh diff --git a/.gitattributes b/.gitattributes index 5517841..a22315d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -475,6 +475,7 @@ inc/classes/main/filter/validator/class_UserNameValidatorFilter.php -text inc/classes/main/filter/verifier/.htaccess -text inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php -text inc/classes/main/filter/verifier/class_EmailValidatorFilter.php -text +inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php -text inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php -text inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php -text inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php -text @@ -652,6 +653,7 @@ inc/loader/class_ClassLoader.php -text inc/output.php -text inc/selector.php -text /index.php -text +/package.sh -text /rebuild_doc.sh -text templates/.htaccess -text templates/_compiled/.htaccess -text diff --git a/application/selector/class_ApplicationSelector.php b/application/selector/class_ApplicationSelector.php index e974a3b..651b2a4 100644 --- a/application/selector/class_ApplicationSelector.php +++ b/application/selector/class_ApplicationSelector.php @@ -325,7 +325,7 @@ class ApplicationSelector extends BaseFrameworkSystem { throw new InvalidArrayCountException(array($this, "curr", count($curr), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); } elseif (!isset($curr['template_class']) || (!isset($curr['app_instance']))) { // Expected entries missing - throw new MissingArrayElementsException(array($this, "curr", array('template_class', 'app_instance')), self::EXCEPTION_ARRAY_ELEMENTS_MISSING); + throw new MissingArrayElementsException(array($this, "curr", array("template_class", "app_instance")), self::EXCEPTION_ARRAY_ELEMENTS_MISSING); } die("
".print_r($curr, true)."
"); diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index 3a41965..ee4315f 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -130,6 +130,12 @@ $cfg->setConfigEntry('user_update_class', "UserUpdateFilter"); // CFG: CAPTCHA-ENCRYPT-VALIDATOR-CLASS $cfg->setConfigEntry('captcha_encrypt_validator_class', "CaptchaEncryptFilter"); +// CFG: CAPTCHA-GUEST-VERIFIER-CLASS +$cfg->setConfigEntry('captcha_guest_verifier_class', "GraphicalCodeCaptchaVerifierFilter"); + +// CFG: CAPTCHA-USER-VERIFIER-CLASS +$cfg->setConfigEntry('captcha_user_verifier_class', "GraphicalCodeCaptchaVerifierFilter"); + // CFG: NEWS-HOME-LIMIT $cfg->setConfigEntry('news_home_limit', 10); diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php index eedc22c..d1b97a5 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php @@ -103,11 +103,14 @@ class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable { * @todo Add more filters */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Add username + // Add username verifier filter $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_class')); // Add password verifier filter $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_class')); + + // Add CAPTCHA verifier code + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_class')); } } diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php index a1f4c10..be2f0c3 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php @@ -120,6 +120,9 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable { // Password verifier filter $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_class')); + + // Add filter for CAPTCHA + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_class')); } } diff --git a/application/ship-simu/main/personell/class_SimulatorPersonell.php b/application/ship-simu/main/personell/class_SimulatorPersonell.php index 08d6938..fc142cf 100644 --- a/application/ship-simu/main/personell/class_SimulatorPersonell.php +++ b/application/ship-simu/main/personell/class_SimulatorPersonell.php @@ -191,7 +191,7 @@ class SimulatorPersonell extends BasePersonell { // Add new personell object to our list public function addRandomPersonell () { // Gender list... - $genders = array('M', 'F'); + $genders = array("M", "F"); // Create new personell members $personellInstance = new SimulatorPersonell(); @@ -245,7 +245,7 @@ class SimulatorPersonell extends BasePersonell { $this->setCacheCond($serialized); // Create cached list - $this->setAllCacheList(new FrameworkArrayObject("FakedCacheList")); + $this->setAllCacheList(new FrameworkArrayObject('FakedCacheList')); // Search all unemployed personells for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) { diff --git a/application/ship-simu/templates/de/code/captch_graphic_code.ctp b/application/ship-simu/templates/de/code/captch_graphic_code.ctp index fbf6f2e..4744e75 100644 --- a/application/ship-simu/templates/de/code/captch_graphic_code.ctp +++ b/application/ship-simu/templates/de/code/captch_graphic_code.ctp @@ -2,7 +2,7 @@ // Get a helper instance without a form tag $captchaHelper = WebFormHelper::createWebFormHelper($this, 'captcha_code', false, false); $captchaHelper->addFieldText('captcha_code', "Bitte wiederhole den Code:"); -$captchaHelper->addInputTextField('captcha_code'); +$captchaHelper->addInputTextField('c_code'); $captchaHelper->addInputHiddenField('hash', $this->readVariable('captcha_hash')); $captchaHelper->flushContent(); diff --git a/docs/COPYING b/docs/COPYING index 370436e..8d3092e 100644 --- a/docs/COPYING +++ b/docs/COPYING @@ -1,3 +1,7 @@ -For scripts, except templates and compileable templates see COPYING.software. +For scripts, except shell scripts, templates and compileable templates see +COPYING.software. For documents see COPYING.documents. + +The rest of the scripts (shell, templates, code templates) are given away +"AS IS" and "WITHOUT ANY WARRANTY". So it shall be public domain. diff --git a/inc/classes/main/cache/class_MemoryCache.php b/inc/classes/main/cache/class_MemoryCache.php index 4cb7459..bf0e3b8 100644 --- a/inc/classes/main/cache/class_MemoryCache.php +++ b/inc/classes/main/cache/class_MemoryCache.php @@ -70,7 +70,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable { */ protected function initCache () { // Now create the "data cache" - $this->dataCache = new FrameworkArrayObject("FakedDataCache"); + $this->dataCache = new FrameworkArrayObject('FakedDataCache'); } /** diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 3c1b5fc..fa862a1 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -203,17 +203,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public function __destruct() { // Is this object already destroyed? - if ($this->__toString() != "DestructedObject") { - // Debug message - if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { - $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wird zerstört.", - __CLASS__, $this->__toString() - )); - } // END - if - + if ($this->__toString() != 'DestructedObject') { // Destroy all informations about this class but keep some text about it alive - $this->setObjectDescription(sprintf("Entferntes Objekt %s", $this->__toString())); - $this->setRealClass("DestructedObject"); + $this->setObjectDescription(sprintf("Removed object %s", $this->__toString())); + $this->setRealClass('DestructedObject'); $this->resetUniqueID(); } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { // Already destructed object @@ -319,8 +312,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ))); // Initialization done! :D - Registry::isInitialized("OK"); - } elseif ($this->__toString() == "DebugMiddleware") { + Registry::isInitialized('OK'); + } elseif ($this->__toString() == 'DebugMiddleware') { // Set configuration instance $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); } @@ -849,10 +842,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * The left part of the ID shall always be a valid class name and the * right part an ID number. * - * @return $pfn The file name with a prepended path name - * @throws NoArrayCreatedException If explode() fails to create an array + * @return $pfn The file name with a prepended path name + * @throws NoArrayCreatedException If explode() fails to create an array * @throws InvalidArrayCountException If the array contains less or - * more than two elements + * more than two elements */ public final function getPathFileNameFromObject () { // Get the main object's unique ID. We use this as a path/filename combination @@ -864,10 +857,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Are there two elements? Index 0 is the path, 1 the file name + global extension if (!is_array($pathFile)) { // No array found - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); + throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED); } elseif (count($pathFile) != 2) { // Invalid ID returned! - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); } // Auto-append missing trailing slash diff --git a/inc/classes/main/commands/web/class_WebHomeCommand.php b/inc/classes/main/commands/web/class_WebHomeCommand.php index 84ef272..ba47887 100644 --- a/inc/classes/main/commands/web/class_WebHomeCommand.php +++ b/inc/classes/main/commands/web/class_WebHomeCommand.php @@ -1,6 +1,6 @@ * @version 0.0.0 @@ -76,24 +76,24 @@ class WebHomeCommand extends BaseCommand implements Commandable { $masterTemplate = $appInstance->getMasterTemplate(); // Load header template - $templateInstance->loadCodeTemplate("header"); + $templateInstance->loadCodeTemplate('header'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("header", "header"); + $templateInstance->assignTemplateWithVariable('header', 'header'); // Load footer template - $templateInstance->loadCodeTemplate("footer"); + $templateInstance->loadCodeTemplate('footer'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("footer", "footer"); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the home template - $templateInstance->loadCodeTemplate("home"); + $templateInstance->loadCodeTemplate('home'); // Assign the home template with the master template as a content ... ;) - $templateInstance->assignTemplateWithVariable("home", "content"); + $templateInstance->assignTemplateWithVariable('home', 'content'); // Load the master template $templateInstance->loadCodeTemplate($masterTemplate); diff --git a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php index 0848cf5..4c8a881 100644 --- a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php +++ b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php @@ -108,18 +108,18 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable { $masterTemplate = $appInstance->getMasterTemplate(); // Load header template - $templateInstance->loadCodeTemplate("header"); + $templateInstance->loadCodeTemplate('header'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("header", "header"); + $templateInstance->assignTemplateWithVariable('header', 'header'); // Load footer template - $templateInstance->loadCodeTemplate("footer"); + $templateInstance->loadCodeTemplate('footer'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("footer", "footer"); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the matching template $templateInstance->loadCodeTemplate($this->actionName); @@ -129,17 +129,17 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable { $templateInstance->assignTemplateWithVariable($this->actionName, "login_content"); // Load main template - $templateInstance->loadCodeTemplate("login_main"); + $templateInstance->loadCodeTemplate('login_main'); // Assign the main template with the master template as a content ... ;) $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("login_main", "content"); + $templateInstance->assignTemplateWithVariable('login_main', 'content'); // Load the master template $templateInstance->loadCodeTemplate($masterTemplate); // Set title - $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName."_title")); + $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title')); // ... and all variables. This should be merged together in a pattern // to make things easier. A cache mechanism should be added between diff --git a/inc/classes/main/commands/web/class_WebLoginCommand.php b/inc/classes/main/commands/web/class_WebLoginCommand.php index b1dd364..84fe288 100644 --- a/inc/classes/main/commands/web/class_WebLoginCommand.php +++ b/inc/classes/main/commands/web/class_WebLoginCommand.php @@ -82,24 +82,24 @@ class WebLoginCommand extends BaseCommand implements Commandable { $masterTemplate = $appInstance->getMasterTemplate(); // Load header template - $templateInstance->loadCodeTemplate("header"); + $templateInstance->loadCodeTemplate('header'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("header", "header"); + $templateInstance->assignTemplateWithVariable('header', 'header'); // Load footer template - $templateInstance->loadCodeTemplate("footer"); + $templateInstance->loadCodeTemplate('footer'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("footer", "footer"); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the home template - $templateInstance->loadCodeTemplate("login_form"); + $templateInstance->loadCodeTemplate('login_form'); // Assign the home template with the master template as a content ... ;) - $templateInstance->assignTemplateWithVariable("login_form", "content"); + $templateInstance->assignTemplateWithVariable('login_form', 'content'); // Load the master template $templateInstance->loadCodeTemplate($masterTemplate); diff --git a/inc/classes/main/commands/web/class_WebLoginFailedCommand.php b/inc/classes/main/commands/web/class_WebLoginFailedCommand.php index 0d1d068..cb17816 100644 --- a/inc/classes/main/commands/web/class_WebLoginFailedCommand.php +++ b/inc/classes/main/commands/web/class_WebLoginFailedCommand.php @@ -76,24 +76,24 @@ class WebLoginFailedCommand extends BaseCommand implements Commandable { $masterTemplate = $appInstance->getMasterTemplate(); // Load header template - $templateInstance->loadCodeTemplate("header"); + $templateInstance->loadCodeTemplate('header'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("header", "header"); + $templateInstance->assignTemplateWithVariable('header', 'header'); // Load footer template - $templateInstance->loadCodeTemplate("footer"); + $templateInstance->loadCodeTemplate('footer'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("footer", "footer"); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the login_failed template - $templateInstance->loadCodeTemplate("login_failed"); + $templateInstance->loadCodeTemplate('login_failed'); // Assign the login_failed template with the master template as a content ... ;) - $templateInstance->assignTemplateWithVariable("login_failed", "content"); + $templateInstance->assignTemplateWithVariable('login_failed', 'content'); // Load the master template $templateInstance->loadCodeTemplate($masterTemplate); diff --git a/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php b/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php index cd09a40..52f3396 100644 --- a/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php +++ b/inc/classes/main/commands/web/class_WebLogoutDoneCommand.php @@ -76,24 +76,24 @@ class WebLogoutDoneCommand extends BaseCommand implements Commandable { $masterTemplate = $appInstance->getMasterTemplate(); // Load header template - $templateInstance->loadCodeTemplate("header"); + $templateInstance->loadCodeTemplate('header'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("header", "header"); + $templateInstance->assignTemplateWithVariable('header', 'header'); // Load footer template - $templateInstance->loadCodeTemplate("footer"); + $templateInstance->loadCodeTemplate('footer'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("footer", "footer"); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the logout_done template - $templateInstance->loadCodeTemplate("logout_done"); + $templateInstance->loadCodeTemplate('logout_done'); // Assign the logout_done template with the master template as a content ... ;) - $templateInstance->assignTemplateWithVariable("logout_done", "content"); + $templateInstance->assignTemplateWithVariable('logout_done', 'content'); // Load the master template $templateInstance->loadCodeTemplate($masterTemplate); diff --git a/inc/classes/main/commands/web/class_WebRegisterCommand.php b/inc/classes/main/commands/web/class_WebRegisterCommand.php index 5448e2a..b00b73b 100644 --- a/inc/classes/main/commands/web/class_WebRegisterCommand.php +++ b/inc/classes/main/commands/web/class_WebRegisterCommand.php @@ -85,25 +85,25 @@ class WebRegisterCommand extends BaseCommand implements Commandable, Registerabl $masterTemplate = $appInstance->getMasterTemplate(); // Load header template - $templateInstance->loadCodeTemplate("header"); + $templateInstance->loadCodeTemplate('header'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("header", "header"); + $templateInstance->assignTemplateWithVariable('header', 'header'); // Load footer template - $templateInstance->loadCodeTemplate("footer"); + $templateInstance->loadCodeTemplate('footer'); // Compile and assign it with a variable $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("footer", "footer"); + $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the register template - $templateInstance->loadCodeTemplate("register_form"); + $templateInstance->loadCodeTemplate('register_form'); // Assign the register template with the master template as a content ... ;) $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable("register_form", "content"); + $templateInstance->assignTemplateWithVariable('register_form', 'content'); // Load the master template $templateInstance->loadCodeTemplate($masterTemplate); diff --git a/inc/classes/main/commands/web/class_WebResendLinkCommand.php b/inc/classes/main/commands/web/class_WebResendLinkCommand.php index 887712e..b24e7d6 100644 --- a/inc/classes/main/commands/web/class_WebResendLinkCommand.php +++ b/inc/classes/main/commands/web/class_WebResendLinkCommand.php @@ -73,7 +73,7 @@ class WebResendLinkCommand extends BaseCommand implements Commandable { $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class'); // Load the mail template - $mailerInstance->loadTemplate("resend_link"); + $mailerInstance->loadTemplate('resend_link'); // Add the recipient $mailerInstance->addRecipientByUser($userInstance); diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 81ad7fd..734e056 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -177,14 +177,14 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend if ($inConstructor) { return false; } else { - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); + throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED); } } elseif (count($pathFile) != 2) { // Invalid ID returned! if ($inConstructor) { return false; } else { - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); } } diff --git a/inc/classes/main/extended/class_ObjectLimits.php b/inc/classes/main/extended/class_ObjectLimits.php index 926e8fc..293e908 100644 --- a/inc/classes/main/extended/class_ObjectLimits.php +++ b/inc/classes/main/extended/class_ObjectLimits.php @@ -93,7 +93,7 @@ class ObjectLimits extends BaseFrameworkSystem { // Auto-initialization if (is_null($this->limitArray)) { // Initialize this array - $this->limitArray = new FrameworkArrayObject("FakedLimitArray"); + $this->limitArray = new FrameworkArrayObject('FakedLimitArray'); } // Add the object's name to it diff --git a/inc/classes/main/factories/cache/class_CacheFactory.php b/inc/classes/main/factories/cache/class_CacheFactory.php index e2cb7bc..04c950d 100644 --- a/inc/classes/main/factories/cache/class_CacheFactory.php +++ b/inc/classes/main/factories/cache/class_CacheFactory.php @@ -66,7 +66,7 @@ class CacheFactory extends BaseFactory { */ public function createConfiguredCache () { // Read the config entry - $cacheType = $this->getConfigInstance()->readConfig("cache_class"); + $cacheType = $this->getConfigInstance()->readConfig('cache_class'); // And get a new instance $cacheInstance = ObjectFactory::createObjectByName($cacheType); diff --git a/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php b/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php new file mode 100644 index 0000000..5a584cb --- /dev/null +++ b/inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php @@ -0,0 +1,67 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("A filter for verifying graphical code CAPTCHAs"); + + // Create unique ID number + $this->generateUniqueId(); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createGraphicalCodeCaptchaVerifierFilter () { + // Get a new instance + $filterInstance = new GraphicalCodeCaptchaVerifierFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + $requestInstance->debugInstance(); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/helper/captcha/images/class_ImageHelper.php b/inc/classes/main/helper/captcha/images/class_ImageHelper.php index 8d59e70..435f4c5 100644 --- a/inc/classes/main/helper/captcha/images/class_ImageHelper.php +++ b/inc/classes/main/helper/captcha/images/class_ImageHelper.php @@ -356,16 +356,16 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate { $templateInstance->loadCodeTemplate($this->getBaseImage()); // Assign all the image values with the template - $templateInstance->assignVariable("image_name" , $this->getImageName()); - $templateInstance->assignVariable("image_type" , $this->getImageType()); - $templateInstance->assignVariable("image_width" , $this->getWidth()); - $templateInstance->assignVariable("image_height" , $this->getHeight()); - $templateInstance->assignVariable("image_bg_red" , $this->backgroundColor['red']); - $templateInstance->assignVariable("image_bg_green", $this->backgroundColor['green']); - $templateInstance->assignVariable("image_bg_blue" , $this->backgroundColor['blue']); - $templateInstance->assignVariable("image_fg_red" , $this->foregroundColor['red']); - $templateInstance->assignVariable("image_fg_green", $this->foregroundColor['green']); - $templateInstance->assignVariable("image_fg_blue" , $this->foregroundColor['blue']); + $templateInstance->assignVariable('image_name' , $this->getImageName()); + $templateInstance->assignVariable('image_type' , $this->getImageType()); + $templateInstance->assignVariable('image_width' , $this->getWidth()); + $templateInstance->assignVariable('image_height' , $this->getHeight()); + $templateInstance->assignVariable('image_bg_red' , $this->backgroundColor['red']); + $templateInstance->assignVariable('image_bg_green', $this->backgroundColor['green']); + $templateInstance->assignVariable('image_bg_blue' , $this->backgroundColor['blue']); + $templateInstance->assignVariable('image_fg_red' , $this->foregroundColor['red']); + $templateInstance->assignVariable('image_fg_green', $this->foregroundColor['green']); + $templateInstance->assignVariable('image_fg_blue' , $this->foregroundColor['blue']); // Add all strings foreach ($this->imageStrings as $id=>$imageString) { @@ -376,10 +376,10 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate { $templateInstance->setVariableGroup($id); // Add group variables - $templateInstance->addGroupVariable("image_x" , $this->getX()); - $templateInstance->addGroupVariable("image_y" , $this->getY()); - $templateInstance->addGroupVariable("image_size" , $this->getFontSize()); - $templateInstance->addGroupVariable("image_string", $this->getImageString()); + $templateInstance->addGroupVariable('image_x' , $this->getX()); + $templateInstance->addGroupVariable('image_y' , $this->getY()); + $templateInstance->addGroupVariable('image_size' , $this->getFontSize()); + $templateInstance->addGroupVariable('image_string', $this->getImageString()); } // END - foreach // Get the raw content diff --git a/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php b/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php index 3e57d24..0a0f302 100644 --- a/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php +++ b/inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php @@ -140,7 +140,7 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha { $templateInstance = $helperInstance->getTemplateInstance(); // Load a template for this CAPTCHA - $templateInstance->loadCodeTemplate("captch_graphic_code"); + $templateInstance->loadCodeTemplate('captch_graphic_code'); // Rename variable $templateInstance->renameVariable('captcha_code', $helperInstance->getFormName().'_captcha'); diff --git a/inc/classes/main/helper/web/class_WebFormHelper.php b/inc/classes/main/helper/web/class_WebFormHelper.php index 603f70b..5b12e2b 100644 --- a/inc/classes/main/helper/web/class_WebFormHelper.php +++ b/inc/classes/main/helper/web/class_WebFormHelper.php @@ -215,7 +215,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate { } // END - if // Generate the content - $inputContent = sprintf("", + $inputContent = sprintf("", $fieldName, $fieldName, $fieldValue @@ -257,7 +257,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate { } // END - if // Generate the content - $inputContent = sprintf("", + $inputContent = sprintf("", $fieldName, $fieldName, $fieldValue @@ -345,7 +345,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate { if ($fieldChecked === false) $checked = " "; // Generate the content - $inputContent = sprintf("", + $inputContent = sprintf("", $fieldName, $fieldName, $checked @@ -778,7 +778,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate { * @return $isSecured Wether this form is secured by a CAPTCHA */ public function ifFormSecuredWithCaptcha () { - $isSecured = ($this->getConfigInstance()->readConfig($this->getFormName()."_captcha_secured") == "Y"); + $isSecured = ($this->getConfigInstance()->readConfig($this->getFormName().'_captcha_secured') === "Y"); return $isSecured; } diff --git a/inc/classes/main/images/extended/class_PngImage.php b/inc/classes/main/images/extended/class_PngImage.php index e5f184d..35625cf 100644 --- a/inc/classes/main/images/extended/class_PngImage.php +++ b/inc/classes/main/images/extended/class_PngImage.php @@ -32,7 +32,7 @@ class PngImage extends BaseImage { parent::__construct(__CLASS__); // Set part description - $this->setObjectDescription(""); + $this->setObjectDescription("PNG image"); // Create unique ID number $this->generateUniqueId(); @@ -52,7 +52,7 @@ class PngImage extends BaseImage { $imageInstance->setTemplateInstance($templateInstance); // Set image type - $imageInstance->setImageType("png"); + $imageInstance->setImageType('png'); // Return the instance return $imageInstance; diff --git a/inc/classes/main/io/class_FileIoStream.php b/inc/classes/main/io/class_FileIoStream.php index f3cf60e..817c538 100644 --- a/inc/classes/main/io/class_FileIoStream.php +++ b/inc/classes/main/io/class_FileIoStream.php @@ -164,7 +164,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil // Is the header (maybe) valid? if (count($header) != 4) { // Throw an exception - throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); } } elseif (substr($rawLine, 0, 5) == "@data") { // Is a data line! @@ -202,7 +202,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil // Was a header found? if (count($header) != 4) { // Throw an exception - throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); } // Decode all from Base64 diff --git a/inc/classes/main/resolver/controller/class_BaseControllerResolver.php b/inc/classes/main/resolver/controller/class_BaseControllerResolver.php index 75a1b8e..8f6cc95 100644 --- a/inc/classes/main/resolver/controller/class_BaseControllerResolver.php +++ b/inc/classes/main/resolver/controller/class_BaseControllerResolver.php @@ -102,14 +102,14 @@ class BaseControllerResolver extends BaseResolver { if (class_exists($this->getClassName())) { // This class does exist. :-) $isValid = true; - } elseif (($this->getClassName() != $this->controllerPrefix."DefaultController") && ($this->getClassName() != $this->controllerPrefix."DefaultNewsController")) { + } elseif (($this->getClassName() != $this->controllerPrefix.'DefaultController') && ($this->getClassName() != $this->controllerPrefix.'DefaultNewsController')) { // Do we have news? if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) { // Yes, display news in home then set default controller with news - $this->setClassName($this->controllerPrefix."DefaultNewsController"); + $this->setClassName($this->controllerPrefix.'DefaultNewsController'); } else { - // No news at "home" page or non-news page - $this->setClassName($this->controllerPrefix."DefaultController"); + // No news at home page or non-news page + $this->setClassName($this->controllerPrefix.'DefaultController'); } } else { // All is tried, give it up here diff --git a/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php b/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php index 830c7b2..1d9e400 100644 --- a/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php +++ b/inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php @@ -136,7 +136,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll $controllerInstance = null; // Default controller - $this->setClassName("ImageDefaultController"); + $this->setClassName('ImageDefaultController'); // Generate the class name //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName; @@ -147,7 +147,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll )); } else { // Default controller - $this->setClassName("ImageDefaultController"); + $this->setClassName('ImageDefaultController'); } //* DEBUG: */ echo ", controller=".$this->getClassName()."
\n"; diff --git a/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php b/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php index 777f8ed..6fd9995 100644 --- a/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php @@ -136,7 +136,7 @@ class WebControllerResolver extends BaseControllerResolver implements Controller $controllerInstance = null; // Default controller - $this->setClassName("WebDefaultController"); + $this->setClassName('WebDefaultController'); // Generate the class name //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName; @@ -147,10 +147,10 @@ class WebControllerResolver extends BaseControllerResolver implements Controller )); } elseif ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) { // Yes, display news in home then set default controller with news - $this->setClassName("WebDefaultNewsController"); + $this->setClassName('WebDefaultNewsController'); } else { - // No news at "home" page or non-news page - $this->setClassName("WebDefaultController"); + // No news at home page or non-news page + $this->setClassName('WebDefaultController'); } //* DEBUG: */ echo ", controller=".$this->getClassName()."
\n"; diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php index e0983b8..c4660eb 100644 --- a/inc/classes/main/template/class_BaseTemplateEngine.php +++ b/inc/classes/main/template/class_BaseTemplateEngine.php @@ -114,7 +114,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { /** * Current variable group */ - private $currGroup = "general"; + private $currGroup = 'general'; /** * All template groups except "general" @@ -202,7 +202,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private function addVariable ($var, $value) { // Set general variable group - $this->setVariableGroup("general"); + $this->setVariableGroup('general'); // Add it to the stack $this->addGroupVariable($var, $value); @@ -239,9 +239,9 @@ class BaseTemplateEngine extends BaseFrameworkSystem { //* DEBIG: */ echo __METHOD__.": currGroup=".$groupName."
\n"; $this->currGroup = $groupName; - // Skip group "general" - if (($groupName != "general") && ($add === true)) { - $this->varGroups[$groupName] = "OK"; + // Skip group 'general' + if (($groupName != 'general') && ($add === true)) { + $this->varGroups[$groupName] = 'OK'; } // END - if } @@ -550,7 +550,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { } /** - * Try to assign an extracted template variable as a "content" or "config" + * Try to assign an extracted template variable as a "content" or 'config' * variable. * * @param $varName The variable's name (shall be content orconfig) by @@ -559,7 +559,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private function assignTemplateVariable ($varName, $var) { // Is it not a config variable? - if ($varName != "config") { + if ($varName != 'config') { // Regular template variables $this->assignVariable($var, ""); } else { @@ -1183,13 +1183,13 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ public function assignApplicationData (ManageableApplication $appInstance) { // Get long name and assign it - $this->assignVariable("app_full_name" , $appInstance->getAppName()); + $this->assignVariable('app_full_name' , $appInstance->getAppName()); // Get short name and assign it - $this->assignVariable("app_short_name", $appInstance->getAppShortName()); + $this->assignVariable('app_short_name', $appInstance->getAppShortName()); // Get version number and assign it - $this->assignVariable("app_version" , $appInstance->getAppVersion()); + $this->assignVariable('app_version' , $appInstance->getAppVersion()); } /** diff --git a/inc/classes/main/template/image/class_ImageTemplateEngine.php b/inc/classes/main/template/image/class_ImageTemplateEngine.php index c4d30e9..759b40e 100644 --- a/inc/classes/main/template/image/class_ImageTemplateEngine.php +++ b/inc/classes/main/template/image/class_ImageTemplateEngine.php @@ -23,7 +23,7 @@ */ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTemplate { /** - * Main nodes in the XML tree ("image" is ignored) + * Main nodes in the XML tree ('image' is ignored) */ private $mainNodes = array("base", "type", "resolution", "background-color", "foreground-color", "image-string"); @@ -56,10 +56,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** @@ -134,8 +130,8 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl xml_set_object($xmlParser, $this); // Set handler call-backs - xml_set_element_handler($xmlParser, "startElement", "endElement"); - xml_set_character_data_handler($xmlParser, "characterHandler"); + xml_set_element_handler($xmlParser, 'startElement', 'endElement'); + xml_set_character_data_handler($xmlParser, 'characterHandler'); // Now parse the XML tree if (!xml_parse($xmlParser, $imageContent)) { @@ -158,7 +154,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl */ public function startElement ($resource, $element, array $attributes) { // Initial method name which will never be called... - $methodName = "initImage"; + $methodName = 'initImage'; // Make the element name lower-case $element = strtolower($element); @@ -167,11 +163,11 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl //* DEBUG: */ echo "START: >".$element."<
\n"; if (in_array($element, $this->mainNodes)) { // Okay, main node found! - $methodName = "setImage" . $this->convertToClassName($element); + $methodName = 'setImage' . $this->convertToClassName($element); } elseif (in_array($element, $this->subNodes)) { // Sub node found - $methodName = "setImageProperty" . $this->convertToClassName($element); - } elseif ($element != "image") { + $methodName = 'setImageProperty' . $this->convertToClassName($element); + } elseif ($element != 'image') { // Invalid node name found throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN); } @@ -204,7 +200,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl } // Construct method name - $methodName = "finish" . $this->convertToClassName($nodeName); + $methodName = 'finish' . $this->convertToClassName($nodeName); // Call the corresponding method call_user_func_array(array($this->imageInstance, $methodName), array()); @@ -250,19 +246,19 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl */ private function setImageType ($imageType) { // Set group to general - $this->setVariableGroup("general"); + $this->setVariableGroup('general'); // Try to compile it first to get the value from variable stack $imageType = $this->compileRawCode($imageType); // Now make a class name of it - $className = $this->convertToClassName($imageType."_image"); + $className = $this->convertToClassName($imageType.'_image'); // And try to initiate it $this->imageInstance = ObjectFactory::createObjectByName($className, array($this)); // Set current main node to type - $this->currMainNode = "type"; + $this->currMainNode = 'type'; } /** @@ -276,7 +272,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initResolution(); // Current main node is resolution - $this->currMainNode = "resolution"; + $this->currMainNode = 'resolution'; } /** @@ -290,7 +286,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initBase(); // Current main node is resolution - $this->currMainNode = "base"; + $this->currMainNode = 'base'; } /** @@ -304,7 +300,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initBackgroundColor(); // Current main node is background-color - $this->currMainNode = "background-color"; + $this->currMainNode = 'background-color'; } /** @@ -318,7 +314,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initForegroundColor(); // Current main node is foreground-color - $this->currMainNode = "foreground-color"; + $this->currMainNode = 'foreground-color'; } /** @@ -328,12 +324,12 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl * @return void * @see ImageTemplateEngine::setImageResolution */ - private function setImageImageString ($groupable = "single") { + private function setImageImageString ($groupable = 'single') { // Call the image class $this->imageInstance->initImageString($groupable); // Current main node is foreground-color - $this->currMainNode = "image-string"; + $this->currMainNode = 'image-string'; } /** @@ -464,7 +460,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl */ public function getImageCacheFqfn () { // Get the FQFN ready - $fqfn = $this->getBasePath()."_cache/" . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType(); + $fqfn = $this->getBasePath().'_cache/' . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType(); // Return it return $fqfn; diff --git a/inc/classes/main/template/web/class_WebTemplateEngine.php b/inc/classes/main/template/web/class_WebTemplateEngine.php index 35d34c5..f87a4e1 100644 --- a/inc/classes/main/template/web/class_WebTemplateEngine.php +++ b/inc/classes/main/template/web/class_WebTemplateEngine.php @@ -37,10 +37,6 @@ class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplat // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..c34340a --- /dev/null +++ b/package.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +echo "$0: Cleaning up..." +rm -f shipsimu_dev*.zip + +echo "$0: Packaging..." +zip -9 shipsimu_dev.zip docs/* Doxyfile index.php rebuild_doc.sh > /dev/null 2>&1 +zip -9r shipsimu_dev.zip application/ db/ devel/ Doxyfile inc/ templates/ tests/ > /dev/null 2>&1 +zip -d shipsimu_dev.zip docs/warn.log db/user/*.serialized templates/images/_cache/*.png application/ship-simu/templates/images/_cache/*.png > /dev/null 2>&1 + +echo "$0: Renaming..." +mv shipsimu_dev.zip shipsimu_dev_`date +%Y%m%d_%H%M%S`.zip + +echo "$0: All done." -- 2.39.5