]> git.mxchange.org Git - shipsimu.git/commitdiff
Simple exception handler and error handler added, profile update added with stubs
authorRoland Häder <roland@mxchange.org>
Fri, 20 Jun 2008 16:10:03 +0000 (16:10 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 20 Jun 2008 16:10:03 +0000 (16:10 +0000)
41 files changed:
.gitattributes
application/ship-simu/exceptions.php
application/ship-simu/loader.php
application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php [new file with mode: 0644]
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php
application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php
application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php
application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php
application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php
application/ship-simu/starter.php
inc/classes/exceptions/class_FrameworkException.php
inc/classes/exceptions/database/general/class_SqlException.php
inc/classes/exceptions/io/class_FileIsMissingException.php [new file with mode: 0644]
inc/classes/exceptions/io/class_FileReadProtectedException.php [new file with mode: 0644]
inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php
inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php
inc/classes/exceptions/main/class_FatalErrorException.php [new file with mode: 0644]
inc/classes/interfaces/commands/class_Commandable.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/web/class_WebDoFormCommand.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/controller/form/class_WebDoFormController.php
inc/classes/main/controller/form/class_WebLoginAreaController.php [new file with mode: 0644]
inc/classes/main/filter/change/.htaccess [new file with mode: 0644]
inc/classes/main/filter/change/class_EmailChangeFilter.php [new file with mode: 0644]
inc/classes/main/filter/change/class_PasswordChangeFilter.php [new file with mode: 0644]
inc/classes/main/helper/web/class_WebFormHelper.php
inc/classes/main/io/class_FrameworkFileInputPointer.php
inc/classes/main/template/class_TemplateEngine.php
inc/config.php
templates/de/code/emergency_exit.ctp

index 5364a5ea935bbb1ecbf58d0dce84f7a69f227370..7a90d3b4e25f58e52356a447de0b9ec67f002f10 100644 (file)
@@ -66,6 +66,7 @@ application/ship-simu/main/class_WorksContract.php -text
 application/ship-simu/main/commands/.htaccess -text
 application/ship-simu/main/commands/web/.htaccess -text
 application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php -text
+application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php -text
 application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php -text
 application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php -text
 application/ship-simu/main/companies/.htaccess -text
@@ -198,7 +199,9 @@ inc/classes/exceptions/helper/class_InvalidFormNameException.php -text
 inc/classes/exceptions/helper/class_UserInstanceMissingException.php -text
 inc/classes/exceptions/io/.htaccess -text
 inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text
+inc/classes/exceptions/io/class_FileIsMissingException.php -text
 inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text
+inc/classes/exceptions/io/class_FileReadProtectedException.php -text
 inc/classes/exceptions/io/class_InvalidDataLengthException.php -text
 inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php -text
 inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php -text
@@ -221,6 +224,7 @@ inc/classes/exceptions/main/class_DimNotFoundInArrayException.php -text
 inc/classes/exceptions/main/class_EmptyVariableException.php -text
 inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text
 inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text
+inc/classes/exceptions/main/class_FatalErrorException.php -text
 inc/classes/exceptions/main/class_GetterNotFoundException.php -text
 inc/classes/exceptions/main/class_InvalidArrayCountException.php -text
 inc/classes/exceptions/main/class_InvalidCommandException.php -text
@@ -360,6 +364,7 @@ inc/classes/main/controller/default/class_WebLoginController.php -text
 inc/classes/main/controller/default/class_WebLoginFailedController.php -text
 inc/classes/main/controller/form/.htaccess -text
 inc/classes/main/controller/form/class_WebDoFormController.php -text
+inc/classes/main/controller/form/class_WebLoginAreaController.php -text
 inc/classes/main/controller/login/.htaccess -text
 inc/classes/main/controller/login/class_WebLoginAreaController.php -text
 inc/classes/main/criteria/.htaccess -text
@@ -395,6 +400,9 @@ inc/classes/main/factories/web/class_WebNewsFactory.php -text
 inc/classes/main/filter/.htaccess -text
 inc/classes/main/filter/auth/.htaccess -text
 inc/classes/main/filter/auth/class_UserAuthFilter.php -text
+inc/classes/main/filter/change/.htaccess -text
+inc/classes/main/filter/change/class_EmailChangeFilter.php -text
+inc/classes/main/filter/change/class_PasswordChangeFilter.php -text
 inc/classes/main/filter/checkboxes/.htaccess -text
 inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php -text
 inc/classes/main/filter/class_ -text
index 7f3ddcae547ce8affe5ed75d4a15c709ac16598f..98989ee11b992d4e64f4dd16443e53d3e361089f 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
+// Our own exception handler
+function __exceptionHandler (FrameworkException $e) {
+       // Call the app_die() method
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> (<strong>%s</strong>) has been terminated due to a thrown exception: <strong>%s: <span id=\"debug_exception\">%s</em></strong>. Backtrace: <div id=\"debug_backtrace\">%s</div>",
+               ApplicationHelper::getInstance()->getAppName(),
+               ApplicationHelper::getInstance()->getAppShortName(),
+               $e->__toString(),
+               $e->getMessage(),
+               $e->getPrintableBackTrace()
+       ));
+}
+
 // Set the new handler
-//set_exception_handler('shipsimu_exception_handler');
+set_exception_handler('__exceptionHandler');
+
+// Error handler
+function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) {
+       // Construct the message
+       $message = sprintf("File: <span id=\"debug_file\">%s</span>, Line: <span id=\"debug_line\">%s</span>, Code: <span id=\"debug_code\">%s</span>, Message: <span id=\"debug_message\">%s</span>",
+               basename($errfile),
+               $errline,
+               $errno,
+               $errstr
+       );
+
+       // Throw an exception here
+       throw new FatalErrorException($message, BaseFrameworkSystem::EXCEPTION_FATAL_ERROR);
+}
+
+// Set error handler
+set_error_handler('__errorHandler');
 
 // [EOF]
 ?>
index e6cf6503ff7d55137590ecfaad4087409a8779c6..e18c7490cc06ad8f4c5092b9e1ccda0996162b34 100644 (file)
@@ -27,35 +27,9 @@ $cfg = FrameworkConfiguration::getInstance();
 
 // Load all classes for the application
 foreach ($lowerClasses as $class) {
-       // Try to load the application classes
-       try {
-               ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", $cfg->readConfig('application_path'), $cfg->readConfig('app_name'), $class));
-       } catch (PathIsNoDirectoryException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:%s] Cannot find application classes in path <u>%s</u> for this reason: <u>%s</u>",
-                       $application,
-                       $class,
-                       $e->getMessage()
-               ));
-       } catch (PathIsEmptyException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:%s] Cannot find application classes in path <u>%s</u> for this reason: <u>%s</u>",
-                       $application,
-                       $class,
-                       $e->getMessage()
-               ));
-       } catch (PathReadProtectedException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:%s] Cannot find application classes in path <u>%s</u> for this reason: <u>%s</u>",
-                       $application,
-                       $class,
-                       $e->getMessage()
-               ));
-       } catch (DirPointerNotOpenedException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:%s] Cannot find application classes in path <u>%s</u> for this reason: <u>%s</u>",
-                       $application,
-                       $class,
-                       $e->getMessage()
-               ));
-       }
-}
+       // Load the application classes
+       ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", $cfg->readConfig('application_path'), $cfg->readConfig('app_name'), $class));
+} // END - if
 
 // Clean up the global namespace
 unset($lowerClasses);
index 960ba39e68b754b78ea10f0169e9f501be1a4130..60d7fa93bccc978c28a4c9f8d26fc32321201ff0 100644 (file)
@@ -113,6 +113,16 @@ class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable {
                        $responseInstance->addFatalMessage('failed_user_login');
                }
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php
new file mode 100644 (file)
index 0000000..18adfa0
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+/**
+ * A command for profile-update handling
+ *
+ * @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 WebShipsimuProfileCommand extends BaseCommand implements Commandable {
+       /**
+        * Filtered request data
+        */
+       private $requestData = array();
+
+       /**
+        * Allowed profile data to pass through
+        */
+       private $allowedData = array(
+               'pass'  => 'pass1',
+               'email' => 'email1',
+               'surname',
+               'family',
+               'street',
+               'city',
+               'zip',
+               'icq',
+               'jabber',
+               'yahoo',
+               'aol',
+               'msn',
+               'rules'
+       );
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Registration handling command for Ship-Simu");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this command and sets the resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver
+        * @return      $commandInstance        The created command instance
+        */
+       public final static function createWebShipsimuProfileCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new WebShipsimuProfileCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Get the controller instance from the resolver (breaks MVC pattern again)
+               $controllerInstance = $resolverInstance->getControllerInstance();
+
+               /* @TODO Add some more pre/post filters to the controller */
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_change_class'));
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the command 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) {
+               // Make sure only allowed values are comming through
+               foreach ($this->allowedData as $alias=>$element) {
+                       // Do we have an alias?
+                       if (is_string($alias)) {
+                               // Yes, so use it
+                               $this->requestData[$alias]   = $requestInstance->getRequestElement($element);
+                       } else {
+                               // No, default entry
+                               $this->requestData[$element] = $requestInstance->getRequestElement($element);
+                       }
+               } // END - foreach
+
+               // Remove the array, we don't need it anymore
+               unset($this->allowedData);
+
+               // Unfinished!
+               $this->debugInstance();
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Add user auth filter (we don't need an update of the user here because it will be redirected)
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class'));
+       }
+}
+
+// [EOF]
+?>
+
index 035991df0644fb10211f46eb68c8bf4ed83f45c5..3958ea587ec91b4fb3de788eb2853ef25a009390 100644 (file)
@@ -100,6 +100,16 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
                // Redirect or login after registration
                $registerInstance->doPostAction();
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index 6a2ab504c3d6151643f56c378dcf52d2983f851c..908d1f117156800e303368a63ea7ce63380165e2 100644 (file)
@@ -113,6 +113,16 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable {
                        $responseInstance->addFatalMessage('failed_user_login');
                }
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index e5389282979431cec2c473399544ea3be11d0244..c1d6590da3b5f2cba0cf3ed5aeb8dcb1b2aefbb6 100644 (file)
@@ -67,13 +67,6 @@ class EconomyCabin extends BaseCabin implements TradeableItem, ConstructableShip
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index 335477b7c80d73bfa20b101f2cb4ac3a518e6332..cb8627a6e82e592b834dae4c02d9f246039e3282 100644 (file)
@@ -67,13 +67,6 @@ class LowCabin extends BaseCabin implements TradeableItem, ConstructableShipPart
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index 8dd7574fcc6f502cb182cd95d8d4cf399d19d83b..195ee8f4c0b012adbf0e417e6ba9bc98e8e007af 100644 (file)
@@ -67,13 +67,6 @@ class LuxuryCabin extends BaseCabin implements TradeableItem, ConstructableShipP
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index d4dfedb4f39f174f75877ec95451636b3487c326..30e573cf951fa48a6857c71933486625ad58917b 100644 (file)
@@ -64,13 +64,6 @@ class PremierCabin extends BaseCabin implements TradeableItem, ConstructableShip
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index c371454ca00258026f69e34f0567a953344d54eb..4977d8f17ceea9e4c204b2b517ec880efcc8b33f 100644 (file)
@@ -65,13 +65,6 @@ class CarDeck extends BaseDeck implements TradeableItem, ConstructableShipPart {
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index b2666faab68fd99f2ed7e5dda23bb731b366143f..20450f7db9d7c1caf5ed3b74ae7afd7f92c82119 100644 (file)
@@ -65,13 +65,6 @@ class TrainDeck extends BaseDeck implements TradeableItem, ConstructableShipPart
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index 8c994852aaf91dc81f89ba106dfb02113d5e238d..a20bbc2c3bc529b6624f3bb0b59614d2df8116b5 100644 (file)
@@ -66,13 +66,6 @@ class TruckDeck extends BaseDeck implements TradeableItem, ConstructableShipPart
        public function isTradeable () {
                return true;
        }
-
-       /**
-        * Limits this object with an ObjectLimits instance
-        */
-       public function limitObject (ObjectLimits $limitInstance) {
-               ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
-       }
 }
 
 // [EOF]
index dd07fb6a53e3987893087c44c8405a4975e19236..738a628daf2dec2aa97fba9597a35327c90bd87f 100644 (file)
@@ -46,18 +46,8 @@ if ((empty($app)) || (is_null($app))) {
        ));
 }
 
-// Call the entry point method
-try {
-       // Call user function
-       call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
-} catch (FrameworkException  $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> has been terminated due to a thrown exception: <strong>%s - %s</strong>",
-               $application,
-               $e->__toString(),
-               $e->getMessage()
-       ));
-}
-
+// Call user function
+call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
 
 // [EOF]
 ?>
index 2c403966037f736c9be75a5e2a37870ee8a6f04f..e74dd5a442e0d2593db00cf463fd2a7eec0fef99 100644 (file)
@@ -66,6 +66,58 @@ abstract class FrameworkException extends ReflectionException {
                return $this->backTrace;
        }
 
+       /**
+        * Getter for printable backtrace
+        *
+        * @return      $backTrace      Backtrace for web pages
+        */
+       public final function getPrintableBackTrace () {
+               // Get the backtrace
+               $dbgTrace = $this->getBackTrace();
+
+               // Taken from de.php.net user comments
+               $dbgMsg = "<br />\nDebug backtrace begin:<br />\n";
+               foreach ($dbgTrace as $dbgIndex => $dbgInfo) {
+                       // No info by default
+                       $info = "NULL";
+
+                       // Are there arguments?
+                       if ((isset($dbgInfo['args'])) && (is_array($dbgInfo['args'])) && (isset($dbgInfo['args'][0]))) {
+                               //* DEBUG: */ echo $dbgIndex.": <pre>".htmlentities(print_r($dbgInfo['args'], true))."</pre>";
+                               $info = "";
+                               foreach ($dbgInfo['args'] as $debug) {
+                                       // Add only non-array elements
+                                       if (!is_array($debug)) {
+                                               $info .= $debug.", ";
+                                       } // END - if
+                               } // END - if
+
+                               $info = substr($info, 0, -2);
+                       } // END - if
+
+                       // Prepare argument infos
+                       $info = "<em id=\"debug_args\">{$info}</em>";
+
+                       // File detection
+                       $file = "Unknown file";
+                       if (isset($dbgInfo['file'])) {
+                               $file = basename($dbgInfo['file']);
+                       } // END - if
+
+                       // Line detection
+                       $line = "Unknown line";
+                       if (isset($dbgInfo['line'])) {
+                               $line = "line {$dbgInfo['line']}";
+                       } // END - if
+
+                       // The message
+                       $dbgMsg .= "\t at <em id=\"debug_id\">".$dbgIndex."</em> <em id=\"debug_file\">".$file."</em> (<em id=\"debug_line\">".$line."</em>) -&gt; ".$dbgInfo['function']."(".$info.")<br />\n";
+               } // END - if
+               $dbgMsg .= "Debug backtrace end<br />\n";
+
+               return $dbgMsg;
+       }
+
        /**
         * Returns the name of the thrown exception
         *
index 5cd4385c616543bd0e421ebeae0a49f04b025803..f7dddab54481d691495a61399fd3ed5cb1ec8f1c 100644 (file)
@@ -31,11 +31,11 @@ class SqlException extends DatabaseException {
         */
        public function __construct (array $msgArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] SQL error detected. Message from database: <u>%s</u>, code: <u>0x%s</u>.",
+               $message = sprintf("[%s:%d] SQL error detected. Message from database: <u>%s</u>, code: <u>%s</u>.",
                        $msgArray[0]->__toString(),
                        $this->getLine(),
                        $msgArray[1],
-                       dechex($msgArray[2])
+                       $this->getHexCode($msgArray[2])
                );
 
                // Call parent constructor
diff --git a/inc/classes/exceptions/io/class_FileIsMissingException.php b/inc/classes/exceptions/io/class_FileIsMissingException.php
new file mode 100644 (file)
index 0000000..a319a71
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/**
+ * An exception thrown when a file pointer is not opened
+ *
+ * @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 FileIsMissingException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $fqfn           Full-qualified file name of (maybe) missing file
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct ($fqfn, $code) {
+               // Add a message around the missing class
+               $message = sprintf("The requested file <u>%s</u> is missing.", $fqfn);
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/io/class_FileReadProtectedException.php b/inc/classes/exceptions/io/class_FileReadProtectedException.php
new file mode 100644 (file)
index 0000000..c061380
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/**
+ * An exception thrown when a file is read-protected
+ *
+ * @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 FileReadProtectedException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $fileName       File which cannot be read from
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct ($fileName, $code) {
+               // Add a message around the missing class
+               $message = sprintf("File <u>%s</u> is read-protected. Please set read access rights (CHMOD).", $fileName);
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
index 29efd8f94820646252fce96535e815545304ba24..f441ef44316b5b864ad0da7b959c24c321ec91bb 100644 (file)
@@ -31,7 +31,7 @@ class ConfigEntryIsEmptyException extends FrameworkException {
         */
        public function __construct (FrameworkConfiguration $class, $code) {
                // Add a message around the missing class
-               $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!",
+               $message = sprintf("[%s:%d] Empty configuration entry provided!",
                        $class->__toString(),
                        $this->getLine()
                );
index d4283319161413f915924056b0fc0952687da8bc..651e8e030007b89c7f35a8f1572bd2e4f45e2850 100644 (file)
@@ -25,8 +25,8 @@ class ConfigEntryNotFoundException extends FrameworkException {
        /**
         * The constructor
         *
-        * @param               $message                Message from the exception
-        * @param               $code           Code number for the exception
+        * @param               $classArray             Array with class
+        * @param               $code                   Code number for the exception
         * @return      void
         */
        public function __construct (array $classArray, $code) {
@@ -34,7 +34,7 @@ class ConfigEntryNotFoundException extends FrameworkException {
                $classArray = (array) $classArray;
 
                // Add a message around the missing class
-               $message = sprintf("[%s:%d] Konfigurationseintrag <u>%s</u> nicht gefunden.",
+               $message = sprintf("[%s:%d] Configuration entry <u>%s</u> not found.",
                        $classArray[0],
                        $this->getLine(),
                        $classArray[1]
diff --git a/inc/classes/exceptions/main/class_FatalErrorException.php b/inc/classes/exceptions/main/class_FatalErrorException.php
new file mode 100644 (file)
index 0000000..b9bc217
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * An exception thrown when a "fatal" error has been captured by an error handler
+ *
+ * @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 FatalErrorException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $message                Message from the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct ($message, $code) {
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
index 76679cb547d61a7de8f75131243ec5cf7d0c450a..fa8796384c203bbd831b9d0cb0777f367b29a972 100644 (file)
@@ -30,6 +30,14 @@ interface Commandable extends FrameworkInterface {
         * @return      void
         */
        function execute (Requestable $requestInstance, Responseable $responseInstance);
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance);
 }
 
 //
index ade2a9c99a5e52686f8b825495a61ab6dcdaa54c..9432fa656ccb117cc29bf1dd6c58e01a308da587 100644 (file)
@@ -136,6 +136,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        const EXCEPTION_DEFAUL_CONTROLLER_GONE       = 0x034;
        const EXCEPTION_CLASS_NOT_FOUND              = 0x035;
        const EXCEPTION_REQUIRED_INTERFACE_MISSING   = 0x036;
+       const EXCEPTION_FATAL_ERROR                  = 0x037;
+       const EXCEPTION_FILE_NOT_FOUND               = 0x038;
 
        /**
         * In the super constructor these system classes shall be ignored or else
@@ -919,7 +921,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Is the extra message given?
                if (!empty($message)) {
                        // Then add it as well
-                       $stubMessage .= sprintf(" Message: <u>%s</u>", $message);
+                       $stubMessage .= sprintf(" Message: <span id=\"stub_message\">%s</span>", $message);
                }
 
                // Debug instance is there?
index 87bd1d13bfc2f4c115b4de1e34182785f1eedd47..79f292a7a76dda6b3543a0020c86122af45969cd 100644 (file)
@@ -71,6 +71,17 @@ class WebDoFormCommand extends BaseCommand implements Commandable {
                debug_print_backtrace();
                die("</pre>Good bye...");
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
+
 }
 
 // [EOF]
index 1deddf282779cd1d6ce362f2a8c524c57ebf9a97..704ee5fff950425a9c4d4d346480847c2f2453fb 100644 (file)
@@ -109,6 +109,16 @@ class WebHomeCommand extends BaseCommand implements Commandable {
                // Get the content back from the template engine and put it in the response class
                $templateInstance->transferToResponse($responseInstance);
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index ac26849836c375393d5161fe223512a607b89242..146623d24ecae9e0aa4fef6fe792f3a86d597b56 100644 (file)
@@ -104,6 +104,9 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                // Prepare a template instance
                $templateInstance = $this->prepareTemplateEngine($appInstance);
 
+               // Assign base URL
+               $templateInstance->assignConfigVariable('base_url');
+
                // Assign all the application's data with template variables
                $templateInstance->assignApplicationData($appInstance);
 
@@ -128,12 +131,14 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                $templateInstance->loadCodeTemplate($action);
 
                // Assign the template with the master template as a content ... ;)
+               $templateInstance->compileTemplate();
                $templateInstance->assignTemplateWithVariable($action, "login_content");
 
                // Load main template
                $templateInstance->loadCodeTemplate("login_main");
 
                // Assign the main template with the master template as a content ... ;)
+               $templateInstance->compileTemplate();
                $templateInstance->assignTemplateWithVariable("login_main", "content");
 
                // Load the master template
@@ -142,17 +147,25 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                // Set title
                $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($action."_title"));
 
-               // Assign base URL
-               $templateInstance->assignConfigVariable('base_url');
-
                // ... and all variables. This should be merged together in a pattern
                // to make things easier. A cache mechanism should be added between
                // these two calls to cache compiled templates.
+               //$templateInstance->debugInstance();
                $templateInstance->compileVariables();
 
                // Get the content back from the template engine and put it in the response class
                $templateInstance->transferToResponse($responseInstance);
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index 64cba33ea447cb94eab94515c85a3d38d1c8efc2..b5a89acbfd72a0a33425f5b790d4be0a7d268349 100644 (file)
@@ -112,6 +112,16 @@ class WebLoginCommand extends BaseCommand implements Commandable {
                // Get the content back from the template engine and put it in the response class
                $templateInstance->transferToResponse($responseInstance);
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index 04b02c165d62de0513762871b5451b8da02846f9..c7baa753dfe3265bd5ffd5004b0d5c08f49acdab 100644 (file)
@@ -112,6 +112,16 @@ class WebLoginFailedCommand extends BaseCommand implements Commandable {
                // Get the content back from the template engine and put it in the response class
                $templateInstance->transferToResponse($responseInstance);
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index 528f4b5933ab40835bec9feb1515632a123a42bf..5c38d0609c07910c2932b0209b7eb352d49ce101 100644 (file)
@@ -112,6 +112,16 @@ class WebLogoutDoneCommand extends BaseCommand implements Commandable {
                // Get the content back from the template engine and put it in the response class
                $templateInstance->transferToResponse($responseInstance);
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index f073baa8f73f5e038f4fa03febd114ebc1044606..2a50f5ecc247c1202919d37dc244f7c8fd1eade2 100644 (file)
@@ -113,6 +113,16 @@ class WebRegisterCommand extends BaseCommand implements Commandable {
                // Get the content back from the template engine and put it in the response class
                $templateInstance->transferToResponse($responseInstance);
        }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @return      void
+        */
+       function addExtraFilters (Controller $controllerInstance) {
+               // Empty for now
+       }
 }
 
 // [EOF]
index db7cfb432522612d4b131ccc85646ff698f4d35a..1856dd3d1718f38babda4f23a2baf592c33d0433 100644 (file)
@@ -72,8 +72,17 @@ class WebDoFormController extends BaseController implements Controller {
                // Get command instance from resolver
                $commandInstance = $this->getResolverInstance()->resolveCommand($formAction);
 
-               // Execute *very* generic pre filters
-               $this->executePreFilters($requestInstance, $responseInstance);
+               // Try to add more filters by the command
+               $commandInstance->addExtraFilters($this);
+
+               // Try to run the pre filters, if auth exceptions come through redirect here
+               try {
+                       // Run the pre filters
+                       $this->executePreFilters($requestInstance, $responseInstance);
+               } catch (UserAuthorizationException $e) {
+                       // Redirect to main page
+                       $responseInstance->redirectToConfiguredUrl('login_failed_url');
+               }
 
                // Is the request still valid? Post filters shall only be executed of
                // the request is valid
diff --git a/inc/classes/main/controller/form/class_WebLoginAreaController.php b/inc/classes/main/controller/form/class_WebLoginAreaController.php
new file mode 100644 (file)
index 0000000..7ea4e50
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Controller for login area with news
+ *
+ * @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 WebLoginAreaController extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Default controller with news");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public final static function createWebLoginAreaController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new WebLoginAreaController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // User auth filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class'));
+
+               // User update filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_class'));
+
+               // News fetcher filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class'));
+
+               // News proccess/display-preparation
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class'));
+
+               /* @TODO: Add some filters to this controller */
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Try to run the pre filters, if auth exceptions come through redirect here
+               try {
+                       // Run the pre filters
+                       $this->executePreFilters($requestInstance, $responseInstance);
+               } catch (UserAuthorizationException $e) {
+                       // Redirect to main page
+                       $responseInstance->redirectToConfiguredUrl('login_failed_url');
+               }
+
+               // Get the command instance from the resolver by sending a request instance to the resolver
+               $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Run the pre filters
+               $this->executePostFilters($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushBuffer();
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/filter/change/.htaccess b/inc/classes/main/filter/change/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/filter/change/class_EmailChangeFilter.php b/inc/classes/main/filter/change/class_EmailChangeFilter.php
new file mode 100644 (file)
index 0000000..8005cc9
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A filter for detecting email changes
+ *
+ * @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 EmailChangeFilter extends BaseFrameworkSystem implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A filter for email changes");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createEmailChangeFilter () {
+               // Get a new instance
+               $filterInstance = new EmailChangeFilter();
+
+               // 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) {
+               // Implement this!
+               $this->partialStub("Please implement this method.");
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/filter/change/class_PasswordChangeFilter.php b/inc/classes/main/filter/change/class_PasswordChangeFilter.php
new file mode 100644 (file)
index 0000000..353ad72
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A filter for password change detection
+ *
+ * @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 PasswordChangeFilter extends BaseFrameworkSystem implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A filter for password change");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createPasswordChangeFilter () {
+               // Get a new instance
+               $filterInstance = new PasswordChangeFilter();
+
+               // 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) {
+               // Implement this!
+               $this->partialStub("Please implement this method.");
+       }
+}
+
+// [EOF]
+?>
index 5debdda12b3dc07c83cd3350cd837b71126e1bb4..1369fe4595cbc3b3c33633d551df363f64088986 100644 (file)
@@ -134,7 +134,7 @@ class WebFormHelper extends BaseHelper {
                if (($this->formOpened === false) && ($formName === false)) {
                        // Thrown an exception
                        throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
-               }
+               } // END - if
 
                // Close the form is default
                $formContent = "</form>";
@@ -172,7 +172,7 @@ class WebFormHelper extends BaseHelper {
                        if ($this->groupOpened === true) {
                                // Then automatically close it here
                                $this->addFormGroup("", "");
-                       }
+                       } // END - if
 
                        /* @TODO Add some unique PIN here to bypass problems with some browser and/or extensions */
                        // Simply close it
@@ -197,7 +197,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Generate the content
                $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s\" name=\"%s\" value=\"%s\" />",
@@ -239,7 +239,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Generate the content
                $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s\" name=\"%s\" value=\"%s\" />",
@@ -266,7 +266,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Generate the content
                $inputContent = sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />",
@@ -292,7 +292,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Set wether the check box is checked...
                $checked = " checked=\"checked\"";
@@ -322,7 +322,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, "reset"), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Generate the content
                $inputContent = sprintf("<input type=\"reset\" class=\"reset_button\" id=\"%s_reset\" value=\"%s\" />",
@@ -347,7 +347,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, "submit"), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Generate the content
                $inputContent = sprintf("<input type=\"submit\" class=\"submit_button\" id=\"%s_submit\" name=\"%s_button\" value=\"%s\" />",
@@ -374,13 +374,13 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw exception here
                        throw new FormClosedException(array($this, $groupName), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // At least the group name should be set
                if ((empty($groupName)) && ($this->groupOpened === false)) {
                        // Throw exception here
                        throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               }
+               } // END - if
 
                // Initialize content with closing div by default
                $content = "    </div>\n</div><!-- Group - CLOSE //-->";
@@ -411,7 +411,7 @@ class WebFormHelper extends BaseHelper {
                        if ($this->subGroupOpened === true) {
                                // Close it here
                                $this->addFormSubGroup("", "");
-                       }
+                       } // END - if
 
                        // Add the content
                        $this->addContent($content);
@@ -422,7 +422,7 @@ class WebFormHelper extends BaseHelper {
                        // All call it again if the group name is not empty
                        if (!empty($groupName)) {
                                $this->addFormGroup($groupName, $groupText);
-                       }
+                       } // END - if
                }
        }
 
@@ -442,13 +442,13 @@ class WebFormHelper extends BaseHelper {
                if ($this->groupOpened === false) {
                        // Throw exception here
                        throw new FormGroupClosedException(array($this, $subGroupName), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
-               }
+               } // END - if
 
                // At least the sub group name should be set
                if ((empty($subGroupName)) && ($this->subGroupOpened === false)) {
                        // Throw exception here
                        throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               }
+               } // END - if
 
                // Initialize content with closing div by default
                $content = "    </div>\n</div><!-- Sub group- CLOSE //-->";
@@ -485,7 +485,7 @@ class WebFormHelper extends BaseHelper {
                        // All call it again if sub group name is not empty
                        if (!empty($subGroupName)) {
                                $this->addFormSubGroup($subGroupName, $subGroupText);
-                       }
+                       } // END - if
                }
        }
 
@@ -503,7 +503,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Set the block type
                $block = "div";
@@ -536,13 +536,13 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === false) {
                        // Throw an exception
                        throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
-               }
+               } // END - if
 
                // Is a group open?
                if ($this->groupOpened === true) {
                        // Then automatically close it here
                        $this->addFormGroup("", "");
-               }
+               } // END - if
 
                // Generate the content
                $inputContent = sprintf("       <div id=\"form_note\">
@@ -687,7 +687,7 @@ class WebFormHelper extends BaseHelper {
                if ($this->formOpened === true) {
                        // Throw an exception
                        throw new FormOpenedException ($this, self::EXCEPTION_OPENED_FORM);
-               }
+               } // END - if
 
                // Send content to template engine
                $this->getTemplateInstance()->assignVariable($this->formName, $this->getContent());
index 25c77cb838aeebef89e9b665c76b1472e62fbeb3..fe6b058751494f27d9bb635799f35f98f39926b1 100644 (file)
@@ -76,17 +76,23 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         */
        public final static function createFrameworkFileInputPointer ($fileName) {
                // Some pre-sanity checks...
-               if (is_null($fileName)) {
+               if ((is_null($fileName)) || (empty($fileName))) {
                        // No filename given
                        throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!file_exists($fileName)) {
+                       // File does not exist!
+                       throw new FileIsMissingException($fileName, self::EXCEPTION_FILE_NOT_FOUND);
+               } elseif (!is_readable($fileName)) {
+                       // File does not exist!
+                       throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
                }
 
                // Try to open a handler
                $filePointer = @fopen($fileName, 'rb');
-               if (($filePointer === null) || ($filePointer === false)) {
+               if ((is_null($filePointer)) || ($filePointer === false)) {
                        // Something bad happend
                        throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID);
-               }
+               } // END - if
 
                // Create new instance
                $pointerInstance = new FrameworkFileInputPointer();
index 7bbf2e1750b1025a6678e539e9209b7e594cefb0..2a828c0f1d62c6c3efc890e8d46a1d5a8bb47c2f 100644 (file)
@@ -600,8 +600,8 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        foreach ($variableMatches[3] as $key=>$var) {
                                // Try to assign it, empty strings are being ignored
                                $this->assignTemplateVariable($variableMatches[1][$key], $var);
-                       }
-               }
+                       } // END - foreach
+               } // END - if
        }
 
        /**
@@ -649,6 +649,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                                                // Remember this template for recursion detection
                                                // RECURSIVE PROTECTION!
                                                $this->loadedTemplates[] = $template;
+                                       } catch (FileIsMissingException $e) {
+                                               // Even this is not done... :/
+                                               $this->rawTemplates[] = $template;
                                        } catch (FilePointerNotOpenedException $e) {
                                                // Even this is not done... :/
                                                $this->rawTemplates[] = $template;
@@ -752,6 +755,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                                        // Remember this template for recursion detection
                                        // RECURSIVE PROTECTION!
                                        $this->loadedTemplates[] = $template;
+                               } catch (FileIsMissingException $e) {
+                                       // This template was never found. We silently ignore it
+                                       unset($this->rawTemplates[$key]);
                                } catch (FilePointerNotOpenedException $e) {
                                        // This template was never found. We silently ignore it
                                        unset($this->rawTemplates[$key]);
@@ -1012,6 +1018,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        } // END - while
 
                        // Prepare PHP code for eval() command
+                       $evalLength = strlen($eval);
                        $eval = str_replace(
                                "<%php", "\";",
                                str_replace(
@@ -1019,14 +1026,11 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                                )
                        );
 
-                       // Debug message
-                       if ((defined('DEBUG_EVAL')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command: <pre><em>%s</em></pre><br />\n",
-                               $this->__toString(),
-                               htmlentities($eval)
-                       ));
-
-                       // Run the constructed command. This will "compile" all variables in
-                       eval($eval);
+                       // Did something change?
+                       if (strlen($eval) != $eval) {
+                               // Run the constructed command. This will "compile" all variables in
+                               eval($eval);
+                       } // END - if
 
                        // Set raw template data
                        $this->setRawTemplateData($result);
index 321d5133687428123336bb5d1661c0531dc85b35..131af0a98b43524884b8399c8e149f2135401665 100644 (file)
@@ -197,6 +197,12 @@ $cfg->setConfigEntry('email_verifier_class', "EmailVerifierFilter");
 // CFG: PASSWORD-VERIFIER
 $cfg->setConfigEntry('password_verifier_class', "PasswordVerifierFilter");
 
+// CFG: EMAIL-CHANGE-CLASS
+$cfg->setConfigEntry('email_change_class', "EmailChangeFilter");
+
+// CFG: PASSWORD-CHANGE-FILTER
+$cfg->setConfigEntry('password_change_class', "PasswordChangeFilter");
+
 // CFG: CRYPTO-HELPER
 $cfg->setConfigEntry('crypto_class', "CryptoHelper");
 
index 406c2b8601fa0db2d1275352ac521c02293f6ccb..152a1bde1c1cf832cbe5e14f10f68acf3dd17fb2 100644 (file)
@@ -10,7 +10,7 @@
 
        <div id="emergency_exit backtrace_box">
                <div id="backtrace_header">
-                       Backtrace:
+                       File inclusion backtrace:
                </div>
                <div id="backtrace_content">
                        $content[backtrace]