*/
class extends BaseFrameworkSystem {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
private $hashedPassword = "";
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
// Get a new instance
$registrationInstance = new ShipSimuRegistration();
+ // Initialize the filter chains
+ $registrationInstance->initFilterChains();
+
// And return it
return $registrationInstance;
}
* @return void
*/
public function doPreRegistration () {
- $this->partialStub();
+ // First run all pre filters
+ $this->executePreFilters();
}
/**
* @return void
*/
public function doPostRegistration () {
- $this->partialStub();
+ // First run all post filters
+ $this->executePostFilters();
}
/**
*/
class extends BaseFrameworkSystem {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class Controller extends BaseController implements Controller {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
private $salt = "";
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
* Create an object of LocalFileDatabase and set the save path for local files.
* This method also validates the given file path.
*
- * @param $savePath The local file path string
- * @param $ioInstance The input/output handler. This
- * should be FileIoHandler
- * @return $dbInstance An instance of LocalFileDatabase
+ * @param $savePath The local file path string
+ * @param $ioInstance The input/output handler. This
+ * should be FileIoHandler
+ * @return $dbInstance An instance of LocalFileDatabase
*/
public final static function createLocalFileDatabase ($savePath, FileIoHandler $ioInstance) {
// Get an instance
* Saves a given object to the local file system by serializing and
* transparently compressing it
*
- * @param $object The object we shall save to the local file system
+ * @param $object The object we shall save to the local file system
* @return void
* @throws NullPointerException If the object instance is null
* @throws NoObjectException If the parameter $object is not
/**
* Get a serialized string from the given object
*
- * @param $object The object we want to serialize and transparently
+ * @param $object The object we want to serialize and transparently
* compress
* @return $serialized A string containing the serialzed/compressed object
* @see ObjectLimits An object holding limition information
* Analyses if a unique ID has already been used or not by search in the
* local database folder.
*
- * @param $uniqueID A unique ID number which shall be checked
- * before it will be used
- * @param $inConstructor If we got called in a de/con-structor or
- * from somewhere else
+ * @param $uniqueID A unique ID number which shall be checked
+ * before it will be used
+ * @param $inConstructor If we got called in a de/con-structor or
+ * from somewhere else
* @return $isUnused true = The unique ID was not found in the database,
- * false = It is already in use by an other object
+ * false = It is already in use by an other object
* @throws NoArrayCreatedException If explode() fails to create an array
* @throws InvalidArrayCountException If the array contains less or
* more than two elements
// Initialize the search loop
$isValid = false;
- while ($dataFile = $dirInstance->readDirectoryExcept(array(".", ".."))) {
+ while ($dataFile = $dirInstance->readDirectoryExcept(array(".", "..", ".htaccess"))) {
// Generate FQFN for testing
$fqfn = sprintf("%s/%s", $pathName, $dataFile);
$this->setLastFile($fqfn);
*/
class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class ???Filter extends BaseFrameworkSystem implements Filterable {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class NullFilter extends BaseFrameworkSystem implements Filterable {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class extends BaseHelper {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
private $responseInstance = null;
/**
- * Private constructor
+ * Pre-registration filter chain
+ */
+ private $preRegistrationFilter = null;
+
+ /**
+ * Pre-registration filter chain
+ */
+ private $postRegistrationFilter = null;
+
+ /**
+ * Protected constructor
*
* @param $className Name of the class
* @return void
$this->removeSystemArray();
}
+ /**
+ * Initialize filters. This must be done before you can use them
+ *
+ * @return void
+ */
+ protected function initFilterChains () {
+ // Pre/post-registration filters
+ $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain');
+ $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain');
+ }
+
/**
* Setter for request instance
*
public final function getResponseInstance () {
return $this->responseInstance;
}
+
+ /**
+ * Adds a filter to the pre filter chain
+ *
+ * @param $filterInstance An instance of a filter
+ * @return void
+ */
+ public function addPreFilter (Filterable $filterInstance) {
+ // Add the pre filter
+ $this->preRegistrationFilter->addFilter($filterInstance);
+ }
+
+ /**
+ * Adds a filter to the post filter chain
+ *
+ * @param $filterInstance An instance of a filter
+ * @return void
+ */
+ public function addPostFilter (Filterable $filterInstance) {
+ // Add the post filter
+ $this->postRegistrationFilter->addFilter($filterInstance);
+ }
+
+ /**
+ * Executes all pre filters
+ *
+ * @return void
+ */
+ protected function executePreFilters () {
+ // Execute all pre filters
+ $this->preRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
+ }
+
+ /**
+ * Executes all post filters
+ *
+ * @return void
+ */
+ protected function executePostFilters () {
+ // Execute all post filters
+ $this->postRegistrationFilter->processFilters($this->requestInstance, $this->responseInstance);
+ }
}
// [EOF]
private $rndStrLen = 0;
/**
- * Private constructor
+ * Protected constructor
*
* @param $className Name of this class
* @return void