application/ship-simu/interfaces/class_TradeableItem.php -text
application/ship-simu/loader.php -text
application/ship-simu/main/.htaccess -text
+application/ship-simu/main/actions/.htaccess -text
+application/ship-simu/main/actions/class_ShipSimuLoginAction.php -text
application/ship-simu/main/class_ -text
application/ship-simu/main/class_BasePersonell.php -text
application/ship-simu/main/class_BaseSimulator.php -text
application/ship-simu/templates/de/code/home.ctp -text
application/ship-simu/templates/de/code/login_failed.ctp -text
application/ship-simu/templates/de/code/login_form.ctp -text
+application/ship-simu/templates/de/code/login_welcome.ctp -text
application/ship-simu/templates/de/code/register_form.ctp -text
application/ship-simu/templates/de/code/shipsimu_main.ctp -text
application/ship-simu/templates/de/html/.htaccess -text
application/ship-simu/templates/de/html/nav_advert.tpl -text
application/ship-simu/templates/de/html/selector_ship-simu.tpl -text
db/.htaccess -text
+db/news/.htaccess -text
db/user/.htaccess -text
devel/.htaccess -text
devel/class_Debug.php -text
* An instance of this class
*/
private static $thisInstance = null;
+
/**
* Protected constructor
*
// CFG: GUEST-LOGIN-PASSWORD
$cfg->setConfigEntry('guest_login_password', "guest");
+// CFG: LOGIN-WELCOME-ACTION-CLASS
+$cfg->setConfigEntry('login_welcome_action_class', "ShipSimuLoginAction");
+
// [EOF]
?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An action class for the login welcome page
+ *
+ * @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 ShipSimuLoginAction extends BaseAction implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set description
+ $this->setObjectDescription("Login welcome action");
+
+ // Generate unique key
+ $this->generateUniqueId();
+ }
+
+ /**
+ * Creates an instance of this action
+ *
+ * @return $actionInstance An instance of this action class
+ */
+ public final static function createShipSimuLoginAction () {
+ // Get a new instance
+ $actionInstance = new ShipSimuLoginAction();
+
+ // Return the instance
+ return $actionInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ /* @TODO Maybe we need to do something later here */
+ }
+}
+
+// [EOF]
+?>
// Get the controller instance from the resolver (breaks MVC pattern again)
$controllerInstance = $resolverInstance->getControllerInstance();
- // @TODO Add some more pre/post filters to the controller
+ /* @TODO Add some more pre/post filters to the controller */
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_class'));
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_class'));
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_class'));
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_class'));
break;
}
- // @TODO Add more filters
+
+ /* @TODO Add more filters */
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_class'));
// Return the prepared instance
__CLASS__,
__LINE__
));
- }
+ } // END - if
// Set ship's name
$passInstance->setShipName($shipName);
if (is_null($struct)) {
// Empty structures list!
throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY);
- }
+ } // END - if
// Anzahl Betten auf 0 setzen
$numBeds = 0;
$el->getObjectDescription()
));
}
- }
+ } // END - for
if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%d</strong> Betten.<br />\n",
__CLASS__,
/**
* Reduces the volume of a processed object.
*
- * @param $limitInstance An instance to ObjectLimits which holds
- * attribute names that we want to include in the processing
- * phase. Other attributes except $uniqueID and $realClass will
- * be ignored and keept out.
+ * @param $limitInstance An instance to ObjectLimits which holds
+ * attribute names that we want to include in the processing phase.
+ * Other attributes except $uniqueID and $realClass will be ignored
+ * and keept out.
* @return void
*/
function limitObject (ObjectLimits $limitInstance) {
--- /dev/null
+<div id="content_header">
+ Willkommen im Loginbereich von {?app_full_name?}
+</div>
+
+<div id="news_frame">
+ {?ship_simu_login_news?}
+</div>
--- /dev/null
+Deny from all
/**
* Flushs the cached HTTP response to the outer world
*
- * @param $foce Wether we shall force the output or abort if headers are
+ * @param $force Wether we shall force the output or abort if headers are
* already sent with an exception
* @return void
* @throws ResponseHeadersAlreadySentException Thrown if headers are
// Set the application instance
$commandInstance->setResolverInstance($resolverInstance);
+ // Load general data like user status and such
+ $commandInstance->prepareCommand();
+
// Return the prepared instance
return $commandInstance;
}
+ /**
+ * Prepares some general data which shall be displayed on every page
+ *
+ * @return void
+ */
+ protected function prepareCommand () {
+ /* @TODO Add some stuff here: Some personal data, app/game related data */
+ }
+
/**
* Executes the given command with given request and response objects
*
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Default action is the one from configuration
+ $actionClass = sprintf("login_%s_action_class", $this->getConfigInstance()->readConfig('login_default_action'));
$action = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
+ // Get "action" from request
+ $actReq = $requestInstance->getRequestElement('action');
+
+ // Do we have a "action" parameter set?
+ if (is_string($actReq)) {
+ // Then use it with prefix
+ $actionClass = sprintf("login_%s_action_class", $actReq);
+ $action = sprintf("login_%s", $actReq);
+ } // END - if
+
+ // Get an action instance
+ $actionInstance = ObjectFactory::createObjectByConfiguredName($actionClass);
+
+ // Execute the action (shall not output anything, see below why)
+ $actionInstance->execute($requestInstance, $responseInstance);
+
// Get the application instance
$appInstance = $this->getResolverInstance()->getApplicationInstance();
// Prepare a template instance
$templateInstance = $this->prepareTemplateEngine($appInstance);
+ // Assign all the application's data with template variables
+ $templateInstance->assignApplicationData($appInstance);
+
// Load the master template
$masterTemplate = $appInstance->getMasterTemplate();
$templateInstance->compileTemplate();
$templateInstance->assignTemplateWithVariable("footer", "footer");
- // Get "action" from request
- $actReq = $requestInstance->getRequestElement("action");
-
- // Do we have a "action" parameter set?
- if (is_string($actReq)) {
- // Then use it with prefix
- $action = sprintf("login_%s", $actReq);
- } // END - if
-
- // @TODO Do the action somewhere here
-
// Load the matching template
$templateInstance->loadCodeTemplate($action);
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_{$action}_title'));
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage("login_{$action}_title"));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
// Set the command resolver
$controllerInstance->setResolverInstance($resolverInstance);
- // @TODO Add some filters to this controller
+ /* @TODO Add some filters to this controller */
// Return the prepared instance
return $controllerInstance;
* @return void
*/
public function connectToDatabase () {
- // @TODO Do some checks on the database directory and files here
+ /* @TODO Do some checks on the database directory and files here */
}
/**
* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- $this->partialStub("Unfinished work.");
+ /* @TODO Unfinished stub, add functionality here */
}
}
$this->addFormGroup("", "");
}
- // @TODO Add some unique PIN here to bypass problems with some browser and/or extensions
+ /* @TODO Add some unique PIN here to bypass problems with some browser and/or extensions */
// Simply close it
$this->formOpened = false;
}
/**
* Flushs the cached HTTP response to the outer world
*
- * @param $foce Wether we shall force the output or abort if headers are
+ * @param $force Wether we shall force the output or abort if headers are
* already sent with an exception
* @return void
* @throws ResponseHeadersAlreadySentException Thrown if headers are
// Shall we encrypt the cookie?
if ($encrypted === true) {
- // @TODO Encryption of cookie data not yet supported
+ /* @TODO Encryption of cookie data not yet supported */
} // END - if
// For slow browsers set the cookie array element first
$domain = $this->getConfigInstance()->readConfig('cookie_domain');
setcookie($cookieName, $cookieValue, $expires);
- // @TODO Why are these parameters conflicting?
+ /* @TODO Why are these parameters conflicting? */
//, $path, $domain, (isset($_SERVER['HTTPS']))
return;
- // @TODO This will send only one cookie out, the first one.
+ /* @TODO This will send only one cookie out, the first one. */
// Now construct the full header
$cookieString = $cookieName . "=" . $cookieValue . "; ";
$cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
- // @TODO Why are these parameters conflicting?
+ /* @TODO Why are these parameters conflicting? */
// $cookieString .= "; path=".$path."; domain=".$domain;
// Set the cookie as a header
}
// One-way data we need for "extra-salting" the random number
- // @TODO Add site key for stronger salt!
+ /* @TODO Add site key for stronger salt! */
$this->extraSalt = sha1($serverIp . ":" . getenv('SERVER_SOFTWARE') . ":" . $this->getConfigInstance()->readConfig('date_key') . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
// Get config entry for max salt length
* @return $num Pseudo-random number
*/
public function randomNumnber ($min, $max) {
- // @TODO I had a better random number generator here
+ /* @TODO I had a better random number generator here */
return mt_rand($min, $max);
}
$this->assignVariable($var, $varMatches[3][$key]);
} elseif (!empty($varMatches[2][$key])) {
// Non-string found so we need some deeper analysis...
- // @TODO Unfinished work or don't die here.
+ /* @TODO Unfinished work or don't die here. */
die("Deeper analysis not yet implemented!");
}
);
// This loop does remove the backslashes (\) in PHP parameters
- // @TODO Make this some nicer...
+ /* @TODO Make this some nicer... */
while (strpos($eval, "<?") !== false) {
// Get left part before "<?"
$evalLeft = substr($eval, 0, strpos($eval, "<?"));
// If the basePath is false it is invalid
if ($basePath2 === false) {
- // @TODO: Do not die here.
+ /* @TODO: Do not die here. */
die("Cannot read {$basePath} !");
} else {
// Set base path