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 5517841..a22315d 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 e974a3b..651b2a4 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 3a41965..ee4315f 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 eedc22c..d1b97a5 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 a1f4c10..be2f0c3 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 08d6938..fc142cf 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 fbf6f2e..4744e75 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 370436e..8d3092e 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 4cb7459..bf0e3b8 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 3c1b5fc..fa862a1 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 84ef272..ba47887 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 0848cf5..4c8a881 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 b1dd364..84fe288 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 0d1d068..cb17816 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 cd09a40..52f3396 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 5448e2a..b00b73b 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 887712e..b24e7d6 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 81ad7fd..734e056 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 926e8fc..293e908 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 e2cb7bc..04c950d 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 8d59e70..435f4c5 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 3e57d24..0a0f302 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 603f70b..5b12e2b 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 e5f184d..35625cf 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 f3cf60e..817c538 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 75a1b8e..8f6cc95 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 830c7b2..1d9e400 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 777f8ed..6fd9995 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 e0983b8..c4660eb 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 c4d30e9..759b40e 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 35d34c5..f87a4e1 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."