application/ship-simu/templates/de/code/login_logout.ctp -text
application/ship-simu/templates/de/code/login_main.ctp -text
application/ship-simu/templates/de/code/login_profile.ctp -text
+application/ship-simu/templates/de/code/login_status_problem.ctp -text
application/ship-simu/templates/de/code/login_welcome.ctp -text
application/ship-simu/templates/de/code/logout_done.ctp -text
application/ship-simu/templates/de/code/register_form.ctp -text
$cfg->setConfigEntry('logout_done_url', "index.php?app=ship-simu&page=logout_done");
// CFG: LOGIN-USER-STATUS-URL
-$cfg->setConfigEntry('login_user_status_url', "index.php?app=ship-simu&page=login_area&action=login_status_problem");
+$cfg->setConfigEntry('login_user_status_url', "index.php?app=ship-simu&page=login_area&action=status_problem");
// CFG: LOGIN-DEFAULT-ACTION
$cfg->setConfigEntry('login_default_action', "welcome");
}
// Formular schliessen
-$helper->addFormTag();
$helper->flushContent();
// Ist Gastlogin erlaubt?
$helper->addInputHiddenField("pass", $this->getConfigInstance()->readConfig('guest_login_password'));
$helper->addFormGroup("buttons", "Gastlogins sind in der Funkionsweise eingeschränkt. Mehr dazu unter "Gastlogin".");
$helper->addInputSubmitButton("Als Gast einloggen");
- $helper->addFormTag();
$helper->flushContent();
}
$helper->addInputResetButton("Alles nochmal eingeben");
$helper->addInputSubmitButton("Accountdaten aktualisieren");
$helper->addFormNote("Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
-$helper->addFormTag();
$helper->flushContent();
?>
<div id="content_header">
- Ihre Profildaten bearbeiten
+ Deine Profildaten bearbeiten
</div>
<div id="profile_box">
--- /dev/null
+<?php
+// Get helper instance for web forms. This will add the opening form-tag to
+// the helper's render cache which is simply a small variable in the class
+// BaseHelper.
+$helper = WebFormHelper::createWebFormHelper($this, "resend_link");
+
+// Pre-fetch field data with a given registry key
+$helper->prefetchFieldValues('user');
+
+// Add submit button or notice
+if ($helper->ifUserAccountUnconfirmed()) {
+ $helper->addInputSubmitButton("Bestätigungslink erneut aussenden");
+} elseif ($helper->ifUserAccountLocked()) {
+ $helper->addFormNote("Dein Account wurde gesperrt! Grund der Sperre:
+ <span id=\"lock_reason\">".$helper->getField('lock_reason')."</span>
+ Bitte melde dich beim Support, damit dieser dir weiterhelfen kann."
+ );
+} elseif ($helper->ifUserAccountGuest()) {
+ $helper->addFormNote("Gästeaccounts sind in der Funktionalität
+ leicht eingeschränkt. Bitte melde dich an, damit du ein
+ vollwertiges Account bekommst."
+ );
+}
+
+// Flush content and automatically close the form
+$helper->flushContent();
+
+if ($helper->ifUserAccountUnconfirmed()) {
+ // Build the form for confirmation
+ $helper = WebFormHelper::createWebFormHelper($this, "confirm_code");
+
+ // Add code box
+ $helper->addFormGroup("code", "Bitte gebe hier den Bestätigungscode aus der Willkommensemail ein. Solltest du diese nicht erhalten haben, kannst du dir diesen jetzt zusenden lassen.");
+ $helper->addFieldText("code", "Bestätigungscode aus der Mail:");
+ $helper->addInputTextField("code");
+
+ // Add submit button
+ $helper->addFormGroup("submit", "Bitte einmal abschicken und das Ergebnis abwarten!");
+ $helper->addInputResetButton("Nochmal eingeben");
+ $helper->addInputSubmitButton("Bestätigungscode zusenden");
+
+ // Flush content and automatically close the form
+ $helper->flushContent();
+} // END - if
+?>
+<div id="content_header">
+ Problem mit deinem Account gefunden:
+</div>
+
+<div id="status_box">
+ Du bist möglicherweise für deine ausgewählte Aktion nicht
+ berechtigt oder du hast noch deine Email-Adresse nicht bestätigt. Du
+ kannst dir nun den Bestätigungslink erneut aussenden lassen, oder den
+ Bestätigungscode unten eingeben.
+
+ <div id="resend_link_box">
+ {?resend_link?}
+ </div>
+
+ <div id="confirm_code_box">
+ {?confirm_code?}
+ </div>
+</div>
$helper->addInputResetButton("Alles nochmal eingeben");
$helper->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
$helper->addFormNote("Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
-$helper->addFormTag();
$helper->flushContent();
?>
<div id="content_header">
* @return void
*/
private final function saveBackTrace () {
+ // Get full backtrace
$this->backTrace = debug_backtrace();
+
+ // Remove this call
+ $dummy = array_shift($this->backTrace);
+
+ // resort the array
+ ksort($this->backTrace);
}
/**
*/
private static $langInstance = null;
+ /**
+ * Debug instance
+ */
+ private static $debugInstance = null;
+
/**
* Instance of a request class
*/
}
}
+ /**
+ * Setter for search instance
+ *
+ * @param $searchInstance Searchable criteria instance
+ * @return void
+ */
+ public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
+ $this->searchInstance = $searchInstance;
+ }
+
+ /**
+ * Getter for search instance
+ *
+ * @return $searchInstance Searchable criteria instance
+ */
+ public final function getSearchInstance () {
+ return $this->searchInstance;
+ }
+
+ /**
+ * Setter for resolver instance
+ *
+ * @param $resolverInstance Instance of a command resolver class
+ * @return void
+ */
+ public final function setResolverInstance (Resolver $resolverInstance) {
+ $this->resolverInstance = $resolverInstance;
+ }
+
+ /**
+ * Getter for resolver instance
+ *
+ * @return $resolverInstance Instance of a command resolver class
+ */
+ public final function getResolverInstance () {
+ return $this->resolverInstance;
+ }
+
/**
* Setter for language instance
*
/**
* Getter for configuration instance
*
- * @return $cfhInstance - Configuration instance
+ * @return $cfgInstance Configuration instance
*/
protected final function getConfigInstance () {
- return Registry::getRegistry()->getInstance('config');
+ $cfgInstance = Registry::getRegistry()->getInstance('config');
+ return $cfgInstance;
}
/**
* Setter for debug instance
*
- * @param $debugInstance The instance for debug output class
+ * @param $debugInstance The instance for debug output class
* @return void
*/
public final function setDebugInstance (DebugMiddleware $debugInstance) {
- Registry::getRegistry()->addInstance('debug', $debugInstance);
+ self::$debugInstance = $debugInstance;
}
/**
* Getter for debug instance
*
- * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput
+ * @return $debugInstance Instance to class DebugConsoleOutput or DebugWebOutput
*/
public final function getDebugInstance () {
- return Registry::getRegistry()->getInstance('debug');
+ return self::$debugInstance;
}
/**
}
}
- /**
- * Converts e.g. a command from URL to a valid class by keeping out bad characters
- *
- * @param $str The string, what ever it is needs to be converted
- * @return $className Generated class name
- */
- public function convertToClassName ($str) {
- // Init class name
- $className = "";
-
- // Convert all dashes in underscores
- $str = str_replace("-", "_", $str);
-
- // Now use that underscores to get classname parts for hungarian style
- foreach (explode("_", $str) as $strPart) {
- // Make the class name part lower case and first upper case
- $className .= ucfirst(strtolower($strPart));
- } // END - foreach
-
- // Return class name
- return $className;
- }
-
/**
* Outputs a debug backtrace and stops further script execution
*
}
/**
- * Setter for search instance
+ * Outputs a debug message wether to debug instance (should be set!) or dies with or pints the message
*
- * @param $searchInstance Searchable criteria instance
+ * @param $message Message we shall send out...
+ * @param $doPrint Wether we shall print or die here which last is the default
* @return void
*/
- public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
- $this->searchInstance = $searchInstance;
- }
+ public function debugOutput ($message, $doPrint = false) {
+ // Get debug instance
+ $debugInstance = $this->getDebugInstance();
- /**
- * Getter for search instance
- *
- * @return $searchInstance Searchable criteria instance
- */
- public final function getSearchInstance () {
- return $this->searchInstance;
+ // Is the debug instance there?
+ if (is_object($debugInstance)) {
+ // Use debug output handler
+ $debugInstance->output($message);
+ if (!$doPrint) die(); // Die here if not printed
+ } else {
+ // Put directly out
+ // DO NOT REWRITE THIS TO app_die() !!!
+ if ($doPrint) {
+ print($message);
+ } else {
+ die($message);
+ }
+ }
}
/**
- * Setter for resolver instance
+ * Converts e.g. a command from URL to a valid class by keeping out bad characters
*
- * @param $resolverInstance Instance of a command resolver class
- * @return void
+ * @param $str The string, what ever it is needs to be converted
+ * @return $className Generated class name
*/
- public final function setResolverInstance (Resolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
+ public function convertToClassName ($str) {
+ // Init class name
+ $className = "";
+
+ // Convert all dashes in underscores
+ $str = str_replace("-", "_", $str);
+
+ // Now use that underscores to get classname parts for hungarian style
+ foreach (explode("_", $str) as $strPart) {
+ // Make the class name part lower case and first upper case
+ $className .= ucfirst(strtolower($strPart));
+ } // END - foreach
+
+ // Return class name
+ return $className;
}
/**
- * Getter for resolver instance
+ * Marks up the code by adding e.g. line numbers
*
- * @return $resolverInstance Instance of a command resolver class
- */
- public final function getResolverInstance () {
- return $this->resolverInstance;
+ * @param $phpCode Unmarked PHP code
+ * @return $markedCode Marked PHP code
+ */
+ public function markupCode ($phpCode) {
+ // Get last error
+ $errorArray = error_get_last();
+
+ // Init the code with error message
+ $markedCode = "";
+ if (is_array($errorArray)) {
+ // Get error infos
+ $markedCode = sprintf("<div id=\"error_header\">File: <span id=\"error_data\">%s</span>, Line: <span id=\"error_data\">%s</span>, Message: <span id=\"error_data\">%s</span>, Type: <span id=\"error_data\">%s</span></div>",
+ basename($errorArray['file']),
+ $errorArray['line'],
+ $errorArray['message'],
+ $errorArray['type']
+ );
+ } // END - if
+
+ // Add line number to the code
+ foreach (explode("\n", $phpCode) as $lineNo=>$code) {
+ // Add line numbers
+ $markedCode .= sprintf("<span id=\"code_line\">%s</span>: %s\n",
+ ($lineNo+1),
+ htmlentities($code, ENT_QUOTES)
+ );
+ } // END - foreach
+
+ // Return the code
+ return $markedCode;
}
}
* @return void
*/
public final function outputStream ($output) {
- trigger_error($output);
+ print($output);
}
/**
} // END - if
// Generate the content
- $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s\" name=\"%s\" value=\"%s\" />",
+ $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s_field\" name=\"%s\" value=\"%s\" />",
$fieldName,
$fieldName,
$fieldValue
} // END - if
// Generate the content
- $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s\" name=\"%s\" value=\"%s\" />",
+ $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s_field\" name=\"%s\" value=\"%s\" />",
$fieldName,
$fieldName,
$fieldValue
if ($fieldChecked === false) $checked = " ";
// Generate the content
- $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox\" id=\"%s\" value=\"1\"%s/>",
+ $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox\" id=\"%s_field\" value=\"1\"%s/>",
$fieldName,
$fieldName,
$checked
return $emailChange;
}
+ /**
+ * Checks wether the user account is unconfirmed
+ *
+ * @return $isUnconfirmed Wether the user account is unconfirmed
+ */
+ public function ifUserAccountUnconfirmed () {
+ $isUnconfirmed = ($this->getField('user_status') === $this->getConfigInstance()->readConfig('user_status_unconfirmed'));
+ return $isUnconfirmed;
+ }
+
+ /**
+ * Checks wether the user account is locked
+ *
+ * @return $isUnconfirmed Wether the user account is locked
+ */
+ public function ifUserAccountLocked () {
+ $isUnconfirmed = ($this->getField('user_status') === $this->getConfigInstance()->readConfig('user_status_locked'));
+ return $isUnconfirmed;
+ }
+
+ /**
+ * Checks wether the user account is a guest
+ *
+ * @return $isUnconfirmed Wether the user account is a guest
+ */
+ public function ifUserAccountGuest () {
+ $isUnconfirmed = ($this->getField('user_status') === $this->getConfigInstance()->readConfig('user_status_guest'));
+ return $isUnconfirmed;
+ }
+
/**
* Flushs the content out (not yet secured against open forms, etc.!) or
- * throw an exception if it is not yet closed
+ * close the form automatically
*
* @return void
* @throws FormOpenedException If the form is still open
public function flushContent () {
// Is the form still open?
if ($this->formOpened === true) {
- // Throw an exception
- throw new FormOpenedException ($this, self::EXCEPTION_OPENED_FORM);
+ // Close the form automatically
+ $this->addFormTag();
} // END - if
// Send content to template engine
$eval = str_replace(
"<%php", "\";",
str_replace(
- "%>", "\$result .= \"", $eval
+ "%>", "\n\$result .= \"", $eval
)
);
// Did something change?
if (strlen($eval) != $eval) {
// Run the constructed command. This will "compile" all variables in
- eval($eval);
+ @eval($eval);
+ } // END - if
+
+ // Goes something wrong?
+ if (!isset($result)) {
+ // Output eval command
+ $this->debugOutput(sprintf("Failed eval() code: <pre>%s</pre>", $this->markupCode($eval, true)), true);
+
+ // Output backtrace here
+ $this->debugBacktrace();
} // END - if
// Set raw template data
$this->getTemplateType()
);
- if ((is_object($this->getDebugInstance())) && (method_exists($this->getDebugInstance(), 'output'))) {
- // Use debug output handler
- $this->getDebugInstance()->output($msg);
- die();
- } else {
- // Put directly out
- // DO NOT REWRITE THIS TO app_die() !!!
- die($msg);
- }
+ // Write the problem to the world...
+ $this->debugOutput($msg);
break;
}
}
} elseif (!is_object($this->outputInstance)) {
// The debug output instance is not an object
throw new NoObjectException($this->ouputInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($this->outputInstance, 'outputStream')) {
+ } elseif (!$this->outputInstance instanceof Debugger) {
// The required method outputStream() is missing
throw new MissingMethodException(array($this->outputInstance, 'outputStream'), self::EXCEPTION_MISSING_METHOD);
}
if (empty($outStream)) {
// Initialization phase
return;
- }
+ } // END - if
// Use the output instance
$this->outputInstance->outputStream($outStream);