Packager script for latest dev version added, misc fixes, captcha verifier filter...
authorRoland Häder <roland@mxchange.org>
Wed, 25 Jun 2008 18:59:57 +0000 (18:59 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 25 Jun 2008 18:59:57 +0000 (18:59 +0000)
33 files changed:
.gitattributes
application/selector/class_ApplicationSelector.php
application/ship-simu/config.php
application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php
application/ship-simu/main/personell/class_SimulatorPersonell.php
application/ship-simu/templates/de/code/captch_graphic_code.ctp
docs/COPYING
inc/classes/main/cache/class_MemoryCache.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/web/class_WebHomeCommand.php
inc/classes/main/commands/web/class_WebLoginAreaCommand.php
inc/classes/main/commands/web/class_WebLoginCommand.php
inc/classes/main/commands/web/class_WebLoginFailedCommand.php
inc/classes/main/commands/web/class_WebLogoutDoneCommand.php
inc/classes/main/commands/web/class_WebRegisterCommand.php
inc/classes/main/commands/web/class_WebResendLinkCommand.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/extended/class_ObjectLimits.php
inc/classes/main/factories/cache/class_CacheFactory.php
inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php [new file with mode: 0644]
inc/classes/main/helper/captcha/images/class_ImageHelper.php
inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php
inc/classes/main/helper/web/class_WebFormHelper.php
inc/classes/main/images/extended/class_PngImage.php
inc/classes/main/io/class_FileIoStream.php
inc/classes/main/resolver/controller/class_BaseControllerResolver.php
inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php
inc/classes/main/resolver/controller/web/class_WebControllerResolver.php
inc/classes/main/template/class_BaseTemplateEngine.php
inc/classes/main/template/image/class_ImageTemplateEngine.php
inc/classes/main/template/web/class_WebTemplateEngine.php
package.sh [new file with mode: 0755]

index 55178417d83919fba809c145e9887569aea6c4c9..a22315d903a2fc0d694713db288ee1bf3312c582 100644 (file)
@@ -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
index e974a3bee8b03bb1e139983447f362f05987d871..651b2a4c359a68ed9d62f0ec9f8c5ef2852bd715 100644 (file)
@@ -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("<pre>".print_r($curr, true)."</pre>");
 
index 3a4196595712f28496db863e604736128b16d857..ee4315fe3388d458b1c7f69ca6b43f661dcd54e0 100644 (file)
@@ -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);
 
index eedc22ce3a5622ca977418aa691dde9e9a606d24..d1b97a5f54e3401094587813bbe7b3a69ec654eb 100644 (file)
@@ -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'));
        }
 }
 
index a1f4c10162caac8f10fc133d019449ee834522fa..be2f0c349c7554c958f4caaf1daa993543630b8a 100644 (file)
@@ -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'));
        }
 }
 
index 08d69386eda6641c0d67d4a748c146b26ba49bed..fc142cf748d9805b36845d3af50fad88e04a13cb 100644 (file)
@@ -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()) {
index fbf6f2e64bcd0cdd9c054527a24f9a70de864353..4744e75aa9032bbe3538c0cf5f99e3369420166b 100644 (file)
@@ -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();
 
index 370436ec2a2c6e4bf806512eb31bebfd449c182a..8d3092e86c6024f0eb7971667ed36d24460ad8cd 100644 (file)
@@ -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.
index 4cb7459b6d72a47d19a4e5e00beb12455bc44fd7..bf0e3b8593a4b57c6c1e1c1b22692cffc973151c 100644 (file)
@@ -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');
        }
 
        /**
index 3c1b5fc9ac8c38e5fd09e5d9629e0d8322c6a599..fa862a188522d40dc4e04b27a2137f35bee7d01c 100644 (file)
@@ -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 <strong>%s</strong> wird zerst&ouml;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 <em>%s</em>", $this->__toString()));
-                       $this->setRealClass("DestructedObject");
+                       $this->setObjectDescription(sprintf("Removed object <em>%s</em>", $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
index 84ef272368fdfdd706a19c9953d6630a9291305a..ba4788750e2d8174c6445de2bca615a65c8dd3c5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A command for the "home" page
+ * A command for the home page
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @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);
index 0848cf5828b53653fbcd114118900552273716d3..4c8a8814f9d8ddc989b165379a505fe1e8f9e8be 100644 (file)
@@ -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
index b1dd364c7b7def57d81519655613ee7388d7c1f4..84fe288be81aabe94806eec78ab799eca30439ba 100644 (file)
@@ -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);
index 0d1d068982c5e9a921a55c70a8c88ac30fcc9282..cb17816ce45f8fe95be5da65c0e9603dd00ae015 100644 (file)
@@ -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);
index cd09a40dd63f5e3f830e18aca484699a0b6dc73f..52f3396cc0fcd80008043c5885c6e39767f0745f 100644 (file)
@@ -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);
index 5448e2a7c27f8f9cee35045d5635dc3eef5310fa..b00b73b548769349569ee7e0d22b5d836d42197b 100644 (file)
@@ -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);
index 887712e75f078900c01dde9d9d40cc04ae86746d..b24e7d6d2186ddc6442f3c2f7da3ed1bb67c2c7d 100644 (file)
@@ -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);
index 81ad7fd40d14a914372f1a376b7626600e6f455f..734e05601ab61c7d1dd2dd116d18cb3a7cc36573 100644 (file)
@@ -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);
                        }
                }
 
index 926e8fc6994e4915f479c82b7a22cb6e61c980e3..293e908c0ca281756a073cb9721f405a3099dc6d 100644 (file)
@@ -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
index e2cb7bce35571fc18604c469a8c6180758272f7a..04c950d0a991ce26cb697f56c857911ec7b7da73 100644 (file)
@@ -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 (file)
index 0000000..5a584cb
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/**
+ * A concrete filter for validating code graphical CAPTCHAs with hashes
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
index 8d59e709b8ecd41401ea0fbc3cbab44e544d5693..435f4c55d81a937595a0e1fb9c24f62189899a0c 100644 (file)
@@ -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
index 3e57d241e65dddf8c1fba3773db2b3f679f9ad61..0a0f3028a92643f9578efe6ba627f758499e1739 100644 (file)
@@ -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');
index 603f70b79f94825f55791541c044ce8836a12d09..5b12e2b943c3c5db2e73028bcda0eb06af07a2a1 100644 (file)
@@ -215,7 +215,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate {
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s_field\" name=\"%s\" value=\"%s\" />",
+               $inputContent = sprintf("<input type=\"text\" class=\"textfield %s_field\" name=\"%s\" value=\"%s\" />",
                        $fieldName,
                        $fieldName,
                        $fieldValue
@@ -257,7 +257,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate {
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s_field\" name=\"%s\" value=\"%s\" />",
+               $inputContent = sprintf("<input type=\"password\" class=\"password %s_field\" name=\"%s\" value=\"%s\" />",
                        $fieldName,
                        $fieldName,
                        $fieldValue
@@ -345,7 +345,7 @@ class WebFormHelper extends BaseHelper implements HelpableTemplate {
                if ($fieldChecked === false) $checked = " ";
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox\" id=\"%s_field\" value=\"1\"%s/>",
+               $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
                        $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;
        }
 
index e5f184d90b782882e53091f5afd872eb8162a51e..35625cf659cdaf4cc087c1c34017a02ee1e32c44 100644 (file)
@@ -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;
index f3cf60ef1ace67f2a87abc96fb1bcccff670ef94..817c53835580707b3e949ee6de98ab40862dc343 100644 (file)
@@ -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
index 75a1b8ebe8d815c20ac556bbd00324d25bb2292a..8f6cc950ac8644f83cf4bb19c73953a6e99dcf7b 100644 (file)
@@ -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
index 830c7b230fb4de7586dda465eeaa6cfdf03407a0..1d9e400698b3c5ca6b57d103ee5e4e43c300198f 100644 (file)
@@ -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()."<br />\n";
 
index 777f8edd926946998c3932c79c8cc11e18848e75..6fd99955d8e93172b1eb03ba9d3f3403944468f5 100644 (file)
@@ -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()."<br />\n";
 
index e0983b8d53ab6f6dea9dadcdca9eb522aea75272..c4660eb9b28cde163ad891ac4d848860834a202b 100644 (file)
@@ -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."<br />\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());
        }
 
        /**
index c4d30e9b25f0473e58b1e6102c6a08364d0e9f87..759b40edab997feaf3b03cbc3bc99ef759e1356a 100644 (file)
@@ -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: &gt;".$element."&lt;<br />\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;
index 35d34c581730fbd03baca34d2ede6a56896d25be..f87a4e12435d08dc17e96edd8ae7e9dc06246715 100644 (file)
@@ -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 (executable)
index 0000000..c34340a
--- /dev/null
@@ -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."