application/ship-simu/templates/de/code/login_form.ctp -text
application/ship-simu/templates/de/code/login_main.ctp -text
application/ship-simu/templates/de/code/logout_done.ctp -text
+application/ship-simu/templates/de/code/mail_debug.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/emails/.htaccess -text
inc/classes/main/template/class_BaseTemplateEngine.php -text
inc/classes/main/template/image/.htaccess -text
inc/classes/main/template/image/class_ImageTemplateEngine.php -text
+inc/classes/main/template/mail/.htaccess -text
+inc/classes/main/template/mail/class_MailTemplateEngine.php -text
inc/classes/main/template/web/.htaccess -text
inc/classes/main/template/web/class_WebTemplateEngine.php -text
inc/classes/main/user/.htaccess -text
// CFG EMAIl-TPL-RESEND-LINK
$cfg->setConfigEntry('email_tpl_resend_link', "text");
+// CFG: MAIL-TEMPLATE-ENGINE
+$cfg->setConfigEntry('mail_template_class', "MailTemplateEngine");
+
+// CFG: IMAGE-TEMPLATE-ENGINE
+$cfg->setConfigEntry('image_template_class', "ImageTemplateEngine");
+
+// CFG: ADMIN-EMAIL
+$cfg->setConfigEntry('admin_email', "you@some-hoster.invalid");
+
// [EOF]
?>
$this->currShip = $shipInstance;
$this->currPart = $partInstance;
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Maschinenraum mit Motor <strong>%s</strong> wird fuer das Schiff <strong>%s</strong> konstruiert.",
+ if (defined('DEBUG_CORE')) $this->debugOutput(sprintf("[%s:] Maschinenraum mit Motor <strong>%s</strong> wird fuer das Schiff <strong>%s</strong> konstruiert.",
$this->__toString(),
$this->getCurrPart()->getObjectDescription(),
$this->currShip->getShipName()
// Passt ueberhaupt das Schiffsteil in's Schiff?
if ($this->isShipPartSizeValid()) {
// Berechnungen fuer umliegendes Objekt anpassen
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil <strong>%s</strong> vom Typ <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.",
+ if (defined('DEBUG_CORE')) $this->debugOutput(sprintf("[%s:] Das Schiffsteil <strong>%s</strong> vom Typ <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.",
$this->__toString(),
$this->getCurrPart()->getObjectDescription(),
$this->getCurrPart()->__toString(),
// Passt dies nun immer noch?
if ($this->isNewSizeValid()) {
// Das passt auch, dann Werte setzen und Motor-Instanz merken
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.",
+ if (defined('DEBUG_CORE')) $this->debugOutput(sprintf("[%s:] Das Schiffsteil <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.",
$this->__toString(),
$this->getObjectDescription(),
$this->currShip->getShipName()
// Existiert ein Schiffsteil?
if (!is_null($this->currPart)) {
// Debug-Meldung ausgeben
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Schiffsteil <strong>%s</strong> gefunden.",
+ if (defined('DEBUG_CORE')) $this->debugOutput(sprintf("[%s:] Schiffsteil <strong>%s</strong> gefunden.",
$this->getCurrPart()->realClass,
$this->getCurrPart()->getObjectDescription()
));
// Debug message
if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) {
- $merchantInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Händler <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.",
+ $merchantInstance->debugOutput(sprintf("[%s:%d] Ein Händler <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.",
__CLASS__,
__LINE__,
$merchantName,
$price = (float) $price;
// Debug message
- if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> "<strong>%s</strong>" zu <strong>%s</strong> verkaufen.",
+ if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Der Händler <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> "<strong>%s</strong>" zu <strong>%s</strong> verkaufen.",
__CLASS__,
__LINE__,
$this->getMerchantName(),
$contractInstance = new WorksContract();
// Debug-Meldung ausgeben
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Neuer Bauvertrag wird für das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->debugOutput(sprintf("[%s:%d] Neuer Bauvertrag wird für das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.",
__CLASS__,
__LINE__,
$shipName,
$parentPart = (string) $parentPart;
// Debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiffsteil <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiffsteil <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.",
__CLASS__,
__LINE__,
$shipPart,
try {
$partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray);
} catch (DimNotFoundInArrayException $e) {
- $this->getDebugInstance()->output(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />",
+ $this->debugOutput(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />",
$this->getShipInstance()->getShipName(),
$e->getMessage()
));
// Debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.",
__CLASS__,
__LINE__
));
$price = $this->getMerchantInstance()->getPriceFromList($partInstance);
// Final debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> kostet <strong>%s</strong>.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> kostet <strong>%s</strong>.",
__CLASS__,
__LINE__,
$partInstance->getObjectDescription(),
$partInstance->setPrice($price);
// Final debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.",
__CLASS__,
__LINE__,
$partInstance->getObjectDescription()
if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) {
if ($partnerInstance->equals($partyInstance)) {
// With itself
- $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
+ $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
__CLASS__,
__LINE__,
$partnerInstance->getObjectDescription(),
));
} else {
// Other contract party
- $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
+ $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
__CLASS__,
__LINE__,
$partnerInstance->getObjectDescription(),
// Reedereien Werften bauen lassen
public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) {
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
$amount = (int) $amount;
// Debug-Meldung ausgeben
- if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.",
+ if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
$employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay?
// Debug message
- if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.",
+ if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
$personellInstance->resetCache();
// Debug-Meldung ausgeben
- if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.",
+ if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
// Distribute all personells on all shipyards
public function distributeAllPersonellOnShipyards () {
- if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).",
+ if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).",
__CLASS__,
__LINE__,
$this->getCompanyName(),
$total = $this->employeeList->count();
// Debug message
- if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.",
+ if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
// Getter for total shipyards
public final function getTotalShipyards () {
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Für die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen Häfen ermittelt.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Für die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen Häfen ermittelt.",
__CLASS__,
__LINE__,
$this->getCompanyName()
$total = $this->shipyardList->count();
// Debug message
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Werft(en).",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Werft(en).",
__CLASS__,
__LINE__,
$this->getCompanyName(),
));
// Debug message
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
// Validate the requested ship type with the company if they can construct it
public function validateWorksContractShipType (SignableContract $contractInstance) {
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> prüft den Bauauftrag der <strong>%s</strong>.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> prüft den Bauauftrag der <strong>%s</strong>.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
$shipType = $shipInstance->__toString();
// Debug message
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> prüft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> prüft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
$shipType = (string) $shipType;
// Debug message
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen können.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen können.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
}
// Debug message
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
// As a customer the shipping company can add new contracts
public function addNewWorksContract (SignableContract $contractInstance) {
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag für ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag für ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
// Determine if company "signs" own contract (must be done) or with an other party
if ($this->equals($partnerInstance)) {
// With itself
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>".",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>".",
__CLASS__,
__LINE__,
$this->getCompanyName(),
));
} else {
// Other external company
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> unterzeichnet einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>" mit der <strong>%s</strong>.",
+ if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> unterzeichnet einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>" mit der <strong>%s</strong>.",
__CLASS__,
__LINE__,
$this->getCompanyName(),
// Hafen-Instanz holen
$harborInstance = new Harbor();
- // Debug message
- if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen <strong>%s</strong> wird konstruiert.", $harborName));
-
// Hafenname setzen
$harborInstance->setHarborName($harborName);
// Werftliste initialisieren
$harborInstance->createshipyardList();
- // Debug-Meldung ausgeben
- if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen <strong>%s</strong> ist jetzt fertig gebaut.", $harborName));
-
// Instanz zurueckliefern
return $harborInstance;
}
$shipyardInstance = new Shipyard();
// Debug message
- if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Werft mit dem Namen <strong>%s</strong> wird im Hafen <strong>%s</strong> konstruiert.",
+ if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Eine Werft mit dem Namen <strong>%s</strong> wird im Hafen <strong>%s</strong> konstruiert.",
__CLASS__,
__LINE__,
$shipyardName,
$shipyardInstance->removeSystemArray();
// Debug-Meldung
- if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Werft <strong>%s</strong> wurde gebaut.",
+ if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->debugOutput(sprintf("[%s:%d] Die Werft <strong>%s</strong> wurde gebaut.",
__CLASS__,
__LINE__,
$shipyardName
$shipType = (string) $shipType;
// Debug message
- if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft <strong>%s</strong> kann bald Schiffe vom Typ <strong>%s</strong> bauen.",
+ if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft <strong>%s</strong> kann bald Schiffe vom Typ <strong>%s</strong> bauen.",
__CLASS__,
__LINE__,
$this->getShipyardName(),
$shipType = (string) $shipType;
// Debug message
- if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft <strong>%s</strong> prüft, ob Schiffe vom Typ <strong>%s</strong> baubar sind.",
+ if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft <strong>%s</strong> prüft, ob Schiffe vom Typ <strong>%s</strong> baubar sind.",
__CLASS__,
__LINE__,
$this->getShipyardName(),
}
// Debug message
- if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft <strong>%s</strong> hat die Suche nach dem Schiffstyp <strong>%s</strong> abgeschlossen.",
+ if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Werft <strong>%s</strong> hat die Suche nach dem Schiffstyp <strong>%s</strong> abgeschlossen.",
__CLASS__,
__LINE__,
$this->getShipyardName(),
// Get new instance
$motorInstance = new Motor();
- // Debug message
- if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $motorInstance->getDebugInstance()->output(sprintf("[%s:%d] Motor <strong>%s</strong> wird gebaut...",
- __CLASS__,
- __LINE__,
- $descr
- ));
-
// Beschreibung und Abmasse setzen
$motorInstance->setObjectDescription($descr);
$motorInstance->setWidth($w);
// Get new instance
$roomInstance = new MaschineRoom();
- // Debug message
- if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $roomInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Maschinenraum wird konstruiert.",
- __CLASS__,
- __LINE__
- ));
-
// Umrechnungsfaktoren setzen
$roomInstance->setResizeFactorElement('width' , 1.3);
$roomInstance->setResizeFactorElement('height', 1.8);
$personellInstance = new SimulatorPersonell();
// Debug message
- if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Es werden <strong>%d</strong> Personal bereitgestellt.",
+ if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] Es werden <strong>%d</strong> Personal bereitgestellt.",
__CLASS__,
__LINE__,
$amountPersonell
}
// Debug message
- if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Personal bereitgestellt.",
+ if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] <strong>%d</strong> Personal bereitgestellt.",
__CLASS__,
__LINE__,
$amountPersonell
// The same (last) conditions?
if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) {
- if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Gecachte Liste wird verwendet.",
+ if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Gecachte Liste wird verwendet.",
__CLASS__,
__LINE__
));
}
// Output debug message
- if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...",
+ if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...",
__CLASS__,
__LINE__
));
// Debug message
if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) {
- $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Der/Die Angestellte <strong>%s %s</strong> wird angelegt.",
+ $personellInstance->debugOutput(sprintf("[%s:%d] Der/Die Angestellte <strong>%s %s</strong> wird angelegt.",
__CLASS__,
__LINE__,
$surname,
// buildInstance = Das was in das Schiffsteil evtl. eingebaut werden soll (null = kein besonderes Teil einbauen!)
// partClass = Das zu konstruierende Schiffsteil
public function createShipPart (ConstructableShipPart $buildInstance, $partClass) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> erhält ein neues Schiffsteil (%s).",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> erhält ein neues Schiffsteil (%s).",
__CLASS__,
__LINE__,
$this->getShipName(),
try {
$partInstance->addShipPartToShip($this, $buildInstance);
} catch (MotorShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keinen Motor erhalten! Grund: <strong>%s</strong>",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keinen Motor erhalten! Grund: <strong>%s</strong>",
__CLASS__,
__LINE__,
$this->getShipName(),
));
return false;
} catch (RoomShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keinen Maschinenraum erhalten! Grund: <strong>%s</strong>",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keinen Maschinenraum erhalten! Grund: <strong>%s</strong>",
__CLASS__,
__LINE__,
$this->getShipName(),
return false;
} catch (StructureShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keine Aufbauten erhalten! Grund: <strong>%s</strong>",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keine Aufbauten erhalten! Grund: <strong>%s</strong>",
__CLASS__,
__LINE__,
$this->getShipName(),
));
return false;
} catch (CabinShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keine Kabine erhalten! Grund: <strong>%s</strong>",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat keine Kabine erhalten! Grund: <strong>%s</strong>",
__CLASS__,
__LINE__,
$this->getShipName(),
));
return false;
} catch (DeckShipMismatchException $e) {
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat kein Deck erhalten! Grund: <strong>%s</strong>",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat kein Deck erhalten! Grund: <strong>%s</strong>",
__CLASS__,
__LINE__,
$this->getShipName(),
$this->structures->append($partInstance);
// Debug-Meldung ausgeben
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat das Schiffsteil <strong>%s</strong> eingebaut bekommen.",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> hat das Schiffsteil <strong>%s</strong> eingebaut bekommen.",
__CLASS__,
__LINE__,
$this->getShipName(),
// Debug message
if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) {
- $passInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Passagier-Schiff wird erstellt.",
+ $passInstance->debugOutput(sprintf("[%s:%d] Ein Passagier-Schiff wird erstellt.",
__CLASS__,
__LINE__
));
}
// Debug-Meldung ausgeben
- $this->getDebugInstance()->output(sprintf("[%s:%d] Es stehen <strong>%d</strong> Betten vom Kabinen-Typ <strong>%s</strong> bereit.",
+ $this->debugOutput(sprintf("[%s:%d] Es stehen <strong>%d</strong> Betten vom Kabinen-Typ <strong>%s</strong> bereit.",
__CLASS__,
__LINE__,
$total,
}
} else {
// Keine Kabine!
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> ist keine Kabine.",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> ist keine Kabine.",
__CLASS__,
__LINE__,
$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.",
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%d</strong> Betten.",
__CLASS__,
__LINE__,
$this->getObjectDescription(),
// Get new instance
$ecoInstance = new EconomyCabin();
- // Debug message
- if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $ecoInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Economy-Class-Kabine wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse extrahieren
$ecoInstance->extractDimensions($dim);
// Get new instance
$lowInstance = new LowCabin();
- // Debug message
- if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $lowInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine 2-Sterne-Kabine wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse extrahieren
$lowInstance->extractDimensions($dim);
// Get new instance
$luxuryInstance = new LuxuryCabin();
- // Debug message
- if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $luxuryInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Luxuskabine wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse extrahieren
$luxuryInstance->extractDimensions($dim);
// Get new instance
$premierInstance = new PremierCabin();
- // Debug message
- if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $premierInstance->getDebugInstance()->output("[PremierCabin:] Eine Premier-Kabine wird konstruiert...");
-
// Abmasse extrahieren
$premierInstance->extractDimensions($dim);
// Kabine hinzufuegen
public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) {
- if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.",
+ if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.",
__CLASS__,
__LINE__,
$cabinInstance->getObjectDescription(),
$this->setDeckInstance($cabinInstance);
// Einbaut-Meldung ausgeben
- if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wurde in das Schiff eingebaut.",
+ if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wurde in das Schiff eingebaut.",
__CLASS__,
__LINE__,
$cabinInstance->getObjectDescription(),
}
// Debug-Meldung ausgeben
- $this->getDebugInstance()->output(sprintf("[%s:%d] Es exisitieren <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.",
+ $this->debugOutput(sprintf("[%s:%d] Es exisitieren <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.",
__CLASS__,
__LINE__,
$num,
// Deckstruktur dem Schiff hinzufuegen
public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) {
- if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.",
+ if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Deck <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.",
__CLASS__,
__LINE__,
$deckInstance->getObjectDescription(),
$this->setNumDecks($deckInstance->getNumDecks());
$deckInstance->removeNumDecks();
- if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck <strong>%s</strong> wurde in das Schiff <strong>%s</strong> eingebaut.",
+ if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Deck <strong>%s</strong> wurde in das Schiff <strong>%s</strong> eingebaut.",
__CLASS__,
__LINE__,
$deckInstance->getObjectDescription(),
// Get new instance
$carInstance = new CarDeck();
- // Debug message
- if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $carInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Autodeck wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse extrahieren
$carInstance->extractDimensions($dim);
// Get new instance
$trainInstance = new TrainDeck();
- // Debug message
- if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $trainInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein LKW-Deck wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse extrahieren
$trainInstance->extractDimensions($dim);
// Get new instance
$truckInstance = new TruckDeck();
- // Debug message
- if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $truckInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein LKW-Deck wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse extrahieren
$truckInstance->extractDimensions($dim);
// Get new instance
$bridgeInstance = new Bridge();
- // Debug message
- if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $bridgeInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Brücke wird konstruiert...",
- __CLASS__,
- __LINE__
- ));
-
// Abmasse setzen
$bridgeInstance->setWidth($width);
$bridgeInstance->setHeight($height);
--- /dev/null
+<div class="debug_header">
+ Mail-Debug-Ausgabe:
+</div>
+
+<div class="mail_header">
+ <div class="mail_header_line">
+ <span class="mail_sender">Von:</span> <span class="mail_info">{?sender?}</span>
+ </div>
+ <div class="mail_header_line">
+ <span class="mail_recipient">An:</span> <span class="mail_info">{?recipient?}</span>
+ </div>
+ <div class="mail_header_line">
+ <span class="mail_subject">Betreff:</span> <span class="mail_info">{?subject?}</span>
+ </div>
+</div>
+
+<div class="mail_text_box">
+ <div class="mail_message">
+ Nachricht:
+ </div>
+
+ <div class="mail_content">
+ {?message?}
+ </div>
+</div>
-<mail>
- <subject value="Anforderung deines Bestätigunglinks" />
- <message>
+<?xml version="1.0" encoding="UTF-8" ?>
+<text-mail>
+ <mail-data>
+ <sender-address value="$config[admin_email]" />
+ <subject-line value="Anforderung deines Bestätigungslinks" />
+ <recipient-address value="{?email?}" />
+ <message>
<![CDATA[Hallo {?username?}!
Du (oder ein anderer) hattest soeben deinen Bestätigungslink erneut angefordert. Solltest du dies nicht gewesen sein, bitten wir dich den Vorfall zu entschuldigen.
Solltest du die URL nicht anklicken können, versuche diese in die Adresszeile deines Browsers zu kopieren.
-Alternativ kannst du im Spielebereich oder im Gastbereich unter Bestätigungscode eingeben den folgenden Code reinkopieren:
+Alternativ kannst du im Spielebereich oder im Gastbereich unter Bestätigungscode den folgenden Code reinkopieren oder eingeben:
{?confirm_hash?}
Dein {?app_short_name?}-Team
{?mail_footer?}]]>
- </message>
- <text-converter>
- html_entity_decode
- </text-converter>
-</mail>
+ </message>
+ </mail-data>
+</text-mail>
+<?xml version="1.0" encoding="ISO-8859-1" ?>
<image>
<type value="{?image_type?}" />
<base>
$message = sprintf("[%s:%d] XML nodes mismatch. Given: %s, Expected: %s",
$classArray[0]->__toString(),
$this->getLine(),
- $lassArray[1],
- $lassArray[2]
+ $classArray[1],
+ $classArray[2]
);
// Call parent exception constructor
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface FrameworkInterface {
+ /**
+ * Getter for field name
+ *
+ * @param $fieldName Field name which we shall get
+ * @return $fieldValue Field value from the user
+ * @throws NullPointerException If the result instance is null
+ */
+ function getField ($fieldName);
+
+ /**
+ * Updates a given field with new value
+ *
+ * @param $fieldName Field to update
+ * @param $fieldValue New value to store
+ * @return void
+ * @throws DatabaseUpdateSupportException If this class does not support database updates
+ */
+ function updateDatabaseField ($fieldName, $fieldValue);
}
//
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface DeliverableMail extends FrameworkInterface {
- /**
- * Loads a text or HTML template depending on configuration into the template engine
- *
- * @param $templateName Name of the template we shall load
- * @return void
- */
- function loadTemplate ($templateName);
-
/**
* Adds a user class to the recipient list for current template
*
*
* @return void
*/
- function deliverEmail();
+ function deliverEmail ();
/**
* Send notification to the admin
*
* @return void
*/
- function sendAdminNotification();
+ function sendAdminNotification ();
}
//
$this->resetUniqueID();
} elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
// Already destructed object
- $this->getDebugInstance()->output(sprintf("[%s:] The object <strong>%s</strong> is already destroyed.",
+ $this->debugOutput(sprintf("[%s:] The object <strong>%s</strong> is already destroyed.",
__CLASS__, $this->__toString()
));
}
}
// Output stub message
- $this->getDebugInstance()->output(sprintf("[%s->%s] Stub! Args: %s",
+ $this->debugOutput(sprintf("[%s->%s] Stub! Args: %s",
$this->__toString(),
$methodName,
$argsString
if (is_null($appInstance)) {
// Thrown an exception
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- }
- }
+ } // END - if
+ } // END - if
// Generate FQFN for all application templates
$fqfn = sprintf("%s%s/%s/%s",
* @return void
*/
public final function debugInstance () {
+ // Restore the error handler to avoid trouble with missing array elements or undeclared variables
+ restore_error_handler();
+
// Generate the output
$content = sprintf("<pre>%s</pre>",
- trim(print_r($this, true))
+ trim(
+ htmlentities(
+ print_r($this, true)
+ )
+ )
);
// Output it
- ApplicationEntryPoint::app_die(sprintf("<strong>%s debug output:</strong><div id=\"debug_content\">%s</div>Loaded includes: <div id=\"debug_include_list\">%s</div>",
+ ApplicationEntryPoint::app_die(sprintf("<strong>%s debug output:</strong><div id=\"debug_content\">%s</div>\nLoaded includes: <div id=\"debug_include_list\">%s</div>",
$this->__toString(),
$content,
ClassLoader::getInstance()->getPrintableIncludeList()
$methodName = "UnknownClass->unknownMethod";
if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
$methodName = $backtrace[1]['class']."->".$backtrace[1]['function'];
- }
+ } // END - if
// Construct the full message
$stubMessage = sprintf("[%s:] Partial stub!",
if (!empty($message)) {
// Then add it as well
$stubMessage .= sprintf(" Message: <span id=\"stub_message\">%s</span>", $message);
- }
+ } // END - if
// Debug instance is there?
if (!is_null($this->getDebugInstance())) {
// Output stub message
- $this->getDebugInstance()->output($stubMessage);
+ $this->debugOutput($stubMessage);
} else {
// Trigger an error
trigger_error($stubMessage."<br />\n");
* Outputs a debug message wether to debug instance (should be set!) or dies with or pints the message
*
* @param $message Message we shall send out...
- * @param $doPrint Wether we shall print or die here which last is the default
+ * @param $doPrint Wether we shall print or die here which first is the default
* @return void
*/
- public function debugOutput ($message, $doPrint = false) {
+ public function debugOutput ($message, $doPrint = true) {
// Get debug instance
$debugInstance = $this->getDebugInstance();
if (!$doPrint) die(); // Die here if not printed
} else {
// Put directly out
- // DO NOT REWRITE THIS TO app_die() !!!
if ($doPrint) {
print($message);
} else {
+ // DO NOT REWRITE THIS TO app_die() !!!
die($message);
}
}
throw new InvalidInterfaceException(array($userInstance, 'ManageableUser'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
} // END - if
- // Get template instance
- $templateInstance = $responseInstance->getTemplateInstance();
-
// Get an application instance
$appInstance = $this->getResolverInstance()->getApplicationInstance();
- // Assign the application data with the template engine
- $templateInstance->assignApplicationData($appInstance);
-
- // Assign base URL
- $templateInstance->assignConfigVariable('base_url');
-
// Get a RNG instance (Random Number Generator)
$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
$hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
// Update the user class
- $userInstance->updateDatabaseField('confirm_hash', $hashedString);
+ $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
+
+ // Re-set config entry to mailer engine
+ $this->getConfigInstance()->setConfigEntry('template_class', $this->getConfigInstance()->readConfig('mail_template_class'));
- // Assign the hash with a template variable
- $templateInstance->assignVariable('confirm_hash', $hashedString);
+ // Prepare the template engine
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign the application data with the template engine
+ $templateInstance->assignApplicationData($appInstance);
// Get a mailer class
- $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance));
+ $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance, $appInstance, 'resend_link'));
- // Load the mail template
- $mailerInstance->loadTemplate('resend_link');
+ // Set this mailer in our template engine
+ $templateInstance->setMailerInstance($mailerInstance);
- // Get a user instance from registry
- $userInstance = Registry::getRegistry()->getInstance('user');
+ // Add template variables we shall get
+ $mailerInstance->addConfigTemplateVariable('base_url');
+ $mailerInstance->addConfigTemplateVariable('admin_email');
+ $mailerInstance->addValueTemplateVariable('confirm_hash');
+ $mailerInstance->addValueTemplateVariable('username');
+ $mailerInstance->addValueTemplateVariable('email');
+
+ // Add the value instance for the confirmation hash
+ $mailerInstance->addValueInstance('confirm_hash', $userInstance);
+ $mailerInstance->addValueInstance('username', $userInstance);
+ $mailerInstance->addValueInstance('email', $userInstance);
// Add the recipient
$mailerInstance->addRecipientByUserInstance($userInstance);
$mailerInstance->useSubjectFromTemplate();
// Send the email out
- $mailerInstance->deliverEmail();
+ $mailerInstance->deliverEmail($responseInstance);
// Send out notification to admin (depends on settings)
- $mailerInstance->sendAdminNotification();
+ $mailerInstance->sendAdminNotification($responseInstance);
}
/**
// Read the file
$hostname = trim($io->readFromFile());
- $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: <strong>%s</strong>",
+ $helper->debugOutput(sprintf("[%s:] Our host name is: <strong>%s</strong>",
$helper->__toString(),
$hostname
));
$ip = $ipResolved;
// Debug message
- $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: <strong>%s</strong>\n",
+ $helper->debugOutput(sprintf("[%s:] Resolved IP address is: <strong>%s</strong>\n",
$helper->__toString(),
$ip
));
const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
// Constants for database columns
- const DB_COLUMN_USERNAME = "username";
- const DB_COLUMN_EMAIL = "email";
+ const DB_COLUMN_USERNAME = "username";
+ const DB_COLUMN_EMAIL = "email";
+ const DB_COLUMN_CONFIRM_HASH = "confirm_hash";
// Constants for database table names
const DB_TABLE_USER = "user";
$templateInstance->assignVariable('image_fg_blue' , $this->foregroundColor['blue']);
// Add all strings
- foreach ($this->imageStrings as $id=>$imageString) {
+ foreach ($this->imageStrings as $id => $imageString) {
// Set current string id to keep this helper in sync with template engine
$this->currString = $id;
$imageContent = $templateInstance->getRawTemplateData();
// Transfer all to the template engine
- $templateInstance->renderImageContent($imageContent);
+ $templateInstance->renderXmlContent($imageContent);
}
}
* @param $templateName Name of the template we shall load
* @return void
*/
- public function loadTemplate ($templateName) {
+ protected final function loadTemplate ($templateName) {
// Set template name
$this->setTemplateName($templateName);
// Is the list initialized?
if (!isset($this->recipientList[$templateName]['recipients'])) {
// Then initialize it here
- $this->recipientList[$templateName]['recipients'] = new FrameworkArrayObject("FakedRecipientList");
+ $this->recipientList[$templateName]['recipients'] = array();
} // END - if
// Add it as a recipient
- $this->recipientList[$templateName]['recipients']->append($userInstance);
+ $this->recipientList[$templateName]['recipients'][] = $userInstance;
+ }
+
+ /**
+ * Adds a template variable (just the name) to the recipient list in given section of current template
+ *
+ * @param $section Section can be "config" or "value" currently
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ private final function addTemplateVariable ($section, $variableName) {
+ // Get template name
+ $templateName = $this->getTemplateName();
+
+ // Generate full section name
+ $sectionName = $section . '_vars';
+
+ // Is the list initialized?
+ if (!isset($this->recipientList[$templateName][$sectionName])) {
+ // Then initialize it here
+ $this->recipientList[$templateName][$sectionName] = array();
+ } // END - if
+
+ // Add the variable to the list
+ $this->recipientList[$templateName][$sectionName][$variableName] = 'OK';
+ }
+
+ /**
+ * Adds a config template variable to the recipient list of current template
+ *
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ public final function addConfigTemplateVariable ($variableName) {
+ $this->addTemplateVariable("config", $variableName);
+ }
+
+ /**
+ * Adds a "value" template variable to the recipient list of current template
+ *
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ public final function addValueTemplateVariable ($variableName) {
+ $this->addTemplateVariable("value", $variableName);
+ }
+
+ /**
+ * Adds a value instance for a given variable name. It should be set!
+ *
+ * @param $variableName Template variable we want to assign a value instance
+ * @param $valueInstance An object instance which can provide "field values"
+ * @return void
+ */
+ public final function addValueInstance ($variableName, FrameworkInterface $valueInstance) {
+ $this->recipientList[$this->getTemplateName()]['values'][$variableName] = $valueInstance;
}
/**
* @param $templateName Name of email template
* @return void
*/
- protected final function setTemplateName ($templateName) {
+ public final function setTemplateName ($templateName) {
$this->templateName = (string) $templateName;
}
// Set the subject line
$this->setSubjectLine("{?subject?}");
}
+
+ /**
+ * Getter for recipient list array
+ *
+ * @return $recipientList Array with reciepients
+ */
+ public final function getRecipientList () {
+ return $this->recipientList;
+ }
}
// [EOF]
* Creates an instance of this mailer class
*
* @param $templateInstance A template instance
+ * @param $appInstance An application helper class
+ * @param $templateName Name of email template to set
* @return $mailerInstance An instance of this mailer class
*/
- public final static function createDebugMailer (CompileableTemplate $templateInstance) {
+ public final static function createDebugMailer (CompileableTemplate $templateInstance, ManageableApplication $appInstance, $templateName) {
// Get a new instance
$mailerInstance = new DebugMailer();
// Set template instance
$mailerInstance->setTemplateInstance($templateInstance);
+ // Set application instance
+ $mailerInstance->setApplicationInstance($appInstance);
+
+ // Set template name
+ $mailerInstance->setTemplateName('resend_link');
+
// Return the instance
return $mailerInstance;
}
* @return void
*/
public function deliverEmail () {
- $this->partialStub();
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // "Deliver" all emails
+ foreach ($this->getRecipientList() as $templateName => $recipientList) {
+ // Walk through all recipients and "sent", or better print, it out
+ foreach ($recipientList['recipients'] as $recipientInstance) {
+ // The recipient should be a user instance, right?
+ if ($recipientInstance instanceof ManageableUser) {
+ // User class found, so entry is valid, first load the template
+ $this->loadTemplate($templateName);
+
+ // Set subject line
+ $templateInstance->assignVariable('subject', $this->getSubjectLine());
+
+ // Walk through all variables, first config to assign them
+ foreach ($recipientList['config_vars'] as $variable=>$dummy) {
+ // Load the config value and set it
+ $templateInstance->assignConfigVariable($variable);
+ } // END - if
+
+ // Now do the same with the values but ask the "value instance" instead!
+ foreach ($recipientList['value_vars'] as $variable=>$dummy) {
+ // Is the value instance there?
+ if (!isset($recipientList['values'][$variable])) {
+ // Throw exception
+ throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Get the field from the value instance
+ $fieldValue = $recipientList['values'][$variable]->getField($variable);
+
+ // Set it in the template engine
+ $templateInstance->assignVariable($variable, $fieldValue);
+ }
+
+ // Render the content
+ $templateInstance->renderXmlContent();
+
+ // Get responce instance
+ $responseInstance = $this->getApplicationInstance()->getResponseInstance();
+
+ // Transfer the data to the response
+ $this->getTemplateInstance()->transferToResponse($responseInstance);
+ } else {
+ // Invalid entry found!
+ $this->partialStub("Handling of invalid recipient entries not yet finished.");
+ }
+ } // END - foreach
+ } // END - foreach
}
/**
* Send notification to the admin
*
* @return void
+ * @todo 0% done
*/
public function sendAdminNotification () {
- $this->partialStub();
+ // Unfinished work
+ }
+
+ /**
+ * Invokes the mail delivery process which will prepare the output of the message in a code template
+ *
+ * @return void
+ */
+ public function invokeMailDelivery () {
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // Get the compiled message and set it as new template variable
+ $message = $templateInstance->getCompiledData();
+ $templateInstance->assignVariable('message', $message);
+
+ // Load the code template
+ $templateInstance->loadCodeTemplate('mail_debug');
+
+ // Compile the template
+ $templateInstance->compileTemplate();
+
+ // Assign this template with variable
+ $templateInstance->assignTemplateWithVariable('mail_debug', 'content');
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($this->getApplicationInstance()->getMasterTemplate());
+
+ // Then compile it again
+ $templateInstance->compileVariables();
}
}
$cfg = $this->getConfigInstance();
// Set new template engine
- $cfg->setConfigEntry('template_class' , "ImageTemplateEngine");
+ $cfg->setConfigEntry('template_class' , $cfg->readConfig('image_template_class'));
$cfg->setConfigEntry('raw_template_extension' , ".img");
$cfg->setConfigEntry('code_template_extension', ".itp");
$cfg->setConfigEntry('tpl_base_path' , "templates/images/");
* @param $var The variable we are looking for
* @return $content Content of the variable or null if not found
*/
- private function readVariable ($var) {
+ protected function readVariable ($var) {
// First everything is not found
$content = null;
*
* @param $groupName Name of variable group
* @param $add Wether add this group
- * @return void
+ * @retur4n void
*/
public function setVariableGroup ($groupName, $add = true) {
// Set group name
* @param $rawTemplateData The raw data from the template
* @return void
*/
- private final function setRawTemplateData ($rawTemplateData) {
+ protected final function setRawTemplateData ($rawTemplateData) {
// And store it in this class
//* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($rawTemplateData)." Bytes set.<br />\n";
//* DEBUG: */ echo $this->currGroup." variables: ".count($this->varStack[$this->currGroup]).", groups=".count($this->varStack)."<br />\n";
/**
* Getter for compiled templates
+ *
+ * @return $compiledData Compiled template data
*/
public final function getCompiledData () {
//* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($this->compiledData)." Bytes read.<br />\n";
);
// This loop does remove the backslashes (\) in PHP parameters
- while (strpos($eval, "<?") !== false) {
+ while (strpos($eval, "<?php") !== false) {
// Get left part before "<?"
- $evalLeft = substr($eval, 0, strpos($eval, "<?"));
+ $evalLeft = substr($eval, 0, strpos($eval, "<?php"));
// Get all from right of "<?"
- $evalRight = substr($eval, (strpos($eval, "<?") + 2));
-
- // Is this a full PHP tag?
- if (substr(strtolower($evalRight), 0, 3) == "php") {
- // Remove "php" string from full PHP tag
- $evalRight = substr($evalRight, 3);
- } // END - if
+ $evalRight = substr($eval, (strpos($eval, "<?php") + 5));
// Cut middle part out and remove escapes
$evalMiddle = trim(substr($evalRight, 0, strpos($evalRight, "?>")));
// Set the code back
$this->setRawTemplateData($rawData);
}
+
+ /**
+ * Renders the given XML content
+ *
+ * @param $content Valid XML content or if not set the current loaded raw content
+ * @return void
+ * @throws XmlParserException If an XML error was found
+ */
+ public final function renderXmlContent ($content = null) {
+ // Is the content set?
+ if (is_null($content)) {
+ // Get current content
+ $content = $this->getRawTemplateData();
+ } // END - if
+
+ // Convert all to UTF8
+ $content = recode("html..utf8", $content);
+
+ // Get an XML parser
+ $xmlParser = xml_parser_create();
+
+ // Force case-folding to on
+ xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, true);
+
+ // Set object
+ xml_set_object($xmlParser, $this);
+
+ // Set handler call-backs
+ xml_set_element_handler($xmlParser, 'startElement', 'endElement');
+ xml_set_character_data_handler($xmlParser, 'characterHandler');
+
+ // Now parse the XML tree
+ if (!xml_parse($xmlParser, $content)) {
+ // Error found in XML!
+ //die("<pre>".htmlentities($content)."</pre>");
+ throw new XmlParserException(array($this, $xmlParser), BaseHelper::EXCEPTION_XML_PARSER_ERROR);
+ } // END - if
+
+ // Free the parser
+ xml_parser_free($xmlParser);
+ }
}
// [EOF]
return $tplInstance;
}
- /**
- * Renders the given image content
- *
- * @param $imageContent A valid XML image content
- * @return void
- * @throws XmlParserException If an XML error was found
- */
- public function renderImageContent ($imageContent) {
- // Get an XML parser
- $xmlParser = xml_parser_create();
-
- // Force case-folding to on
- xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, true);
-
- // Set object
- xml_set_object($xmlParser, $this);
-
- // Set handler call-backs
- xml_set_element_handler($xmlParser, 'startElement', 'endElement');
- xml_set_character_data_handler($xmlParser, 'characterHandler');
-
- // Now parse the XML tree
- if (!xml_parse($xmlParser, $imageContent)) {
- // Error found in XML!
- throw new XmlParserException(array($this, $xmlParser), BaseHelper::EXCEPTION_XML_PARSER_ERROR);
- } // END - if
-
- // Free the parser
- xml_parser_free($xmlParser);
- }
-
/**
* Handles the start element of an XML resource
*
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function endElement ($resource, $nodeName) {
+ protected function endElement ($resource, $nodeName) {
// Make all lower-case
$nodeName = strtolower($nodeName);
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
- if (($nodeName != $this->currMainNode) && (in_array($nodeName, $this->mainNodes))) {
+ if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
// Did not match!
- throw new XmlNodeMismatchException (array($this, $nodeName, $this->currMainNode), BaseHelper::EXCEPTION_XML_NODE_MISMATCH);
- } elseif (in_array($nodeName, $this->subNodes)) {
+ throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), BaseHelper::EXCEPTION_XML_NODE_MISMATCH);
+ } elseif (in_array($nodeName, $this->getSubNodes())) {
// Silently ignore sub nodes
return;
}
* @return void
* @todo Find something usefull with this!
*/
- public function characterHandler ($resource, $characters) {
+ protected function characterHandler ($resource, $characters) {
// Trim all spaces away
$characters = trim($characters);
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The own template engine for loading caching and sending out images
+ *
+ * @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 MailTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
+ /**
+ * Main nodes in the XML tree
+ */
+ private $mainNodes = array("mail-data");
+
+ /**
+ * Sub nodes in the XML tree
+ */
+ private $subNodes = array("subject-line", "sender-address", "recipient-address", "message");
+
+ /**
+ * Mailer instance
+ */
+ private $mailerInstance = null;
+
+ /**
+ * Current main node
+ */
+ private $currMainNode = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Mail template engine");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @param $basePath The local base path for all templates
+ * @param $langInstance An instance of LanguageSystem (default)
+ * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @return $tplInstance An instance of TemplateEngine
+ * @throws BasePathIsEmptyException If the provided $basePath is empty
+ * @throws InvalidBasePathStringException If $basePath is no string
+ * @throws BasePathIsNoDirectoryException If $basePath is no
+ * directory or not found
+ * @throws BasePathReadProtectedException If $basePath is
+ * read-protected
+ */
+ public final static function createMailTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ // Get a new instance
+ $tplInstance = new MailTemplateEngine();
+
+ // Is the base path valid?
+ if (empty($basePath)) {
+ // Base path is empty
+ throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!is_string($basePath)) {
+ // Is not a string
+ throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($basePath)) {
+ // Is not a path
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($basePath)) {
+ // Is not readable
+ throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ }
+
+ // Get configuration instance
+ $cfgInstance = FrameworkConfiguration::getInstance();
+
+ // Set the base path
+ $tplInstance->setBasePath($basePath);
+
+ // Set the language and IO instances
+ $tplInstance->setLanguageInstance($langInstance);
+ $tplInstance->setFileIoInstance($ioInstance);
+
+ // Set template extensions
+ $tplInstance->setRawTemplateExtension($cfgInstance->readConfig('raw_template_extension'));
+ $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
+
+ // Absolute output path for compiled templates
+ $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+
+ // Return the prepared instance
+ return $tplInstance;
+ }
+
+ /**
+ * Getter for current main node
+ *
+ * @return $currMainNode Current main node
+ */
+ public final function getCurrMainNode () {
+ return $this->currMainNode;
+ }
+
+ /**
+ * Getter for main node array
+ *
+ * @return $mainNodes Array with valid main node names
+ */
+ public final function getMainNodes () {
+ return $this->mainNodes;
+ }
+
+ /**
+ * Getter for sub node array
+ *
+ * @return $subNodes Array with valid sub node names
+ */
+ public final function getSubNodes () {
+ return $this->subNodes;
+ }
+
+ /**
+ * Handles the start element of an XML resource
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $element The element we shall handle
+ * @param $attributes All attributes
+ * @return void
+ * @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
+ */
+ protected function startElement ($resource, $element, array $attributes) {
+ // Initial method name which will never be called...
+ $methodName = 'initEmail';
+
+ // Make the element name lower-case
+ $element = strtolower($element);
+
+ // Is the element a main node?
+ //* DEBUG: */ echo "START: >".$element."<<br />\n";
+ if (in_array($element, $this->getMainNodes())) {
+ // Okay, main node found!
+ $methodName = 'setEmail' . $this->convertToClassName($element);
+ } elseif (in_array($element, $this->getSubNodes())) {
+ // Sub node found
+ $methodName = 'setEmailProperty' . $this->convertToClassName($element);
+ } elseif ($element != 'text-mail') {
+ // Invalid node name found
+ throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN);
+ }
+
+ // Call method
+ //* DEBUG: */ echo "call: ".$methodName."<br />\n";
+ call_user_func_array(array($this, $methodName), $attributes);
+ }
+
+ /**
+ * Ends the main or sub node by sending out the gathered data
+ *
+ * @param $resource An XML resource pointer (currently ignored)
+ * @param $nodeName Name of the node we want to finish
+ * @return void
+ * @throws XmlNodeMismatchException If current main node mismatches the closing one
+ */
+ protected function endElement ($resource, $nodeName) {
+ // Make all lower-case
+ $nodeName = strtolower($nodeName);
+
+ // Does this match with current main node?
+ //* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
+ if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
+ // Did not match!
+ throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), BaseHelper::EXCEPTION_XML_NODE_MISMATCH);
+ } elseif (in_array($nodeName, $this->getSubNodes())) {
+ // Silently ignore sub nodes
+ return;
+ }
+
+ // Construct method name
+ $methodName = 'finish' . $this->convertToClassName($nodeName);
+
+ // Call the corresponding method
+ call_user_func_array(array($this, $methodName), array());
+ }
+
+ /**
+ * Adds the message text to the template engine
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ */
+ protected function characterHandler ($resource, $characters) {
+ // Trim all spaces away
+ $characters = trim($characters);
+
+ // Is this string empty?
+ if (empty($characters)) {
+ // Then skip it silently
+ return false;
+ } // END - if
+
+ // Add the message now
+ $this->assignVariable('message', $characters);
+ }
+
+ /**
+ * Intializes the mail
+ *
+ * @return void
+ * @todo Add cache creation here
+ */
+ private function initEmail () {
+ // Unfinished work!
+ }
+
+ /**
+ * Setter for mail data node
+ *
+ * @return void
+ * @todo Should we call back the mailer class here?
+ */
+ private function setEmailMailData () {
+ // Set current main node
+ $this->currMainNode = 'mail-data';
+ }
+
+ /**
+ * Setter for sender address property
+ *
+ * @param $senderAddress Sender address to set in email
+ * @return void
+ */
+ private function setEmailPropertySenderAddress ($senderAddress) {
+ // Set the template variable
+ $this->assignVariable('sender', $senderAddress);
+ }
+
+ /**
+ * Setter for recipient address property
+ *
+ * @param $recipientAddress Recipient address to set in email
+ * @return void
+ */
+ private function setEmailPropertyRecipientAddress ($recipientAddress) {
+ // Set the template variable
+ $this->assignVariable('recipient', $recipientAddress);
+ }
+
+ /**
+ * Setter for subject line property
+ *
+ * @param $subjectLine Subject line to set in email
+ * @return void
+ */
+ private function setEmailPropertySubjectLine ($subjectLine) {
+ // Set the template variable
+ $this->assignVariable('subject', $subjectLine);
+ }
+
+ /**
+ * Method stub to avoid output
+ *
+ * @return void
+ */
+ private function setEmailPropertyMessage () {
+ // Empty for now
+ }
+
+ /**
+ * Gets the template variable "message", stores it back as raw template data
+ * and compiles all variables so the mail message got prepared for output
+ *
+ * @return void
+ */
+ private function finishMailData () {
+ // Get the message and set it as new raw template data back
+ $message = $this->readVariable('message');
+ $this->setRawTemplateData($message);
+
+ // Get some variables to compile
+ //$sender = $this->compileRawCode($this->readVariable('sender'));
+ //$this->assignVariable('sender', $sender);
+
+ // Then compile all variables
+ $this->compileVariables();
+ }
+
+ /**
+ * Invokes the final mail process
+ *
+ * @return void
+ */
+ private function finishTextMail () {
+ $this->getMailerInstance()->invokeMailDelivery();
+ }
+
+ /**
+ * Getter for image cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the image cache
+ */
+ public function getMailCacheFqfn () {
+ // Unfinished work!
+ $fqfn = "";
+ $this->debugBackTrace();
+
+ // Return it
+ return $fqfn;
+ }
+
+ /**
+ * Setter for mailer instance
+ *
+ * @param $mailerInstance A mailer instance
+ * @return void
+ */
+ public final function setMailerInstance (DeliverableMail $mailerInstance) {
+ $this->mailerInstance = $mailerInstance;
+ }
+
+ /**
+ * Getter for mailer instance
+ *
+ * @return $mailerInstance A mailer instance
+ */
+ protected final function getMailerInstance () {
+ return $this->mailerInstance;
+ }
+
+ /**
+ * Outputs the mail to the world. This should only the mailer debug class do!
+ *
+ * @param $responseInstance An instance of a Responseable class
+ * @return void
+ */
+ public function transferToResponse (Responseable $responseInstance) {
+ $responseInstance->writeToBody($this->getCompiledData());
+ }
+}
+
+// [EOF]
+?>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class User extends BaseUser implements ManageableUser, Registerable, Updateable {
- // Exceptions
+ // Exception constances
const EXCEPTION_USERNAME_NOT_FOUND = 0x150;
const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151;
const EXCEPTION_USER_PASS_MISMATCH = 0x152;
// Return it
return $fullDomain;
}
-} // END - class
+
+ /**
+ * Getter for field name
+ *
+ * @param $fieldName Field name which we shall get
+ * @return $fieldValue Field value from the user
+ */
+ function getField ($fieldName) {
+ // Dummy method!
+ }
+
+ /**
+ * Updates a given field with new value
+ *
+ * @param $fieldName Field to update
+ * @param $fieldValue New value to store
+ * @return void
+ */
+ public function updateDatabaseField ($fieldName, $fieldValue) {
+ // Dummy method!
+ }
+}
// [EOF]
?>
+<?xml version="1.0" encoding="ISO-8859-1" ?>
<image>
<type value="{?image_type?}" />
<base>