application/ship-simu/main/factories/.htaccess -text
application/ship-simu/main/factories/class_ShipSimuWebNewsFactory.php -text
application/ship-simu/main/goverment/.htaccess -text
-application/ship-simu/main/goverment/class_SimpleGoverment.php -text
+application/ship-simu/main/goverment/class_SimplifiedGoverment.php -text
application/ship-simu/main/login/.htaccess -text
application/ship-simu/main/login/class_ShipSimuGuestLogin.php -text
application/ship-simu/main/login/class_ShipSimuUserLogin.php -text
application/ship-simu/main/user/extended/class_ShipSimuMember.php -text
application/ship-simu/main/wrapper/.htaccess -text
application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php -text
+application/ship-simu/main/wrapper/class_UserGovermentDatabaseWrapper.php -text
application/ship-simu/starter.php -text
application/ship-simu/templates/.htaccess -text
application/ship-simu/templates/de/.htaccess -text
/clear-cache.sh -text
db/.htaccess -text
db/company_user/.htaccess -text
+db/gov_user/.htaccess -text
db/news/.htaccess -text
db/user/.htaccess -text
db/user_points/.htaccess -text
inc/classes/exceptions/helper/class_FormGroupClosedException.php -text
inc/classes/exceptions/helper/class_FormOpenedException.php -text
inc/classes/exceptions/helper/class_InvalidFormNameException.php -text
+inc/classes/exceptions/helper/class_NoGroupOpenedException.php -text
inc/classes/exceptions/helper/class_UserInstanceMissingException.php -text
inc/classes/exceptions/io/.htaccess -text
inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text
inc/classes/main/controller/web/class_WebLoginFailedController.php -text
inc/classes/main/controller/web/class_WebLogoutDoneController.php -text
inc/classes/main/controller/web/class_WebRegisterController.php -text
+inc/classes/main/controller/web/class_WebStatusController.php -text
inc/classes/main/criteria/.htaccess -text
inc/classes/main/criteria/class_DataSetCriteria.php -text
inc/classes/main/criteria/class_SearchCriteria.php -text
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Application-Helper");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Tidy up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Application-Helper");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Tidy up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Applikationswechsler");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Remove system array and thousand seperator
$this->removeSystemArray();
$this->removeNumberFormaters();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Application-Helper");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Tidy up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
/**
// CFG: USER-POINTS-DB-WRAPPER-CLASS
$cfg->setConfigEntry('user_points_db_wrapper_class', "UserPointsDatabaseWrapper");
+// CFG: USER-GOVERMENT-WRAPPER
+$cfg->setConfigEntry('user_gov_wrapper_class', "UserGovermentDatabaseWrapper");
+
// CFG EMAIl-TPL-RESEND-LINK
$cfg->setConfigEntry('email_tpl_resend_link', "text");
$cfg->setConfigEntry('user_ppints_class', "UserPoints");
// CFG: GOVERMENT-CLASS
-$cfg->setConfigEntry('goverment_class', "SimpleGoverment");
+$cfg->setConfigEntry('goverment_class', "SimplifiedGoverment");
// CFG: BANK-CLASS
$cfg->setConfigEntry('bank_class', "MoneyBank");
class InvalidContractPartnerException extends FrameworkException {
public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:] <span id=\"exception_reason\">%s</span> ist kein gütiger Vertragspartner.",
- $class->__toString(),
- $class->getObjectDescription()
+ $message = sprintf("[%s:] Kein gütiger Vertragspartner.",
+ $class->__toString()
);
// Call parent constructor
class ItemNotInPriceListException extends FrameworkException {
public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[Merchant:] Preis für den Artikel <span id=\"exception_reason\">%s</span> <em><span id=\"exception_reason\">%s</span></em> nicht gefunden.",
- $class->__toString(),
- $class->getObjectDescription()
+ $message = sprintf("[Merchant:] Preis für den Artikel <span id=\"exception_reason\">%s</span> nicht gefunden.",
+ $class->__toString()
);
// Call parent constructor
class ItemNotTradeableException extends FrameworkException {
public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:] <span id=\"exception_reason\">%s</span> ist nicht handelbar!",
- $classArray[0]->__toString(),
- $classArray[1]->getObjectDescription()
+ $message = sprintf("[%s:] Object not tradeable.",
+ $classArray[0]->__toString()
);
// Call parent constructor
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Login welcome action");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Profile action");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Shipping comany action");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("A money bank class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
- $this->removeNumberFormaters();
$this->removeSystemArray();
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct($className);
- // Set description
- $this->setObjectDescription("Personal");
+ // Tidy up a little
+ $this->removeSystemArray();
+ $this->removeNumberFormaters();
}
// Remove min/max ages
// Call highest constructor
parent::__construct($className);
- // Set part description and class name
- $this->setObjectDescription("Simulator-Basis-Einheit");
-
// Clean up a little, dies sollte ganz zum Schluss erfolgen!
+ $this->removeSystemArray();
+ $this->removeNumberFormaters();
$this->removeResizeFactorArray();
$this->removeCurrPart();
$this->removeCurrShip();
$this->currShip = $shipInstance;
$this->currPart = $partInstance;
- if (defined('DEBUG_CORE')) $this->debugOutput(sprintf("[%s:] Maschinenraum mit Motor <strong>%s</strong> wird fuer das Schiff <strong>%s</strong> konstruiert.",
- $this->__toString(),
- $this->getCurrPart()->getObjectDescription(),
- $this->currShip->getShipName()
- ));
-
// Passt ueberhaupt das Schiffsteil in's Schiff?
if ($this->isShipPartSizeValid()) {
- // Berechnungen fuer umliegendes Objekt anpassen
- if (defined('DEBUG_CORE')) $this->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(),
- $this->currShip->getShipName()
- ));
-
// Muessen die Masse angepasst werden?
if ($this->isResizeFactorValid()) {
// Neue Angaben berechnen (wir lassen etwas Lust fuer Kabelbaeume, Roehren, Maschinisten, etc.)
// Passt dies nun immer noch?
if ($this->isNewSizeValid()) {
// Das passt auch, dann Werte setzen und Motor-Instanz merken
- 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()
- ));
$this->setWidth($this->newWidth);
$this->setHeight($this->newHeight);
$this->setLength($this->newLength);
// Existiert ein Schiffsteil?
if (!is_null($this->currPart)) {
- // Debug-Meldung ausgeben
- if (defined('DEBUG_CORE')) $this->debugOutput(sprintf("[%s:] Schiffsteil <strong>%s</strong> gefunden.",
- $this->getCurrPart()->realClass,
- $this->getCurrPart()->getObjectDescription()
- ));
-
// Schiffsteil-Instanz setzen
$this->setPartInstance($this->currPart);
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Händler");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeSystemArray();
}
// Secure pricing
$price = (float) $price;
- // Debug message
- if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Der Händler <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> "<strong>%s</strong>" zu <strong>%s</strong> verkaufen.",
- __CLASS__,
- __LINE__,
- $this->getMerchantName(),
- $itemInstance->__toString(),
- $itemInstance->getObjectDescription(),
- $this->formatCurrency($price)
- ));
-
// Construct pricing item and add it to the list
$this->priceList->append(array(
'item' => $itemInstance,
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Bauvertrag");
-
- // Unique-ID generieren
- $this->generateUniqueId();
-
// Clean up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
// Neuen Bauvertrag generieren
// Get new instance
$contractInstance = new WorksContract();
- // Debug-Meldung ausgeben
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->debugOutput(sprintf("[%s:%d] Neuer Bauvertrag wird für das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.",
- __CLASS__,
- __LINE__,
- $shipName,
- $partnerInstance->getObjectDescription(),
- $partnerInstance->getCompanyName()
- ));
-
// Schiffsnamen setzen
$contractInstance->setShipName($shipName);
// Get price for this item
$price = $this->getMerchantInstance()->getPriceFromList($partInstance);
- // Final debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> kostet <strong>%s</strong>.",
- __CLASS__,
- __LINE__,
- $partInstance->getObjectDescription(),
- $this->getMerchantInstance()->formatCurrency($price)
- ));
-
// Add price
$partInstance->setPrice($price);
-
- // Final debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.",
- __CLASS__,
- __LINE__,
- $partInstance->getObjectDescription()
- ));
}
// Setter for contract partner
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("User login handling command for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Registration handling command for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Registration handling command for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("User login handling command for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("A shipping company class");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
// Does the given user owns a company?
if ($companyInstance->ifUserParticipatesInCompany($userInstance)) {
- // Then do some nastly caching here but don't throw an exception
+ // Then do some nasty caching here but don't throw an exception
// because then you will hurt our web helpers... :/
$companyInstance->partialStub("Don't throw exceptions here.");
} // END - if
// Make this person employed and give him some money to work
$employee->setEmployed(true);
- $employee->setObjectDescription($dummy->getObjectDescription());
$employee->setRealClass($dummy->__toString());
$employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay?
$shipType
));
- // Debug message
- 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(),
- $shipInstance->getObjectDescription()
- ));
-
// Iterate shipyard list
for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) {
// Get current element
// 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->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> prüft den Bauauftrag der <strong>%s</strong>.",
- __CLASS__,
- __LINE__,
- $this->getCompanyName(),
- $contractInstance->getShipName()
- ));
-
// First get the ship type
$shipInstance = $contractInstance->getShipInstance();
// Get it's real class name
$shipType = $shipInstance->__toString();
- // Debug message
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> prüft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.",
- __CLASS__,
- __LINE__,
- $this->getCompanyName(),
- $contractInstance->getShipName(),
- $shipInstance->getObjectDescription()
- ));
-
// Now check if the ship type is in any list and return the result
return ($this->isShipTypeConstructable($shipType));
}
// As a customer the shipping company can add new contracts
public function addNewWorksContract (SignableContract $contractInstance) {
- if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag für ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.",
- __CLASS__,
- __LINE__,
- $this->getCompanyName(),
- $contractInstance->getShipInstance()->getObjectDescription(),
- $contractInstance->getShipInstance()->getShipName()
- ));
$this->contractList->append($contractInstance);
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Liegeplatz");
-
- // Generate unique ID number
- $this->generateUniqueId();
}
}
protected function __construct ($className) {
// Eltern-Konstrutor aufrufen
parent::__construct($className);
-
- // Set description
- $this->setObjectDescription("Namenlose Landkonstruktion");
-
- // Clean up a little
- $this->removeNumberFormaters();
}
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Trockendock");
-
- // Generate unique ID number
- $this->generateUniqueId();
}
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Hafen");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
- $this->removePartInstance();
}
// Creates a harbor
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Anlegebrücke");
-
- // Generate unique ID number
- $this->generateUniqueId();
}
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Werft");
-
// Staff-Liste/Schiffstyp-Liste erzeugen
$this->createStaffList();
$this->createShipTypeList();
-
- // Generate unique ID number
- $this->generateUniqueId();
}
// Create a shipyard and notify it about it's owner
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Set description
- $this->setObjectDescription("Namenloser Antrieb");
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removePartInstance();
}
// Setter-Methode fuert PS-Zahl
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Namenloser Motor");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// Einen Motor erstellen
$motorInstance = new Motor();
// Beschreibung und Abmasse setzen
- $motorInstance->setObjectDescription($descr);
$motorInstance->setWidth($w);
$motorInstance->setHeight($h);
$motorInstance->setLength($l);
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("News-Objektefabrik für Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
+++ /dev/null
-<?php
-/**
- * A goverment class with simplified ways...
- *
- * @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 SimpleGoverment extends BaseFrameworkSystem implements Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A class for simplified goverment");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
- }
-
- /**
- * Creates an instance of this goverment class by given user instance
- *
- * @param $userInstance The user instance
- * @return $govermentInstance Instance of the prepared goverment instance
- */
- public final static function createSimpleGoverment (ManageableAccount $userInstance) {
- // Get a new instance
- $govermentInstance = new SimpleGoverment();
-
- // Set the user instance
- $govermentInstance->setUserInstance($userInstance);
-
- // Return the prepared instance
- return $govermentInstance;
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+<?php
+/**
+ * A goverment class with simplified ways...
+ *
+ * @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
+ * @todo Find an interface for goverments
+ *
+ * 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 SimplifiedGoverment extends BaseFrameworkSystem implements Registerable {
+ // Constants
+ const STATUS_STARTER_HELP = "STARTER_HELP";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeSystemArray();
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * Creates an instance of this goverment class by given user instance
+ *
+ * @param $userInstance The user instance
+ * @return $govermentInstance Instance of the prepared goverment instance
+ */
+ public final static function createSimplifiedGoverment (ManageableAccount $userInstance) {
+ // Get a new instance
+ $govermentInstance = new SimplifiedGoverment();
+
+ // Set the user instance
+ $govermentInstance->setUserInstance($userInstance);
+
+ // Return the prepared instance
+ return $govermentInstance;
+ }
+
+ /**
+ * Checks wether the goverment has already payed a startup help to the
+ * current user
+ *
+ * @return $alreadyPayed Wether the goverment has already payed
+ */
+ public function ifGovermentAlreadyPayedStartupHelp () {
+ // Default is not payed
+ $alreadyPayed = false;
+
+ // Now get a search criteria and set the user's name as criteria
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+ $criteriaInstance->addCriteria('gov_uid', $this->getUserInstance()->getUserName());
+ $criteriaInstance->addCriteria('gov_activity_status', self::STATUS_STARTER_HELP);
+ $criteriaInstance->setLimit(1);
+
+ // Get a wrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class');
+
+ // Get result back
+ $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Was the query fine?
+ if ($resultInstance->getAffectedRows() === 1) {
+ // Entry found!
+ $alreadyPayed = true;
+ } // END - if
+
+ // Return the result
+ return $alreadyPayed;
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Guest login for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Login for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Login helper for Ship-Simu");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct($className) {
// Call parent constructor
parent::__construct($className);
-
- // Beschreibung
- $this->setObjectDescription("Schiffsteil");
-
- // Clean up a little
- $this->removeNumberFormaters();
}
// Setter for price
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Maschinenraum");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
// Maschinenraum erstellen
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Simulationspersonal");
-
- // Create unique ID
- $this->generateUniqueId();
-
- // Clean-up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Firmenangestellte(r)");
-
- // Create unique ID
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// Generate a specified amount of personell
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Ship-Simu registration class");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Call parent constructor
parent::__construct($className);
- // Set object description
- $this->setObjectDescription("Allgemeines Schiff");
-
// Prepare array object for all structures
$this->createStructuresArray();
// Clean-up a little
$this->removePartInstance();
- $this->removeNumberFormaters();
}
// Array-Objekt anlegen
// Instanz im Aufbauten-Array vermerken
$this->structures->append($partInstance);
- // Debug-Meldung ausgeben
- 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(),
- $partInstance->getObjectDescription()
- ));
-
// Alles klar!
return true;
}
// Eltern-Kontruktor aufrufen
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Passagier-Schiff");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
// Passagier-Schiff erstellen
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Set description
- $this->setObjectDescription("Schiffsstrukturen");
-
- // Clean up a little
- $this->removeNumberFormaters();
}
// Setter for price
// Call parent constructor
parent::__construct($className);
- // Set description
- $this->setObjectDescription("Kabine");
+ // Clean up a little
+ $this->removeSystemArray();
+ $this->removeNumberFormaters();
}
// Is this a cabin?
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Economy-Class-Kabine");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// Economy-Kabine erstellen
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("2Star-Class-Kabine");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// 2-Sterne-Klasse erstellen
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Luxuskabine");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// Eine Luxuskabine erstellen
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Premier-Class-Kabine");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// Premier-Kabine erstellen
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Set description
- $this->setObjectDescription("Kabinenstruktur");
}
// Kabine hinzufuegen
public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) {
- if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Die Kabine <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.",
- __CLASS__,
- __LINE__,
- $cabinInstance->getObjectDescription(),
- $shipInstance->getShipName()
- ));
-
// Eltern-Methode aufrufen
parent::addShipPartToShip ($shipInstance, $cabinInstance);
// Instanz setzen
$this->setDeckInstance($cabinInstance);
-
- // Einbaut-Meldung ausgeben
- 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(),
- $shipInstance->getShipName()
- ));
}
// Wrapper fuer setDeckInstance->setPartInstance
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Set description
- $this->setObjectDescription("Deckstruktur");
}
// Deckstruktur dem Schiff hinzufuegen
public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) {
- if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Deck <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.",
- __CLASS__,
- __LINE__,
- $deckInstance->getObjectDescription(),
- $shipInstance->getShipName()
- ));
-
// Eltern-Methode aufrufen
parent::addShipPartToShip($shipInstance, $deckInstance);
// Andere Daten uebertragen und von der Quelle loeschen
$this->setNumDecks($deckInstance->getNumDecks());
$deckInstance->removeNumDecks();
-
- 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(),
- $shipInstance->getShipName()
- ));
}
// Deckanzahl entfernen
class BaseUpperStructure extends BaseStructure {
/**
* Constructor for all super structures on a ship
+ *
+ * @return void
*/
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Set description
- $this->setObjectDescription("Aufbauten");
}
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Autodeck");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// Autodeck erstellen
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Zug-Deck");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// LKW-Deck erstellen
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("LKW-Deck");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
// LKW-Deck erstellen
class BaseDeck extends BaseDeckStructure {
/**
* Constructor for cargo decks in general
+ *
+ * @return void
*/
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
- // Set description
- $this->setObjectDescription("Allgemeines Deck");
+ // Clean up a little
+ $this->removeSystemArray();
+ $this->removeNumberFormaters();
}
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Brücke");
-
- // Generate unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
$this->removePartInstance();
}
// Get max allowed companies to found
$maxFound = $this->getConfigInstance()->readConfig('max_allowed_companies_found');
- // Get a company wrapper
- $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
-
// Now get a search criteria and set the user's name as criteria
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
$criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
$criteriaInstance->setLimit($maxFound);
+ // Get a company wrapper
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
+
// Do the count-select by criteria
$totalRows = $wrapperInstance->doSelectCountByCriteria($criteriaInstance);
} // END - if
// Just forward this request to the user points class
- $hasRequired = $pointsInstance->ifUserHasRequiredPoints ($action);
+ $hasRequired = $pointsInstance->ifUserHasRequiredPoints($action);
// Return the result
return $hasRequired;
*
* @return $bankLends Wether the money bank is able to lend money
*/
- public function ifUserAllowTakeCreditsFromMoneyBank () {
+ public function ifUserAllowedTakeCreditsFromMoneyBank () {
// Per default the money bank cannot pay
$bankLends = false;
} // END - if
// Does the money bank lend more money?
+ /** UNFINISHED PART!
if ($bankInstance->ifBankLendsMoreMoney()) {
// Okay, that they will do
$bankLends = true;
} // END - if
+ */
// Return result
return $bankLends;
} // END - if
// Now check if the user has maximum credits
+ /** UNFINISHED PART!
if ($bankInstance->ifUserHasMaxCredits()) {
// Yes, he does!
$hasMaxCredits = true;
} // END - if
+ */
// Return the result
return $hasMaxCredits;
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className = "") {
- // Is the class name empty? Then this is not a specialized user class
- if (empty($className)) $className = __CLASS__;
-
+ protected function __construct ($className = __CLASS__) {
// Call parent constructor
parent::__construct($className);
-
- // Set part description
- $this->setObjectDescription("Special ship-simu class");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
* @param $className Name of the class
* @return void
*/
- protected function __construct ($className = "") {
- // Is the class name empty? Then this is not a specialized user class
- if (empty($className)) $className = __CLASS__;
-
+ protected function __construct ($className = __CLASS__) {
// Call parent constructor
parent::__construct($className);
+ }
- // Set part description
- $this->setObjectDescription("Special member class for Ship-Simu");
+ /**
+ * Destructor for e.g. flushing pending updates to the database
+ *
+ * @return void
+ */
+ public function __destruct () {
+ // Flush any updated entries to the database
+ $this->flushPendingUpdates();
- // Create unique ID number
- $this->generateUniqueId();
+ // Call parent destructor
+ parent::__destruct();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A wrapper for database access to company data");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
--- /dev/null
+<?php
+/**
+ * A wrapper for database access to goverment->user data
+ *
+ * @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 UserGovermentDatabaseWrapper extends BaseDatabaseWrapper {
+ // Constants for database tables
+ const DB_TABLE_USER_GOVERMENT = "gov_user";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this wrapper class
+ *
+ * @return $wrapperInstance An instance of this wrapper class
+ */
+ public final static function createUserGovermentDatabaseWrapper () {
+ // Create a new instance
+ $wrapperInstance = new UserGovermentDatabaseWrapper();
+
+ // Set (primary!) table name
+ $wrapperInstance->setTableName(self::DB_TABLE_USER_GOVERMENT);
+
+ // Return the instance
+ return $wrapperInstance;
+ }
+}
+
+// [EOF]
+?>
// Get a link helper instance
$linkInstance = WebLinkHelper::createWebLinkHelper($this, 'company_links', 'index.php?app=ship-simu&page=login_area');
-// Preftech the user data
+// Prefetch the user data
$linkInstance->prefetchValueInstance('user');
+// Add link group for company founder
+$linkInstance->addLinkGroup('company_founder', "Vielleicht willst du eine virtuelle Reederei gründen, um dich virtuell selbstständig zu machen?");
+
// Maximum of allowed companies reached?
if ($linkInstance->getValueInstance()->ifUserCreatedMaximumAllowedCompanies()) {
- // No more companies allowed to create
+ // No more companies allowed to found
+ $linkInstance->addLinkNote("Du hast zu viele Firmen gegründet. Bitte denke über eine Fusion (Zusammenlegung) nach.");
} elseif ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('found_new_company')) {
// Enough money to found company
-} elseif ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applications')) {
+ $linkInstance->addActionLink('company_found', "Gründe eine virtuelle Firma und mache dich (virtuell) selbstständig.");
+} else {
+ // No more money left for founding company so place link here to refill page/money bank
+ if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) {
+ // Display link to money bank page
+ $linkInstance->addActionLink('moneybank', "Jetzt deinen Kredit tilgen.");
+ } elseif ($linkInstance->getValueInstance()->ifUserHasMaximumCreditsWithMoneyBank()) {
+ // Maximum credits reached which a money bank can lent
+ $linkInstance->addLinkNote("Die Bank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
+ $linkInstance->addActionLink('moneybank&sub=payback_credits', "Jetzt deinen Kredit tilgen.");
+ } else {
+ // Money bank is closed!
+ $linkInstance->addLinkNote("Die Bank hat derzeit geschlossen. Bitte später nochmal versuchen.");
+ }
+}
+
+// Add link group for goverment
+$linkInstance->addLinkGroup('goverment', "Bewerbe dich bei anderen Firmen und hole dir eine Starthilfe vom Staat ab wenn du nicht flüssig bist!");
+
+if ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applications')) {
// Enough money to write applications to other companies
+ $linkInstance->addActionLink('company_list', "Alle Firmen auflisten zum Bewerben.");
} elseif ($linkInstance->getValueInstance()->ifGovermentPaysStartupHelp()) {
// Display link to goverment for startup help
-} // END - if
+ $linkInstance->addActionLink('goverment&sub=request&request=startup_help', "Direkt zum Antragsformular für deine Starthilfe.");
+} else {
+ // Even goverment cannot help the gamer here
+ $linkInstance->addLinkNote("Leider kann dir der Staat nicht mehr weiterhelfen, dich zu bewerben, da du zu oft Starthilfen erhalten hast. Hier muss aber noch weiter am Spiel gearbeitet werden. :-)");
+}
+
+// Add link group for money bank
+$linkInstance->addLinkGroup('moneybank', "Leihe dir zu günstigen Zinsen virtuelles Geld aus, wenn du mehr brauchst!");
-if ($linkInstance->getValueInstance()->ifUserAllowTakeCreditsFromMoneyBank()) {
+if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) {
// Display link to money bank page
+ $linkInstance->addActionLink('moneybank', "Jetzt deinen Kredit tilgen.");
} elseif ($linkInstance->getValueInstance()->ifUserHasMaximumCreditsWithMoneyBank()) {
// Maximum credits reached which a money bank can lent
+ $linkInstance->addLinkNote("Die Bank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
+ $linkInstance->addActionLink('moneybank&sub=payback_credits', "Jetzt deinen Kredit tilgen.");
} else {
// Money bank is closed!
+ $linkInstance->addLinkNote("Die Bank hat derzeit geschlossen. Bitte später nochmal versuchen.");
}
+// Add link group for refill page
+$linkInstance->addLinkGroup('refill_page', "Hole dir virtuelles Geld von uns zu fairen Preisen!");
+
if ($linkInstance->ifRefillPageActive()) {
// Display link to refill page
+ $linkInstance->addActionLink('money_refill', "Jetzt dein virtuelles Geld aufladen.");
} else {
// Refill page not active
+ $linkInstance->addLinkNote("Das Aufladen ist derzeit nicht möglich oder gestört und wurde von uns deaktiviert.");
}
// Flush content to the template
// End of PHP commands
?>
-<div class="table_header" id="list_company_header">
- Auflistung der Reedereien, an denenen du dich beteiligst:
-</div>
+<div class="table_main" id="list_companies">
+ <div class="table_header">
+ Auflistung der Reedereien, an denenen du dich beteiligst:
+ </div>
-<div class="table_list">
- {?company_list?}
-</div>
+ <div class="table_list">
+ {?company_list?}
+ </div>
-<div class="table_footer">
- {?company_links?}
+ <div class="table_footer">
+ {?company_links?}
+ </div>
</div>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when a group was not opened before
+ *
+ * @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 NoGroupOpenedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $msgArray Array containing exception data
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $msgArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Group not opened before. Raw text follows: <span id=\"exception_reason\">%s</span>",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*/
public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Objects of type <span id=\"exception_reason\">%s</span> are not allowed here.",
+ $message = sprintf("[%s:%d] Object is not allowed here.",
$class->__toString(),
- $this->getLine(),
- $class->getObjectDescription()
+ $this->getLine()
);
// Call parent constructor
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Post registration action for logging in");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Logout action");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Web profile action");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Cookie-based login");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Memory cache");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
*/
private $realClass = "FrameworkSystem";
- /**
- * A human-readable description for this simulator part
- */
- private $objectDescription = "Namenlose Framework-Einheit";
-
- /**
- * The unique ID string for identifying all type of classes
- */
- private $uniqueID = "";
-
/**
* Thousands seperator
*/
// Is this object already destroyed?
if ($this->__toString() != 'DestructedObject') {
// Destroy all informations about this class but keep some text about it alive
- $this->setObjectDescription(sprintf("Removed object <em>%s</em>", $this->__toString()));
$this->setRealClass('DestructedObject');
- $this->resetUniqueID();
} elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
// Already destructed object
$this->debugOutput(sprintf("[%s:] The object <strong>%s</strong> is already destroyed.",
$this->realClass = $realClass;
}
- /**
- * Generate unique ID from a lot entropy
- *
- * @return void
- */
- public final function generateUniqueId () {
- // Is the id set for this class?
- if (empty($this->uniqueID)) {
-
- // Correct missing class name
- $corrected = false;
- if ($this->__toString() == "") {
- $this->setRealClass(__CLASS__);
- $corrected = true;
- }
-
- // Cache datbase instance
- $db = $this->getDatabaseInstance();
-
- // Generate new id
- $tempID = false;
- while (true) {
- // Generate a unique ID number
- $tempID = $this->generateIdNumber();
- $isUsed = false;
-
- // Try to figure out if the ID number is not yet used
- try {
- // Is this a registry?
- if ($this->__toString() == "Registry") {
- // Registry, then abort here
- break;
- } elseif (is_object($db)) {
- $isUsed = $db->isUniqueIdUsed($tempID, true);
- }
- } catch (FrameworkException $e) {
- // Catches all and ignores all ;-)
- }
-
- if (
- (
- $tempID !== false
- ) && (
- (
- $db === null
- ) || (
- (
- is_object($db)
- ) && (
- !$isUsed
- )
- )
- )
- ) {
- // Abort the loop
- break;
- }
- } // END - while
-
- // Apply the new ID
- $this->setUniqueID($tempID);
-
- // Revert maybe corrected class name
- if ($corrected) {
- $this->setRealClass("");
- }
-
- // Remove system classes if we are in a system class
- if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) {
- // This may save some RAM...
- $this->removeSystemArray();
- }
- }
- }
-
- /**
- * Generates a new ID number for classes based from the class' real name,
- * the description and some random data
- *
- * @return $tempID The new (temporary) ID number
- */
- private final function generateIdNumber () {
- return sprintf("%s@%s",
- $this->__toString(),
- md5(sprintf("%s:%s:%s:%s:%s:%s",
- $this->__toString(),
- $this->getObjectDescription(),
- time(),
- getenv('REMOTE_ADDR'),
- getenv('SERVER_ADDR'),
- mt_rand()
- ))
- );
- }
-
- /**
- * Setter for unique ID
- *
- * @param $uniqueID The newly generated unique ID number
- * @return void
- */
- private final function setUniqueID ($uniqueID) {
- // Cast to string
- $uniqueID = (string) $uniqueID;
-
- // Set the ID number
- $this->uniqueID = $uniqueID;
- }
-
- /**
- * Getter for unique ID
- *
- * @return $uniqueID The unique ID of this class
- */
- public final function getUniqueID () {
- return $this->uniqueID;
- }
-
- /**
- * Resets or recreates the unique ID number
- *
- * @return void
- */
- public final function resetUniqueID() {
- // Sweet and simple... ;-)
- $newUniqueID = $this->generateIdNumber();
- $this->setUniqueID($newUniqueID);
- }
-
- /**
- * Getter for simulator description
- *
- * @return $objectDescription The description of this simulation part
- */
- public final function getObjectDescription () {
- return $this->objectDescription;
- }
-
- /**
- * Setter for simulation part description
- *
- * @param $objectDescription The description as string for this simulation part
- * @return void
- */
- public final function setObjectDescription ($objectDescription) {
- $this->objectDescription = (String) $objectDescription;
- }
-
- /**
- * Validate if given object is the same as current
- *
- * @param $object An object instance for comparison with this class
- * @return boolean The result of comparing both's unique ID
- */
- public final function equals (FrameworkInterface $object) {
- return ($this->getUniqueID() == $object->getUniqueID());
- }
-
/**
* Compare if both simulation part description and class name matches
* (shall be enough)
*
* @param $itemInstance An object instance to an other class
* @return boolean The result of comparing class name simulation part description
+ * @deprecated
*/
public function itemMatches ($itemInstance) {
+ $this->partialStub("Deprecated!");
return (
(
$this->__toString() == $itemInstance->__toString()
unset($this->systemClasses);
}
- /**
- * Create a file name and path name from the object's unique ID number.
- * The left part of the ID shall always be a valid class name and the
- * right part an ID number.
- *
- * @return $pfn The file name with a prepended path name
- * @throws NoArrayCreatedException If explode() fails to create an array
- * @throws InvalidArrayCountException If the array contains less or
- * more than two elements
- */
- public final function getPathFileNameFromObject () {
- // Get the main object's unique ID. We use this as a path/filename combination
- $pathFile = $this->getUniqueID();
-
- // Split it up in path and file name
- $pathFile = explode("@", $pathFile);
-
- // Are there two elements? Index 0 is the path, 1 the file name + global extension
- if (!is_array($pathFile)) {
- // No array found
- throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED);
- } elseif (count($pathFile) != 2) {
- // Invalid ID returned!
- throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
- }
-
- // Auto-append missing trailing slash
- $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]);
-
- // Create the file name and return it
- $pfn = ($pathFile[0] . $pathFile[1]);
- return $pfn;
- }
-
/**
* Appends a trailing slash to a string
*
* @return $markedCode Marked PHP code
*/
public function markupCode ($phpCode) {
+ // Init marked code
+ $markedCode = "";
+
// Get last error
$errorArray = error_get_last();
// Init the code with error message
- $markedCode = "";
if (is_array($errorArray)) {
// Get error infos
$markedCode = sprintf("<div id=\"error_header\">File: <span id=\"error_data\">%s</span>, Line: <span id=\"error_data\">%s</span>, Message: <span id=\"error_data\">%s</span>, Type: <span id=\"error_data\">%s</span></div>",
foreach (explode("\n", $phpCode) as $lineNo=>$code) {
// Add line numbers
$markedCode .= sprintf("<span id=\"code_line\">%s</span>: %s\n",
- ($lineNo+1),
+ ($lineNo + 1),
htmlentities($code, ENT_QUOTES)
);
} // END - foreach
}
/**
- * Filter a given timestamp to make it look more beatifull for web-based
- * front-ends. If null is given a message id null_timestamp will be
- * resolved and returned.
+ * Filter a given GMT timestamp (non Uni* stamp!) to make it look more
+ * beatiful for web-based front-ends. If null is given a message id
+ * null_timestamp will be resolved and returned.
*
* @param $timestamp Timestamp to prepare (filter) for display
* @return $readable A readable timestamp
// Get a message string
$readable = $this->getLanguageInstance()->getMessage('null_timestamp');
} else {
- $this->partialStub("Do further analysis on timestamp {$timestamp}.");
+ switch ($this->getLanguageInstance()->getLanguageCode()) {
+ case "de": // German format is a bit different to default
+ // Split the GMT stamp up
+ $dateTime = explode(" ", $timestamp);
+ $dateArray = explode("-", $dateTime[0]);
+ $timeArray = explode(":", $dateTime[1]);
+
+ // Construct the timestamp
+ $readable = sprintf($this->getConfigInstance()->readConfig('german_date_time'),
+ $dateArray[0],
+ $dateArray[1],
+ $dateArray[2],
+ $timeArray[0],
+ $timeArray[1],
+ $timeArray[2]
+ );
+ break;
+
+ default: // Default is pass-through
+ $readable = $timestamp;
+ break;
+ }
}
// Return the stamp
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for confirmation link handling");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for handling forms on a centralized place");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the "home" page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the "login area" page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the login form page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the "login failed" page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the "logout done" page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the registration form");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for resending confirmation link");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("BZIP2 compressor");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("GZIP compressor");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Null compressor");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("General console tools");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Controller for handling forms");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default image controller");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default controller with news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Controller for confirmation link handling");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default controller for all other web requests");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default controller with news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Controller for login form");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Login failed controller");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Controller for login form");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Controller for register form");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
--- /dev/null
+<?php
+/**
+ * Controller for changing user status
+ *
+ * @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
+ * @todo This controller shall still provide some headlines for sidebars
+ *
+ * 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 WebStatusController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createWebStatusController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebStatusController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Storeable data set for databases");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Search criteria class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Update criteria class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Cryptographical helper");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct($class);
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
return $resultInstance;
}
+ /**
+ * Count the numbers of rows we shall receive
+ *
+ * @param $criteriaInstance An instance of a Criteria class
+ * @return $numRows Numbers of rows of database entries
+ */
+ public function doSelectCountByCriteria (Criteria $criteriaInstance) {
+ // Total numbers is zero by default
+ $numRows = 0;
+
+ // Get the result from above method
+ $resultInstance = $this->doSelectByCriteria($criteriaInstance);
+
+ // Was that query fine?
+ if ($resultInstance->ifStatusIsOkay()) {
+ // Then get the number of rows
+ $numRows = $resultInstance->getAffectedRows();
+ } // END - if
+
+ // Return the result
+ return $numRows;
+ }
+
/**
* Setter for table name
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Class for local file databases");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean up a little
+ $this->removeNumberFormaters();
$this->removeSystemArray();
}
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Database wrapper for news objects");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Database wrapper for user objects");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Database wrapper for user points objects");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Debug output for the console");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Debug output to error_log()");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Debug output for webpages");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set object description
- $this->setObjectDescription("Factory for cache objects");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set object description
- $this->setObjectDescription("Simple generic object factory");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Factory for webpages with news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A user authorization filter");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for email changes");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for password change");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for checking if rules where accepted");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("A concrete filter");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("A filter chain class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for checking encryption data");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for checking if username is the reserved guest login");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for downloading news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for processing news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A null filter");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("User status 'confirmed' update filter");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("User update filter");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for Email validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for Password validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for username validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for account password verification");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for confirmation code verification");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for Email validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for verifying graphical code CAPTCHAs");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for password verification");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for password verification");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for username verification");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for username verification");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for email changes");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for checking if the user account is unconfirmed");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A solveable CAPTCHA");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A image helper class");
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A solveable graphical code CAPTCHA");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseHelper extends BaseFrameworkSystem {
+ /**
+ * Instance to the class which provides field values
+ */
+ private $valueInstance = null;
+
/**
* Rendered content created by the helper class
*/
private $content = "";
/**
- * Instance to the class which provides field values
+ * Wether the group is opened or not
*/
- private $valueInstance = null;
+ private $groupOpened = false;
+
+ /**
+ * Wether the sub group is opened or not
+ */
+ private $subGroupOpened = false;
+
+ /**
+ * Name of the group
+ */
+ private $groupName = "";
+
+ /**
+ * Name of the sub group
+ */
+ private $subGroupId = "";
+
+ /**
+ * Previously opened group
+ */
+ private $previousGroupId = "";
+
+ /**
+ * Previously opened sub group
+ */
+ private $previousSubGroupId = "";
// Exception constants
const EXCEPTION_XML_PARSER_ERROR = 0x1e0;
const EXCEPTION_XML_NODE_UNKNOWN = 0x1e1;
const EXCEPTION_XML_NODE_MISMATCH = 0x1e2;
+ const EXCEPTION_GROUP_NOT_OPENED = 0x1e3;
/**
* Protected constructor
* @return void
*/
protected final function addContent ($newContent) {
- $this->content .= (string) trim($newContent)."\r\n";
+ $this->content .= (string) trim($newContent) . "\r\n";
}
/**
$fieldValue = $this->getValueField($fieldName);
// Assign it with a template variable
- $this->getTemplateInstance()->assignVariable("block_" . $fieldName, $fieldValue);
+ $this->getTemplateInstance()->assignVariable('block_' . $fieldName, $fieldValue);
}
/**
$fieldValue = $this->getValueField($fieldName);
// Now filter it through the value through the filter method
- $filteredValue = call_user_func_array(array($this, "doFilter" . $this->convertToClassName($filterMethod)), array($fieldValue));
+ $filteredValue = call_user_func_array(array($this, 'doFilter' . $this->convertToClassName($filterMethod)), array($fieldValue));
// Assign it with a template variable
- $this->getTemplateInstance()->assignVariable("block_" . $fieldName, $filteredValue);
+ $this->getTemplateInstance()->assignVariable('block_' . $fieldName, $filteredValue);
}
/**
public final function getValueInstance () {
return $this->valueInstance;
}
+
+ /**
+ * Check wether a group was opened previously
+ *
+ * @return $groupOpened Wether any group was opened before
+ */
+ protected final function ifGroupOpenedPreviously () {
+ $groupOpened = (!empty($this->previousGroupId));
+ return $groupOpened;
+ }
+
+ /**
+ * Check wether a group was opened previously
+ *
+ * @return $subGroupOpened Wether any group was opened before
+ */
+ protected final function ifSubGroupOpenedPreviously () {
+ $subGroupOpened = (!empty($this->previousSubGroupId));
+ return $subGroupOpened;
+ }
+
+ /**
+ * Getter for previous group id
+ *
+ * @return $previousGroupId Id of previously opened group
+ */
+ protected final function getPreviousGroupId () {
+ return $this->previousGroupId;
+ }
+
+ /**
+ * Setter for previous group id
+ *
+ * @param $previousGroupId Id of previously opened group
+ * @return void
+ */
+ protected final function setPreviousGroupId ($previousGroupId) {
+ $this->previousGroupId = (string) $previousGroupId;
+ }
+
+ /**
+ * Getter for previous sub group id
+ *
+ * @return $previousSubGroupId Id of previously opened sub group
+ */
+ protected final function getPreviousSubGroupId () {
+ return $this->previousSubGroupId;
+ }
+
+ /**
+ * Setter for previous sub group id
+ *
+ * @param $previousSubGroupId Id of previously opened sub group
+ * @return void
+ */
+ protected final function setPreviousSubGroupId ($previousSubGroupId) {
+ $this->previousSubGroupId = (string) $previousSubGroupId;
+ }
}
// [EOF]
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A helper for generating web blocks");
}
/**
*/
private $formName = "";
- /**
- * Wether the group is opened or not
- */
- private $groupOpened = false;
-
- /**
- * Wether the sub group is opened or not
- */
- private $subGroupOpened = false;
-
- /**
- * Name of the group
- */
- private $groupName = "";
-
- /**
- * Name of the sub group
- */
- private $subGroupName = "";
-
/**
* Wether form tag is enabled (default: true)
*/
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Helper class for HTML forms");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Set form name
$helperInstance->setFormName($formName);
+
// A form-less field may say "false" here...
if ($withForm === true) {
// Create the form
$this->addInputHiddenField('form', $this->getFormName());
// Is a group open?
- if ($this->groupOpened === true) {
+ if ($this->ifGroupOpenedPreviously()) {
// Then automatically close it here
$this->addFormGroup();
} // END - if
* Add a password input tag to the form or throw an exception if it is not
* yet opened. The field's name will be set as id.
*
- * @param $fieldName Input field name
- * @param $fieldValue Input default value (default: empty)
+ * @param $fieldName Input field name
+ * @param $fieldValue Input default value (default: empty)
* @return void
* @throws FormClosedException If the form is not yet opened
*/
* Add a hidden input tag to the form or throw an exception if it is not
* yet opened. The field's name will be set as id.
*
- * @param $fieldName Input field name
- * @param $fieldValue Input default value (default: empty)
+ * @param $fieldName Input field name
+ * @param $fieldValue Input default value (default: empty)
* @return void
* @throws FormClosedException If the form is not yet opened
*/
* Add a checkbox input tag to the form or throw an exception if it is not
* yet opened. The field's name will be set as id.
*
- * @param $fieldName Input field name
- * @param $fieldChecked Wether the field is checked (defaut: checked)
+ * @param $fieldName Input field name
+ * @param $fieldChecked Wether the field is checked (defaut: checked)
* @return void
* @throws FormClosedException If the form is not yet opened
*/
* Add a reset input tag to the form or throw an exception if it is not
* yet opened. The field's name will be set as id.
*
- * @param $buttonText Text displayed on the button
+ * @param $buttonText Text displayed on the button
* @return void
* @throws FormClosedException If the form is not yet opened
*/
/**
* Add a form group or close an already opened and open a new one
*
- * @param $groupName Name of the group or last opened if empty
+ * @param $groupId Name of the group or last opened if empty
* @param $groupText Text including HTML to show above this group
* @return void
* @throws FormClosedException If no form has been opened before
- * @throws EmptyVariableException If $groupName is not set
+ * @throws EmptyVariableException If $groupId is not set
*/
- public function addFormGroup ($groupName = "", $groupText = "") {
+ public function addFormGroup ($groupId = "", $groupText = "") {
// Is a form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw exception here
- throw new FormClosedException(array($this, $groupName), self::EXCEPTION_CLOSED_FORM);
+ throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM);
} // END - if
// At least the group name should be set
- if ((empty($groupName)) && ($this->groupOpened === false)) {
+ if ((empty($groupId)) && (!$this->ifGroupOpenedPreviously())) {
// Throw exception here
- throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (empty($groupName)) {
+ throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (empty($groupId)) {
// Close the last opened
- $groupName = $this->groupName;
+ $groupId = $this->getPreviousGroupId();
}
// Same group to open?
- if (($this->groupOpened === false) && ($groupName == $this->groupName)) {
+ if ((!$this->ifGroupOpenedPreviously()) && ($groupId == $this->getPreviousGroupId())) {
// Abort here silently
return false;
} // END - if
$content = " </div>\n</div><!-- Group - CLOSE //-->";
// Is this group opened?
- if ($this->groupOpened === false) {
+ if (!$this->ifGroupOpenedPreviously()) {
// Begin the div/span blocks
$content = sprintf("<!-- Group %s - OPEN //-->
<div class=\"group_box\" id=\"%s_group_box\">
%s
</span>
<div class=\"group_field\" id=\"%s_group_field\">",
- $groupName,
- $groupName,
- $groupName,
+ $groupId,
+ $groupId,
+ $groupId,
$groupText,
- $groupName
+ $groupId
);
- // Add the content
- $this->addContent($content);
-
// Switch the state
- $this->groupName = $groupName;
- $this->groupOpened = true;
+ $this->openGroupByIdContent($groupId, $content);
} else {
// Is a sub group opened?
- if ($this->subGroupOpened === true) {
+ if ($this->ifSubGroupOpenedPreviously()) {
// Close it here
$this->addFormSubGroup();
} // END - if
- // Add the content
- $this->addContent($content);
-
// Switch the state
- $this->groupOpened = false;
+ $this->closePreviousGroupByContent($content);
// All call it again if the group name is not empty
- if (!empty($groupName)) {
- $this->addFormGroup($groupName, $groupText);
+ if (!empty($groupId)) {
+ $this->addFormGroup($groupId, $groupText);
} // END - if
}
}
* throws an exception if no group has been opened before or if the sub
* group name is empty.
*
- * @param $subGroupName Name of the group or last opened if empty
+ * @param $subGroupId Name of the group or last opened if empty
* @param $subGroupText Text including HTML to show above this group
* @return void
- * @throws FormGroupClosedException If no group has been opened before
- * @throws EmptyVariableException If $subGroupName is not set
+ * @throws FormFormClosedException If no group has been opened before
+ * @throws EmptyVariableException If $subGroupId is not set
*/
- public function addFormSubGroup ($subGroupName = "", $subGroupText = "") {
+ public function addFormSubGroup ($subGroupId = "", $subGroupText = "") {
// Is a group opened?
- if ($this->groupOpened === false) {
+ if (!$this->ifGroupOpenedPreviously()) {
// Throw exception here
- throw new FormGroupClosedException(array($this, $subGroupName), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
+ throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
} // END - if
// At least the sub group name should be set
- if ((empty($subGroupName)) && ($this->subGroupOpened === false)) {
+ if ((empty($subGroupId)) && (!$this->ifSubGroupOpenedPreviously())) {
// Throw exception here
- throw new EmptyVariableException(array($this, 'groupName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (empty($subGroupName)) {
+ throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (empty($subGroupId)) {
// Close the last opened
- $subGroupName = $this->subGroupName;
+ $subGroupId = $this->getSubGroupId();
}
// Same sub group to open?
- if (($this->subGroupOpened === false) && ($subGroupName == $this->subGroupName)) {
+ if ((!$this->ifSubGroupOpenedPreviously()) && ($subGroupId == $this->getSubGroupId())) {
// Abort here silently
return false;
} // END - if
$content = " </div>\n</div><!-- Sub group- CLOSE //-->";
// Is this group opened?
- if ($this->subGroupOpened === false) {
+ if (!$this->ifSubGroupOpenedPreviously()) {
// Begin the span block
$content = sprintf("<!-- Sub group %s - OPEN //-->
<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
%s
</span>
<div class=\"subgroup_field\" id=\"%s_subgroup_field\">",
- $subGroupName,
- $subGroupName,
- $subGroupName,
+ $subGroupId,
+ $subGroupId,
+ $subGroupId,
$subGroupText,
- $subGroupName
+ $subGroupId
);
- // Add the content
- $this->addContent($content);
-
// Switch the state and remeber the name
- $this->subGroupOpened = true;
- $this->subGroupName = $subGroupName;
+ $this->openSubGroupByIdContent($subGroupId, $content);
} else {
- // Add the content
- $this->addContent($content);
-
// Switch the state
- $this->subGroupOpened = false;
+ $this->closePreviousSubGroupByContent($content);
// All call it again if sub group name is not empty
- if (!empty($subGroupName)) {
- $this->addFormSubGroup($subGroupName, $subGroupText);
+ if (!empty($subGroupId)) {
+ $this->addFormSubGroup($subGroupId, $subGroupText);
} // END - if
}
}
// Set the block type
$block = "div";
- if ($this->groupOpened === true) $block = "span";
+ if ($this->ifGroupOpenedPreviously()) $block = "span";
// Generate the content
$inputContent = sprintf(" <%s id=\"%s_text\">
} // END - if
// Is a group open?
- if ($this->groupOpened === true) {
+ if ($this->ifGroupOpenedPreviously()) {
// Then automatically close it here
$this->addFormGroup();
} // END - if
$extraInstance = Registry::getRegistry()->getInstance('extra');
// Get a configured instance
- $captchaInstance = ObjectFactory::createObjectByConfiguredName($this->getFormName()."_captcha", array($this, $extraInstance));
+ $captchaInstance = ObjectFactory::createObjectByConfiguredName($this->getFormName().'_captcha', array($this, $extraInstance));
// Initiate the CAPTCHA
$captchaInstance->initiateCaptcha();
// Close the form automatically
$this->addFormTag();
} elseif ($this->formEnabled === false) {
- if ($this->subGroupOpened === true) {
+ if ($this->ifSubGroupOpenedPreviously()) {
// Close sub group
$this->addFormSubGroup();
- } elseif ($this->groupOpened === true) {
+ } elseif ($this->ifGroupOpenedPreviously()) {
// Close group
$this->addFormGroup();
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A helper for generating web links");
}
/**
* Flush the content out,e g. to a template variable
*
* @return void
+ * @todo Completely unimplemented
*/
public function flushContent () {
- $this->partialStub("Please implement this method.");
+ // Needed to be implemented!
+ }
+
+ /**
+ * Adds a link group (like the form group is) with some raw language to the
+ * helper.
+ *
+ * @param $groupId Id string of the group
+ * @param $groupText Text for this group to add
+ * @return void
+ */
+ public function addLinkGroup ($groupId, $groupText) {
+ // Is a group with that name open?
+ if ($this->ifGroupIsOpened($groupId)) {
+ // Then close it here
+ $this->closeGroupById($groupId);
+ } else {
+ // Open the new group
+ $this->openGroupByIdText($groupId, $groupText);
+ }
+ }
+
+ /**
+ * Adds text (note) to the previously opened group or throws an exception
+ * if no previous group was opened.
+ *
+ * @param $groupNote Note to be added to a group
+ * @return void
+ * @throws NoGroupOpenedException If no previous group was opened
+ */
+ public function addLinkNote ($groupNote) {
+ // Check if a previous group was opened
+ if (!$this->ifGroupOpenedPreviously()) {
+ // No group was opened before!
+ throw new NoGroupOpenedException(array($this, $groupNote), self::EXCEPTION_GROUP_NOT_OPENED);
+ }
}
}
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("PNG image");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Universal file I/O stream system");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Helper for handling directories");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
+ $this->removeSystemArray();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Handler for reading from files");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
+ $this->removeSystemArray();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Handler for writing to files");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
+ $this->removeSystemArray();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Language sub-system");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A mailer for debugging purposes");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Console output class");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Class for web output e.g. XHTML code");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Class for handling user points");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Default news reader");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Registry class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("HTTP request");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local web actions");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Web"
$this->setActionPrefix("Web");
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local image commands");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Image"
$this->setCommandPrefix("Image");
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local web commands");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Web"
$this->setCommandPrefix("Web");
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local web controllers");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Image"
$this->setControllerPrefix("Image");
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local web controllers");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Web"
$this->setControllerPrefix("Web");
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("HTTP response");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("HTTP response");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Database result");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
$nextValid = false;
// Is the result valid?
- if ($this->resultArray['status'] === "ok") {
- // The status is fine so let's have a look for the next entry
- if ($this->valid()) {
- // Next entry found, so count one up and cache it
- $this->currentPos++;
- $this->currentRow = $this->resultArray['rows'][$this->currentPos];
- $nextValid = true;
- } // END - if
+ if ($this->valid()) {
+ // Next entry found, so count one up and cache it
+ $this->currentPos++;
+ $this->currentRow = $this->resultArray['rows'][$this->currentPos];
+ $nextValid = true;
} // END - if
// Return the result
$isValid = false;
// Check if
- if ((isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
+ if (($this->ifStatusIsOkay()) && (isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
// All fine!
$isValid = true;
} // END - if
return $isValid;
}
+ /**
+ * Determines wether the status of the query was fine ("ok")
+ *
+ * @return $ifStatusOkay Wether the status of the query was okay
+ */
+ public function ifStatusIsOkay () {
+ return ((isset($this->resultArray['status'])) && ($this->resultArray['status'] === "ok"));
+ }
+
/**
* Gets the current key of iteration
*
// Call parent constructor
parent::__construct($className);
- // Set part description
- $this->setObjectDescription("Standard random number generator");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Yet-another fixed salt. This is not dependend on server software or date
if ($extraInstance instanceof FrameworkInterface) {
// With extra instance information
- $this->fixedSalt = sha1($serverIp . ":" . $extraInstance->__toString() . ":" . serialize($this->getDatabaseInstance()->getConnectionData()) . ":" . $extraInstance->getObjectDescription());
+ $this->fixedSalt = sha1($serverIp . ":" . $extraInstance->__toString() . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
} else {
// Without extra information
$this->fixedSalt = sha1($serverIp . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Image template engine");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Mail template engine");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Web template engine");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Generic guest class");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Generic user class");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Komprimierungshandler");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Datenbank-Mittelschicht");
-
- // Create an unique ID
- $this->generateUniqueId();
}
// Create new database connection layer
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Debug-Ausgabe-Instance");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Set own instance
self::$thisInstance = $this;
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Datei-Ein-/Ausgabe-Handler");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Set own instance
self::$thisInstance = $this;
}
// CFG: DB-UPDATE-PRIMARY-FORCED
$cfg->setConfigEntry('db_update_primary_forced', "Y");
+// CFG: GERMAN-DATE-TIME
+$cfg->setConfigEntry('german_date_time', "%3\$s.%2\$s.%1\$s, %4\$s:%5\$s:%6\$s");
+
// [EOF]
?>
#!/bin/sh
-echo "$0: Cleaning up..."
-rm -f shipsimu_dev*.zip
+sh ./clear-cache.sh
echo "$0: Packaging..."
zip -9 shipsimu_dev.zip docs/* Doxyfile *.php *.sh > /dev/null 2>&1
zip -9r shipsimu_dev.zip application/ db/ devel/ Doxyfile inc/ templates/ tests/ > /dev/null 2>&1
-zip -d shipsimu_dev.zip docs/warn.log db/user/*.serialized templates/images/_cache/*.png application/ship-simu/templates/images/_cache/*.png > /dev/null 2>&1
+zip -d shipsimu_dev.zip docs/warn.log db/*/*.serialized > /dev/null 2>&1
echo "$0: Renaming..."
mv shipsimu_dev.zip shipsimu_dev_`date +%Y%m%d_%H%M%S`.zip