inc/classes/main/filter/class_ -text
inc/classes/main/filter/class_AbstractFilterDecorator.php -text
inc/classes/main/filter/class_BaseFilter.php -text
+inc/classes/main/filter/class_BaseFilterDecorator.php -text
inc/classes/main/filter/class_FilterChain.php -text
inc/classes/main/filter/crypto/.htaccess -text
inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php -text
* @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @todo Find a better name for this interface
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface EncryptableStream extends Streamable {
+ /**
+ * Encrypt the string with fixed salt
+ *
+ * @param $str The unencrypted string
+ * @return $encrypted Encrypted string
+ */
+ function encryptStream ($str);
+
+ /**
+ * Decrypt the string with fixed salt
+ *
+ * @param $encrypted Encrypted string
+ * @return $str The unencrypted string
+ */
+ function decryptStream ($encrypted);
}
//
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
// Call parent constructor
parent::__construct($className);
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
-
// Get registry instance
$registryInstance = Registry::getRegistry();
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
const EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED = 0x039;
const EXCEPTION_FILTER_CHAIN_INTERCEPTED = 0x040;
- /**
- * In the super constructor these system classes shall be ignored or else
- * we would get an endless calling loop.
- *
- *---------------------------------------------------------------------*
- * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL RUN YOUR SERVER IN AN *
- * ENDLESS LOOP !!! *
- *---------------------------------------------------------------------*
- */
- private $systemClasses = array(
- 'DebugMiddleware', // Debug middleware output sub-system
- 'Registry', // Object registry
- 'ObjectFactory', // Object factory
- 'DebugWebOutput', // Debug web output sub-system
- 'WebOutput', // Web output sub-system
- 'CompressorChannel', // Compressor sub-system
- 'DebugConsoleOutput', // Debug console output sub-system
- 'DebugErrorLogOutput', // Debug error_log() output sub-system
- 'FrameworkDirectoryPointer', // Directory handler sub-system
- 'NullCompressor', // Null compressor
- 'Bzip2Compressor', // BZIP2 compressor
- 'GzipCompressor', // GZIP compressor
- );
/**
* Protected super constructor
*
* @return void
*/
private final function initInstance () {
- // Is this a system class?
- if (!in_array($this->__toString(), $this->systemClasses)) {
- // Set configuration instance
- $this->setConfigInstance(FrameworkConfiguration::getInstance());
-
- // Add application helper to our class
- $this->systemclasses[] = $this->getConfigInstance()->getConfigEntry('app_helper_class');
-
- // Set debug instance
- $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->getConfigEntry('debug_class')));
-
- // Get output instance and set it
- $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($this->getConfigInstance()->getConfigEntry('web_content_type')));
- $this->setWebOutputInstance($outputInstance);
-
- // Set the compressor channel
- $this->setCompressorChannel(CompressorChannel::createCompressorChannel(
- $this->getConfigInstance()->getConfigEntry('base_path').
- $this->getConfigInstance()->getConfigEntry('compressor_base_path')
- ));
-
- // Initialization done! :D
- Registry::isInitialized('OK');
- } elseif ($this->__toString() == 'DebugMiddleware') {
- // Set configuration instance
- $this->setConfigInstance(FrameworkConfiguration::getInstance());
- }
+ // Set configuration instance
+ $this->setConfigInstance(FrameworkConfiguration::getInstance());
}
/**
}
/**
- * Compare class name of this and given class name
+ * Checks wether an object equals this object. You should overwrite this
+ * method to implement own equality checks
*
- * @param $className The class name as string from the other class
- * @return boolean The result of comparing both class names
+ * @param $objectInstance An instance of a FrameworkInterface object
+ * @return $equals Wether both objects equals
*/
- public final function isClass ($className) {
- return ($this->__toString() == $className);
+ public function equals (FrameworkInterface $objectInstance) {
+ // Now test it
+ $equals = ((
+ $this->__toString() == $objectInstance->__toString()
+ ) && (
+ $this->hashCode() == $objectInstance->hashCode()
+ ));
+
+ // Return the result
+ return $result;
}
/**
return $price;
}
- /**
- * Removes number formating characters
- *
- * @return void
- */
- public final function removeNumberFormaters () {
- unset($this->thousands);
- unset($this->decimals);
- }
-
/**
* Private getter for language instance
*
Registry::getRegistry()->addInstance('language', $langInstance);
}
- /**
- * Remove the $systemClasses array from memory
- *
- * @return void
- */
- public final function removeSystemArray () {
- unset($this->systemClasses);
- }
-
/**
* Appends a trailing slash to a string
*
* @throws NullPointerException If the discovered application
* instance is still null
*/
- protected function prepareTemplateInstance (BaseFrameworkSystem $appInstance=null) {
+ protected function prepareTemplateInstance (FrameworkInterface $appInstance=null) {
// Is the application instance set?
if (is_null($appInstance)) {
// Get the current instance
// Call parent constructor
parent::__construct($className);
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
-
// Initialize both filter chains
$this->initFilterChain('pre');
$this->initFilterChain('post');
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct($class = __CLASS__) {
// Call parent constructor
parent::__construct($class);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
// Initialize the cache instance
$this->initCacheInstance();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseFactory extends BaseFrameworkSystem {
- /**
- * An instance of the real factory class
- */
- private $realFactoryInstance = null;
-
/**
* Protected constructor
*
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
- }
-
- /**
- * Setter for the *real* factory instance
- *
- * @param $realFactoryInstance An instance of the real factory class
- * @return void
- */
- public final function setRealFactoryInstance (BaseFrameworkSystem $realFactoryInstance) {
- $this->realFactoryInstance = $realFactoryInstance;
- }
-
- /**
- * Getter for the *real* factory instance
- *
- * @return $realFactoryInstance An instance of the real factory class
- */
- protected final function getRealFactoryInstance () {
- return $this->realFactoryInstance;
}
}
<?php
-/**
- * An abstract filter decorator for decorating filters with other filters
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-abstract class AbstractFilterDecorator extends BaseFrameworkSystem implements Filterable {
- /**
- * The decorated filter instance
- */
- private $filterInstance = null;
-
- /**
- * Protected constructor
- *
- * @param $className Name of the real class' name
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
- }
-
- /**
- * Setter for the decorated filter instance
- *
- * @param $filterInstance An instance of a filter
- * @return void
- */
- protected final function setFilterInstance (Filterable $filterInstance) {
- $this->filterInstance = $filterInstance;
- }
-
- /**
- * Getter for the decorated filter instance
- *
- * @return $filterInstance An instance of a filter
- */
- protected final function getFilterInstance () {
- return $this->filterInstance;
- }
-
- /**
- * Execute the inner filter
- *
- * @param $requestInstance An instance of a request class
- * @param $responseInstance An instance of a response class
- * @return void
- */
- public final function execute (Requestable $requestInstance, Responseable $responseInstance) {
- $this->getFilterInstance()->execute($requestInstance, $responseInstance);
- }
-
-
- /**
- * Do the execution of the filter
- *
- * @param $requestInstance An instance of a request class
- * @param $responseInstance An instance of a response class
- * @return void
- */
- abstract public function doExecute (Requestable $requestInstance, Responseable $responseInstance);
-}
-
-// [EOF]
+// @DEPRECATED
+die("Use BaseFilterDecorator instead.");
?>
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
--- /dev/null
+<?php
+/**
+ * A general filter decorator for decorating filters with other filters
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseFilterDecorator extends BaseFrameworkSystem implements Filterable {
+ /**
+ * The decorated filter instance
+ */
+ private $filterInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the real class' name
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Setter for the decorated filter instance
+ *
+ * @param $filterInstance An instance of a filter
+ * @return void
+ */
+ protected final function setFilterInstance (Filterable $filterInstance) {
+ $this->filterInstance = $filterInstance;
+ }
+
+ /**
+ * Getter for the decorated filter instance
+ *
+ * @return $filterInstance An instance of a filter
+ */
+ protected final function getFilterInstance () {
+ return $this->filterInstance;
+ }
+
+ /**
+ * Execute the inner filter
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public final function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ $this->getFilterInstance()->execute($requestInstance, $responseInstance);
+ }
+
+
+ /**
+ * Do the execution of the filter
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ abstract public function doExecute (Requestable $requestInstance, Responseable $responseInstance);
+}
+
+// [EOF]
+?>
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean-up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean-up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean-up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean-up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className = __CLASS__) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
// Return the instance
return $streamInstance;
}
+
+ /**
+ * Encrypt the string with fixed salt
+ *
+ * @param $str The unencrypted string
+ * @return $encrypted Encrypted string
+ */
+ public function encryptStream ($str) {
+ // Just handle it over
+ $encrypted = (string) $str;
+
+ // Return it
+ return $encrypted;
+ }
+
+ /**
+ * Decrypt the string with fixed salt
+ *
+ * @param $encrypted Encrypted string
+ * @return $str The unencrypted string
+ */
+ function decryptStream ($encrypted) {
+ // Just handle it over
+ $str = (string) $encrypted;
+
+ // Return it
+ return $str;
+ }
}
// [EOF]
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
}
// Call parent constructor
parent::__construct();
- // Clean up a little
- $this->removeSystemArray();
- $this->removeNumberFormaters();
-
// Set data (DEPRECATED!)
$this->username = $PPUsername;
$this->password = $PPPassword;
}
/**
- * Anfrage senden und Rückgabecode in Variable speichern
+ * Anfrage senden und Rueckgabecode in Variable speichern
*/
function queryApi ( $data = array() ) {
$fp = fsockopen($this->host, 80, $this->errno, $this->_err);
$data["PrimusInterface_Username"] = base64_encode($this->username);
$data["PrimusInterface_Password"] = base64_encode(md5($this->password));
- // POST-Daten übermitteln:
+ // POST-Daten uebermitteln:
$data = http_build_query($data, '', '&');
fputs($fp, "POST {$this->path}HTTP/1.1\r\n");
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
if (empty($cfgEntry)) {
// Entry is empty
throw new ConfigEntryIsEmptyException($this, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY);
- } elseif (!$this->isConfigEntrySet($cfgEntry)) {
+ } elseif (!$this->isConfigurationEntrySet($cfgEntry)) {
// Entry was not found!
throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND);
}