]> git.mxchange.org Git - shipsimu.git/commitdiff
Debug mailer finished and debug messages removed:
authorRoland Häder <roland@mxchange.org>
Sun, 29 Jun 2008 23:38:35 +0000 (23:38 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 29 Jun 2008 23:38:35 +0000 (23:38 +0000)
- The class DebugMailer is now 99% ready. It outputs the sent mail but has not
  been tested with multiple mails
- Confirmation mail is now basicly done
- A lot debug messages removed/rewritten
- Two generic methods added to interface FrameworkInterface
- XML headers added to XML templates

45 files changed:
.gitattributes
application/ship-simu/config.php
application/ship-simu/main/class_BaseSimulator.php
application/ship-simu/main/class_Merchant.php
application/ship-simu/main/class_WorksContract.php
application/ship-simu/main/companies/class_ShippingCompany.php
application/ship-simu/main/constructions/harbors/class_Harbor.php
application/ship-simu/main/constructions/yards/class_Shipyard.php
application/ship-simu/main/drives/motor/class_Motor.php
application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php
application/ship-simu/main/personell/class_SimulatorPersonell.php
application/ship-simu/main/personell/company/class_CompanyEmployee.php
application/ship-simu/main/ships/class_BaseShip.php
application/ship-simu/main/ships/passenger/class_PassengerShip.php
application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php
application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php
application/ship-simu/main/structures/extended/class_BaseCabinStructure.php
application/ship-simu/main/structures/extended/class_BaseDeckStructure.php
application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php
application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php
application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php
application/ship-simu/main/structures/extended/upper/class_Bridge.php
application/ship-simu/templates/de/code/mail_debug.ctp [new file with mode: 0644]
application/ship-simu/templates/de/emails/text_resend_link.tpl
application/ship-simu/templates/images/de/image/base_code.itp
inc/classes/exceptions/xml/class_XmlNodeMismatchException.php
inc/classes/interfaces/class_FrameworkInterface.php
inc/classes/interfaces/mailer/class_DeliverableMail.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/web/class_WebResendLinkCommand.php
inc/classes/main/console/class_ConsoleTools.php
inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php
inc/classes/main/helper/captcha/images/class_ImageHelper.php
inc/classes/main/mailer/class_BaseMailer.php
inc/classes/main/mailer/debug/class_DebugMailer.php
inc/classes/main/response/class_ImageResponse.php
inc/classes/main/template/class_BaseTemplateEngine.php
inc/classes/main/template/image/class_ImageTemplateEngine.php
inc/classes/main/template/mail/.htaccess [new file with mode: 0644]
inc/classes/main/template/mail/class_MailTemplateEngine.php [new file with mode: 0644]
inc/classes/main/user/user/class_User.php
inc/config/class_FrameworkConfiguration.php
templates/images/de/image/base_image.itp

index e3d7b8cc61fa77ecb0c68e0e76881cf8ffc2442d..b34935c1bb488bc36cd5f40189e78b6269f74e38 100644 (file)
@@ -154,6 +154,7 @@ 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_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
@@ -573,6 +574,8 @@ inc/classes/main/template/.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
index 5967ed38d3639cb114e21dfd03204eba94672843..fcaa33c9dfaab29f189b4dc7c8d63bd1b7a2ea14 100644 (file)
@@ -223,5 +223,14 @@ $cfg->setConfigEntry('company_db_wrapper_class', "CompanyDatabaseWrapper");
 // 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]
 ?>
index cb29c92f110801a60eb3dcebdc301c2fb6f9f297..db7a1f2319e91d65ccf49540a059abda6e728bf6 100644 (file)
@@ -117,7 +117,7 @@ class BaseSimulator extends BaseFrameworkSystem {
                $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()
@@ -126,7 +126,7 @@ class BaseSimulator extends BaseFrameworkSystem {
                // 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(),
@@ -143,7 +143,7 @@ class BaseSimulator extends BaseFrameworkSystem {
                                // 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()
@@ -172,7 +172,7 @@ class BaseSimulator extends BaseFrameworkSystem {
                        // 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()
                                ));
index 8f23118a3216c02cbf50fc074ca07fb98097ff52..52f63c1d4ecea78efe6fa0c06e345985f96749eb 100644 (file)
@@ -56,7 +56,7 @@ class Merchant extends BaseFrameworkSystem {
 
                // Debug message
                if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) {
-                       $merchantInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein H&auml;ndler <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.",
+                       $merchantInstance->debugOutput(sprintf("[%s:%d] Ein H&auml;ndler <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.",
                                __CLASS__,
                                __LINE__,
                                $merchantName,
@@ -109,7 +109,7 @@ class Merchant extends BaseFrameworkSystem {
                $price = (float) $price;
 
                // Debug message
-               if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der H&auml;ndler <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> &quot;<strong>%s</strong>&quot; zu <strong>%s</strong> verkaufen.",
+               if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Der H&auml;ndler <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> &quot;<strong>%s</strong>&quot; zu <strong>%s</strong> verkaufen.",
                        __CLASS__,
                        __LINE__,
                        $this->getMerchantName(),
index 9527b232a39fbf86fb057436a144be357325c6c7..4a6005911552cce971e9537011f4c59afa048d23 100644 (file)
@@ -65,7 +65,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $contractInstance = new WorksContract();
 
                // Debug-Meldung ausgeben
-               if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Neuer Bauvertrag wird f&uuml;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&uuml;r das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.",
                        __CLASS__,
                        __LINE__,
                        $shipName,
@@ -123,7 +123,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $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,
@@ -137,13 +137,13 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                try {
                        $partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray);
                } catch (DimNotFoundInArrayException $e) {
-                       $this->getDebugInstance()->output(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollst&auml;ndigt werden. Grund: <strong>%s</strong><br />",
+                       $this->debugOutput(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollst&auml;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__
                        ));
@@ -167,7 +167,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $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(),
@@ -178,7 +178,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                $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()
@@ -239,7 +239,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                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 &uuml;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 &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
                                        __CLASS__,
                                        __LINE__,
                                        $partnerInstance->getObjectDescription(),
@@ -249,7 +249,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                                ));
                        } 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 &uuml;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 &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
                                        __CLASS__,
                                        __LINE__,
                                        $partnerInstance->getObjectDescription(),
index 841be84d0134d40f7d4ea03483c837367d7ff16b..a7f12ef410e559594d6730f2b07a8ad5088e0e44 100644 (file)
@@ -251,7 +251,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // 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(),
@@ -296,7 +296,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $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(),
@@ -350,7 +350,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        $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(),
@@ -366,7 +366,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $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(),
@@ -376,7 +376,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // 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(),
@@ -430,7 +430,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $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(),
@@ -443,7 +443,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Getter for total shipyards
        public final function getTotalShipyards () {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] F&uuml;r die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen H&auml;fen ermittelt.",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] F&uuml;r die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen H&auml;fen ermittelt.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName()
@@ -459,7 +459,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $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(),
@@ -488,7 +488,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                ));
 
                // 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(),
@@ -519,7 +519,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // 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&uuml;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&uuml;ft den Bauauftrag der <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -542,7 +542,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $shipType = $shipInstance->__toString();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;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&uuml;ft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -560,7 +560,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $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&ouml;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&ouml;nnen.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -595,7 +595,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                }
 
                // 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(),
@@ -608,7 +608,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // 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&uuml;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&uuml;r ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -646,7 +646,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // 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&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot;.",
+                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot;.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
@@ -655,7 +655,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        ));
                } 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&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot; 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&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot; mit der <strong>%s</strong>.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
index e168cc4acc33da3acc688250e12c9d0a18a3fd48..9cae1be691cea0e1872c00167caa65adb37861bc 100644 (file)
@@ -55,18 +55,12 @@ class Harbor extends BaseConstruction {
                // 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;
        }
index f0036943334140700a4f50558983ee58aa9182ae..474821a237f8118d0dc8dce20e5f5e94bc3d9488 100644 (file)
@@ -81,7 +81,7 @@ class Shipyard extends BaseConstruction {
                $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,
@@ -104,7 +104,7 @@ class Shipyard extends BaseConstruction {
                $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
@@ -166,7 +166,7 @@ class Shipyard extends BaseConstruction {
                $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(),
@@ -186,7 +186,7 @@ class Shipyard extends BaseConstruction {
                $shipType = (string) $shipType;
 
                // Debug message
-               if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft <strong>%s</strong> pr&uuml;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&uuml;ft, ob Schiffe vom Typ <strong>%s</strong> baubar sind.",
                        __CLASS__,
                        __LINE__,
                        $this->getShipyardName(),
@@ -206,7 +206,7 @@ class Shipyard extends BaseConstruction {
                }
 
                // 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(),
index e347c06293a9124ad5d7094e256be1fe12286658..8f8b61f51404a34509d4bace8069bc6c0e000f72 100644 (file)
@@ -42,13 +42,6 @@ class Motor extends BaseDrive implements TradeableItem, ConstructableShipPart {
                // 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);
index f1fc00b21e25f1cce1c591ddf5ac08bc3cf2fb11..d332c5f9a364774e23499329becded88078fa13f 100644 (file)
@@ -42,12 +42,6 @@ class MaschineRoom extends BaseShipPart {
                // 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);
index 86b1ba0d42ee944af5607f0351d64c0acad01c94..1021c569e30606308eee49574cd76248211a482f 100644 (file)
@@ -82,7 +82,7 @@ class SimulatorPersonell extends BasePersonell {
                $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
@@ -97,7 +97,7 @@ class SimulatorPersonell extends BasePersonell {
                }
 
                // 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
@@ -226,7 +226,7 @@ class SimulatorPersonell extends BasePersonell {
 
                // 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__
                        ));
@@ -236,7 +236,7 @@ class SimulatorPersonell extends BasePersonell {
                }
 
                // 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__
                ));
index 2fc0961697b71bfb90c2202ca7d68d03691e5909..32d2abe80b50c2380fe3a50c1d97f7df6484db59 100644 (file)
@@ -47,7 +47,7 @@ class CompanyEmployee extends SimulatorPersonell {
 
                // 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,
index 36863fe3a7762b98731d0749752d46daf9131bcb..51f1559d947e4b9ed1f7c300d8b9dee68230187c 100644 (file)
@@ -62,7 +62,7 @@ class BaseShip extends BaseSimulator {
        // 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&auml;lt ein neues Schiffsteil (%s).",
+               if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiff <strong>%s</strong> erh&auml;lt ein neues Schiffsteil (%s).",
                        __CLASS__,
                        __LINE__,
                        $this->getShipName(),
@@ -82,7 +82,7 @@ class BaseShip extends BaseSimulator {
                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(),
@@ -90,7 +90,7 @@ class BaseShip extends BaseSimulator {
                        ));
                        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(),
@@ -99,7 +99,7 @@ class BaseShip extends BaseSimulator {
                        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(),
@@ -107,7 +107,7 @@ class BaseShip extends BaseSimulator {
                        ));
                        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(),
@@ -115,7 +115,7 @@ class BaseShip extends BaseSimulator {
                        ));
                        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(),
@@ -128,7 +128,7 @@ class BaseShip extends BaseSimulator {
                $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(),
index af742b3450c3ac5d18a994ce9ad1b9d952cfa543..4e8b1300e39636314cd1a5d7d4e02db679206436 100644 (file)
@@ -45,7 +45,7 @@ class PassengerShip extends BaseShip implements ConstructableShip {
 
                // 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__
                        ));
@@ -93,7 +93,7 @@ class PassengerShip extends BaseShip implements ConstructableShip {
                                        }
 
                                        // 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,
@@ -102,7 +102,7 @@ class PassengerShip extends BaseShip implements ConstructableShip {
                                }
                        } 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()
@@ -110,7 +110,7 @@ class PassengerShip extends BaseShip implements ConstructableShip {
                        }
                } // 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(),
index ea295b78e640f55a7fef4cecca96e3b2499205d2..095162292c401b03af018eaa43bae1d0c4d92ca6 100644 (file)
@@ -42,12 +42,6 @@ class EconomyCabin extends BaseCabin implements TradeableItem, ConstructableShip
                // 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);
 
index eb15261feea23c61e2bc6b907bfd41b2e8fb9229..367882872adabdc92bf0aff757d69642c18253eb 100644 (file)
@@ -42,12 +42,6 @@ class LowCabin extends BaseCabin implements TradeableItem, ConstructableShipPart
                // 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);
 
index 32dde8e2d20bf42c920ea2cb062cbc355b597d2d..3f181d8adede2e5105074af7be407a1da17bcdd6 100644 (file)
@@ -42,12 +42,6 @@ class LuxuryCabin extends BaseCabin implements TradeableItem, ConstructableShipP
                // 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);
 
index df8e09d7c321ecf91c9f0c40e187942047af9b3e..5a06df024b601f39a075442c05b5be3ec321db9d 100644 (file)
@@ -42,9 +42,6 @@ class PremierCabin extends BaseCabin implements TradeableItem, ConstructableShip
                // 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);
 
index a1843522e6a921d24274eaa79831cd895154fd10..d0c0aaa8b0326484e08bf4df7e0ff028db2eeace 100644 (file)
@@ -43,7 +43,7 @@ class BaseCabinStructure extends BaseStructure {
 
        // 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&uuml;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&uuml;r das Schiff <strong>%s</strong> konstruiert.",
                        __CLASS__,
                        __LINE__,
                        $cabinInstance->getObjectDescription(),
@@ -67,7 +67,7 @@ class BaseCabinStructure extends BaseStructure {
                $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(),
@@ -136,7 +136,7 @@ class BaseCabinStructure extends BaseStructure {
                        }
 
                        // 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,
index ce8abb43cc12e2880aa83702c898b5521b44bbc6..371a004d7bc5a06317c3fe28a9c4bfd58302463b 100644 (file)
@@ -36,7 +36,7 @@ class BaseDeckStructure extends BaseStructure {
 
        // 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&uuml;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&uuml;r das Schiff <strong>%s</strong> konstruiert.",
                        __CLASS__,
                        __LINE__,
                        $deckInstance->getObjectDescription(),
@@ -50,7 +50,7 @@ class BaseDeckStructure extends BaseStructure {
                $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(),
index f2966f9d8ff3a237f89604d51ec3ce4981d2aa3a..4f7163d16c7795201f783928b9a493527ab49beb 100644 (file)
@@ -42,12 +42,6 @@ class CarDeck extends BaseDeck implements TradeableItem, ConstructableShipPart {
                // 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);
 
index d5d6eaa36f1e30e9e90175f4d77df19ab85dd6b0..5fb92ebbb2b70801a8af68c57979ac4d2a6f4d7b 100644 (file)
@@ -42,12 +42,6 @@ class TrainDeck extends BaseDeck implements TradeableItem, ConstructableShipPart
                // 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);
 
index acace1e6a5d25bf3cccab32eb52c9e83cd5b7c32..75e342eb6b3f21075cdbdda9103a98636d7d6005 100644 (file)
@@ -43,12 +43,6 @@ class TruckDeck extends BaseDeck implements TradeableItem, ConstructableShipPart
                // 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);
 
index 7516c6695ebf6a572270877ae72525d2c164d5d2..ae3ca7d2d470aed76ff9c4986933aa2be1394bd8 100644 (file)
@@ -43,12 +43,6 @@ class Bridge extends BaseUpperStructure implements TradeableItem, ConstructableS
                // Get new instance
                $bridgeInstance = new Bridge();
 
-               // Debug message
-               if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $bridgeInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Br&uuml;cke wird konstruiert...",
-                       __CLASS__,
-                       __LINE__
-               ));
-
                // Abmasse setzen
                $bridgeInstance->setWidth($width);
                $bridgeInstance->setHeight($height);
diff --git a/application/ship-simu/templates/de/code/mail_debug.ctp b/application/ship-simu/templates/de/code/mail_debug.ctp
new file mode 100644 (file)
index 0000000..e62dd07
--- /dev/null
@@ -0,0 +1,25 @@
+<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>
index aae1ddcd1405f53e17eec54ef3153511209705f4..4451ec1c794c2dcb65e1e5df9b645057d28c0817 100644 (file)
@@ -1,6 +1,10 @@
-<mail>
-       <subject value="Anforderung deines Best&auml;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&auml;tigungslinks" />
+               <recipient-address value="{?email?}" />
+               <message>
                <![CDATA[Hallo {?username?}!
 
 Du (oder ein anderer) hattest soeben deinen Best&auml;tigungslink erneut angefordert. Solltest du dies nicht gewesen sein, bitten wir dich den Vorfall zu entschuldigen.
@@ -11,7 +15,7 @@ $config[base_url]/index.php?app=ship-simu&page=confirm&confirm={?confirm_hash?}
 
 Solltest du die URL nicht anklicken k&ouml;nnen, versuche diese in die Adresszeile deines Browsers zu kopieren.
 
-Alternativ kannst du im Spielebereich oder im Gastbereich unter Best&auml;tigungscode eingeben den folgenden Code reinkopieren:
+Alternativ kannst du im Spielebereich oder im Gastbereich unter Best&auml;tigungscode den folgenden Code reinkopieren oder eingeben:
 
 {?confirm_hash?}
 
@@ -21,8 +25,6 @@ Mit freundlichen Gr&uuml;&szlig;en,
   Dein {?app_short_name?}-Team
 
 {?mail_footer?}]]>
-       </message>
-       <text-converter>
-               html_entity_decode
-       </text-converter>
-</mail>
+               </message>
+       </mail-data>
+</text-mail>
index ecba6c92b9fce353c71d2b9deb0458b58bb8a9c3..6501b56f88e487826a4a53d6f19c10d1b0150fef 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
 <image>
        <type value="{?image_type?}" />
        <base>
index 0733edf0a94bae1283ca092ae865ce0c5f25f6fc..848d542cbf4659330f64d302b9ada063a6b37b1b 100644 (file)
@@ -34,8 +34,8 @@ class XmlNodeMismatchException extends FrameworkException {
                $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
index 2b7246d8c8fbfa74f105cae324fef817b7011b64..8d808b4decfd9f9e5f0ed92ef30f717a9b6ef56f 100644 (file)
  * 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);
 }
 
 //
index 34a55086a2b57e7fa5f774e029da3eb1a88a0caa..675254d53df51623b741beec852e8b8defd074c9 100644 (file)
  * 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
         *
@@ -50,14 +42,14 @@ interface DeliverableMail extends FrameworkInterface {
         *
         * @return      void
         */
-       function deliverEmail();
+       function deliverEmail ();
 
        /**
         * Send notification to the admin
         *
         * @return      void
         */
-       function sendAdminNotification();
+       function sendAdminNotification ();
 }
 
 //
index ad7bfafd588c9bd05c5dc4805705741b039b1185..4a6eb893e0418d524b38ba71681d6e859dc27db6 100644 (file)
@@ -218,7 +218,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $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()
                        ));
                }
@@ -285,7 +285,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                }
 
                // Output stub message
-               $this->getDebugInstance()->output(sprintf("[%s-&gt;%s] Stub! Args: %s",
+               $this->debugOutput(sprintf("[%s-&gt;%s] Stub! Args: %s",
                        $this->__toString(),
                        $methodName,
                        $argsString
@@ -956,8 +956,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        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",
@@ -989,13 +989,20 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @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()
@@ -1016,7 +1023,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                $methodName = "UnknownClass-&gt;unknownMethod";
                if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
                        $methodName = $backtrace[1]['class']."-&gt;".$backtrace[1]['function'];
-               }
+               } // END - if
 
                // Construct the full message
                $stubMessage = sprintf("[%s:] Partial stub!",
@@ -1027,12 +1034,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                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");
@@ -1056,10 +1063,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * 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();
 
@@ -1070,10 +1077,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        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);
                        }
                }
index 9ff8050ff29cb9fef45567da1c9fdfa78a60ec20..fda4669147c2e846a7262ffae0bf3d117da77c2c 100644 (file)
@@ -76,18 +76,9 @@ class WebResendLinkCommand extends BaseCommand implements Commandable {
                        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');
 
@@ -101,19 +92,34 @@ class WebResendLinkCommand extends BaseCommand implements Commandable {
                $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);
@@ -122,10 +128,10 @@ class WebResendLinkCommand extends BaseCommand implements Commandable {
                $mailerInstance->useSubjectFromTemplate();
 
                // Send the email out
-               $mailerInstance->deliverEmail();
+               $mailerInstance->deliverEmail($responseInstance);
 
                // Send out notification to admin (depends on settings)
-               $mailerInstance->sendAdminNotification();
+               $mailerInstance->sendAdminNotification($responseInstance);
        }
 
        /**
index 26c956b5b7ec91481588efd1128f756db2d79f85..80433e3da9be18d988c6104fff677f84d5d9e706 100644 (file)
@@ -56,7 +56,7 @@ class ConsoleTools extends BaseFrameworkSystem {
 
                        // 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
                        ));
@@ -71,7 +71,7 @@ class ConsoleTools extends BaseFrameworkSystem {
                                $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
                                ));
index 9b480db18b4de7e456f70f253cbe2fed5827d0f0..62c7d883f8b7f0d5528c514cc03123e1d4caec87 100644 (file)
@@ -26,8 +26,9 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper {
        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";
index 0f5af546d31a8905de293b74ec91d8df6f68e787..a29f5a19aba95cc1da3af4374863c623314a8384 100644 (file)
@@ -368,7 +368,7 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
                $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;
 
@@ -386,7 +386,7 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
                $imageContent = $templateInstance->getRawTemplateData();
 
                // Transfer all to the template engine
-               $templateInstance->renderImageContent($imageContent);
+               $templateInstance->renderXmlContent($imageContent);
        }
 }
 
index 3685bf7cf353af51b68f1865b355d2f1b5e743ce..2dcbd9315b386132448bba430f46cacc7c251573 100644 (file)
@@ -53,7 +53,7 @@ class BaseMailer extends BaseFrameworkSystem {
         * @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);
 
@@ -77,11 +77,66 @@ class BaseMailer extends BaseFrameworkSystem {
                // 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;
        }
 
        /**
@@ -90,7 +145,7 @@ class BaseMailer extends BaseFrameworkSystem {
         * @param       $templateName   Name of email template
         * @return      void
         */
-       protected final function setTemplateName ($templateName) {
+       public final function setTemplateName ($templateName) {
                $this->templateName = (string) $templateName;
        }
 
@@ -144,6 +199,15 @@ class BaseMailer extends BaseFrameworkSystem {
                // 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]
index ee6f3ee01d8c1c4e932c3d988a8212b39231f1b4..6a93267b474a837f61ce4b8ba44c157f66651295 100644 (file)
@@ -43,15 +43,23 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
         * 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;
        }
@@ -62,16 +70,109 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
         * @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();
        }
 }
 
index abf349150c8c92cd72b2479cfbcb804414d23995..7112907b855771d521da1e465aed5681d0c946e9 100644 (file)
@@ -216,7 +216,7 @@ class ImageResponse extends BaseFrameworkSystem implements Responseable {
                $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/");
index 7db635e0783f85671ee1f40c5c490dd1fb9c4776..4db73b617de299fc4c976bb955506c8a622ee28d 100644 (file)
@@ -174,7 +174,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * @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;
 
@@ -232,7 +232,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @param       $groupName      Name of variable group
         * @param       $add            Wether add this group
-        * @retur     void
+        * @retur4n     void
         */
        public function setVariableGroup ($groupName, $add = true) {
                // Set group name
@@ -461,7 +461,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * @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";
@@ -491,6 +491,8 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 
        /**
         * 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";
@@ -967,18 +969,12 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        );
 
                        // 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, "?>")));
@@ -1246,6 +1242,47 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                // 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]
index b47c706e9f60a9ef9ca649ee4d3d09484d30f63b..d60f102359ae04cd55c101a3008181c1d15f17f8 100644 (file)
@@ -112,37 +112,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
                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
         *
@@ -185,16 +154,16 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
         * @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: &gt;".$nodeName."&lt;<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;
                }
@@ -214,7 +183,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl
         * @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);
 
diff --git a/inc/classes/main/template/mail/.htaccess b/inc/classes/main/template/mail/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/template/mail/class_MailTemplateEngine.php b/inc/classes/main/template/mail/class_MailTemplateEngine.php
new file mode 100644 (file)
index 0000000..84a24f4
--- /dev/null
@@ -0,0 +1,362 @@
+<?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: &gt;".$element."&lt;<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: &gt;".$nodeName."&lt;<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]
+?>
index 8380c857273acd5dc8d750025755ffbf20da2e25..6b0491dbf18eae859b624f690e3babc79f68c3c9 100644 (file)
@@ -22,7 +22,7 @@
  * 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;
index 25125e5fdb4a61128fa05f81c4232a26562589f6..74c9416c91fc28c62e9bbfefd171c06cf9c5882f 100644 (file)
@@ -301,7 +301,28 @@ class FrameworkConfiguration implements Registerable {
                // 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]
 ?>
index ecba6c92b9fce353c71d2b9deb0458b58bb8a9c3..6501b56f88e487826a4a53d6f19c10d1b0150fef 100644 (file)
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
 <image>
        <type value="{?image_type?}" />
        <base>