]> git.mxchange.org Git - core.git/commitdiff
Rewritten a lot double-quotes to single-requotes, removed deprecated exception, some...
authorRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 22:38:55 +0000 (22:38 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 13 Mar 2009 22:38:55 +0000 (22:38 +0000)
56 files changed:
.gitattributes
inc/classes/exceptions/class_FrameworkException.php
inc/classes/exceptions/controller/class_DefaultControllerException.php
inc/classes/exceptions/controller/class_InvalidControllerException.php
inc/classes/exceptions/crypto/class_EncryptInvalidLengthException.php
inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php
inc/classes/exceptions/main/class_InvalidCommandException.php
inc/classes/exceptions/template/class_ViewHelperNotFoundException.php [deleted file]
inc/classes/exceptions/xml/class_InvalidXmlNodeException.php
inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php
inc/classes/interfaces/io/output/class_OutputStreamer.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/web/class_WebLoginAreaCommand.php
inc/classes/main/compressor/class_GzipCompressor.php
inc/classes/main/crypto/class_CryptoHelper.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/debug/class_DebugConsoleOutput.php
inc/classes/main/debug/class_DebugErrorLogOutput.php
inc/classes/main/debug/class_DebugWebOutput.php
inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php
inc/classes/main/filter/validator/class_EmailValidatorFilter.php
inc/classes/main/helper/class_BaseHelper.php
inc/classes/main/helper/web/blocks/class_WebBlockHelper.php
inc/classes/main/helper/web/class_BaseWebHelper.php
inc/classes/main/helper/web/forms/class_WebFormHelper.php
inc/classes/main/helper/web/links/class_WebLinkHelper.php
inc/classes/main/io/class_FileIoStream.php
inc/classes/main/language/class_LanguageSystem.php
inc/classes/main/output/class_ConsoleOutput.php
inc/classes/main/output/class_WebOutput.php
inc/classes/main/registry/class_Registry.php
inc/classes/main/request/class_HttpRequest.php
inc/classes/main/resolver/action/class_BaseActionResolver.php
inc/classes/main/resolver/command/class_BaseCommandResolver.php
inc/classes/main/resolver/command/image/class_ImageCommandResolver.php
inc/classes/main/resolver/command/web/class_WebCommandResolver.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/response/class_BaseResponse.php
inc/classes/main/response/http/class_HttpResponse.php
inc/classes/main/response/image/class_ImageResponse.php
inc/classes/main/result/class_DatabaseResult.php
inc/classes/main/rng/class_RandomNumberGenerator.php
inc/classes/main/template/class_BaseTemplateEngine.php
inc/classes/main/template/image/class_ImageTemplateEngine.php
inc/classes/main/template/mail/class_MailTemplateEngine.php
inc/classes/main/user/class_BaseUser.php
inc/classes/third_party/api/primusportal/class_PrimeraApi.php
inc/classes/third_party/api/wernisportal/class_WernisApi.php
inc/config/class_FrameworkConfiguration.php
inc/database.php
inc/database/lib-local.php
inc/language.php
inc/loader/class_ClassLoader.php
inc/selector.php

index f7c63ef4f8367eb9861ea0dd10218a3f627d4d06..dc179059e36629ac8d3ae78b4247dd21290642d9 100644 (file)
@@ -108,7 +108,6 @@ inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text
 inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text
 inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text
 inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text
-inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text
 inc/classes/exceptions/user/.htaccess -text
 inc/classes/exceptions/user/class_AccountPasswordMismatchException.php -text
 inc/classes/exceptions/user/class_UserEmailMissingException.php -text
index f3a42895eaf2dcba6a719a394203c5d4acfe0f58..ed71ebdd50096fe55769f5ff9d5426752fe76e03 100644 (file)
@@ -122,7 +122,7 @@ abstract class FrameworkException extends ReflectionException {
                                foreach ($dbgInfo['args'] as $debug) {
                                        // Add only non-array elements
                                        if (!is_array($debug)) {
-                                               $info .= $debug.", ";
+                                               $info .= $debug . ', ';
                                        } // END - if
                                } // END - foreach
 
@@ -146,7 +146,7 @@ abstract class FrameworkException extends ReflectionException {
                        } // END - if
 
                        // The message
-                       $dbgMsg .= "\t at <em id=\"debug_id_".$dbgIndex."\">".$dbgIndex."</em> <em id=\"debug_file_".$dbgIndex."\">".$file."</em> (<em id=\"debug_line_".$dbgIndex."\">".$line."</em>) -&gt; ".$dbgInfo['function']."(".$info.")<br />\n";
+                       $dbgMsg .= "\t at <em id=\"debug_id_".$dbgIndex."\">".$dbgIndex."</em> <em id=\"debug_file_".$dbgIndex."\">".$file."</em> (<em id=\"debug_line_".$dbgIndex."\">".$line."</em>) -&gt; ".$dbgInfo['function'].'('.$info.")<br />\n";
                } // END - if
 
                // Add end-message
index c718c00bb649ae2dd5649db1b65e41e3318da13d..f0065e5d326fe481c0290143bbd4d3ef30e98ea1 100644 (file)
@@ -37,7 +37,7 @@ class DefaultControllerException extends FrameworkException {
                );
 
                // Set extra data
-               $this->setExtraData($resolverInstance->getClassName().":".$this->getLine());
+               $this->setExtraData($resolverInstance->getClassName().':'.$this->getLine());
 
                // Call parent contructor with message
                parent::__construct($message, $code);
index 5e25a52d843f6aefe9d3b8cae54d4715396c52eb..c8234e15a8e26bd3bf0f4ce6ce98c9ae5d775b5a 100644 (file)
@@ -39,7 +39,7 @@ class InvalidControllerException extends FrameworkException {
                );
 
                // Set extra data
-               $this->setExtraData($msgArray[0]->getClassName().":".$this->getLine());
+               $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
 
                // Call parent contructor with message
                parent::__construct($message, $code);
index 7fbe36c2f96d941d0e138eac8f2d3f953d556b3e..43d5a2cec2ed17005367aeff731b944e05d96e3c 100644 (file)
@@ -41,7 +41,7 @@ class EncryptInvalidLengthException extends FrameworkException {
                );
 
                // Set extra data
-               $this->setExtraData($filterInstance->__toString().":".$length);
+               $this->setExtraData($filterInstance->__toString().':'.$length);
 
                // Call parent exception constructor
                parent::__construct($message, $code);
index d0446134d7e5ff102bb6e536c9aaab8376135f5c..ccffca89e1fe762b42e878fd73a607975d064cd7 100644 (file)
@@ -40,7 +40,7 @@ class ConfigEntryNotFoundException extends FrameworkException {
                );
 
                // Set extra data
-               $this->setExtraData($classArray[1].":".$this->getLine());
+               $this->setExtraData($classArray[1].':'.$this->getLine());
 
                // Call parent constructor
                parent::__construct($message, $code);
index 4076c7df851a3a9e249b37a5c75bbe5d5df9ec7b..834b6c4ba0889f41b8224ddf826516e7dbf6f1c4 100644 (file)
@@ -39,7 +39,7 @@ class InvalidCommandException extends FrameworkException {
                );
 
                // Set extra data
-               $this->setExtraData($msgArray[0]->getClassName().":".$this->getLine());
+               $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
 
                // Call parent constructor
                parent::__construct($message, $code);
diff --git a/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php b/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php
deleted file mode 100644 (file)
index e45325a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * An exception thrown when a given view helper was not found
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007 - 2009 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- * @todo               Rename this class to NoViewHelperException
- * @deprecated
- *
- * 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 ViewHelperNotFoundException extends FrameworkException {
-       /**
-        * The constructor
-        *
-        * @param       $msgArray       An array holding our informations
-        * @param       $code           Code number for the exception
-        * @return      void
-        */
-       public function __construct (array $msgArray, $code) {
-               // Add a message around the missing class
-               $message = sprintf("[%s:] View-Helper <span class=\"exception_reason\">%s</span> ist ung&uuml;ltig.",
-                       $msgArray[0]->__toString(),
-                       $msgArray[1]
-               );
-
-               // Call parent constructor
-               parent::__construct($message, $code);
-       }
-}
-
-// [EOF]
-?>
index 0e3f0cfa22e8319a867e1e5f7558b3027b7958ba..e2c5781e21a31ed34afa4c9e2a9954c6c4a77daf 100644 (file)
@@ -31,9 +31,9 @@ class InvalidXmlNodeException extends FrameworkException {
         */
        public function __construct (array $classArray, $code) {
                // Extract attributes
-               $attributes = "<em>None</em>";
+               $attributes = '<em>None</em>';
                if ((is_array($classArray[2])) && (count($classArray[2]) > 0)) {
-                       $attributes = implode(", ", $classArray[2]);
+                       $attributes = implode(', ', $classArray[2]);
                } // END - if
 
                // Construct our message
index f5cd0d9d9bee6b0faeea6943ba66e1af7da8043b..726fc7894a05ea8db4bd31d0088d6671a9dc8c32 100644 (file)
@@ -37,7 +37,7 @@ interface DatabaseFrontendInterface extends FrameworkDatabaseInterface {
         * Starts a SELECT query on the database by given return type, table name
         * and search criteria
         *
-        * @param       $resultType             Result type ("array", "object" and "indexed" are valid)
+        * @param       $resultType             Result type ('array', 'object' and 'indexed' are valid)
         * @param       $tableName              Name of the database table
         * @param       $criteria               Search criteria class
         * @return      $resultData             Result data of the query
@@ -47,7 +47,7 @@ interface DatabaseFrontendInterface extends FrameworkDatabaseInterface {
        function querySelect ($resultType, $tableName, LocalSearchCriteria $criteriaInstance);
 
        /**
-        * "Inserts" a data set instance into a local file database folder
+        * 'Inserts' a data set instance into a local file database folder
         *
         * @param       $dataSetInstance        A storeable data set
         * @return      void
@@ -56,7 +56,7 @@ interface DatabaseFrontendInterface extends FrameworkDatabaseInterface {
        function queryInsertDataSet (StoreableCriteria $dataSetInstance);
 
        /**
-        * "Updates" a data set instance with a database layer
+        * 'Updates' a data set instance with a database layer
         *
         * @param       $dataSetInstance        A storeable data set
         * @return      void
index 9c00477156387520729ce8250d1ff90fa3a8828f..767812174687c1f09e2b217b90f1bdffb0c8b724 100644 (file)
@@ -25,8 +25,8 @@ interface OutputStreamer extends Streamable {
        /**
         * Assigns a variable for output
         *
-        * @param               $var            The variable we shall assign
-        * @param               $value  The value to store in the variable
+        * @param       $var    The variable we shall assign
+        * @param       $value  The value to store in the variable
         * @return      void
         */
        function assignVariable ($var, $value);
@@ -36,7 +36,7 @@ interface OutputStreamer extends Streamable {
         *
         * @return      void
         */
-       function output ($outStream=false);
+       function output ($outStream = false);
 }
 
 //
index 06fddbc5162c8a143d85d8279847fd1d70647298..46280f890d3063a02b741b52fb6eac6e6b419dc9 100644 (file)
@@ -208,7 +208,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
                        // Already destructed object
                        $this->debugOutput(sprintf("[%s:] The object <span class=\"object_name\">%s</span> is already destroyed.",
-                               __CLASS__, $this->__toString()
+                               __CLASS__,
+                               $this->__toString()
                        ));
                }
        }
@@ -223,27 +224,27 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $argsString = '';
                if (empty($args)) {
                        // No arguments
-                       $argsString = "NULL";
+                       $argsString = 'NULL';
                } elseif (is_array($args)) {
                        // Some arguments are there
                        foreach ($args as $arg) {
                                // Add the type
-                               $argsString .= $arg." (".gettype($arg);
+                               $argsString .= $arg . ' (' . gettype($arg);
 
                                // Add length if type is string
-                               if (gettype($arg) == 'string') $argsString .= ", ".strlen($arg);
+                               if (gettype($arg) == 'string') $argsString .= ', '.strlen($arg);
 
                                // Closing bracket
-                               $argsString .= "), ";
+                               $argsString .= '), ';
                        } // END - foreach
 
                        // Remove last comma
-                       if (substr($argsString, -2, 1) === ",") {
+                       if (substr($argsString, -2, 1) == ',') {
                                $argsString = substr($argsString, 0, -2);
                        } // END - if
                } else {
                        // Invalid arguments!
-                       $argsString = sprintf("!INVALID:%s!", $args);
+                       $argsString = '!INVALID:' . gettype($args) . '!';
                }
 
                // Output stub message
@@ -622,7 +623,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         *                                                                                              thousands seperator
         *                                                                                              is missing
         */
-       public function formatCurrency ($value, $currency = "&euro;", $decNum = 2) {
+       public function formatCurrency ($value, $currency = '&euro;', $decNum = 2) {
                // Are all required attriutes set?
                if ((!isset($this->decimals)) || (!isset($this->thousands))) {
                        // Throw an exception
@@ -633,10 +634,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $value = (float) $value;
 
                // Reformat the US number
-               $price = sprintf("%s %s",
-                       number_format($value, $decNum, $this->decimals, $this->thousands),
-                       $currency
-               );
+               $price = number_format($value, $decNum, $this->decimals, $this->thousands) . $currency;
 
                // Return as string...
                return $price;
@@ -690,7 +688,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        public final function addMissingTrailingSlash ($str) {
                // Is there a trailing slash?
-               if (substr($str, -1, 1) != "/") $str .= "/";
+               if (substr($str, -1, 1) != '/') $str .= '/';
                return $str;
        }
 
@@ -812,7 +810,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $backtrace = debug_backtrace();
 
                // Generate the class::method string
-               $methodName = "UnknownClass-&gt;unknownMethod";
+               $methodName = 'UnknownClass-&gt;unknownMethod';
                if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
                        $methodName = $backtrace[1]['class']."-&gt;".$backtrace[1]['function'];
                } // END - if
@@ -889,10 +887,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $className = '';
 
                // Convert all dashes in underscores
-               $str = str_replace("-", "_", $str);
+               $str = $this->convertDashesToUnderscore($str);
 
                // Now use that underscores to get classname parts for hungarian style
-               foreach (explode("_", $str) as $strPart) {
+               foreach (explode('_', $str) as $strPart) {
                        // Make the class name part lower case and first upper case
                        $className .= ucfirst(strtolower($strPart));
                } // END - foreach
@@ -901,6 +899,20 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $className;
        }
 
+       /**
+        * Converts dashes to underscores, e.g. useable for configuration entries
+        *
+        * @param       $str    The string with maybe dashes inside
+        * @return      $str    The converted string with no dashed, but underscores
+        */
+       public final function convertDashesToUnderscores ($str) {
+               // Convert them all
+               $str = str_replace('-', '_', $str);
+
+               // Return converted string
+               return $str;
+       }
+
        /**
         * Marks up the code by adding e.g. line numbers
         *
@@ -948,7 +960,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        public function doFilterFormatTimestamp ($timestamp) {
                // Default value to return
-               $readable = "???";
+               $readable = '???';
 
                // Is the timestamp null?
                if (is_null($timestamp)) {
@@ -958,9 +970,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        switch ($this->getLanguageInstance()->getLanguageCode()) {
                                case "de": // German format is a bit different to default
                                        // Split the GMT stamp up
-                                       $dateTime = explode(" ", $timestamp);
-                                       $dateArray = explode("-", $dateTime[0]);
-                                       $timeArray = explode(":", $dateTime[1]);
+                                       $dateTime  = explode(' ', $timestamp  );
+                                       $dateArray = explode('-', $dateTime[0]);
+                                       $timeArray = explode(':', $dateTime[1]);
 
                                        // Construct the timestamp
                                        $readable = sprintf($this->getConfigInstance()->readConfig('german_date_time'),
index 7531fa1f7241183b8e817be8df5bbee8f9a2f50d..2cd3c9c1692322c960d4722086456fc352c6fc1d 100644 (file)
@@ -159,10 +159,7 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                $appInstance = $registryInstance->getInstance('application');
 
                // Default action is the one from configuration
-               $this->actionName = sprintf("%s_login_%s",
-                       str_replace("-", "_", $appInstance->getAppShortName()),
-                       $this->getConfigInstance()->readConfig('login_default_action')
-               );
+               $this->actionName = $this->convertDashesToUnderscores($appInstance->getAppShortName()) . '_login_' . $this->getConfigInstance()->readConfig('login_default_action');
 
                // Get "action" from request
                $actReq = $requestInstance->getRequestElement('action');
@@ -170,10 +167,7 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                // Do we have a "action" parameter set?
                if ((is_string($actReq)) && (!empty($actReq))) {
                        // Then use it with prefix
-                       $this->actionName = sprintf("%s_login_%s",
-                               str_replace("-", "_", $appInstance->getAppShortName()),
-                               $actReq
-                       );
+                       $this->actionName = $this->convertDashesToUnderscores($appInstance->getAppShortName()) . '_login_' . $actReq;
                } // END - if
 
                // Get application instance
index b4cc520861cb7da56285a6c566d9208014810c75..8ba2d72e245b16f1af166d2e9457c653af8c6fa8 100644 (file)
@@ -88,10 +88,10 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Getter for the file extension of this compressor
         *
-        * @return      $string Returns always "gz"
+        * @return      $string Returns always 'gz'
         */
        public final function getCompressorExtension () {
-               return "gz";
+               return 'gz';
        }
 }
 
index bc1c191f8be96b1f189e1c36f2550b50d8bb1b68..004ea24f6bcf357964463bbcb4db052952224dbf 100644 (file)
@@ -41,6 +41,11 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         */
        private $salt = '';
 
+       /**
+        * Seperator on many places
+        */
+       private $seperator '|';
+
        /**
         * Protected constructor
         *
@@ -166,7 +171,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
 
                // Get key
-               if ($this->getConfigInstance()->readConfig('crypt_fixed_salt') === "Y") {
+               if ($this->getConfigInstance()->readConfig('crypt_fixed_salt') == 'Y') {
                        $key = md5($this->rngInstance->getFixedSalt());
                } else {
                        $key = md5($this->rngInstance->getExtraSalt());
@@ -175,39 +180,39 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                // Add some "garbage" to the string
                switch ($this->rngInstance->randomNumber(0, 8)) {
                        case 0:
-                               $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20));
+                               $garbageString = crc32($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . crc32($this->rngInstance->randomString(20));
                                break;
 
                        case 1:
-                               $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20));
+                               $garbageString = crc32($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . md5($this->rngInstance->randomString(20));
                                break;
 
                        case 2:
-                               $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20));
+                               $garbageString = crc32($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . sha1($this->rngInstance->randomString(20));
                                break;
 
                        case 3:
-                               $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20));
+                               $garbageString = md5($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . crc32($this->rngInstance->randomString(20));
                                break;
 
                        case 4:
-                               $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20));
+                               $garbageString = md5($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . md5($this->rngInstance->randomString(20));
                                break;
 
                        case 5:
-                               $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20));
+                               $garbageString = md5($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . sha1($this->rngInstance->randomString(20));
                                break;
 
                        case 6:
-                               $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20));
+                               $garbageString = sha1($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . crc32($this->rngInstance->randomString(20));
                                break;
 
                        case 7:
-                               $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20));
+                               $garbageString = sha1($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . md5($this->rngInstance->randomString(20));
                                break;
 
                        case 8:
-                               $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20));
+                               $garbageString = sha1($this->rngInstance->randomString(10)) . $this->seperator . base64_encode($str) . $this->seperator . sha1($this->rngInstance->randomString(20));
                                break;
                }
 
@@ -230,7 +235,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
 
                // Get key
-               if ($this->getConfigInstance()->readConfig('crypt_fixed_salt') === "Y") {
+               if ($this->getConfigInstance()->readConfig('crypt_fixed_salt') == 'Y') {
                        $key = md5($this->rngInstance->getFixedSalt());
                } else {
                        $key = md5($this->rngInstance->getExtraSalt());
@@ -240,7 +245,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                $garbageString = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encrypted, MCRYPT_MODE_ECB, $iv);
 
                // Get the real string out
-               $strArray = explode("|", $garbageString);
+               $strArray = explode($this->seperator, $garbageString);
 
                // Does the element count match?
                assert(count($strArray) == 3);
index 2e28443090bf01b5ebfff2ebe9a36cb1d3a7b900..d026afd4fbb4e332053f8369ea0d88671fba85e1 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
-
        // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
        const DB_CODE_TABLE_MISSING     = 0x100;
        const DB_CODE_TABLE_UNWRITEABLE = 0x101;
        const DB_CODE_DATA_FILE_CORRUPT = 0x102;
 
+       // Status results
+       const RESULT_OKAY = 'ok';
+
        /**
         * Save path for "file database"
         */
@@ -38,7 +40,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        /**
         * The file's extension
         */
-       private $fileExtension = "serialized";
+       private $fileExtension = 'serialized';
 
        /**
         * The last read file's name
@@ -331,7 +333,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                if (!isset($this->tableInfo['primary'])) {
                        // Then create the info file
                        $this->createTableInfoFile($dataSetInstance);
-               } elseif (($this->getConfigInstance()->readConfig('db_update_primary_forced') === "Y") && ($dataSetInstance->getPrimaryKey() != $this->tableInfo['primary'])) {
+               } elseif (($this->getConfigInstance()->readConfig('db_update_primary_forced') == 'Y') && ($dataSetInstance->getPrimaryKey() != $this->tableInfo['primary'])) {
                        // Set the array element
                        $this->tableInfo[$dataSetInstance->getTableName()]['primary'] = $dataSetInstance->getPrimaryKey();
 
@@ -353,12 +355,12 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * Starts a SELECT query on the database by given return type, table name
         * and search criteria
         *
-        * @param       $resultType             Result type ("array", "object" and "indexed" are valid)
+        * @param       $resultType             Result type ('array', 'object' and 'indexed' are valid)
         * @param       $tableName              Name of the database table
         * @param       $criteria               Local search criteria class
         * @return      $resultData             Result data of the query
         * @throws      UnsupportedCriteriaException    If the criteria is unsupported
-        * @throws      SqlException                                    If an "SQL error" occurs
+        * @throws      SqlException                                    If an 'SQL error' occurs
         */
        public function querySelect ($resultType, $tableName, LocalSearchCriteria $criteriaInstance) {
                // The result is null by any errors
@@ -367,15 +369,15 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                // Create full path name
                $pathName = $this->getSavePath() . $tableName . '/';
 
-               // A "select" query is not that easy on local files, so first try to
-               // find the "table" which is in fact a directory on the server
+               // A 'select' query is not that easy on local files, so first try to
+               // find the 'table' which is in fact a directory on the server
                try {
                        // Get a directory pointer instance
                        $directoryInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName);
 
                        // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read
                        $resultData = array(
-                               'status'        => "ok",
+                               'status'        => LocalfileDatabase::RESULT_OKAY,
                                'rows'          => array()
                        );
 
@@ -385,7 +387,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $idx = 1;
 
                        // Read the directory with some exceptions
-                       while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) && ($limitFound < $criteriaInstance->getLimit())) {
+                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', "info." . $this->getFileExtension()))) && ($limitFound < $criteriaInstance->getLimit())) {
                                // Does the extension match?
                                if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
                                        // Skip this file!
@@ -521,7 +523,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $searchInstance = $dataSetInstance->getSearchInstance();
 
                        // Read the directory with some exceptions
-                       while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) && ($limitFound < $searchInstance->getLimit())) {
+                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', "info." . $this->getFileExtension()))) && ($limitFound < $searchInstance->getLimit())) {
                                // Does the extension match?
                                if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
                                        // Skip this file!
index 2d76aa159a6c97506edb28b770fd7cac42f5add0..94edad9b95be682bf4dcf02f21a3af4d311767a7 100644 (file)
@@ -72,7 +72,7 @@ class DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, Output
         *
         * @return      void
         */
-       public final function output ($outStream=false) {
+       public final function output ($outStream = false) {
                // Empty output will be silently ignored
                if ($outStream !== false) {
                        $this->outputStream($outStream);
index 59a3aabff7933b11a9aa3af4109a12ebb100eacc..b873a91ca87c62d1c613b3ad0444637acadfa37d 100644 (file)
@@ -35,7 +35,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
        /**
         * Creates an instance of this class
         *
-        * @return      $debugInstance          The prepared debug instance
+        * @return      $debugInstance  The prepared debug instance
         */
        public final static function createDebugErrorLogOutput () {
                // Get a new instance
@@ -48,7 +48,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
        /**
         * Outputs the given data without HTML tags
         *
-        * @param               $output The HTML'ed output
+        * @param       $output         The HTML'ed output
         * @return      void
         */
        public final function outputStream ($output) {
@@ -67,8 +67,8 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
        /**
         * Assigns a variable for output
         *
-        * @param               $var            The variable we shall assign
-        * @param               $value  The value to store in the variable
+        * @param       $var    The variable we shall assign
+        * @param       $value  The value to store in the variable
         * @return      void
         */
        public final function assignVariable ($var, $value) {
@@ -81,7 +81,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
         *
         * @return      void
         */
-       public final function output ($outStream=false) {
+       public final function output ($outStream = false) {
                // Empty output will be silently ignored
                if ($outStream !== false) {
                        $this->outputStream($outStream);
index 7406574d42ba7a92c4d8622acc34d018cfab3c1a..1464814e308681ccef56d6388c4f295055aabc20 100644 (file)
@@ -35,7 +35,7 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre
        /**
         * Creates an instance of this class
         *
-        * @return      $debugInstance          The prepared debug instance
+        * @return      $debugInstance  The prepared debug instance
         */
        public final static function createDebugWebOutput () {
                // Get a new instance
@@ -48,7 +48,7 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre
        /**
         * Outputs the given data directly
         *
-        * @param               $output The HTML output
+        * @param       $output         The HTML output
         * @return      void
         */
        public final function outputStream ($output) {
@@ -60,8 +60,8 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre
        /**
         * Assigns a variable for output
         *
-        * @param               $var            The variable we shall assign
-        * @param               $value  The value to store in the variable
+        * @param       $var    The variable we shall assign
+        * @param       $value  The value to store in the variable
         * @return      void
         */
        public final function assignVariable ($var, $value) {
@@ -74,7 +74,7 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre
         *
         * @return      void
         */
-       public final function output ($outStream=false) {
+       public final function output ($outStream = false) {
                // Empty output will be silently ignored
                if ($outStream !== false) {
                        $this->outputStream($outStream);
index 8444ced849225b9d851e900bc22ee7a1c590706a..ef8dbfc2e05eca6e1e1afc624fcd8d47a3a986a8 100644 (file)
@@ -67,7 +67,7 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable {
                } // END - if
 
                // Decode it fully
-               $encryptDecoded = base64_decode(str_replace(" ", "+", urldecode($encryptRequest)));
+               $encryptDecoded = base64_decode(str_replace(' ', '+', urldecode($encryptRequest)));
 
                // Get a crypto helper and decrypt the string
                $decryptedString = ObjectFactory::createObjectByConfiguredName('crypto_class')->decryptString($encryptDecoded);
index 9dabfc3937faed3ad3e1858c0f8efc9dfbf34cb3..bf01652b0a637c138ff48a6ccb4208682c15a4eb 100644 (file)
@@ -61,7 +61,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                $email = $requestInstance->getRequestElement('email');
 
                // Is the Email set?
-               if ((is_null($email)) || ($this->getConfigInstance()->readConfig('register_email_unique') === "Y")) {
+               if ((is_null($email)) || ($this->getConfigInstance()->readConfig('register_email_unique') == 'Y')) {
                        // Try it again
                        $email1 = $requestInstance->getRequestElement('email1');
                        $email2 = $requestInstance->getRequestElement('email2');
index c651872cab81bb808b1285061be8d65362879b3d..89a3babe5e27c6d7a6b6934053f11938499bf85d 100644 (file)
@@ -89,7 +89,7 @@ class BaseHelper extends BaseFrameworkSystem {
         * @return      void
         */
        protected final function addContent ($newContent) {
-               $this->content .= (string) trim($newContent)."\n";
+               $this->content .= (string) trim($newContent) . "\n";
        }
 
        /**
@@ -244,7 +244,13 @@ class BaseHelper extends BaseFrameworkSystem {
                // Add the group to the stack
                $this->groups[$this->totalCounter] = $groupId;
                $this->groups[$groupId]['opened']  = true;
-               $this->groups[$groupId]['content'] = sprintf("<!-- group %s opened (length: %s, tag: %s) //-->%s\n", $groupId, strlen($content), $tag, $content);
+               $this->groups[$groupId]['content'] = sprintf(
+                       "<!-- group %s opened (length: %s, tag: %s) //-->%s\n",
+                       $groupId,
+                       strlen($content),
+                       $tag,
+                       $content
+               );
                $this->groups[$groupId]['tag'] = $tag;
 
                // Mark this group as previously opened
@@ -278,11 +284,21 @@ class BaseHelper extends BaseFrameworkSystem {
                // Is the content empty?
                if ((empty($content)) && (!empty($this->groups[$groupId]['tag']))) {
                        // Get it from opener
-                       $content = sprintf("<!-- group %s auto-closed //--></%s>", $groupId, $this->groups[$groupId]['tag']);
+                       $content = sprintf(
+                               "<!-- group %s auto-closed //--></%s>",
+                               $groupId,
+                               $this->groups[$groupId]['tag']
+                       );
                } // END - if
 
                // Add content to it and mark it as closed
-               $this->groups[$groupId]['content'] .= sprintf("<!-- group %s closed (length: %s, tag: %s) //-->%s\n", $groupId, strlen($content), $this->groups[$groupId]['tag'], $content);
+               $this->groups[$groupId]['content'] .= sprintf(
+                       "<!-- group %s closed (length: %s, tag: %s) //-->%s\n",
+                       $groupId,
+                       strlen($content),
+                       $this->groups[$groupId]['tag'],
+                       $content
+               );
                $this->groups[$groupId]['opened'] = false;
 
                // Mark previous group as closed
@@ -367,7 +383,7 @@ class BaseHelper extends BaseFrameworkSystem {
                // Is header content there?
                if (isset($this->groups['header'])) {
                        // Then add it
-                       $content .= $this->groups['header']['content']."\n";
+                       $content .= $this->groups['header']['content'] . "\n";
                } // END - if
 
                // Initiate content
@@ -395,7 +411,7 @@ class BaseHelper extends BaseFrameworkSystem {
                // Is footer content there?
                if (isset($this->groups['footer'])) {
                        // Then add it
-                       $content .= $this->groups['footer']['content']."\n";
+                       $content .= $this->groups['footer']['content'] . "\n";
                } // END - if
 
                // Return it
index bcdeb5ffcec976df862fdd3fd5221cef97b2cce3..5f17a563853f88eedcc9d391663e6581b9919c7f 100644 (file)
@@ -83,7 +83,7 @@ class WebBlockHelper extends BaseWebHelper implements HelpableTemplate {
         * @return      $withRegistration       Wether with registration date
         */
        public function ifIncludeRegistrationStamp () {
-               $withRegistration = ($this->getConfigInstance()->readConfig('block_shows_registration') === "Y");
+               $withRegistration = ($this->getConfigInstance()->readConfig('block_shows_registration') == 'Y');
                return $withRegistration;
        }
 
index 5b56aaa3c2bea83ee85b22423b7648c41474529a..6aad86ce18ec72fc08698196997903bb5f7e547f 100644 (file)
@@ -40,7 +40,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $required       Wether the email address is required
         */
        public function ifRegisterRequiresEmailVerification () {
-               $required = ($this->getConfigInstance()->readConfig('register_requires_email') === "Y");
+               $required = ($this->getConfigInstance()->readConfig('register_requires_email') == 'Y');
                return $required;
        }
 
@@ -50,7 +50,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $required       Wether profile shall be asked
         */
        public function ifRegisterIncludesProfile () {
-               $required = ($this->getConfigInstance()->readConfig('register_includes_profile') === "Y");
+               $required = ($this->getConfigInstance()->readConfig('register_includes_profile') == 'Y');
                return $required;
        }
 
@@ -60,7 +60,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $required       Wether personal data shall be asked
         */
        public function ifRegisterIncludesPersonaData () {
-               $required = ($this->getConfigInstance()->readConfig('register_personal_data') === "Y");
+               $required = ($this->getConfigInstance()->readConfig('register_personal_data') == 'Y');
                return $required;
        }
 
@@ -70,7 +70,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $required       Wether birthday shall be asked
         */
        public function ifProfileIncludesBirthDay () {
-               $required = ($this->getConfigInstance()->readConfig('profile_includes_birthday') === "Y");
+               $required = ($this->getConfigInstance()->readConfig('profile_includes_birthday') == 'Y');
                return $required;
        }
 
@@ -80,7 +80,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $isUnique
         */
        public function ifEmailMustBeUnique () {
-               $isUnique = ($this->getConfigInstance()->readConfig('register_email_unique') === "Y");
+               $isUnique = ($this->getConfigInstance()->readConfig('register_email_unique') == 'Y');
                return $isUnique;
        }
 
@@ -90,7 +90,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $required       Wether the specified chat protocol is enabled
         */
        public function ifChatEnabled ($chatProtocol) {
-               $required = ($this->getConfigInstance()->readConfig(sprintf("chat_enabled_%s", $chatProtocol)) == "Y");
+               $required = ($this->getConfigInstance()->readConfig('chat_enabled_' . $chatProtocol) == 'Y');
                return $required;
        }
 
@@ -100,7 +100,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $isEnabled      Wether the login is enabled or disabled
         */
        public function ifLoginIsEnabled () {
-               $isEnabled = ($this->getConfigInstance()->readConfig('login_enabled') === "Y");
+               $isEnabled = ($this->getConfigInstance()->readConfig('login_enabled') == 'Y');
                return $isEnabled;
        }
 
@@ -130,7 +130,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $isAllowed      Wether guest login is allowed
         */
        public function ifGuestLoginAllowed () {
-               $isAllowed = ($this->getConfigInstance()->readConfig('guest_login_allowed') === "Y");
+               $isAllowed = ($this->getConfigInstance()->readConfig('guest_login_allowed') == 'Y');
                return $isAllowed;
        }
 
@@ -140,7 +140,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $requireConfirm         Wether email change must be confirmed
         */
        public function ifEmailChangeRequireConfirmation () {
-               $requireConfirm = ($this->getConfigInstance()->readConfig('email_change_confirmation') === "Y");
+               $requireConfirm = ($this->getConfigInstance()->readConfig('email_change_confirmation') == 'Y');
                return $requireConfirm;
        }
 
@@ -160,7 +160,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $emailChange    Wether changing email address is allowed
         */
        public function ifEmailChangeAllowed () {
-               $emailChange = ($this->getConfigInstance()->readConfig('email_change_allowed') === "Y");
+               $emailChange = ($this->getConfigInstance()->readConfig('email_change_allowed') == 'Y');
                return $emailChange;
        }
 
@@ -201,7 +201,7 @@ class BaseWebHelper extends BaseHelper {
         * @return      $refillActive   Wether the refill page is active
         */
        public function ifRefillPageActive () {
-               $refillActive = ($this->getConfigInstance()->readConfig('refill_page_active') === "Y");
+               $refillActive = ($this->getConfigInstance()->readConfig('refill_page_active') == 'Y');
                return $refillActive;
        }
 }
index e20545f0d254246a2e90694eae6073aaed0be568..9a35b9f30b2138f058fa88c4dcbafaa39ce22d07 100644 (file)
@@ -59,7 +59,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         *
         * @param       $templateInstance       An instance of a valid template engine
         * @param       $formName                       Name of the form
-        * @param       $formId                         Value for "id" attribute (default: $formName)
+        * @param       $formId                         Value for 'id' attribute (default: $formName)
         * @param       $withForm                       Wether include the form tag
         * @return      $helperInstance         A preparedf instance of this helper
         */
@@ -79,7 +79,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                // Set form name
                $helperInstance->setFormName($formName);
 
-               // A form-less field may say "false" here...
+               // A form-less field may say 'false' here...
                if ($withForm === true) {
                        // Create the form
                        $helperInstance->addFormTag($formName, $formId);
@@ -96,9 +96,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         * Add the form tag or close it an already opened form tag
         *
         * @param       $formName       Name of the form (default: false)
-        * @param       $formId         Id of the form (attribute "id"; default: false)
+        * @param       $formId         Id of the form (attribute 'id'; default: false)
         * @return      void
-        * @throws      InvalidFormNameException        If the form name is invalid (=false)
+        * @throws      InvalidFormNameException        If the form name is invalid ( = false)
         * @todo        Add some unique PIN here to bypass problems with some browser and/or extensions
         */
        public function addFormTag ($formName = false, $formId = false) {
@@ -109,7 +109,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                } // END - if
 
                // Close the form is default
-               $formContent = "</form>";
+               $formContent = '</form>';
 
                // Check wether we shall open or close the form
                if (($this->formOpened === false) && ($this->formEnabled === true)) {
@@ -128,7 +128,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        );
 
                        // Add close bracket
-                       $formContent .= ">";
+                       $formContent .= '>';
 
                        // Open the form and remeber the form name
                        $this->formOpened = true;
@@ -176,7 +176,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        $fieldValue
                );
 
-               // And add it maybe with a "li" tag
+               // And add it maybe with a 'li' tag
                $this->addContentToPreviousGroup($inputContent);
        }
 
@@ -189,7 +189,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        public function addInputTextFieldWithDefault ($fieldName) {
                // Get the value from instance
                $fieldValue = $this->getValueField($fieldName);
-               //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
                $this->addInputTextField($fieldName, $fieldValue);
@@ -257,7 +257,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        public function addInputHiddenFieldWithDefault ($fieldName) {
                // Get the value from instance
                $fieldValue = $this->getValueField($fieldName);
-               //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
                $this->addInputHiddenField($fieldName, $fieldValue);
@@ -273,7 +273,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        public function addInputHiddenConfiguredField ($fieldName, $prefix) {
                // Get the value from instance
                $fieldValue = $this->getConfigInstance()->readConfig("{$prefix}_{$fieldName}");
-               //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
                $this->addInputHiddenField($fieldName, $fieldValue);
@@ -297,7 +297,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
 
                // Set wether the check box is checked...
                $checked = " checked=\"checked\"";
-               if ($fieldChecked === false) $checked = " ";
+               if ($fieldChecked === false) $checked = ' ';
 
                // Generate the content
                $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
@@ -428,7 +428,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
 
                        // All call it again if group name is not empty
                        if ((!empty($groupId)) && ($groupId != $prevGroupId)) {
-                               //* DEBUG: */ echo $groupId."/".$prevGroupId."<br />\n";
+                               //* DEBUG: */ echo $groupId.'/'.$prevGroupId."<br />\n";
                                $this->addFormGroup($groupId, $groupText);
                        } // END - if
                }
@@ -723,7 +723,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         * @return      $required       Wether the email address is required
         */
        public function ifRegisterRequiresEmailVerification () {
-               $required = ($this->getConfigInstance()->readConfig('register_requires_email') === "Y");
+               $required = ($this->getConfigInstance()->readConfig('register_requires_email') == 'Y');
                return $required;
        }
 
@@ -733,7 +733,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         * @return      $required       Wether profile data shall be asked
         */
        public function ifRegisterIncludesProfile () {
-               $required = ($this->getConfigInstance()->readConfig('register_includes_profile') === "Y");
+               $required = ($this->getConfigInstance()->readConfig('register_includes_profile') == 'Y');
                return $required;
        }
 
@@ -743,7 +743,7 @@ class WebFormHelper extends BaseWebHelper 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 83b806d89ac8685a9cee7379f90b577eaad95609..5dd2ef7e0b436a29c099d621457b5058354655d0 100644 (file)
@@ -32,6 +32,16 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate {
         */
        private $linkBase = '';
 
+       /**
+        * First parameter seperator
+        */
+       private $firstParameter = '?';
+
+       /**
+        * Seperator for more paraemters
+        */
+       private $parameterSeperator = '&amp;';
+
        /**
         * Protected constructor
         *
@@ -226,17 +236,17 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate {
                // Check if a previous group was opened
                if ($this->ifGroupOpenedPreviously() === false) {
                        // No group was opened before!
-                       throw new NoGroupOpenedException(array($this, $linkAction."(".$linkText.")"), self::EXCEPTION_GROUP_NOT_OPENED);
+                       throw new NoGroupOpenedException(array($this, $linkAction . '(' . $linkText . ')'), self::EXCEPTION_GROUP_NOT_OPENED);
                } // END - if
 
                // Default parameter seperator is &amp;
-               $seperator = "&amp;";
+               $seperator = $this->parameterSeperator;
 
                // Is there a question mark in?
-               $linkArray = explode("?", $this->getLinkBase());
+               $linkArray = explode($this->firstParameter, $this->getLinkBase());
                if (count($linkArray) == 0) {
                        // No question mark
-                       $seperator = "?";
+                       $seperator = $this->firstParameter;
                } // END - if
 
                // Prepare action
index b4a8548062f007f29c69f14ed07c6cbef0ef7861..b1e374467fd47b0be9a10c111c8e3cfc46e90a25 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer {
+       /**
+        * File header indicator
+        */
+       private $fileHeader = '@head';
+
+       /**
+        * Data block indicator
+        */
+       private $dataBlock = '@data';
+
+       /**
+        * Seperator #1
+        */
+       private $chunker = ':';
+
+       /**
+        * Seperator #2
+        */
+       private $seperator = '^';
+
        /**
         * Protected constructor
         */
@@ -49,12 +69,13 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
        }
 
        /**
-        * Saves data to a given local file
+        * Saves data to a given local file and create missing directory structures
         *
-        * @param               $fileName               The file name for the to be saved file
-        * @param               $dataArray      The data we shall store to the file
+        * @param       $fileName       The file name for the to be saved file
+        * @param       $dataArray      The data we shall store to the file
         * @return      void
         * @see         FileOutputStreamer
+        * @todo        This method needs heavy rewrite
         */
        public final function saveFile ($fileName, $dataArray) {
                // Try it five times
@@ -68,17 +89,23 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                                $dirName = dirname($fileName);
                                for ($idx2 = 0; $idx2 < (2 - $idx); $idx2++) {
                                        $dirName = dirname($dirName);
-                               }
+                               } // END - for
+
                                // Try to create it
                                @mkdir($dirName);
                        }
-               }
+               } // END - for
 
                // Write a header information for validation purposes
-               $fileInstance->writeToFile(sprintf("@head^%s:%s:%s:%s\n",
+               $fileInstance->writeToFile(sprintf("%s%s%s%s%s%s%s%s%s\n",
+                       $this->fileHeader,
+                       $this->seperator,
                        $dataArray[0],
+                       $this->chunker,
                        time(),
+                       $this->chunker,
                        strlen($dataArray[1]),
+                       $this->chunker,
                        md5($dataArray[1])
                ));
 
@@ -86,20 +113,23 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                $b64Stream = base64_encode($dataArray[1]);
 
                // write the data line by line
-               $line = str_repeat(" ", 50); $idx = 0;
+               $line = str_repeat(' ', 50); $idx = 0;
                while (strlen($line) == 50) {
                        // Get 50 chars or less
                        $line = substr($b64Stream, $idx, 50);
 
                        // Save it to the stream
-                       $fileInstance->writeToFile(sprintf("@data^%s:%s\n",
+                       $fileInstance->writeToFile(sprintf("%s%s%s%s%s\n",
+                               $this->dataBlock,
+                               $this->seperator,
                                $line,
+                               $this->chunker,
                                md5($line)
                        ));
 
                        // Advance to the next 50-chars block
                        $idx += 50;
-               }
+               } // END - while
 
                // Close the file
                $fileInstance->closeFile();
@@ -147,26 +177,26 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                        $rawLine = rtrim($rawLine);
 
                        // Analyze this line
-                       if (substr($rawLine, 0, 5) == "@head") {
+                       if (substr($rawLine, 0, 5) == $this->fileHeader) {
                                // Header found, so let's extract it
-                               $header = explode("^", $rawLine);
+                               $header = explode($this->seperator, $rawLine);
                                $header = trim($header[1]);
 
                                // Now we must convert it again into an array
-                               $header = explode(":", $header);
+                               $header = explode($this->chunker, $header);
 
                                // 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);
                                }
-                       } elseif (substr($rawLine, 0, 5) == "@data") {
+                       } elseif (substr($rawLine, 0, 5) == $this->dataBlock) {
                                // Is a data line!
-                               $data = explode("^", $rawLine);
+                               $data = explode($this->seperator, $rawLine);
                                $data = $data[1];
 
                                // First element is the data, second the MD5 checksum
-                               $data = explode(":", $data);
+                               $data = explode($this->chunker, $data);
 
                                // Validate the read line
                                if (count($data) == 2) {
@@ -183,7 +213,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                                $readData .= $data[0];
                        } else {
                                // Other raw lines than header/data tagged lines and re-add the new-line char
-                               $readData .= $rawLine."\n";
+                               $readData .= $rawLine . "\n";
                        }
                }
 
index c1d66e4f3c5b2ebbaf14932f452df4b86b8091b0..fe66586aadaae8a5240595705bc910090b8259c4 100644 (file)
@@ -31,7 +31,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
        /**
         * The 2-char language code
         */
-       private $langCode = "xx"; // This will later be overwritten!
+       private $langCode = 'xx'; // This will later be overwritten!
 
        /**
         * The array-object for all language strings
index b0df4fefb887dbc4f93ab3f78b117417487ee71b..f149914c8e5aeee696a323f6cbc9fc20207f0592 100644 (file)
@@ -58,11 +58,12 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
                self::$consoleInstance = new ConsoleOutput();
 
                // Set the content type
+               // @TODO Need to rewrite this to $requestInstance->addHeader()
                if (!empty($contentType)) {
                        @header(sprintf("Content-type: %s",
                                $contentType
                        ));
-               }
+               } // END - if
 
                // Return instance
                return self::$consoleInstance;
@@ -87,7 +88,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
         * @param       $outStream      Something we shall sent to the console
         * @return      void
         */
-       public final function output ($outStream=false) {
+       public final function output ($outStream = false) {
                if ($outStream === false) {
                        // Output something here...
                        foreach ($this->vars as $var => $value) {
index ad5bd90bfd236a4b1fbf7b754d65f5571545d1ec..adbf50c510045a5c00b03f0b7062b54e32ae5d65 100644 (file)
@@ -52,15 +52,16 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registera
                        $contentType = trim($contentType);
 
                        // Set the content type
+                       // @TODO Need to rewrite this to $requestInstance->addHeader()
                        if (!empty($contentType)) {
                                @header(sprintf("Content-type: %s",
                                        $contentType
                                ));
-                       }
+                       } // END - if
 
                        // Get a new instance and set it
                        self::$webInstance = new WebOutput();
-               }
+               } // END - if
 
                // Return instance
                return self::$webInstance;
@@ -83,7 +84,7 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registera
         *
         * @return      void
         */
-       public final function output ($outStream=false) {
+       public final function output ($outStream = false) {
                print(stripslashes($outStream));
        }
 }
index d5ad6e6bb882a69baa697722107c0d31ec76c47f..808a35a3ca2c05340c2aebf0c8d051d547e409ea 100644 (file)
@@ -78,7 +78,7 @@ class Registry extends BaseFrameworkSystem implements Register {
         */
        public final static function isInitialized ($initialized = null) {
                // If no parameter (null by default) is provided we want to get the
-               // parameter. If set to e.g. "OK" then the registry is set to
+               // parameter. If set to e.g. 'OK' then the registry is set to
                // "initialized".
                if (is_null($initialized)) {
                        // Get status if initialized
index 7f60316cbd7426cb2f2b8e747b55febac82ad79b..8409470ab86d911cb18a8b199d512ee012c7f798 100644 (file)
@@ -144,7 +144,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
                $headerValue = null;
 
                // Construct the name
-               $name = 'HTTP_' . strtolower(str_replace('-', '_', $headerName));
+               $name = 'HTTP_' . strtolower($this->convertDashesToUnderscores($headerName));
 
                // Does this header exist?
                if (isset($_SERVER[$name])) {
index 5d4738b996d866903054eb01b7c3a5ec02280cda..b8b701eac4b934bc750d7b6a0cdc32498a4fa84c 100644 (file)
@@ -89,11 +89,11 @@ class BaseActionResolver extends BaseResolver {
                        throw new EmptyVariableException(array($this, 'actionName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } // END - if
 
+               // Create class name
+               $className = $this->actionPrefix . $this->convertToClassName($actionName) . 'Action';
+
                // Now, let us create the full name of the action class
-               $this->setClassName(sprintf("%s%sAction",
-                       $this->actionPrefix,
-                       $this->convertToClassName($actionName)
-               ));
+               $this->setClassName($className);
 
                // Is this class already loaded?
                if (class_exists($this->getClassName())) {
@@ -118,9 +118,10 @@ class BaseActionResolver extends BaseResolver {
                $actionInstance = null;
 
                // Create action class name
-               $this->setClassName(sprintf("Web%sAction",
-                       $this->convertToClassName($this->getActionName())
-               ));
+               $className = $this->actionPrefix . $this->convertToClassName($this->getActionName()) . 'Action';
+
+               // ... and set it
+               $this->setClassName($className);
 
                // Initiate the action
                $actionInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
index fc662c3aa1cb048a8ac7cc1ed72ba3edcdf10b36..ac9c0cab7b84f4ab65ef533db45a27f93d7bbd7a 100644 (file)
@@ -87,13 +87,13 @@ class BaseCommandResolver extends BaseResolver {
                if (empty($commandName)) {
                        // Then thrown an exception here
                        throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               }
+               } // END - if
+
+               // Create the full class name
+               $className = $this->commandPrefix . $this->convertToClassName($commandName) . 'Command';
 
                // Now, let us create the full name of the command class
-               $this->setClassName(sprintf("%s%sCommand",
-                       $this->commandPrefix,
-                       $this->convertToClassName($commandName)
-               ));
+               $this->setClassName($className);
 
                // Is this class already loaded?
                if (class_exists($this->getClassName())) {
index d70e25c0799ecc5bd10276c869f52cefb61fe8e3..85be798b77b8dff9e16ac072eb549e5cac16cfe7 100644 (file)
@@ -155,10 +155,8 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve
                // Init command instance
                $commandInstance = null;
 
-               // Create command class name
-               $this->setClassName(sprintf("Image%sCommand",
-                       $this->convertToClassName($commandName)
-               ));
+               // Create class name
+               $className = 'Image' . $this->convertToClassName($commandName) . 'Command';
 
                // Is this class loaded?
                if (!class_exists($this->getClassName())) {
index f61f0cddd62ed159d1ec604abf32f6e6bb946e74..56ad9e1caf41d2a649764b9733e4e63791a80aa6 100644 (file)
@@ -155,10 +155,11 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                // Init command instance
                $commandInstance = null;
 
+               // Create class name
+               $className = 'Web' . $this->convertToClassName($commandName) . 'Command';
+
                // Create command class name
-               $this->setClassName(sprintf("Web%sCommand",
-                       $this->convertToClassName($commandName)
-               ));
+               $this->setClassName($className);
 
                // Is this class loaded?
                if (!class_exists($this->getClassName())) {
index 6295df907fa551aaa40f5f776acc67990f4b6dba..2b80405fbeef4114ef90b0feb5d9d2253ecca390 100644 (file)
@@ -90,11 +90,11 @@ class BaseControllerResolver extends BaseResolver {
                        throw new EmptyVariableException(array($this, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } // END - if
 
+               // Create class name
+               $className = $this->controllerPrefix . $this->convertToClassName($controllerName) . 'Controller';
+
                // Now, let us create the full name of the controller class
-               $this->setClassName(sprintf("%s%sController",
-                       $this->controllerPrefix,
-                       $this->convertToClassName($controllerName)
-               ));
+               $this->setClassName($className);
 
                // Try it hard to get an controller
                while ($isValid === false) {
index dc664e87cefa98684daee07b1cabb05f8fc8ee67..191609f6f3e5ae8c83a22ebe68b1526c2ec03553 100644 (file)
@@ -133,9 +133,10 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll
                //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
                if ($controllerName != $defaultController) {
                        // Create controller class name
-                       $this->setClassName(sprintf("Image%sController",
-                               $this->convertToClassName($controllerName)
-                       ));
+                       $className = 'Image' . $this->convertToClassName($controllerName) . 'Controller';
+
+                       // ... and set it
+                       $this->setClassName($className);
                } // END - if
                //* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
 
@@ -146,11 +147,17 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll
                } // END - if
 
                // Initiate the resolver and controller
-               $resolverInstance = ObjectFactory::createObjectByConfiguredName('image_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
-               $controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
-
-               // Remove resolver
-               unset($resolverInstance);
+               $resolverInstance = ObjectFactory::createObjectByConfiguredName(
+                       'image_cmd_resolver_class',
+                       array(
+                               $controllerName,
+                               $this->getApplicationInstance()
+                       )
+               );
+               $controllerInstance = ObjectFactory::createObjectByName(
+                       $this->getClassName(),
+                       array($resolverInstance)
+               );
 
                // Return the result
                return $controllerInstance;
index 06ba1118e8a8739c4a3a526aa3592b2eb1937c81..297a40c2ccaf977b1419a623ce0e818c0efbbcef 100644 (file)
@@ -133,9 +133,10 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
                //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
                if ($controllerName != $defaultController) {
                        // Create controller class name
-                       $this->setClassName(sprintf("Web%sController",
-                               $this->convertToClassName($controllerName)
-                       ));
+                       $className = 'Web' . $this->convertToClassName($controllerName) . 'Controller';
+
+                       // ... and set it
+                       $this->setClassName($className);
                } 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');
@@ -163,15 +164,22 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
                        $resolverClass = $this->getConfigInstance()->readConfig($resolverConfigEntry);
                } catch (ConfigEntryNotFoundException $e) {
                        // Use default resolver entry
-                       $resolverConfigEntry = "web_cmd_resolver_class";
+                       // @TODO Maybe we need to log this?
+                       $resolverConfigEntry = 'web_cmd_resolver_class';
                }
 
                // Initiate the resolver and controller
-               $resolverInstance = ObjectFactory::createObjectByConfiguredName($resolverConfigEntry, array($controllerName, $this->getApplicationInstance()));
-               $controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
-
-               // Remove resolver (we don't need it anymore)
-               unset($resolverInstance);
+               $resolverInstance = ObjectFactory::createObjectByConfiguredName(
+                       $resolverConfigEntry,
+                       array(
+                               $controllerName,
+                               $this->getApplicationInstance()
+                       )
+               );
+               $controllerInstance = ObjectFactory::createObjectByName(
+                       $this->getClassName(),
+                       array($resolverInstance)
+               );
 
                // Return the result
                return $controllerInstance;
index 7e40ce779eb20a21c1957fd01ff2121facbc9f51..fbcd41b5179abd7eb09921d4964589e495a1d266 100644 (file)
@@ -181,7 +181,7 @@ class BaseResponse extends BaseFrameworkSystem {
                        // Send cookies out?
                        if (count($this->cookies) > 0) {
                                // Send all cookies
-                               $cookieString = implode(" ", $this->cookies);
+                               $cookieString = implode(' ', $this->cookies);
                                header("Set-Cookie: {$cookieString}");
 
                                // Remove them all
index 19a453bb52348741e67856402edc84b6dedc2b49..46f42d6f5fa62cf95f921b5edce300606ae35886 100644 (file)
@@ -80,7 +80,7 @@ class HttpResponse extends BaseResponse implements Responseable {
         * @todo        this will send only one cookie out, the first one.
         */
        public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) {
-               //* DEBUG: */ echo $cookieName."=".$cookieValue."<br />\n";
+               //* DEBUG: */ echo $cookieName.'='.$cookieValue."<br />\n";
                // Are headers already sent?
                if (headers_sent()) {
                        // Throw an exception here
@@ -108,7 +108,7 @@ class HttpResponse extends BaseResponse implements Responseable {
                return;
 
                // Now construct the full header
-               $cookieString = $cookieName . "=" . $cookieValue . "; ";
+               $cookieString = $cookieName . '=' . $cookieValue . '; ';
                $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
                // $cookieString .= "; path=".$path."; domain=".$domain;
 
@@ -140,20 +140,20 @@ class HttpResponse extends BaseResponse implements Responseable {
                // Compile the URL
                $url = $this->getTemplateInstance()->compileRawCode($url);
 
-               // Do we have a "http" in front of the URL?
-               if (substr(strtolower($url), 0, 4) != "http") {
+               // Do we have a 'http' in front of the URL?
+               if (substr(strtolower($url), 0, 4) != 'http') {
                        // Is there a / in front of the relative URL?
-                       if (substr($url, 0, 1) == "/") $url = substr($url, 1);
+                       if (substr($url, 0, 1) == '/') $url = substr($url, 1);
 
                        // No, then extend it with our base URL
-                       $url = $this->getConfigInstance()->readConfig('base_url') . "/" . $url;
+                       $url = $this->getConfigInstance()->readConfig('base_url') . '/' . $url;
                } // END - if
 
                // Add redirect header
-               $this->addHeader("Location", $url);
+               $this->addHeader('Location', $url);
 
                // Set correct response status
-               $this->setResponseStatus("301 Moved Permanently");
+               $this->setResponseStatus('301 Moved Permanently');
 
                // Clear the body
                $this->setResponseBody('');
index dc6e5ad03e0f2a5debf4c3f7bf319d75983866f2..21344c453136cc225a5bcfd3b40cae26cca70186 100644 (file)
@@ -122,7 +122,7 @@ class ImageResponse extends BaseResponse implements Responseable {
                return;
 
                // Now construct the full header
-               $cookieString = $cookieName . "=" . $cookieValue . "; ";
+               $cookieString = $cookieName . '=' . $cookieValue . '; ';
                $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
                // $cookieString .= "; path=".$path."; domain=".$domain;
 
@@ -154,20 +154,20 @@ class ImageResponse extends BaseResponse implements Responseable {
                // Compile the URL
                $url = $this->getTemplateInstance()->compileRawCode($url);
 
-               // Do we have a "http" in front of the URL?
-               if (substr(strtolower($url), 0, 4) != "http") {
+               // Do we have a 'http' in front of the URL?
+               if (substr(strtolower($url), 0, 4) != 'http') {
                        // Is there a / in front of the relative URL?
-                       if (substr($url, 0, 1) == "/") $url = substr($url, 1);
+                       if (substr($url, 0, 1) == '/') $url = substr($url, 1);
 
                        // No, then extend it with our base URL
-                       $url = $this->getConfigInstance()->readConfig('base_url') . "/" . $url;
+                       $url = $this->getConfigInstance()->readConfig('base_url') . '/' . $url;
                } // END - if
 
                // Add redirect header
-               $this->addHeader("Location", $url);
+               $this->addHeader('Location', $url);
 
                // Set correct response status
-               $this->setResponseStatus("301 Moved Permanently");
+               $this->setResponseStatus('301 Moved Permanently');
 
                // Clear the body
                $this->setResponseBody('');
index e0d169a5caadaff51f00daff0306291be33d7ed1..19f8b3e7894c3040e65c541a860ae8f272e03383 100644 (file)
@@ -195,12 +195,12 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
        }
 
        /**
-        * Determines wether the status of the query was fine ("ok")
+        * Determines wether the status of the query was fine (LocalfileDatabase::RESULT_OKAY)
         *
         * @return      $ifStatusOkay   Wether the status of the query was okay
         */
        public function ifStatusIsOkay () {
-               return ((isset($this->resultArray['status'])) && ($this->resultArray['status'] === "ok"));
+               return ((isset($this->resultArray['status'])) && ($this->resultArray['status'] === LocalfileDatabase::RESULT_OKAY));
        }
 
        /**
index 431b9d130bbe092b8133dafc9d7b543dcbfae61b..e52715b4c9aba5d355991f45cd20a0c6fb37869f 100644 (file)
@@ -101,7 +101,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
                $serverIp = "cluster";
 
                // Do we have a single server?
-               if ($this->getConfigInstance()->readConfig('is_single_server') === "Y") {
+               if ($this->getConfigInstance()->readConfig('is_single_server') == 'Y') {
                        // Then use that IP for extra security
                        $serverIp = getenv('SERVER_ADDR');
                } // END - if
@@ -109,14 +109,14 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
                // Yet-another fixed salt. This is not dependend on server software or date
                if ($extraInstance instanceof FrameworkInterface) {
                        // With extra instance information
-                       $this->fixedSalt = sha1($serverIp . ":" . $extraInstance->__toString() . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
+                       $this->fixedSalt = sha1($serverIp . ':' . $extraInstance->__toString() . ':' . serialize($this->getDatabaseInstance()->getConnectionData()));
                } else {
                        // Without extra information
-                       $this->fixedSalt = sha1($serverIp . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
+                       $this->fixedSalt = sha1($serverIp . ':' . serialize($this->getDatabaseInstance()->getConnectionData()));
                }
 
                // One-way data we need for "extra-salting" the random number
-               $this->extraSalt = sha1($this->fixedSalt . ":" . getenv('SERVER_SOFTWARE') . ":" . $this->getConfigInstance()->readConfig('date_key') . $this->getConfigInstance()->readConfig('base_url'));
+               $this->extraSalt = sha1($this->fixedSalt . ':' . getenv('SERVER_SOFTWARE') . ':' . $this->getConfigInstance()->readConfig('date_key') . $this->getConfigInstance()->readConfig('base_url'));
 
                // Get config entry for max salt length
                $this->rndStrLen = $this->getConfigInstance()->readConfig('rnd_str_length');
index 7052d5f8f2478f72dea5e4a23f1f5fed11e3888f..c40b183c021148b0cc3fba84b297083080e53bf7 100644 (file)
@@ -32,22 +32,22 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        /**
         * Template type
         */
-       private $templateType = "html";
+       private $templateType = 'html';
 
        /**
         * The extension for web and email templates (not compiled templates)
         */
-       private $templateExtension = ".tpl";
+       private $templateExtension = '.tpl';
 
        /**
         * The extension for code templates (not compiled templates)
         */
-       private $codeExtension = ".ctp";
+       private $codeExtension = '.ctp';
 
        /**
         * Path relative to $basePath and language code for compiled code-templates
         */
-       private $compileOutputPath = "templates/_compiled";
+       private $compileOutputPath = 'templates/_compiled';
 
        /**
         * The raw (maybe uncompiled) template
@@ -116,6 +116,16 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private $varGroups = array();
 
+       /**
+        * Code begin
+        */
+       private $codeBegin = '<?php';
+
+       /**
+        * Code end
+        */
+       private $codeEnd = '?>';
+
        // Exception codes for the template engine
        const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED   = 0x110;
        const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x111;
@@ -285,7 +295,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        }
 
        /**
-        * Setter for template type. Only "html", "emails" and "compiled" should
+        * Setter for template type. Only 'html', 'emails' and 'compiled' should
         * be sent here
         *
         * @param       $templateType   The current template's type
@@ -460,8 +470,8 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        protected final function setRawTemplateData ($rawTemplateData) {
                // And store it in this class
-               //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($rawTemplateData)." Bytes set.<br />\n";
-               //* DEBUG: */ echo $this->currGroup." variables: ".count($this->varStack[$this->currGroup]).", groups=".count($this->varStack)."<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$this->getUniqueId().': '.strlen($rawTemplateData).' Bytes set.<br />\n';
+               //* DEBUG: */ echo $this->currGroup.' variables: '.count($this->varStack[$this->currGroup]).', groups='.count($this->varStack).'<br />\n';
                $this->rawTemplateData = (string) $rawTemplateData;
        }
 
@@ -471,7 +481,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $rawTemplateData        The raw data from the template
         */
        public final function getRawTemplateData () {
-               //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($this->rawTemplateData)." Bytes read.<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$this->getUniqueId().': '.strlen($this->rawTemplateData).' Bytes read.<br />\n';
                return $this->rawTemplateData;
        }
 
@@ -482,7 +492,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private final function setCompiledData ($compiledData) {
                // And store it in this class
-               //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($compiledData)." Bytes set.<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$this->getUniqueId().': '.strlen($compiledData).' Bytes set.<br />\n';
                $this->compiledData = (string) $compiledData;
        }
 
@@ -492,7 +502,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $compiledData   Compiled template data
         */
        public final function getCompiledData () {
-               //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($this->compiledData)." Bytes read.<br />\n";
+               //* DEBUG: */ echo __METHOD__.':'.$this->getUniqueId().': '.strlen($this->compiledData).' Bytes read.<br />\n';
                return $this->compiledData;
        }
 
@@ -606,9 +616,9 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * Structure of $templateMatches:
         *---------------------------------
         * [0] => Array - An array with all full matches
-        * [1] => Array - An array with left part (before the ":") of a match
-        * [2] => Array - An array with right part of a match including ":"
-        * [3] => Array - An array with right part of a match excluding ":"
+        * [1] => Array - An array with left part (before the ':') of a match
+        * [2] => Array - An array with right part of a match including ':'
+        * [3] => Array - An array with right part of a match excluding ':'
         */
        private function analyzeTemplate (array $templateMatches) {
                // Backup raw template data
@@ -773,18 +783,18 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                foreach ($varMatches[1] as $key => $var) {
 
                        // Detect leading equals
-                       if (substr($varMatches[2][$key], 0, 1) == "=") {
+                       if (substr($varMatches[2][$key], 0, 1) == '=') {
                                // Remove and cast it
                                $varMatches[2][$key] = (string) substr($varMatches[2][$key], 1);
-                       }
+                       } // END - if
 
                        // Do we have some quotes left and right side? Then it is free text
                        if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) {
                                // Free string detected! Which we can assign directly
                                $this->assignVariable($var, $varMatches[3][$key]);
                        } elseif (!empty($varMatches[2][$key])) {
-                               // Non-string found so we need some deeper analysis...
-                               die("Deeper analysis not yet implemented!");
+                               // @TODO Non-string found so we need some deeper analysis...
+                               ApplicationEntryPoint::app_die('Deeper analysis not yet implemented!');
                        }
 
                } // for ($varMatches ...
@@ -792,7 +802,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        /**
         * Compiles all loaded raw templates
         *
-        * @param               $templateMatches        See method analyzeTemplate() for details
+        * @param       $templateMatches        See method analyzeTemplate() for details
         * @return      void
         */
        private function compileRawTemplateData (array $templateMatches) {
@@ -854,23 +864,23 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        private function finalizeVariableCompilation () {
                // Get the content
                $content = $this->getRawTemplateData();
-               //* DEBUG: */ echo __METHOD__.": content before=".strlen($content)." (".md5($content).")<br />\n";
+               //* DEBUG: */ echo __METHOD__.': content before='.strlen($content).' ('.md5($content).')<br />\n';
 
                // Walk through all variables
                foreach ($this->varStack['general'] as $currEntry) {
-                       //* DEBUG: */ echo __METHOD__.": name=".$currEntry['name'].", value=<pre>".htmlentities($currEntry['value'])."</pre>\n";
+                       //* DEBUG: */ echo __METHOD__.': name='.$currEntry['name'].', value=<pre>'.htmlentities($currEntry['value']).'</pre>\n';
                        // Replace all [$var] or {?$var?} with the content
-                       // Old behaviour, will become obsolete!
-                       $content = str_replace("\$content[".$currEntry['name']."]", $currEntry['value'], $content);
+                       // @TODO Old behaviour, will become obsolete!
+                       $content = str_replace("\$content[".$currEntry['name'].']', $currEntry['value'], $content);
 
-                       // Yet another old way
-                       $content = str_replace("[".$currEntry['name']."]", $currEntry['value'], $content);
+                       // @TODO Yet another old way
+                       $content = str_replace('['.$currEntry['name'].']', $currEntry['value'], $content);
 
                        // The new behaviour
-                       $content = str_replace("{?".$currEntry['name']."?}", $currEntry['value'], $content);
+                       $content = str_replace('{?'.$currEntry['name'].'?}', $currEntry['value'], $content);
                } // END - for
 
-               //* DEBUG: */ echo __METHOD__.": content after=".strlen($content)." (".md5($content).")<br />\n";
+               //* DEBUG: */ echo __METHOD__.': content after='.strlen($content).' ('.md5($content).')<br />\n';
 
                // Set the content back
                $this->setRawTemplateData($content);
@@ -880,7 +890,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * Load a specified web template into the engine
         *
         * @param       $template       The web template we shall load which is located in
-        *                                              "html" by default
+        *                                              'html' by default
         * @return      void
         */
        public function loadWebTemplate ($template) {
@@ -899,7 +909,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function assignConfigVariable ($var) {
                // Sweet and simple...
-               //* DEBUG: */ echo __METHOD__.":var={$var}<br />\n";
+               //* DEBUG: */ echo __METHOD__.':var={$var}<br />\n';
                $this->varStack['config'][$var] = $this->getConfigInstance()->readConfig($var);
        }
 
@@ -907,7 +917,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * Load a specified email template into the engine
         *
         * @param       $template       The email template we shall load which is located in
-        *                                              "emails" by default
+        *                                              'emails' by default
         * @return      void
         */
        public function loadEmailTemplate ($template) {
@@ -922,7 +932,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * Load a specified code template into the engine
         *
         * @param       $template       The code template we shall load which is
-        *                                              located in "code" by default
+        *                                              located in 'code' by default
         * @return      void
         */
        public function loadCodeTemplate ($template) {
@@ -947,7 +957,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                // Iterate through all general variables
                foreach ($this->varStack['general'] as $currVariable) {
                        // Transfer it's name/value combination to the $content array
-                       //* DEBUG: */ echo $currVariable['name']."=<pre>".htmlentities($currVariable['value'])."</pre>\n";
+                       //* DEBUG: */ echo $currVariable['name'].'=<pre>'.htmlentities($currVariable['value']).'</pre>\n';
                        $dummy[$currVariable['name']] = $currVariable['value'];
                }// END - if
 
@@ -964,7 +974,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                unset($idx);
                unset($currVariable);
 
-               // Run the compilation twice to get content from helper classes in
+               // Run the compilation three times to get content from helper classes in
                $cnt = 0;
                while ($cnt < 3) {
                        // Finalize the compilation of template variables
@@ -976,19 +986,19 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        );
 
                        // This loop does remove the backslashes (\) in PHP parameters
-                       while (strpos($eval, "<?php") !== false) {
+                       while (strpos($eval, $this->codeBegin) !== false) {
                                // Get left part before "<?"
-                               $evalLeft = substr($eval, 0, strpos($eval, "<?php"));
+                               $evalLeft = substr($eval, 0, strpos($eval, $this->codeBegin));
 
                                // Get all from right of "<?"
-                               $evalRight = substr($eval, (strpos($eval, "<?php") + 5));
+                               $evalRight = substr($eval, (strpos($eval, $this->codeBegin) + 5));
 
                                // Cut middle part out and remove escapes
-                               $evalMiddle = trim(substr($evalRight, 0, strpos($evalRight, "?>")));
+                               $evalMiddle = trim(substr($evalRight, 0, strpos($evalRight, $this->codeEnd)));
                                $evalMiddle = stripslashes($evalMiddle);
 
                                // Remove the middle part from right one
-                               $evalRight = substr($evalRight, (strpos($evalRight, "?>") + 2));
+                               $evalRight = substr($evalRight, (strpos($evalRight, $this->codeEnd) + 2));
 
                                // And put all together
                                $eval = sprintf("%s<%%php %s %%>%s", $evalLeft, $evalMiddle, $evalRight);
@@ -998,7 +1008,9 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        $eval = str_replace(
                                "<%php", "\";",
                                str_replace(
-                                       "%>", "\n\$result .= \"", $eval
+                                       "%>",
+                                       "\n\$result .= \"",
+                                       $eval
                                )
                        );
 
@@ -1046,7 +1058,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                $rawData = $this->getRawTemplateData();
 
                // Remove double spaces and trim leading/trailing spaces
-               $rawData = trim(str_replace("  ", " ", $rawData));
+               $rawData = trim(str_replace('  ', ' ', $rawData));
 
                // Search for raw variables
                $this->extractVariablesFromRawData($rawData);
@@ -1091,23 +1103,23 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        public function output () {
                // Check which type of template we have
                switch ($this->getTemplateType()) {
-               case "html": // Raw HTML templates can be send to the output buffer
-                       // Quick-N-Dirty:
-                       $this->getWebOutputInstance()->output($this->getCompiledData());
-                       break;
-
-               default: // Unknown type found
-                       // Construct message
-                       $msg = sprintf("[%s-&gt;%s] Unknown/unsupported template type <span class=\"data\">%s</span> detected.",
-                               $this->__toString(),
-                               __FUNCTION__,
-                               $this->getTemplateType()
-                       );
-
-                       // Write the problem to the world...
-                       $this->debugOutput($msg);
-                       break;
-               }
+                       case 'html': // Raw HTML templates can be send to the output buffer
+                               // Quick-N-Dirty:
+                               $this->getWebOutputInstance()->output($this->getCompiledData());
+                               break;
+
+                       default: // Unknown type found
+                               // Construct message
+                               $msg = sprintf("[%s-&gt;%s] Unknown/unsupported template type <span class=\"data\">%s</span> detected.",
+                                       $this->__toString(),
+                                       __FUNCTION__,
+                                       $this->getTemplateType()
+                               );
+
+                               // Write the problem to the world...
+                               $this->debugOutput($msg);
+                               break;
+               } // END - switch
        }
 
        /**
@@ -1115,7 +1127,6 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @param       $helperName             The helper's name
         * @return      void
-        * @throws      ViewHelperNotFoundException     If the given view helper was not found
         */
        protected function loadViewHelper ($helperName) {
                // Make first character upper case, rest low
@@ -1126,21 +1137,8 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        // Create a class name
                        $className = "{$helperName}ViewHelper";
 
-                       // Does this class exists?
-                       if (!class_exists($className)) {
-                               // Abort here!
-                               throw new ViewHelperNotFoundException(array($this, $helperName), self::EXCEPTION_INVALID_VIEW_HELPER);
-                       } // END - if
-
                        // Generate new instance
-                       $eval = sprintf("\$this->helpers[%s] = %s::create%s();",
-                               $helperName,
-                               $className,
-                               $className
-                       );
-
-                       // Run the code
-                       eval($eval);
+                       $this->helpers[$helperName] = ObjectFactory::createObjectByName($className);
                } // END - if
 
                // Return the requested instance
@@ -1211,7 +1209,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                //* DEBUG: */ echo "<pre>".print_r($varMatches, true)."</pre>";
                foreach ($varMatches[0] as $match) {
                        // Add variable tags around it
-                       $varCode = "{?".$match."?}";
+                       $varCode = '{?' . $match . '?}';
 
                        // Is the variable found in code? (safes some calls)
                        if (strpos($rawCode, $varCode) !== false) {
@@ -1290,7 +1288,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                // Now parse the XML tree
                if (!xml_parse($xmlParser, $content)) {
                        // Error found in XML!
-                       //die("<pre>".htmlentities($content)."</pre>");
+                       //die('<pre>'.htmlentities($content).'</pre>');
                        throw new XmlParserException(array($this, $xmlParser), BaseHelper::EXCEPTION_XML_PARSER_ERROR);
                } // END - if
 
index 309279a695abccb5812943a39db08cf879d49891..f20dc1b6732ee529174fefb49c02639b19f5a0e1 100644 (file)
@@ -25,12 +25,31 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
        /**
         * Main nodes in the XML tree ('image' is ignored)
         */
-       private $mainNodes = array("base", "type", "resolution", "background-color", "foreground-color", "image-string");
+       private $mainNodes = array(
+               'base',
+               'type',
+               'resolution',
+               'background-color',
+               'foreground-color',
+               'image-string'
+       );
 
        /**
         * Sub nodes in the XML tree
         */
-       private $subNodes = array("name", "string-name", "x", "y", "font-size", "width", "height", "red", "green", "blue", "text");
+       private $subNodes = array(
+               'name',
+               'string-name',
+               'x',
+               'y',
+               'font-size',
+               'width',
+               'height',
+               'red',
+               'green',
+               'blue',
+               'text'
+       );
 
        /**
         * Image instance
@@ -450,7 +469,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 241e24fe44fa492a9b7f04a2a9c664a96faaf521..64811c5e5104eb7e05cdb5ad5a5875b1dc349d98 100644 (file)
@@ -30,7 +30,12 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        /**
         * Sub nodes in the XML tree
         */
-       private $subNodes = array("subject-line", "sender-address", "recipient-address", "message");
+       private $subNodes = array(
+               'subject-line',
+               'sender-address',
+               'recipient-address',
+               'message'
+       );
 
        /**
         * Mailer instance
index f1a63026e0259c0494bb0ba33cd887b698913e16..d995e3310ec530fc47efc3d731db75570bd8928c 100644 (file)
@@ -251,7 +251,7 @@ class BaseUser extends BaseFrameworkSystem {
                // Search for it
                if ($this->getResultInstance()->find('pass_hash')) {
                        // So does the hashes match?
-                       //* DEBUG: */ echo $requestInstance->getRequestElement('pass_hash')."/".$entry['pass_hash'];
+                       //* DEBUG: */ echo $requestInstance->getRequestElement('pass_hash').'/'.$entry['pass_hash'];
                        $matches = ($requestInstance->getRequestElement('pass_hash') === $this->getResultInstance()->getFoundValue());
                } // END - if
 
index fba7463490046fd02a5426135a3e9a26a97da59c..de237fd65309a7c982ab969447e81cf1322a3865 100644 (file)
@@ -45,7 +45,7 @@
  *
  *     Die komplette Rückgabe des Interfaces wird als assoziatives Array in der Klassen-
  *     variable __data gespeichert:
- *     __data => array("status" => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
+ *     __data => array('status' => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
  *                     "statustext" => Status in Worten (z.B.: "Transaktion erfolgreich durchgeführt"),
  *                     ")
  *
@@ -56,7 +56,7 @@
  * @copyright  (c) 2007 by Primusportal.de
  * @copyright  (c) 2008 by Roland Haeder
  */
-class PrimeraApi {
+class PrimeraApi extends BaseFrameworkSystem {
        /**
         * Fehler - Interfacebenutzer
         */
@@ -109,12 +109,12 @@ class PrimeraApi {
        private $path = "/transfer.interface.2.0.php";
 
        private $errno = 0;
-       private $err = "";
+       private $err = '';
 
-       private $seperator = ":";
+       private $seperator = ':';
 
-       private $username = "";
-       private $password = "";
+       private $username = '';
+       private $password = '';
 
        private $data = array();
 
@@ -154,7 +154,7 @@ class PrimeraApi {
                fputs($fp, "Connection: close\r\n\r\n");
                fputs($fp, $data);
 
-               $return = "";
+               $return = '';
                while (!feof($fp)) {
                        $return.=fgets($fp,128);
                }
@@ -170,7 +170,7 @@ class PrimeraApi {
                $x = explode("\n", $content);
                $return = array();
                foreach($x as $currentLine) {
-                       $line_exploded = explode(":", $currentLine,2);
+                       $line_exploded = explode($this->seperator, $currentLine,2);
                        if (count($line_exploded) > 1) {
                                $return[$line_exploded[0]] = $line_exploded[1];
                        }
@@ -183,17 +183,18 @@ class PrimeraApi {
         * @param int$Amount Betrag in ganzzahligen Primera
         * @param string $Description Beschreibung (Sichtbar in Einzelauflistung)
         */
-       public function payPrimera ($Receiver, $Amount, $Description = "") {
+       public function payPrimera ($Receiver, $Amount, $Description = '') {
                $valid = false;
-               $PostData = array("PrimusInterface_Action" => "Pay",
-                       "PrimusInterface_Receiver" => base64_encode($Receiver),
-                       "PrimusInterface_Amount" => base64_encode($Amount),
-                       "PrimusInterface_Description" => base64_encode($Description) );
+               $PostData = array(
+                       'PrimusInterface_Action'      => 'Pay',
+                       'PrimusInterface_Receiver'    => base64_encode($Receiver),
+                       'PrimusInterface_Amount'      => base64_encode($Amount),
+                       'PrimusInterface_Description' => base64_encode($Description) );
 
                $PostReturn = $this->parseContent( $this->queryApi($PostData) );
 
                $this->data = $PostReturn;
-               if ($PostReturn["status"] == "200") {
+               if ($PostReturn['status'] == '200') {
                        $valid = true;
                }
                return $valid;
@@ -205,16 +206,17 @@ class PrimeraApi {
         * - ist er aktiv
         * @param string/int $User Userid / Username
         */
-       function CheckPrimusUser($User) {
+       function CheckPrimusUser ($User) {
                $valid = false;
-               $PostData = array("PrimusInterface_Action"=> "CheckPrimusUser",
-                       "PrimusInterface_CheckPrimusUser" => $User);
+               $PostData = array(
+                       'PrimusInterface_Action'          => 'CheckPrimusUser',
+                       'PrimusInterface_CheckPrimusUser' => $User);
 
                $PostReturn = $this->parseContent( $this->queryApi($PostData) );
 
                $this->data = $PostReturn;
 
-               if ($PostReturn["status"] == self::PI_USER_CHECK_OK) {
+               if ($PostReturn['status'] == self::PI_USER_CHECK_OK) {
                        $valid = true;
                }
                return $valid;
@@ -229,7 +231,7 @@ class PrimeraApi {
                $PostReturn = $this->parseContent( $this->queryApi($PostData) );
 
                $this->data = $PostReturn;
-               if ($PostReturn["status"] == self::PI_GET_PRIMERA_DONE) {
+               if ($PostReturn['status'] == self::PI_GET_PRIMERA_DONE) {
                        $primera = $PostReturn["primera"];
                }
                return $primera;
index c333778bf2b99bc7ab76391e240aa8b2b859e0a2..42936f106b99d01d7753e698f59ceb3554c05d59 100644 (file)
@@ -25,7 +25,7 @@ class WernisApi extends BaseFrameworkSystem {
        /**
         * Static base API URL
         */
-       private static $apiUrl = "http://www.wds66.com/api/";
+       private static $apiUrl = 'http://www.wds66.com/api/';
 
        /**
         * API Wernis amount
@@ -40,12 +40,12 @@ class WernisApi extends BaseFrameworkSystem {
        /**
         * API Wernis password (not account password!)
         */
-       private $w_md5 = "";
+       private $w_md5 = '';
 
        /**
         * Nickname of the user
         */
-       private $w_nick = "";
+       private $w_nick = '';
 
        /**
         * Wernis amount of the user
@@ -57,6 +57,11 @@ class WernisApi extends BaseFrameworkSystem {
         */
        private $statusArray = array();
 
+       /**
+        * Status for 'okay'
+        */
+       private $statusOkay = 'OK';
+
        /**
         * Protected constructor
         *
@@ -201,14 +206,14 @@ class WernisApi extends BaseFrameworkSystem {
                // Construct the request string
                $requestString = $this->config['api_url'] . $scriptName."?api_id=".$this->config['wernis_api_id']."&api_key=".$this->config['wernis_api_key'];
                foreach ($requestData as $key => $value) {
-                       $requestString .= "&".$key."=".$value;
+                       $requestString .= '&' . $key . '=' . $value;
                }
 
                // Get the raw response from the lower function
                $response = $this->sendRawRequest($requestString);
 
                // Check the response header if all is fine
-               if (strpos($response[0], "200") === false) {
+               if (strpos($response[0], '200') === false) {
                        // Something bad happend... :(
                        return array(
                                'status'  => "request_error",
@@ -220,13 +225,13 @@ class WernisApi extends BaseFrameworkSystem {
                $response = $response[(count($response) - 1)];
 
                // Prepare the returning result for higher functions
-               if (substr($response, 0, 1) == "&") {
+               if (substr($response, 0, 1) == '&') {
                        // Remove the leading & (which can be used in Flash)
                        $response = substr($response, 1);
                }
 
                // Bring back the response
-               $data = explode("=", $response);
+               $data = explode('=', $response);
 
                // Default return array (should not stay empty)
                $return = array();
@@ -283,7 +288,7 @@ class WernisApi extends BaseFrameworkSystem {
                } else {
                        // All fine here
                        $return = array(
-                               'status'   => "OK",
+                               'status'   => $this->statusOkay,
                                'response' => $response
                        );
                }
@@ -302,7 +307,7 @@ class WernisApi extends BaseFrameworkSystem {
 
                // Prepare the request data
                $requestData = array(
-                       'sub_request'   => "receive",
+                       'sub_request'   => 'receive',
                        't_uid'                 => $this->w_id,
                        't_md5'                 => $this->w_md5,
                        'r_uid'                 => (int)$this->config['wernis_refid'],
@@ -313,7 +318,7 @@ class WernisApi extends BaseFrameworkSystem {
                // Return the result from the lower functions
                $return = $this->sendRequest("book.php", $requestData);
 
-               if ($return['status'] == "OK") {
+               if ($return['status'] == $this->statusOkay) {
                        // All fine!
                        $result = true;
                } else {
@@ -335,7 +340,7 @@ class WernisApi extends BaseFrameworkSystem {
 
                // Prepare the request data
                $requestData = array(
-                       'sub_request'   => "send",
+                       'sub_request'   => 'send',
                        't_uid'                 => $this->w_id,
                        't_md5'                 => $this->w_md5,
                        'r_uid'                 => (int)$this->config['wernis_refid'],
@@ -346,7 +351,7 @@ class WernisApi extends BaseFrameworkSystem {
                // Return the result from the lower functions
                $return = $this->sendRequest("book.php", $requestData);
 
-               if ($return['status'] == "OK") {
+               if ($return['status'] == $this->statusOkay) {
                        // All fine!
                        $result = true;
                } else {
@@ -362,24 +367,24 @@ class WernisApi extends BaseFrameworkSystem {
        private function sendRawRequest ($script) {
                // Use the hostname from script URL as new hostname
                $url = substr($script, 7);
-               $extract = explode("/", $url);
+               $extract = explode('/', $url);
 
                // Done extracting the URL :)
                $url = $extract[0];
 
                // Extract host name
-               $host = str_replace("http://", "", $url);
-               if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
+               $host = str_replace("http://", '', $url);
+               if (ereg('/', $host)) $host = substr($host, 0, strpos($host, '/'));
 
                // Generate relative URL
                $script = substr($script, (strlen($url) + 7));
-               if (substr($script, 0, 1) == "/") $script = substr($script, 1);
+               if (substr($script, 0, 1) == '/') $script = substr($script, 1);
 
                // Open connection
                $fp = @fsockopen($host, 80, $errno, $errdesc, 30);
                if (!$fp) {
                        // Failed!
-                       return array("", "", "");
+                       return array('', '', '');
                }
 
                // Generate request header
@@ -404,7 +409,7 @@ class WernisApi extends BaseFrameworkSystem {
                // Was the request successfull?
                if ((!ereg("200 OK", $response[0])) && (empty($response[0]))) {
                        // Not found / access forbidden
-                       $response = array("", "", "");
+                       $response = array('', '', '');
                }
 
                // Return response
index aa00607c0d3b91a242febd70c55f8a342fb34c56..5d47232ca4bdcee9f7b5d65303e1091125628ee3 100644 (file)
@@ -109,9 +109,9 @@ class FrameworkConfiguration implements Registerable {
                                        $fqfn = $inc;
 
                                        // Base path added? (Uni* / Windows)
-                                       if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) {
+                                       if ((substr($inc, 0, 1) != '/') && (substr($inc, 1, 1) != ':')) {
                                                // Generate FQFN
-                                               $fqfn = sprintf("%s/inc/extra/%s", $this->readConfig('base_path'), $inc);
+                                               $fqfn = $this->readConfig('base_path') . '/inc/extra/' . $inc;
                                        } // END - if
                                } // END - if
 
@@ -143,11 +143,6 @@ class FrameworkConfiguration implements Registerable {
                        throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND);
                }
 
-               // Debug message
-               if ((defined('DEBUG_CONFIG')) || (defined('DEBUG_ALL'))) {
-                       echo "[".__METHOD__."] Configuration entry ".$cfgEntry." requested.<br />\n";
-               } // END - if
-
                // Return the requested value
                return $this->config[$cfgEntry];
        }
@@ -194,16 +189,16 @@ class FrameworkConfiguration implements Registerable {
         */
        public function detectBaseUrl() {
                // Initialize the URL
-               $baseUrl = "http";
+               $baseUrl = 'http';
 
                // Do we have HTTPS?
                if (isset($_SERVER['HTTPS'])) {
                        // Add the >s< for HTTPS
-                       $baseUrl .= "s";
+                       $baseUrl .= 's';
                } // END - if
 
-               // Construct the full URL now and secure it against CSRF attacks
-               $baseUrl = $baseUrl . "://" . $this->detectDomain() . $this->detectScriptPath();
+               // Construct the full URL and secure it against CSRF attacks
+               $baseUrl = $baseUrl . '://' . $this->detectDomain() . $this->detectScriptPath();
 
                // Return the URL
                return $baseUrl;
@@ -216,7 +211,7 @@ class FrameworkConfiguration implements Registerable {
         */
        public function detectDomain () {
                // Full domain is localnet.invalid by default
-               $fullDomain = "localnet.invalid";
+               $fullDomain = 'localnet.invalid';
 
                // Is the server name there?
                if (isset($_SERVER['SERVER_NAME'])) {
@@ -241,7 +236,7 @@ class FrameworkConfiguration implements Registerable {
                // Is the scriptname set?
                if (isset($_SERVER['SCRIPT_NAME'])) {
                        // Get dirname from it and replace back-slashes with slashes for lame OSes...
-                       $scriptPath = str_replace("\\", "/", dirname($_SERVER['SCRIPT_NAME']));
+                       $scriptPath = str_replace("\\", '/', dirname($_SERVER['SCRIPT_NAME']));
                } // END - if
 
                // Return it
index b9f40fa65476b01527c70577a9b79893124a9035..6a57e201c5442bc4f1409bcfccb25c41d0672470 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-// Initialize layer
-$layerInstance = null;
+// Initialize database layer
+$databaseInstance = null;
 
 // Get config instance
 $cfg = FrameworkConfiguration::getInstance();
 
 // Generate FQFN for the database layer
-$fqfn = sprintf("%sinc/database/lib-%s.php",
-       $cfg->readConfig('base_path'),
-       $cfg->readConfig('db_type')
-);
+$fqfn = $cfg->readConfig('base_path') . 'inc/database/lib-' . $cfg->readConfig('db_type') . '.php';
 
 // Load the database layer include
 if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
@@ -46,14 +43,14 @@ if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
 }
 
 // Clean it up
-unset($fqfn);
+unset($fqfn, $cfg);
 
 // Prepare database instance
-$db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layerInstance);
+$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $databaseInstance);
 
 // Is the app variable there and valid?
 // @TODO Rewrite this
-if (is_object($app)) $app->setDatabaseInstance($db);
+if (is_object($app)) $app->setDatabaseInstance($connectionInstance);
 
 // [EOF]
 ?>
index 68ef141b315f3a6570e76999eff25ff98313e3e2..84fd7238892d3ec057e717cb0bd6a02adbefd623 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-// Zum Testen speichern wir in lokale Dateien (LocalFileDatabase)
-try {
-       $layerInstance = LocalFileDatabase::createLocalFileDatabase(FrameworkConfiguration::getInstance()->readConfig('local_db_path'), FileIoHandler::getInstance());
-} catch (SavePathIsEmptyException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (SavePathNotFoundException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (SavePathIsNoDirectoryException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (SavePathReadProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-} catch (SavePathWriteProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <span class=\"exception_reason\">%s</span>",
-               $e->getMessage()
-       ));
-}
+// For testing purposes we use a local file database
+$databaseInstance = LocalFileDatabase::createLocalFileDatabase(
+       FrameworkConfiguration::getInstance()->readConfig('local_db_path'),
+       FileIoHandler::getInstance()
+);
 
 // [EOF]
 ?>
index 30a3575128c1ba0cbc8c33db42cfad6863081df9..b4735458f3f7ee8a2eb337a5a2f37d619fcd9747 100644 (file)
@@ -23,7 +23,7 @@
 
 // Try to instance the language system
 $lang = LanguageSystem::createLanguageSystem(
-       $cfg->readConfig('base_path').
+       FrameworkConfiguration::getInstance()->readConfig('base_path').
        FrameworkConfiguration::getInstance()->readConfig('lang_base_path')
 );
 
index 7b551d8747c95ab9f3acea3b2040a8ea150c8155..df4e3631717721e7417ca8577cec1550c96ff62f 100644 (file)
@@ -261,10 +261,10 @@ class ClassLoader {
 
                // Directories which our class loader ignores by default while
                // deep-scanning the directory structure.
-               $ignoreList[] = ".";
-               $ignoreList[] = "..";
-               $ignoreList[] = ".htaccess";
-               $ignoreList[] = ".svn";
+               $ignoreList[] = '.';
+               $ignoreList[] = '..';
+               $ignoreList[] = '.htaccess';
+               $ignoreList[] = '.svn';
 
                // Keep it in class for later usage
                $this->ignoreList = $ignoreList;
@@ -312,10 +312,10 @@ class ClassLoader {
                $oldPrefix = $this->prefix;
 
                // Set new prefix (temporary!)
-               $this->prefix = "config-";
+               $this->prefix = 'config-';
 
                // Set base directory
-               $basePath = sprintf("%sinc/config/", $this->configInstance->readConfig('base_path'));
+               $basePath = $this->configInstance->readConfig('base_path') . 'inc/config/';
 
                // Load all classes from the config directory
                $this->scanClassPath($basePath);
index 33a4fa966e7a05e6d33ef2aeaca489539a3cb902..7e7dee502a316feb47ebdecce3af46a4feb6e6b5 100644 (file)
@@ -46,11 +46,7 @@ foreach ($configAppIncludes as $inc) {
        }
 
        // Generate a FQFN for the helper class
-       $fqfn = sprintf("%s%s/%s.php",
-               $cfg->readConfig('application_path'),
-               $cfg->readConfig('app_name'),
-               $inc
-       );
+       $fqfn = $cfg->readConfig('application_path') . $cfg->readConfig('app_name') . '/' . $inc . '.php';
 
        // Does the include file exists?
        if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
@@ -64,5 +60,8 @@ foreach ($configAppIncludes as $inc) {
        }
 }
 
+// Remove variables from namespace, which we don't need
+unset($cfg, $inc, $configAppIncludes, $fqfn);
+
 // [EOF]
 ?>