db/company_user/.htaccess -text
db/gov_user/.htaccess -text
db/news/.htaccess -text
+db/payments/.htaccess -text
db/user/.htaccess -text
db/user_points/.htaccess -text
devel/.htaccess -text
inc/classes/interfaces/database/middleware/class_DatabaseConnector.php -text
inc/classes/interfaces/debug/.htaccess -text
inc/classes/interfaces/debug/class_Debugger.php -text
+inc/classes/interfaces/discovery/.htaccess -text
+inc/classes/interfaces/discovery/class_Discoverable.php -text
inc/classes/interfaces/filter/.htaccess -text
inc/classes/interfaces/filter/class_Filterable.php -text
inc/classes/interfaces/helper/.htaccess -text
inc/classes/main/database/databases/class_LocalFileDatabase.php -text
inc/classes/main/database/wrapper/.htaccess -text
inc/classes/main/database/wrapper/class_NewsDatabaseWrapper.php -text
+inc/classes/main/database/wrapper/class_PaymentsDatabaseWrapper.php -text
inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php -text
inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php -text
inc/classes/main/debug/.htaccess -text
inc/classes/main/debug/class_DebugConsoleOutput.php -text
inc/classes/main/debug/class_DebugErrorLogOutput.php -text
inc/classes/main/debug/class_DebugWebOutput.php -text
+inc/classes/main/discovery/.htaccess -text
+inc/classes/main/discovery/class_ -text
+inc/classes/main/discovery/class_BaseDiscovery.php -text
+inc/classes/main/discovery/payment/.htaccess -text
+inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php -text
inc/classes/main/factories/.htaccess -text
inc/classes/main/factories/cache/.htaccess -text
inc/classes/main/factories/cache/class_CacheFactory.php -text
inc/classes/main/filter/news/class_NewsProcessFilter.php -text
inc/classes/main/filter/null/.htaccess -text
inc/classes/main/filter/null/class_NullFilter.php -text
+inc/classes/main/filter/payment/.htaccess -text
+inc/classes/main/filter/payment/class_PaymentDiscoveryFilter.php -text
inc/classes/main/filter/update/.htaccess -text
inc/classes/main/filter/update/class_UserStatusConfimedUpdateFilter.php -text
inc/classes/main/filter/update/class_UserUpdateFilter.php -text
$cfg->setConfigEntry('chat_enabled_msn', "Y");
// CFG: USER-REGISTRATION
-$cfg->setConfigEntry('user_registration_class', "ShipSimuRegistration");
+$cfg->setConfigEntry('user_registration_class', "BlogRegistration");
// CFG: USER-LOGIN-CLASS
-$cfg->setConfigEntry('user_login_class', "ShipSimuUserLogin");
+$cfg->setConfigEntry('user_login_class', "BlogUserLogin");
// CFG: GUEST-LOGIN-CLASS
-$cfg->setConfigEntry('guest_login_class', "ShipSimuGuestLogin");
+$cfg->setConfigEntry('guest_login_class', "BlogGuestLogin");
// CFG: USER-STATUS-REGISTER
$cfg->setConfigEntry('user_status_unconfirmed', "UNCONFIRMED");
$cfg->setConfigEntry('user_status_confirmed', "CONFIRMED");
// CFG: LOGIN-HELPER-CLASS
-$cfg->setConfigEntry('login_helper_class', "ShipSimuLoginHelper");
+$cfg->setConfigEntry('login_helper_class', "BlogLoginHelper");
// CFG: AUTH-METHOD-CLASS
$cfg->setConfigEntry('auth_method_class', "CookieAuth");
$cfg->setConfigEntry('guest_login_passwd', "guest");
// CFG: LOGIN-WELCOME-ACTION-CLASS
-$cfg->setConfigEntry('login_welcome_action_class', "ShipSimuLoginAction");
+$cfg->setConfigEntry('login_welcome_action_class', "BlogLoginAction");
// CFG: LOGIN-LOGOUT-ACTION-CLASS
-$cfg->setConfigEntry('login_logout_action_class', "ShipSimuLogoutAction");
+$cfg->setConfigEntry('login_logout_action_class', "BlogLogoutAction");
// CFG: LOGIN-PROFILE-ACTION-CLASS
-$cfg->setConfigEntry('login_profile_action_class', "ShipSimuProfileAction");
+$cfg->setConfigEntry('login_profile_action_class', "BlogProfileAction");
-// CFG: SHIPSIMU-REGISTER-CAPTCHA
+// CFG: BLOG-REGISTER-CAPTCHA
$cfg->setConfigEntry('blog_register_captcha', "GraphicalCodeCaptcha");
-// CFG: blog-USER-LOGIN-CAPTCHA
+// CFG: BLOG-USER-LOGIN-CAPTCHA
$cfg->setConfigEntry('blog_user_login_captcha', "GraphicalCodeCaptcha");
-// CFG: blog-GUEST-LOGIN-CAPTCHA
+// CFG: BLOG-GUEST-LOGIN-CAPTCHA
$cfg->setConfigEntry('blog_guest_login_captcha', "GraphicalCodeCaptcha");
// CFG: CAPTCHA-STRING-LENGTH
// CFG: RANDOM-STRING-LENGTH
$cfg->setConfigEntry('random_string_length', 100);
-// CFG: blog-REGISTER-CAPTCHA-SECURED
+// CFG: BLOG-REGISTER-CAPTCHA-SECURED
$cfg->setConfigEntry('blog_register_captcha_secured', "Y");
-// CFG: blog-USER-LOGIN-CAPTCHA-SECURED
+// CFG: BLOG-USER-LOGIN-CAPTCHA-SECURED
$cfg->setConfigEntry('blog_user_login_captcha_secured', "Y");
-// CFG: blog-GUEST-LOGIN-CAPTCHA-SECURED
+// CFG: BLOG-GUEST-LOGIN-CAPTCHA-SECURED
$cfg->setConfigEntry('blog_guest_login_captcha_secured', "Y");
// CFG: BLOCK-SHOWS-REGISTRATION
// CFG: CAPTCHA-REFILL-VERFIER-FILTER
$cfg->setConfigEntry('captcha_refill_verifier_filter', "GraphicalCodeCaptchaVerifierFilter");
-// CFG: CONFIRM-CODE-VALIDATOR-FILTER
+// CFG: CONFIRM-CODE-VERIFIER-FILTER
$cfg->setConfigEntry('confirm_code_verifier_filter', "ConfirmCodeVerifierFilter");
// CFG: REFILL-PAGE-FILTER
$cfg->setConfigEntry('refill_page_filter', "RefillPageFilter");
+// CFG: REFILL-REQUEST-CURRENCY-BOOK-FILTER
+$cfg->setConfigEntry('refill_request_currency_book_filter', "RefillRequestCurrencyBookFilter");
+
+// CFG: PAYMENT-DISCOVERY-FILTER
+$cfg->setConfigEntry('payment_discovery_filter', "PaymentDiscoveryFilter");
+
// CFG: NEWS-HOME-LIMIT
$cfg->setConfigEntry('news_home_limit', 10);
// CFG: USER-POINTS-DB-WRAPPER-CLASS
$cfg->setConfigEntry('user_points_db_wrapper_class', "UserPointsDatabaseWrapper");
-// CFG: USER-GOVERMENT-WRAPPER
+// CFG: USER-GOVERMENT-WRAPPER-CLASS
$cfg->setConfigEntry('user_gov_wrapper_class', "UserGovermentDatabaseWrapper");
+// CFG: PAYMENT-DB-WRAPPER-CLASS
+$cfg->setConfigEntry('payment_db_wrapper_class', "PaymentsDatabaseWrapper");
+
// CFG EMAIl-TPL-RESEND-LINK
$cfg->setConfigEntry('email_tpl_resend_link', "text");
-// CFG: MAIL-TEMPLATE-ENGINE
+// CFG: MAIL-TEMPLATE-CLASS
$cfg->setConfigEntry('mail_template_class', "MailTemplateEngine");
-// CFG: IMAGE-TEMPLATE-ENGINE
+// CFG: IMAGE-TEMPLATE-CLASS
$cfg->setConfigEntry('image_template_class', "ImageTemplateEngine");
// CFG: ADMIN-EMAIL
// CFG: REFILL-PAGE-MIN-CURRENCY-AMOUNT
$cfg->setConfigEntry('refill_page_min_currency_amount', 1000);
+// CFG: LOGIN-FILL-PAYMENT-DISCOVERY
+$cfg->setConfigEntry('login_refill_payment_discovery', "LocalPaymentDiscovery");
+
// [EOF]
?>
* @param $requestInstance An instance of a class with an Requestable interface
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
- * @todo Maybe add fetching company list of current user here?
+ * @todo 0% done
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Unfinished method
// Is the refill page active?
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter'));
+
+ // Add payment discovery filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('payment_discovery_filter', array($this)));
}
}
// Is the refill page active?
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter'));
+ // Verify password
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter'));
+
// Verify CAPTCHA code
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter'));
// Verify refill request
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter'));
+
+ // Prepare a filter based on the requested type we shall refill
+ $filterName = sprintf("refill_request_%s_book_filter", $requestInstance->getRequestElement('type'));
+
+ // Now, try to load that filter
+ $controllerInstance->addPostFilter(ObjectFactory::createObjectByConfiguredName($filterName));
}
}
// Now get a search criteria and set the user's name as criteria
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
- $criteriaInstance->addCriteria('gov_uid', $this->getUserInstance()->getUserName());
- $criteriaInstance->addCriteria('gov_activity_status', self::STATUS_STARTER_HELP);
+ $criteriaInstance->addCriteria("gov_uid", $this->getUserInstance()->getUserName());
+ $criteriaInstance->addCriteria("gov_activity_status", self::STATUS_STARTER_HELP);
$criteriaInstance->setLimit(1);
// Get a wrapper instance
$criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry);
// Include registration timestamp
- $criteriaInstance->addCriteria('registered', date("Y-m-d H:i:s", time()));
+ $criteriaInstance->addCriteria("registered", date("Y-m-d H:i:s", time()));
}
}
$updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
// And add our both entries
- $updateInstance->addCriteria('last_activity', date("Y-m-d H:i:s", time()));
- $updateInstance->addCriteria('last_action', $lastAction);
+ $updateInstance->addCriteria("last_activity", date("Y-m-d H:i:s", time()));
+ $updateInstance->addCriteria("last_action", $lastAction);
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Add the user primary key as a search criteria
- $criteriaInstance->addCriteria('participant_id', $userInstance->getPrimaryKey());
+ $criteriaInstance->addCriteria("participant_id", $userInstance->getPrimaryKey());
$criteriaInstance->setLimit(1);
// Set company->user table
// Ask again for current account password
$helper->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Änderungen dein derzeitiges Passwort ein.");
-$helper->addFieldText('pass_old', "Altes Passwort:");
+$helper->addFieldText('pass_old', "Derzeitiges Passwort:");
$helper->addInputPasswordField('pass_old');
// Abschliessender Hinweis und Abschluss des Formulars
// Neue Helper-Instanz holen
$helper = WebFormHelper::createWebFormHelper($this, 'refill_form');
+// Pre-fetch payment types
+$helper->prefetchValueInstance('payments');
+
// Add form group
$helper->addFormGroup('refill_form', "Bitte wähle aus, was du nachbestellen willst und gebe die Menge an.");
$helper->addFormSubGroup('amount', "Gebe hier in ganzen Zahlen die Menge an, die du nachbestellen willst.");
$helper->addInputTextField('amount', 1000);
+// Ask again for current account password
+$helper->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Nachbestellung dein derzeitiges Passwort ein.");
+$helper->addFieldText('pass_old', "Derzeitiges Passwort:");
+$helper->addInputPasswordField('pass_old');
+
// CAPTCHA enbaled?
if ($helper->ifFormSecuredWithCaptcha()) {
$helper->addFormGroup('captcha_refill', "Bitte wiederhole den angezeigten Code:");
} // END - if
// Submit button
-$helper->addFormGroup('buttons_refill', "Mit Absenden des Formulars wird deine Nachbestellung rechtskräftig!");
+$helper->addFormGroup('buttons_refill', "Mit Absenden des Formulars wird deine Nachbestellung verbindlich!");
$helper->addInputResetButton("Eingaben löschen");
$helper->addInputSubmitButton("Nachbestellung verbindlich aufgeben");
$helper->flushContent();
$cfg->setConfigEntry('chat_enabled_msn', "Y");
// CFG: USER-REGISTRATION
-$cfg->setConfigEntry('user_registration_class', "ShipSimuRegistration");
+$cfg->setConfigEntry('user_registration_class', "ShoutBoxRegistration");
// CFG: USER-LOGIN-CLASS
-$cfg->setConfigEntry('user_login_class', "ShipSimuUserLogin");
+$cfg->setConfigEntry('user_login_class', "ShoutBoxUserLogin");
// CFG: GUEST-LOGIN-CLASS
-$cfg->setConfigEntry('guest_login_class', "ShipSimuGuestLogin");
+$cfg->setConfigEntry('guest_login_class', "ShoutBoxGuestLogin");
// CFG: USER-STATUS-REGISTER
$cfg->setConfigEntry('user_status_unconfirmed', "UNCONFIRMED");
$cfg->setConfigEntry('user_status_confirmed', "CONFIRMED");
// CFG: LOGIN-HELPER-CLASS
-$cfg->setConfigEntry('login_helper_class', "ShipSimuLoginHelper");
+$cfg->setConfigEntry('login_helper_class', "ShoutBoxLoginHelper");
// CFG: AUTH-METHOD-CLASS
$cfg->setConfigEntry('auth_method_class', "CookieAuth");
$cfg->setConfigEntry('guest_login_passwd', "guest");
// CFG: LOGIN-WELCOME-ACTION-CLASS
-$cfg->setConfigEntry('login_welcome_action_class', "ShipSimuLoginAction");
+$cfg->setConfigEntry('login_welcome_action_class', "ShoutBoxLoginAction");
// CFG: LOGIN-LOGOUT-ACTION-CLASS
-$cfg->setConfigEntry('login_logout_action_class', "ShipSimuLogoutAction");
+$cfg->setConfigEntry('login_logout_action_class', "ShoutBoxLogoutAction");
// CFG: LOGIN-PROFILE-ACTION-CLASS
-$cfg->setConfigEntry('login_profile_action_class', "ShipSimuProfileAction");
+$cfg->setConfigEntry('login_profile_action_class', "ShoutBoxProfileAction");
-// CFG: SHIPSIMU-REGISTER-CAPTCHA
+// CFG: SHOUTBOX-REGISTER-CAPTCHA
$cfg->setConfigEntry('shoutbox_register_captcha', "GraphicalCodeCaptcha");
-// CFG: shoutbox-USER-LOGIN-CAPTCHA
+// CFG: SHOUTBOX-USER-LOGIN-CAPTCHA
$cfg->setConfigEntry('shoutbox_user_login_captcha', "GraphicalCodeCaptcha");
-// CFG: shoutbox-GUEST-LOGIN-CAPTCHA
+// CFG: SHOUTBOX-GUEST-LOGIN-CAPTCHA
$cfg->setConfigEntry('shoutbox_guest_login_captcha', "GraphicalCodeCaptcha");
// CFG: CAPTCHA-STRING-LENGTH
// CFG: RANDOM-STRING-LENGTH
$cfg->setConfigEntry('random_string_length', 100);
-// CFG: shoutbox-REGISTER-CAPTCHA-SECURED
+// CFG: SHOUTBOX-REGISTER-CAPTCHA-SECURED
$cfg->setConfigEntry('shoutbox_register_captcha_secured', "Y");
-// CFG: shoutbox-USER-LOGIN-CAPTCHA-SECURED
+// CFG: SHOUTBOX-USER-LOGIN-CAPTCHA-SECURED
$cfg->setConfigEntry('shoutbox_user_login_captcha_secured', "Y");
-// CFG: shoutbox-GUEST-LOGIN-CAPTCHA-SECURED
+// CFG: SHOUTBOX-GUEST-LOGIN-CAPTCHA-SECURED
$cfg->setConfigEntry('shoutbox_guest_login_captcha_secured', "Y");
// CFG: BLOCK-SHOWS-REGISTRATION
$cfg->setConfigEntry('chat_enabled_msn', "Y");
// CFG: USER-REGISTRATION
-$cfg->setConfigEntry('user_registration_class', "ShipSimuRegistration");
+$cfg->setConfigEntry('user_registration_class', "ToDoRegistration");
// CFG: USER-LOGIN-CLASS
-$cfg->setConfigEntry('user_login_class', "ShipSimuUserLogin");
+$cfg->setConfigEntry('user_login_class', "ToDoUserLogin");
// CFG: GUEST-LOGIN-CLASS
-$cfg->setConfigEntry('guest_login_class', "ShipSimuGuestLogin");
+$cfg->setConfigEntry('guest_login_class', "ToDoGuestLogin");
// CFG: USER-STATUS-REGISTER
$cfg->setConfigEntry('user_status_unconfirmed', "UNCONFIRMED");
$cfg->setConfigEntry('user_status_confirmed', "CONFIRMED");
// CFG: LOGIN-HELPER-CLASS
-$cfg->setConfigEntry('login_helper_class', "ShipSimuLoginHelper");
+$cfg->setConfigEntry('login_helper_class', "ToDoLoginHelper");
// CFG: AUTH-METHOD-CLASS
$cfg->setConfigEntry('auth_method_class', "CookieAuth");
$cfg->setConfigEntry('guest_login_passwd', "guest");
// CFG: LOGIN-WELCOME-ACTION-CLASS
-$cfg->setConfigEntry('login_welcome_action_class', "ShipSimuLoginAction");
+$cfg->setConfigEntry('login_welcome_action_class', "ToDoLoginAction");
// CFG: LOGIN-LOGOUT-ACTION-CLASS
-$cfg->setConfigEntry('login_logout_action_class', "ShipSimuLogoutAction");
+$cfg->setConfigEntry('login_logout_action_class', "ToDoLogoutAction");
// CFG: LOGIN-PROFILE-ACTION-CLASS
-$cfg->setConfigEntry('login_profile_action_class', "ShipSimuProfileAction");
+$cfg->setConfigEntry('login_profile_action_class', "ToDoProfileAction");
-// CFG: SHIPSIMU-REGISTER-CAPTCHA
+// CFG: TODO-REGISTER-CAPTCHA
$cfg->setConfigEntry('todo_register_captcha', "GraphicalCodeCaptcha");
-// CFG: todo-USER-LOGIN-CAPTCHA
+// CFG: TODO-USER-LOGIN-CAPTCHA
$cfg->setConfigEntry('todo_user_login_captcha', "GraphicalCodeCaptcha");
-// CFG: todo-GUEST-LOGIN-CAPTCHA
+// CFG: TODO-GUEST-LOGIN-CAPTCHA
$cfg->setConfigEntry('todo_guest_login_captcha', "GraphicalCodeCaptcha");
// CFG: CAPTCHA-STRING-LENGTH
// CFG: RANDOM-STRING-LENGTH
$cfg->setConfigEntry('random_string_length', 100);
-// CFG: todo-REGISTER-CAPTCHA-SECURED
+// CFG: TODO-REGISTER-CAPTCHA-SECURED
$cfg->setConfigEntry('todo_register_captcha_secured', "Y");
-// CFG: todo-USER-LOGIN-CAPTCHA-SECURED
+// CFG: TODO-USER-LOGIN-CAPTCHA-SECURED
$cfg->setConfigEntry('todo_user_login_captcha_secured', "Y");
-// CFG: todo-GUEST-LOGIN-CAPTCHA-SECURED
+// CFG: TODO-GUEST-LOGIN-CAPTCHA-SECURED
$cfg->setConfigEntry('todo_guest_login_captcha_secured', "Y");
// CFG: BLOCK-SHOWS-REGISTRATION
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for discovery
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Discoverable extends FrameworkInterface {
+ /**
+ * Discovers the request
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ function discover (Requestable $requestInstance);
+}
+
+//
+?>
*/
public function debugBackTrace () {
// Sorry, there is no other way getting this nice backtrace
- print "<pre>\n";
+ print("<pre>\n");
debug_print_backtrace();
- print "</pre>";
+ print("</pre>");
exit;
}
*/
class BaseController extends BaseFrameworkSystem implements Registerable {
/**
- * Pre filter chain instance
+ * Generic filter chains
*/
- private $preFilterChain = null;
-
- /**
- * Post filter chain instance
- */
- private $postFilterChain = null;
+ private $filterChains = array();
/**
* Protected constructor
$this->removeSystemArray();
// Initialize both filter chains
- $this->preFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
- $this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
+ $this->initFilterChain('pre');
+ $this->initFilterChain('post');
// Add this controller to the registry
Registry::getRegistry()->addInstance('controller', $this);
}
+ /**
+ * Private method to initialize a given filter chain
+ *
+ * @param $filterChain Name of the filter chain
+ * @return void
+ */
+ private function initFilterChain ($filterChain) {
+ $this->filterChains[$filterChain] = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
+ }
+
/**
* Adds a filter to the pre filter chain
*
*/
public function addPreFilter (Filterable $filterInstance) {
// Add the pre filter
- $this->preFilterChain->addFilter($filterInstance);
+ $this->filterChains['pre']->addFilter($filterInstance);
}
/**
*/
public function addPostFilter (Filterable $filterInstance) {
// Add the post filter
- $this->postFilterChain->addFilter($filterInstance);
+ $this->filterChains['post']->addFilter($filterInstance);
}
/**
*/
protected function executePreFilters (Requestable $requestInstance, Responseable $responseInstance) {
// Execute all pre filters
- $this->preFilterChain->processFilters($requestInstance, $responseInstance);
+ $this->filterChains['pre']->processFilters($requestInstance, $responseInstance);
}
/**
*/
protected function executePostFilters (Requestable $requestInstance, Responseable $responseInstance) {
// Execute all post filters
- $this->postFilterChain->processFilters($requestInstance, $responseInstance);
+ $this->filterChains['post']->processFilters($requestInstance, $responseInstance);
}
}
--- /dev/null
+<?php
+/**
+ * A database wrapper for payments
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PaymentsDatabaseWrapper extends BaseDatabaseWrapper {
+ // Constants for exceptions
+ const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
+
+ // Constants for database table names
+ const DB_TABLE_PAYMENTS = "payments";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct() {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database wrapper by a provided user class
+ *
+ * @return $wrapperInstance An instance of the created wrapper class
+ */
+ public final static function createPaymentsDatabaseWrapper () {
+ // Get a new instance
+ $wrapperInstance = new PaymentsDatabaseWrapper();
+
+ // Set (primary!) table name
+ $wrapperInstance->setTableName(self::DB_TABLE_PAYMENTS);
+
+ // Return the instance
+ return $wrapperInstance;
+ }
+}
+
+// [EOF]
+?>
* @return void
*/
public final function outputStream ($output) {
- print(html_entity_decode(strip_tags($output)));
+ print(html_entity_decode(strip_tags(stripslashes($output))));
}
/**
public final function outputStream ($output) {
// Strip out <br />
$output = str_replace("<br />", "", $output);
- print($output."<br />\n");
+ print(stripslashes($output)."<br />\n");
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A local payment discovery class. This class looks in local database for
+ * registered payment types and like all the others it at least returns the
+ * money bank transfer type.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ???Discovery extends BaseDiscovery implements Discoverable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Create an instance of this class
+ *
+ * @return $discoveryInstance An instance of this discovery class
+ */
+ public final static function create???Discovery () {
+ // Get an instance of this class
+ $discoveryInstance = new ???Discovery();
+
+ // Return the prepared instance
+ return $discoveryInstance;
+ }
+
+ /**
+ * Discovers the request
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function discover (Requestable $requestInstance) {
+ $this->partialStub("Please implement this method.");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general discovery class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseDiscovery extends BaseFrameworkSystem {
+ /**
+ * Action name for payment discovery
+ */
+ private $actionName = "";
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Protected setter for action name
+ *
+ * @param $actionName Action name to set
+ * @return void
+ */
+ protected final function setActionName ($actionName) {
+ $this->actionName = (string) $actionName;
+ }
+
+ /**
+ * Private getter for action name
+ *
+ * @return $actionName Action name to set
+ */
+ protected final function getActionName () {
+ return $this->actionName;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A local payment discovery class. This class looks in local database for
+ * registered payment types and like all the others it at least returns the
+ * money bank transfer type.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Create an instance of this class
+ *
+ * @param $filterInstance An instance of a filter
+ * @return $discoveryInstance An instance of this discovery class
+ */
+ public final static function createLocalPaymentDiscovery (Filterable $filterInstance) {
+ // Get an instance of this class
+ $discoveryInstance = new LocalPaymentDiscovery();
+
+ // Set the action from filter
+ $discoveryInstance->setActionName($filterInstance->getActionName());
+
+ // Return the prepared instance
+ return $discoveryInstance;
+ }
+
+ /**
+ * Discovers the request
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function discover (Requestable $requestInstance) {
+ // Now get a search criteria and set app name and payment action as search critera
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+ $criteriaInstance->addCriteria("app_name", $requestInstance->getRequestElement('app'));
+ $criteriaInstance->addCriteria("payment_action", $this->getActionName().'_action');
+ $criteriaInstance->setLimit(1);
+
+ // Get a wrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('payment_db_wrapper_class');
+
+ // Get result back
+ $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Set the result instance
+ $this->setResultInstance($resultInstance);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for payment discovery. This class discovers the payment type and
+ * returns an object holding all available payment system for the requested
+ * type.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PaymentDiscoveryFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Action name for payment discovery
+ */
+ private $actionName = "";
+
+ /**
+ * Instance of a discovery class
+ */
+ private $discoveryInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @param $actionInstance A performable action
+ * @return $filterInstance An instance of this filter class
+ * @throws NullPointerException If the resolver is not set
+ */
+ public final static function createPaymentDiscoveryFilter (PerformableAction $actionInstance) {
+ // Get a new instance
+ $filterInstance = new PaymentDiscoveryFilter();
+
+ // Get resolver from action
+ $resolverInstance = $actionInstance->getResolverInstance();
+
+ // Is the resolver set?
+ if (is_null($resolverInstance)) {
+ // Throw an exception here
+ throw new NullPointerException($filterInstance, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Get the action name from resolver
+ $actionName = $resolverInstance->getActionName();
+
+ // Store it away in this class
+ $filterInstance->setActionName($actionName);
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Protected setter for action name
+ *
+ * @param $actionName Action name to set
+ * @return void
+ */
+ protected final function setActionName ($actionName) {
+ $this->actionName = (string) $actionName;
+ }
+
+ /**
+ * Getter for action name
+ *
+ * @return $actionName Action name to set
+ */
+ public final function getActionName () {
+ return $this->actionName;
+ }
+
+ /**
+ * Protected setter for discovery instance
+ *
+ * @param $discoveryInstance A discovery instance
+ * @return void
+ */
+ protected final function setDiscoveryInstance (Discoverable $discoveryInstance) {
+ $this->discoveryInstance = $discoveryInstance;
+ }
+
+ /**
+ * Protected getter for discovery instance
+ *
+ * @return $discoveryInstance A discovery instance
+ */
+ public final function getDiscoveryInstance () {
+ return $this->discoveryInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Try to get real discovery class
+ try {
+ // Get an instance from the object factory
+ $discoveryInstance = ObjectFactory::createObjectByConfiguredName($this->getActionName().'_payment_discovery', array($this));
+
+ // Call the discovery method
+ $discoveryInstance->discover($requestInstance);
+
+ // Remember this instance if all wents fine
+ $this->setDiscoveryInstance($discoveryInstance);
+ } catch (FrameworkException $e) {
+ // Something bad happend
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('payment_error');
+ $responseInstance->addFatalMessagePlain($e->getMessage());
+
+ // Abort here
+ return false;
+ }
+ }
+}
+
+// [EOF]
+?>
} // END - if
// Render the content
- $content = sprintf("<option value=\"%s\" class=\"suboption suboption_%s\" disabled=\"disabled\">%s</option>\n",
- $subName,
+ $content = sprintf("<option value=\"invalid\" class=\"suboption suboption_%s\" disabled=\"disabled\">%s</option>\n",
$subName,
$subValue
);
}
} else {
// Output it to the console
- printf("%s\n", trim(html_entity_decode(strip_tags($outStream))));
+ printf("%s\n", trim(html_entity_decode(strip_tags(stripslashes($outStream)))));
}
}
* @return void
*/
public final function output ($outStream=false) {
- print($outStream);
+ print(stripslashes($outStream));
}
}
// Now get a search criteria and set the user's name as criteria
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
- $criteriaInstance->addCriteria('points_uid', $this->getUserInstance()->getUserName());
+ $criteriaInstance->addCriteria("points_uid", $this->getUserInstance()->getUserName());
$criteriaInstance->setLimit(1);
// Get result back
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Add the page as criteria to it at lease
- $criteriaInstance->addCriteria('page', $page);
+ $criteriaInstance->addCriteria("page", $page);
// Add limitation from config
$criteriaInstance->setLimit($this->getConfigInstance()->readConfig("news_{$page}_limit"));
*
* @return $actionName Last validated action name
*/
- protected final function getActionName () {
+ public final function getActionName () {
return $this->actionName;
}
$this->fatalMessages[] = $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId);
}
+ /**
+ * Adds a plain fatal message id to the response
+ *
+ * @param $message The plain message we shall add
+ * @return void
+ */
+ public final function addFatalMessagePlain ($message) {
+ // Adds the resolved message id to the fatal message list
+ $this->fatalMessages[] = $message;
+ }
+
/**
* Flushs the cached HTTP response to the outer world
*
$updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
// And add our both entries
- $updateInstance->addCriteria('last_activity', date("Y-m-d H:i:s", time()));
- $updateInstance->addCriteria('last_action', $lastAction);
+ $updateInstance->addCriteria("last_activity", date("Y-m-d H:i:s", time()));
+ $updateInstance->addCriteria("last_action", $lastAction);
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);