application/ship-simu/starter.php -text
application/ship-simu/templates/.htaccess -text
application/ship-simu/templates/de/.htaccess -text
+application/ship-simu/templates/de/code/captch_graphic_code.ctp -text
application/ship-simu/templates/de/code/footer.ctp -text
application/ship-simu/templates/de/code/header.ctp -text
application/ship-simu/templates/de/code/home.ctp -text
inc/classes/exceptions/user/class_UsernameMissingException.php -text
inc/classes/exceptions/xml/.htaccess -text
inc/classes/exceptions/xml/class_InvalidXmlNodeException.php -text
+inc/classes/exceptions/xml/class_XmlNodeMismatchException.php -text
inc/classes/exceptions/xml/class_XmlParserException.php -text
inc/classes/interfaces/.htaccess -text
inc/classes/interfaces/actions/.htaccess -text
templates/de/code/header.ctp -text
templates/de/html/.htaccess -text
templates/images/.htaccess -text
+templates/images/_cache/.htaccess -text
templates/images/de/.htaccess -text
templates/images/de/image/.htaccess -text
-templates/images/de/image/base_image.img -text
-templates/images/de/image/emergency_exit.img -text
+templates/images/de/image/base_image.itp -text
+templates/images/de/image/emergency_exit.itp -text
tests/ConfigTest.php -text
tests/RegistryTest.php -text
tests/RequestTest.php -text
$e->getHexCode(),
$e->getMessage(),
$e->getPrintableBackTrace()
- ));
+ ),
+ $e->getHexCode(),
+ $e->getExtraData()
+ );
} // END - function
// Set the new handler
private $authMethod = "";
// Exception constants
- const EXCEPTION_INVALID_USER_INSTANCE = 0x080;
+ const EXCEPTION_INVALID_USER_INSTANCE = 0x900;
/**
* Protected constructor
--- /dev/null
+<?php
+// Get a helper instance without a form tag
+$helper = WebFormHelper::createWebFormHelper($this, "captcha_code", false, false);
+$helper->addFormGroup('captcha_code', "Unser Spiel ist durch ein grafisches CAPTCHA gesichert. Du musst den angezeigten Code wiederholen, damit du unser Spiel nutzen kannst.");
+$helper->addFieldText('captcha_code', "Bitte wiederhole den Code:");
+$helper->addInputTextField('captcha_code');
+$helper->flushContent();
+
+// [EOF]
+?>
+<div id="captcha_image">
+ <img src="$config[base_url]/index.php?app=ship-simu&page=captcha_image&encrypt={?encrypted_code?}&response=image" alt="CAPTCHA-Bild" title="CAPTCHA-Bild" id="captcha_img" />
+</div>
+<div id="captcha_code">
+ {?captcha_code?}
+</div>
*/
private $backTrace = array();
+ /**
+ * Extra data
+ */
+ private $extraData = "";
+
/**
* The super constructor for all exceptions
*
$message = (string) $message;
$code = (int) $code;
+ // In emergency exit?
+ if (defined('EMERGENCY_EXIT_CALLED')) {
+ // Output message
+ printf("[%s:] Message: %s, Backtrace: <pre>%s</pre>",
+ $this->__toString(),
+ $message,
+ $this->getPrintableBackTrace()
+ );
+
+ // End here
+ exit;
+ } // END - if
+
// Make sure everything is assigned properly
parent::__construct($message, $code);
}
// Return it
return $hexCode;
}
+
+ /**
+ * Setter for extra data
+ *
+ * @param $extraData Extra data to store
+ * @return void
+ */
+ protected final function setExtraData ($extraData) {
+ $this->extraData = $extraData;
+ }
+
+ /**
+ * Getter for extra data
+ *
+ * @return $extraData Extra data to store
+ */
+ public final function getExtraData () {
+ return $this->extraData;
+ }
}
// [EOF]
$msgArray[1]
);
+ // Set extra data
+ $this->setExtraData($msgArray[1]);
+
// Call parent constructor
parent::__construct($message, $code);
}
$classArray[1],
$attributes
);
- die($message);
// Call parent exception constructor
parent::__construct($message, $code);
--- /dev/null
+<?php
+/**
+ * An exception thrown when an XML node does not match the excepted
+ *
+ * @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 XmlNodeMismatchException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $classArray Array holding the exception data
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Construct our message
+ $message = sprintf("[%s:%d] XML nodes mismatch. Given: %s, Expected: %s",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $lassArray[1],
+ $lassArray[2]
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*/
private $resolverInstance = null;
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = null;
+
/**
* The real class name
*/
}
}
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ protected final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
/**
* Setter for search instance
*
// Assign all the application's data with template variables
$templateInstance->assignApplicationData($appInstance);
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
// Load the master template
$masterTemplate = $appInstance->getMasterTemplate();
*/
abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface {
// Constants for exceptions
- const EXCEPTION_SQL_QUERY = 0x050;
+ const EXCEPTION_SQL_QUERY = 0x500;
/**
* The limiter instance
class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
// Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
- const DB_CODE_TABLE_MISSING = 0x010;
- const DB_CODE_TABLE_UNWRITEABLE = 0x011;
- const DB_CODE_DATA_FILE_CORRUPT = 0x012;
+ const DB_CODE_TABLE_MISSING = 0x100;
+ const DB_CODE_TABLE_UNWRITEABLE = 0x101;
+ const DB_CODE_DATA_FILE_CORRUPT = 0x102;
/**
* Save path for "file database"
private $cacheInstance = null;
// Constants for exceptions
- const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x070;
+ const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x700;
// Constants for database columns
private $cacheInstance = null;
// Constants for exceptions
- const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x070;
+ const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x800;
// Constants for database columns
const DB_COLUMN_USERNAME = "username";
*/
class UserAuthFilter extends BaseFilter implements Filterable {
// Exception constants
- const EXCEPTION_AUTH_DATA_INVALID = 0x0a0;
+ const EXCEPTION_AUTH_DATA_INVALID = 0xb00;
/**
* The login method we shall choose
*/
class BaseFilter extends BaseFrameworkSystem {
// Exception constants
- const EXCEPTION_FILTER_CHAIN_ABORTED = 0x090;
+ const EXCEPTION_FILTER_CHAIN_ABORTED = 0xa00;
/**
* Protected constructor
*/
class BaseHelper extends BaseFrameworkSystem {
// Exception constants
- const EXCEPTION_XML_PARSER_ERROR = 0x0d0;
- const EXCEPTION_XML_NODE_UNKNOWN = 0x0d1;
-
- /**
- * Template engine instance
- */
- private $templateInstance = null;
+ const EXCEPTION_XML_PARSER_ERROR = 0xe00;
+ const EXCEPTION_XML_NODE_UNKNOWN = 0xe01;
+ const EXCEPTION_XML_NODE_MISMATCH = 0xe02;
/**
* Rendered content created by the helper class
$this->removeSystemArray();
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a template engine class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a template engine class
- */
- protected final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Add content
*
*/
private $imageType = "png";
+ /**
+ * The image name
+ */
+ private $imageName = "";
+
/**
* Width of the image in pixel
*/
);
/**
- * Image message string
+ * All image strings
*/
- private $imageString = "No message set!";
+ private $imageStrings = array();
+
+ /**
+ * Current string name
+ */
+ private $currString = "";
/**
* Protected constructor
}
/**
- * Getter for image type
+ * Getter for image name
*
* @return $imageType Type of the image
*/
return $this->imageType;
}
+ /**
+ * Setter for base image
+ *
+ * @param $baseImage A base image template
+ * @return void
+ */
+ public final function setBaseImage ($baseImage) {
+ $this->baseImage = (string) $baseImage;
+ }
+
+ /**
+ * Getter for base image
+ *
+ * @return $baseImage A base image template
+ */
+ public final function getBaseImage () {
+ return $this->baseImage;
+ }
+
+ /**
+ * Setter for image name
+ *
+ * @param $imageName Name of the image
+ * @return void
+ */
+ public final function setImageName ($imageName) {
+ $this->imageName = (string) $imageName;
+ }
+
+ /**
+ * Getter for image name
+ *
+ * @return $imageName Name of the image
+ */
+ protected final function getImageName () {
+ return $this->imageName;
+ }
+
/**
* Setter for image width
*
$this->foregroundColor['blue'] = (int) $blue;
}
+ /**
+ * Adds an image string to the buffer by the given string name
+ *
+ * @param $stringName String name (identifier)
+ */
+ public function addTextLine ($stringName) {
+ // Create the image string
+ $this->imageStrings[$stringName] = array(
+ 'x' => "",
+ 'y' => "",
+ 'size' => "",
+ 'string' => ""
+ );
+
+ // Set current string name
+ $this->currString = $stringName;
+ }
+
/**
* Setter for image message string
*
* @return void
*/
public final function setImageString ($imageString) {
- $this->imageString = (string) $imageString;
+ $this->imageStrings[$this->currString]['string'] = (string) $imageString;
}
/**
* @return $imageString A message to display in the image
*/
public final function getImageString () {
- return $this->imageString;
+ return $this->imageStrings[$this->currString]['string'];
}
/**
- * Setter for base image
+ * Setter for X/Y coordinates for strings
*
- * @param $baseImage A base image template
+ * @param $x X coordinate
+ * @param $y Y coordinate
* @return void
*/
- public final function setBaseImage ($baseImage) {
- $this->baseImage = (string) $baseImage;
+ public final function setCoord ($x, $y) {
+ $this->imageStrings[$this->currString]['x'] = (int) $x;
+ $this->imageStrings[$this->currString]['y'] = (int) $y;
}
/**
- * Getter for base image
+ * Getter for X coordinate
*
- * @return $baseImage A base image template
+ * @return $x X coordinate
*/
- public final function getBaseImage () {
- return $this->baseImage;
+ public final function getX () {
+ return $this->imageStrings[$this->currString]['x'];
+ }
+
+ /**
+ * Getter for Y coordinate
+ *
+ * @return $y Y coordinate
+ */
+ public final function getY () {
+ return $this->imageStrings[$this->currString]['y'];
+ }
+
+ /**
+ * Setter for font size
+ *
+ * @param $fontSize Font size for strings
+ * @return void
+ */
+ public final function setFontSize ($fontSize) {
+ $this->imageStrings[$this->currString]['size'] = (int) $fontSize;
+ }
+
+ /**
+ * Getter for font size
+ *
+ * @return $fontSize Font size for strings
+ */
+ public final function getFontSize () {
+ return $this->imageStrings[$this->currString]['size'];
}
/**
$templateInstance->loadCodeTemplate($this->getBaseImage());
// Assign all the image values with the template
+ $templateInstance->assignVariable("image_name" , $this->getImageName());
$templateInstance->assignVariable("image_type" , $this->getImageType());
$templateInstance->assignVariable("image_width" , $this->getWidth());
$templateInstance->assignVariable("image_height" , $this->getHeight());
$templateInstance->assignVariable("image_fg_red" , $this->foregroundColor['red']);
$templateInstance->assignVariable("image_fg_green", $this->foregroundColor['green']);
$templateInstance->assignVariable("image_fg_blue" , $this->foregroundColor['blue']);
- $templateInstance->assignVariable("image_string" , $this->getImageString());
+
+ // Add all strings
+ foreach ($this->imageStrings as $id=>$imageString) {
+ // Set current string id
+ $this->currString = $id;
+
+ // Set variable group
+ $templateInstance->setVariableGroup($id);
+
+ // Add group variables
+ $templateInstance->addGroupVariable("image_x" , $this->getX());
+ $templateInstance->addGroupVariable("image_y" , $this->getY());
+ $templateInstance->addGroupVariable("image_size" , $this->getFontSize());
+ $templateInstance->addGroupVariable("image_string", $this->getImageString());
+ } // END - foreach
// Get the raw content
$imageContent = $templateInstance->getRawTemplateData();
private $formEnabled = true;
// Class Constants
- const EXCEPTION_FORM_NAME_INVALID = 0x030;
- const EXCEPTION_CLOSED_FORM = 0x031;
- const EXCEPTION_OPENED_FORM = 0x032;
- const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0x033;
+ const EXCEPTION_FORM_NAME_INVALID = 0x300;
+ const EXCEPTION_CLOSED_FORM = 0x301;
+ const EXCEPTION_OPENED_FORM = 0x302;
+ const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0x303;
/**
* Protected constructor
// Get a new instance
$imageInstance = new ???Image();
+ // Set image type
+ $imageInstance->setImageType("???");
+
// Return the instance
return $imageInstance;
}
* 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 BaseImage extends BaseFrameworkSystem {
+class BaseImage extends BaseFrameworkSystem implements Registerable {
+ /**
+ * Image type
+ */
+ private $imageType = "";
+
+ /**
+ * Width of the image
+ */
+ private $width = "";
+
+ /**
+ * Height of the image
+ */
+ private $height = "";
+
+ /**
+ * Background color in RGB
+ */
+ private $backgroundColor = array(
+ 'red' => "",
+ 'green' => "",
+ 'blue' => ""
+ );
+
+ /**
+ * Foreground color in RGB
+ */
+ private $foregroundColor = array(
+ 'red' => "",
+ 'green' => "",
+ 'blue' => ""
+ );
+
+ /**
+ * Current choosen color array
+ */
+ private $colorMode = "";
+
+ /**
+ * Image resource
+ */
+ private $imageResource = null;
+
+ /**
+ * Image name
+ */
+ private $imageName = "";
+
+ /**
+ * String name
+ */
+ private $stringName = "";
+
+ /**
+ * Groupable image strings?
+ */
+ private $groupable = "single";
+
/**
* Protected constructor
*
$this->removeNumberFormaters();
$this->removeSystemArray();
}
-}
+ /**
+ * Private setter for all colors
+ *
+ * @param $colorMode Wether background or foreground color
+ * @param $colorChannel Red, green or blue channel?
+ * @param $colorValue Value to set
+ */
+ private final function setColor ($colorMode, $colorChannel, $colorValue) {
+ // Construct the eval() command
+ $eval = sprintf("\$this->%s['%s'] = \"%s\";",
+ $colorMode,
+ $colorChannel,
+ $colorValue
+ );
+
+ // Run the command
+ //* DEBUG: */ echo "mode={$colorMode}, channel={$colorChannel}, value={$colorValue}<br />\n";
+ eval($eval);
+ }
+
+ /**
+ * Setter for image width
+ *
+ * @param $width Width of the image
+ * @return void
+ */
+ public final function setWidth ($width) {
+ $this->width = $width;
+ }
+
+ /**
+ * Getter for image width
+ *
+ * @return $width Width of the image
+ */
+ public final function getWidth () {
+ return $this->width;
+ }
+
+ /**
+ * Setter for image height
+ *
+ * @param $height Height of the image
+ * @return void
+ */
+ public final function setHeight ($height) {
+ $this->height = $height;
+ }
+
+ /**
+ * Getter for image height
+ *
+ * @return $height Height of the image
+ */
+ public final function getHeight () {
+ return $this->height;
+ }
+
+ /**
+ * Finish the type handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishType () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Prepares the class for resolution (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function initResolution () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Finish resolution handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishResolution () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Prepares the class for base (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function initBase () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Finish base handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishBase () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Prepares the class for background color
+ *
+ * @return void
+ */
+ public function initBackgroundColor () {
+ $this->colorMode = "backgroundColor";
+ }
+
+ /**
+ * Finish background color handling
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishBackgroundColor () {
+ // Empty at the moment
+ }
+
+ /**
+ * Prepares the class for foreground color
+ *
+ * @return void
+ */
+ public function initForegroundColor () {
+ $this->colorMode = "foregroundColor";
+ }
+
+ /**
+ * Finish foreground color handling
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishForegroundColor () {
+ // Empty at the moment
+ }
+
+ /**
+ * Prepares the class for string (unused at the moment)
+ *
+ * @param $groupable Wether this image string is groupable or single
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function initImageString ($groupable = "single") {
+ $this->groupable = $groupable;
+ }
+
+ /**
+ * Finish string handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishImageString () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Setter for red color
+ *
+ * @param $red Red color value
+ * @return void
+ */
+ public final function setRed ($red) {
+ // Get array name
+ $arrayName = $this->colorMode;
+
+ // Set image color
+ $this->setColor($arrayName, 'red', $red);
+ }
+
+ /**
+ * Setter for green color
+ *
+ * @param $green Green color value
+ * @return void
+ */
+ public final function setGreen ($green) {
+ // Get array name
+ $arrayName = $this->colorMode;
+
+ // Set image color
+ $this->setColor($arrayName, 'green', $green);
+ }
+
+ /**
+ * Setter for blue color
+ *
+ * @param $blue Blue color value
+ * @return void
+ */
+ public final function setBlue ($blue) {
+ // Get array name
+ $arrayName = $this->colorMode;
+
+ // Set image color
+ $this->setColor($arrayName, 'blue', $blue);
+ }
+
+ /**
+ * Setter for image string
+ *
+ * @param $string String to set in image
+ * @return void
+ */
+ public final function setString ($string) {
+ $this->imageString = (string) $string;
+ }
+
+ /**
+ * Getter for image string
+ *
+ * @return $string String to set in image
+ */
+ public final function getString () {
+ return $this->imageString;
+ }
+
+ /**
+ * Setter for image type
+ *
+ * @param $imageType Type to set in image
+ * @return void
+ */
+ protected final function setImageType ($imageType) {
+ $this->imageType = (string) $imageType;
+ }
+
+ /**
+ * Getter for image type
+ *
+ * @return $imageType Type to set in image
+ */
+ public final function getImageType () {
+ return $this->imageType;
+ }
+
+ /**
+ * Setter for image name
+ *
+ * @param $name Name of the image
+ * @return void
+ */
+ public final function setImageName ($name) {
+ $this->imageName = (string) $name;
+ }
+
+ /**
+ * Getter for image name
+ *
+ * @return $name Name of the image
+ */
+ public final function getImageName () {
+ return $this->imageName;
+ }
+
+ /**
+ * Getter for image resource
+ *
+ * @return $imageResource An image resource from imagecreatetruecolor() function
+ */
+ public final function getImageResource() {
+ return $this->imageResource;
+ }
+
+ /**
+ * Setter for X coordinate
+ *
+ * @param $x X coordinate
+ * @return void
+ */
+ public final function setX ($x) {
+ $this->x = $x;
+ }
+
+ /**
+ * Getter for X coordinate
+ *
+ * @return $x X coordinate
+ */
+ public final function getX () {
+ return $this->x;
+ }
+
+ /**
+ * Setter for Y coordinate
+ *
+ * @param $y Y coordinate
+ * @return void
+ */
+ public final function setY ($y) {
+ $this->y = $y;
+ }
+
+ /**
+ * Getter for Y coordinate
+ *
+ * @return $y Y coordinate
+ */
+ public final function getY () {
+ return $this->y;
+ }
+
+ /**
+ * Setter for font size
+ *
+ * @param $fontSize Font size for strings
+ * @return void
+ */
+ public final function setFontSize ($fontSize) {
+ $this->fontSize = $fontSize;
+ }
+
+ /**
+ * Getter for font size
+ *
+ * @return $fontSize Font size for strings
+ */
+ public final function getFontSize () {
+ return $this->fontSize;
+ }
+
+ /**
+ * Setter for string name
+ *
+ * @param $stringName String name to set
+ * @return void
+ */
+ public final function setStringName($stringName) {
+ $this->stringName = $stringName;
+ }
+
+ /**
+ * Finish this image by producing it
+ *
+ * @return void
+ */
+ public function finishImage () {
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // Compile width and height
+ $width = $templateInstance->compileRawCode($this->getWidth());
+ $height = $templateInstance->compileRawCode($this->getHeight());
+
+ // Set both again
+ $this->setWidth($width);
+ $this->setHeight($height);
+
+ // Get a image resource
+ $this->imageResource = imagecreatetruecolor($width, $height);
+
+ // Compile background colors
+ $red = $templateInstance->compileRawCode($this->backgroundColor['red']);
+ $green = $templateInstance->compileRawCode($this->backgroundColor['green']);
+ $blue = $templateInstance->compileRawCode($this->backgroundColor['blue']);
+
+ // Set all back
+ $this->initBackgroundColor();
+ $this->setRed($red);
+ $this->setGreen($green);
+ $this->setBlue($blue);
+
+ // Get a pointer for background color
+ $backColor = imagecolorallocate($this->imageResource, $red, $green, $blue);
+
+ // Fill the image
+ imagefill($this->imageResource, 0, 0, $backColor);
+
+ // Compile foreground colors
+ $red = $templateInstance->compileRawCode($this->foregroundColor['red']);
+ $green = $templateInstance->compileRawCode($this->foregroundColor['green']);
+ $blue = $templateInstance->compileRawCode($this->foregroundColor['blue']);
+
+ // Set all fore
+ $this->initForegroundColor();
+ $this->setRed($red);
+ $this->setGreen($green);
+ $this->setBlue($blue);
+
+ // Get a pointer for foreground color
+ $foreColor = imagecolorallocate($this->imageResource, $red, $green, $blue);
+
+ switch ($this->groupable) {
+ case "single": // Single image string
+ // Compile image string
+ $imageString = $templateInstance->compileRawCode($this->getString());
+
+ // Set it back
+ $this->setString($imageString);
+
+ // Compile X/Y coordinates and font size
+ $x = $templateInstance->compileRawCode($this->getX());
+ $y = $templateInstance->compileRawCode($this->getY());
+ $size = $templateInstance->compileRawCode($this->getFontSize());
+
+ // Set the image string
+ imagestring($this->imageResource, $size, $x, $y, $imageString, $foreColor);
+ break;
+
+ case "groupable": // More than one string allowed
+ // Walk through all groups
+ foreach ($templateInstance->getVariableGroups() as $group => $set) {
+ // Set the group
+ $templateInstance->setVariableGroup($group, false);
+
+ // Compile image string
+ $imageString = $templateInstance->compileRawCode($this->getString());
+
+ // Compile X/Y coordinates and font size
+ $x = $templateInstance->compileRawCode($this->getX());
+ $y = $templateInstance->compileRawCode($this->getY());
+ $size = $templateInstance->compileRawCode($this->getFontSize());
+
+ // Set the image string
+ //* DEBUG: */ echo __METHOD__.": size={$size}, x={$x}, y={$y}, string={$imageString}<br />\n";
+ imagestring($this->imageResource, $size, $x, $y, $imageString, $foreColor);
+ } // END - foreach
+ break;
+ }
+
+ // You need finishing in your image class!
+ }
+
+ /**
+ * Getter for full created image content
+ *
+ * @return $imageContent The raw image content
+ */
+ public function getContent () {
+ // Get cache file name
+ $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
+
+ // Load the content
+ $imageContent = file_get_contents($cacheFile);
+
+ // And return it
+ return $imageContent;
+ }
+}
// [EOF]
?>
/**
* Creates an instance of this image class
*
- * @return $imageInstance An instance of this image class
+ * @param $templateInstance A template instance
+ * @return $imageInstance An instance of this image class
*/
- public final static function createPngImage() {
+ public final static function createPngImage(CompileableTemplate $templateInstance) {
// Get a new instance
$imageInstance = new PngImage();
+ // Set template instance
+ $imageInstance->setTemplateInstance($templateInstance);
+
+ // Set image type
+ $imageInstance->setImageType("png");
+
// Return the instance
return $imageInstance;
}
+
+ /**
+ * Finish this image by producing it
+ *
+ * @return void
+ */
+ public function finishImage () {
+ // Call parent method
+ parent::finishImage();
+
+ // Get a file name for our image
+ $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
+
+ // Finish the image and send it to a cache file
+ imagepng($this->getImageResource(), $cacheFile, 9, PNG_ALL_FILTERS);
+ }
}
// [EOF]
private $className = "";
// Exception constants
- const EXCEPTION_INVALID_COMMAND = 0x0c0;
- const EXCEPTION_INVALID_CONTROLLER = 0x0c1;
- const EXCEPTION_INVALID_ACTION = 0x0c2;
+ const EXCEPTION_INVALID_COMMAND = 0xd00;
+ const EXCEPTION_INVALID_CONTROLLER = 0xd01;
+ const EXCEPTION_INVALID_ACTION = 0xd02;
/**
* Protected constructor
*/
private $fatalMessages = array();
+ /**
+ * Instance of the image
+ */
+ private $imageInstance = null;
+
/**
* Protected constructor
*
$this->addHeader('Last-Modified', $now);
$this->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
$this->addHeader('Pragma', 'no-cache'); // HTTP/1.0
+ $this->addHeader('Content-type', 'image/'.$this->imageInstance->getImageType());
// Define the charset to be used
//$this->addHeader('Content-Type:', sprintf("text/html; charset=%s", $this->getConfigInstance()->readConfig('header_charset')));
// Are there some error messages?
if (count($this->fatalMessages) == 0) {
- // Flush the output to the world
- $this->getWebOutputInstance()->output($this->responseBody);
+ // Get image content from cache
+ $imageContent = $this->imageInstance->getContent();
+ die($imageContent);
} else {
// Display all error messages
- $this->getApplicationInstance()->handleFatalMessages($this->fatalMessages);
-
- // Send the error messages out to the world
- $this->getWebOutputInstance()->output($this->responseBody);
+ $this->partialStub("Fatal messages are currently unsupported in image response.");
}
// Clear response header and body
// Set new template engine
$cfg->setConfigEntry('template_class', "ImageTemplateEngine");
- $cfg->setConfigEntry('raw_template_extension', ".img");
- $cfg->setConfigEntry('code_template_extension', ".img");
+ $cfg->setConfigEntry('raw_template_extension', ".itp");
+ $cfg->setConfigEntry('code_template_extension', ".itp");
$cfg->setConfigEntry('tpl_base_path', "templates/images/");
$cfg->setConfigEntry('code_template_type', "image");
$this->addCookie($cookieName, $_COOKIE[$cookieName], false);
} // END - if
}
+
+ /**
+ * Setter for image instanxe
+ *
+ * @param $imageInstance An instance of an image
+ * @return void
+ */
+ public final function setImageInstance (BaseImage $imageInstance) {
+ $this->imageInstance = $imageInstance;
+ }
}
// [EOF]
*/
class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, UpdateableResult, SeekableIterator {
// Exception constants
- const EXCEPTION_INVALID_DATABASE_RESULT = 0x0b0;
- const EXCEPTION_RESULT_UPDATE_FAILED = 0x0b1;
+ const EXCEPTION_INVALID_DATABASE_RESULT = 0xc00;
+ const EXCEPTION_RESULT_UPDATE_FAILED = 0xc01;
/**
* Current position in array
private $lastTemplate = "";
/**
- * The variable stack for the templates. This must be initialized and
- * shall become an instance of FrameworkArrayObject.
+ * The variable stack for the templates
*/
- private $varStack = null;
+ private $varStack = array();
/**
* Configuration variables in a simple array
*/
private $helpers = array();
- // Exception codes for the template engine
- const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x020;
- const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x021;
- const EXCEPTION_INVALID_VIEW_HELPER = 0x022;
+ /**
+ * Current variable group
+ */
+ private $currGroup = "general";
/**
- * Initialize the variable stack. This holds all variables for later
- * compilation.
- *
- * @return void
+ * All template groups except "general"
*/
- public final function initVariableStack () {
- $this->varStack = new FrameworkArrayObject("FakedVariableStack");
- }
+ private $varGroups = array();
+
+ // Exception codes for the template engine
+ const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x200;
+ const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x201;
+ const EXCEPTION_INVALID_VIEW_HELPER = 0x202;
/**
* Protected constructor
// First everything is not found
$found = false;
- // Now search for it
- for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) {
- // Get current item
- $currEntry = $idx->current();
-
- // Is the entry found?
- if ($currEntry['name'] == $var) {
- // Found!
- $found = $idx->key();
- break;
- }
- }
+ // Is the group there?
+ if (isset($this->varStack[$this->currGroup])) {
+ // Now search for it
+ foreach ($this->varStack[$this->currGroup] as $idx=>$currEntry) {
+ // Is the entry found?
+ if ($currEntry['name'] == $var) {
+ // Found!
+ $found = $idx;
+ break;
+ } // END - if
+ } // END - foreach
+ } // END - if
// Return the current position
return $found;
// First everything is not found
$content = null;
- // Now search for it
- for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) {
- // Get current item
- $currEntry = $idx->current();
+ // Get variable index
+ $found = $this->isVariableAlreadySet($var);
- // Is the entry found?
- if ($currEntry['name'] == $var) {
- // Found!
- $content = $currEntry['value'];
- break;
- }
- }
+ // Is the variable found?
+ if ($found !== false) {
+ // Read it
+ $found = $this->varStack[$this->currGroup][$found]['value'];
+ } // END - if
+
+ //* DEBUG: */ echo __METHOD__.": group=".$this->currGroup.",var=".$var.", found=".$found."<br />\n";
// Return the current position
- return $content;
+ return $found;
}
/**
* @return void
*/
private function addVariable ($var, $value) {
+ // Set general variable group
+ $this->setVariableGroup("general");
+
// Add it to the stack
- $this->varStack->append(array(
- 'name' => trim($var),
- 'value' => trim($value)
- ));
+ $this->addGroupVariable($var, $value);
+ }
+
+ /**
+ * Returns all variables of current group or empty array
+ *
+ * @return $result Wether array of found variables or empty array
+ */
+ private function readCurrentGroup () {
+ // Default is not found
+ $result = array();
+
+ // Is the group there?
+ if (isset($this->varStack[$this->currGroup])) {
+ // Then use it
+ $result = $this->varStack[$this->currGroup];
+ } // END - if
+
+ // Return result
+ return $result;
+ }
+
+ /**
+ * Settter for variable group
+ *
+ * @param $groupName Name of variable group
+ * @param $add Wether add this group
+ * @return void
+ */
+ public function setVariableGroup ($groupName, $add = true) {
+ // Set group name
+ //* DEBIG: */ echo __METHOD__.": currGroup=".$groupName."<br />\n";
+ $this->currGroup = $groupName;
+
+ // Skip group "general"
+ if (($groupName != "general") && ($add === true)) {
+ $this->varGroups[$groupName] = "OK";
+ } // END - if
+ }
+
+
+ /**
+ * Adds a variable to current group
+ *
+ * @param $var Variable to set
+ * @param $value Value to store in variable
+ * @return void
+ */
+ public function addGroupVariable ($var, $value) {
+ //* DEBUG: */ echo __METHOD__.": group=".$this->currGroup.", var=".$var.", value=".$value."<br />\n";
+
+ // Get current variables in group
+ $currVars = $this->readCurrentGroup();
+
+ // Append our variable
+ $currVars[] = array(
+ 'name' => $var,
+ 'value' => $value
+ );
+
+ // Add it to the stack
+ $this->varStack[$this->currGroup] = $currVars;
}
/**
* @return void
*/
private function modifyVariable ($var, $value) {
- // It should be there so let's look again...
- for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) {
- // Get current entry
- $currEntry = $idx->current();
-
- // Is this the requested variable?
- if ($currEntry['name'] == $var) {
- // Change it to the other value
- $this->varStack->offsetSet($idx->key(), array(
- 'name' => $var,
- 'value' => $value
- ));
- }
- }
+ // Get index for variable
+ $idx = $this->isVariableAlreadySet($var);
+
+ // Is the variable set?
+ if ($idx !== false) {
+ // Then modify it
+ $this->varStack[$this->currGroup][$idx]['value'] = $value;
+ } // END - if
}
/**
throw new MissingMethodException(array($ioInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD);
}
- /* DEBUG: */ echo __METHOD__.": FQFN=".$fqfn."<br />\n";
+ // Some debug code to look on the file which is being loaded
+ //* DEBUG: */ echo __METHOD__.": FQFN=".$fqfn."<br />\n";
// Load the raw template
$rawTemplateData = $ioInstance->loadFileContents($fqfn);
$content = $this->getRawTemplateData();
// Walk through all variables
- for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) {
- // Get current entry
- $currEntry = $idx->current();
-
+ foreach ($this->varStack['general'] as $currEntry) {
// Replace all [$var] or {?$var?} with the content
//* DEBUG: */ echo "name=".$currEntry['name'].", value=<pre>".htmlentities($currEntry['value'])."</pre>\n";
$content = str_replace("\$content[".$currEntry['name']."]", $currEntry['value'], $content);
$validVar = $this->getConfigInstance()->readConfig('tpl_valid_var');
$dummy = array();
- // Iterate through all variables
- for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) {
-
- // Get current variable from the stack
- $currVariable = $idx->current();
-
+ // Iterate through all general variables
+ foreach ($this->varStack['general'] as $currVariable) {
// Transfer it's name/value combination to the $content array
//* DEBUG: */ echo $currVariable['name']."=<pre>".htmlentities($currVariable['value'])."</pre>\n";
$dummy[$currVariable['name']] = $currVariable['value'];
*
* @return void
*/
- public final function output () {
+ public function output () {
// Check which type of template we have
switch ($this->getTemplateType()) {
case "html": // Raw HTML templates can be send to the output buffer
/**
* Loads a given view helper (by name)
*
- * @param $helperName The helper's name
+ * @param $helperName The helper's name
* @return void
* @throws ViewHelperNotFoundException If the given view helper was not found
*/
* @param $rawCode Raw code to compile
* @return $rawCode Compile code with inserted variable value
*/
- protected function compileRawCode ($rawCode) {
+ public function compileRawCode ($rawCode) {
// Find the variables
+ //* DEBUG: */ echo "rawCode=<pre>".htmlentities($rawCode)."</pre>\n";
preg_match_all($this->regExpVarValue, $rawCode, $varMatches);
// Compile all variables
+ //* DEBUG: */ echo "<pre>".print_r($varMatches, true)."</pre>";
foreach ($varMatches[0] as $match) {
- // Replace the variable with it's value, if found
- $rawCode = str_replace("{?".$match."?}", $this->readVariable($match), $rawCode);
+ // Add variable tags around it
+ $varCode = "{?".$match."?}";
+
+ // Is the variable found in code? (safes some calls)
+ if (strpos($rawCode, $varCode) !== false) {
+ // Replace the variable with it's value, if found
+ //* DEBUG: */ echo __METHOD__.": match=".$match."<br />\n";
+ $rawCode = str_replace($varCode, $this->readVariable($match), $rawCode);
+ } // END - if
} // END - foreach
// Return the compiled data
return $rawCode;
}
+
+ /**
+ * Getter for variable group array
+ *
+ * @return $vargroups All variable groups
+ */
+ public final function getVariableGroups () {
+ return $this->varGroups;
+ }
}
// [EOF]
/**
* Main nodes in the XML tree ("image" is ignored)
*/
- private $mainNodes = array("type", "resolution", "background-color", "foreground-color", "image-string");
+ private $mainNodes = array("base", "type", "resolution", "background-color", "foreground-color", "image-string");
/**
* Sub nodes in the XML tree
*/
- private $subNodes = array("width", "height", "red", "green", "blue", "text");
+ private $subNodes = array("name", "string-name", "x", "y", "font-size", "width", "height", "red", "green", "blue", "text");
/**
* Image instance
*/
private $imageInstance = null;
+ /**
+ * Current main node
+ */
+ private $currMainNode = "";
+
/**
* Protected constructor
*
// Set the base path
$tplInstance->setBasePath($basePath);
- // Initialize the variable stack
- $tplInstance->initVariableStack();
-
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
$tplInstance->setFileIoInstance($ioInstance);
/**
* Handles the start element of an XML resource
*
- * @param $resource XML parser resource
+ * @param $resource XML parser resource (currently ignored)
* @param $element The element we shall handle
* @param $attributes All attributes
* @return void
$element = strtolower($element);
// Is the element a main node?
+ //* DEBUG: */ echo "START: >".$element."<<br />\n";
if (in_array($element, $this->mainNodes)) {
// Okay, main node found!
$methodName = "setImage" . $this->convertToClassName($element);
$methodName = "setImageProperty" . $this->convertToClassName($element);
} elseif ($element != "image") {
// Invalid node name found
- throw new InvalidXmlNodeException(array($this, $element, $attributes), self::EXCEPTION_XML_NODE_UNKNOWN);
+ throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN);
}
// Call method
call_user_func_array(array($this, $methodName), $attributes);
}
+ /**
+ * Ends the main or sub node by sending out the gathered data
+ *
+ * @param $resource An XML resource pointer (currently ignored)
+ * @param $nodeName Name of the node we want to finish
+ * @return void
+ * @throws XmlNodeMismatchException If current main node mismatches the closing one
+ */
+ public function endElement ($resource, $nodeName) {
+ // Make all lower-case
+ $nodeName = strtolower($nodeName);
+
+ // Does this match with current main node?
+ //* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
+ if (($nodeName != $this->currMainNode) && (in_array($nodeName, $this->mainNodes))) {
+ // Did not match!
+ throw new XmlNodeMismatchException (array($this, $nodeName, $this->currMainNode), BaseHelper::EXCEPTION_XML_NODE_MISMATCH);
+ } elseif (in_array($nodeName, $this->subNodes)) {
+ // Silently ignore sub nodes
+ return;
+ }
+
+ // Construct method name
+ $methodName = "finish" . $this->convertToClassName($nodeName);
+
+ // Call the corresponding method
+ call_user_func_array(array($this->imageInstance, $methodName), array());
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something usefull with this!
+ */
+ public function characterHandler ($resource, $characters) {
+ // Trim all spaces away
+ $characters = trim($characters);
+
+ // Is this string empty?
+ if (empty($characters)) {
+ // Then skip it silently
+ return false;
+ } // END - if
+
+ // Unfinished work!
+ $this->partialStub("Handling extra characters is not yet supported!");
+ }
+
/**
* Intializes the image
*
* @return void
*/
private function setImageType ($imageType) {
+ // Set group to general
+ $this->setVariableGroup("general");
+
// Try to compile it first to get the value from variable stack
$imageType = $this->compileRawCode($imageType);
$className = $this->convertToClassName($imageType."_image");
// And try to initiate it
- $this->imageInstance = ObjectFactory::createObjectByName($className);
+ $this->imageInstance = ObjectFactory::createObjectByName($className, array($this));
+
+ // Set current main node to type
+ $this->currMainNode = "type";
+ }
+
+ /**
+ * "Setter" for resolution, we first need to collect the resolution from the
+ * sub-nodes. So first, this method will prepare an array for it
+ *
+ * @return void
+ */
+ private function setImageResolution () {
+ // Call the image class
+ $this->imageInstance->initResolution();
+
+ // Current main node is resolution
+ $this->currMainNode = "resolution";
+ }
+
+ /**
+ * "Setter" for base information. For more details see above method!
+ *
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageBase () {
+ // Call the image class
+ $this->imageInstance->initBase();
+
+ // Current main node is resolution
+ $this->currMainNode = "base";
+ }
+
+ /**
+ * "Setter" for background-color. For more details see above method!
+ *
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageBackgroundColor () {
+ // Call the image class
+ $this->imageInstance->initBackgroundColor();
+
+ // Current main node is background-color
+ $this->currMainNode = "background-color";
+ }
+
+ /**
+ * "Setter" for foreground-color. For more details see above method!
+ *
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageForegroundColor () {
+ // Call the image class
+ $this->imageInstance->initForegroundColor();
+
+ // Current main node is foreground-color
+ $this->currMainNode = "foreground-color";
+ }
+
+ /**
+ * "Setter" for image-string. For more details see above method!
+ *
+ * @param $groupable Wether this image string is groupable
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageImageString ($groupable = "single") {
+ // Call the image class
+ $this->imageInstance->initImageString($groupable);
+
+ // Current main node is foreground-color
+ $this->currMainNode = "image-string";
+ }
+
+ /**
+ * Setter for image name
+ *
+ * @param $imageName Name of the image
+ * @return void
+ */
+ private function setImagePropertyName ($imageName) {
+ // Call the image class
+ $this->imageInstance->setImageName($imageName);
+ }
+
+ /**
+ * Setter for image width
+ *
+ * @param $width Width of the image or variable
+ * @return void
+ */
+ private function setImagePropertyWidth ($width) {
+ // Call the image class
+ $this->imageInstance->setWidth($width);
+ }
+
+ /**
+ * Setter for image height
+ *
+ * @param $height Height of the image or variable
+ * @return void
+ */
+ private function setImagePropertyHeight ($height) {
+ // Call the image class
+ $this->imageInstance->setHeight($height);
+ }
+
+ /**
+ * Setter for image red color
+ *
+ * @param $red Red color value
+ * @return void
+ */
+ private function setImagePropertyRed ($red) {
+ // Call the image class
+ $this->imageInstance->setRed($red);
+ }
+
+ /**
+ * Setter for image green color
+ *
+ * @param $green Green color value
+ * @return void
+ */
+ private function setImagePropertyGreen ($green) {
+ // Call the image class
+ $this->imageInstance->setGreen($green);
+ }
+
+ /**
+ * Setter for image blue color
+ *
+ * @param $blue Blue color value
+ * @return void
+ */
+ private function setImagePropertyBlue ($blue) {
+ // Call the image class
+ $this->imageInstance->setBlue($blue);
+ }
+
+ /**
+ * Setter for string name (identifier)
+ *
+ * @param $stringName String name (identifier)
+ * @return void
+ */
+ private function setImagePropertyStringName ($stringName) {
+ // Call the image class
+ $this->imageInstance->setStringName($stringName);
+ }
+
+ /**
+ * Setter for font size
+ *
+ * @param $fontSize Size of the font
+ * @return void
+ */
+ private function setImagePropertyFontSize ($fontSize) {
+ // Call the image class
+ $this->imageInstance->setFontSize($fontSize);
+ }
+
+ /**
+ * Setter for image string
+ *
+ * @param $imageString Image string to set
+ * @return void
+ */
+ private function setImagePropertyText ($imageString) {
+ // Call the image class
+ $this->imageInstance->setString($imageString);
+ }
+
+ /**
+ * Setter for X coordinate
+ *
+ * @param $x X coordinate
+ * @return void
+ */
+ private function setImagePropertyX ($x) {
+ // Call the image class
+ $this->imageInstance->setX($x);
+ }
+
+ /**
+ * Setter for Y coordinate
+ *
+ * @param $y Y coordinate
+ * @return void
+ */
+ private function setImagePropertyY ($y) {
+ // Call the image class
+ $this->imageInstance->setY($y);
+ }
+
+ /**
+ * Getter for image cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the image cache
+ */
+ public function getImageCacheFqfn () {
+ // Get the FQFN ready
+ $fqfn = $this->getBasePath()."_cache/" . md5($this->imageInstance->getImageName()) . "." . $this->imageInstance->getImageType();
+
+ // Return it
+ return $fqfn;
+ }
+
+ /**
+ * Outputs the image to the world
+ *
+ * @param $responseInstance An instance of a Responseable class
+ * @return void
+ */
+ public function transferToResponse (Responseable $responseInstance) {
+ // Set the image instance
+ $responseInstance->setImageInstance($this->imageInstance);
}
}
// Set the base path
$tplInstance->setBasePath($basePath);
- // Initialize the variable stack
- $tplInstance->initVariableStack();
-
// Set the language and IO instances
$tplInstance->setLanguageInstance($langInstance);
$tplInstance->setFileIoInstance($ioInstance);
private $email = "";
// Exceptions
- const EXCEPTION_USERNAME_NOT_FOUND = 0x060;
- const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x061;
- const EXCEPTION_USER_PASS_MISMATCH = 0x062;
+ const EXCEPTION_USERNAME_NOT_FOUND = 0x700;
+ const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x701;
+ const EXCEPTION_USER_PASS_MISMATCH = 0x702;
/**
* Protected constructor
private $email = "";
// Exceptions
- const EXCEPTION_USERNAME_NOT_FOUND = 0x060;
- const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x061;
- const EXCEPTION_USER_PASS_MISMATCH = 0x062;
+ const EXCEPTION_USERNAME_NOT_FOUND = 0x600;
+ const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x601;
+ const EXCEPTION_USER_PASS_MISMATCH = 0x602;
/**
* Protected constructor
private static $cfgInstance = null;
// Some constants for the configuration system
- const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0x040;
- const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0x041;
+ const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0x400;
+ const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0x401;
/**
* Protected constructor
// Now look it up in our index
if (isset($this->classes[$fileName])) {
// File is found so load it only once
+ //* DEBUG: */ echo "LOAD: ".$fileName." - Start<br />\n";
require($this->classes[$fileName]);
+ //* DEBUG: */ echo "LOAD: ".$fileName." - End<br />\n";
// Count this include
$this->total++;
--- /dev/null
+Deny from all
+++ /dev/null
-<image>
- <type value="{?image_type?}" />
- <resolution>
- <width value="{?image_width?}" />
- <height value="{?image_height?}" />
- </resolution>
- <background-color>
- <red value="{?image_bg_red?}" />
- <green value="{?image_bg_green?}" />
- <blue value="{?image_bg_blue?}" />
- </background-color>
- <foreground-color>
- <red value="{?image_bg_red?}" />
- <green value="{?image_bg_green?}" />
- <blue value="{?image_bg_blue?}" />
- </foreground-color>
- <image-string>
- <text value="{?image_string?}" />
- </image-string>
-</image>
--- /dev/null
+<image>
+ <type value="{?image_type?}" />
+ <base>
+ <name value="{?image_name?}" />
+ </base>
+ <resolution>
+ <width value="{?image_width?}" />
+ <height value="{?image_height?}" />
+ </resolution>
+ <background-color>
+ <red value="{?image_bg_red?}" />
+ <green value="{?image_bg_green?}" />
+ <blue value="{?image_bg_blue?}" />
+ </background-color>
+ <foreground-color>
+ <red value="{?image_fg_red?}" />
+ <green value="{?image_fg_green?}" />
+ <blue value="{?image_fg_blue?}" />
+ </foreground-color>
+ <image-string value="groupable">
+ <string-name value="{?image_string_name?}" />
+ <x value="{?image_x?}" />
+ <y value="{?image_y?}" />
+ <font-size value="{?image_size?}" />
+ <text value="{?image_string?}" />
+ </image-string>
+</image>
+++ /dev/null
-<?php
-// Needed in every image template to initialy set the image type
-$helper = ImageHelper::createImageHelper($this, "png");
-$helper->setBaseImage("base_image");
-
-// Set image dimensions
-$helper->setWidth(400);
-$helper->setHeight(200);
-
-// Background and foreground color
-$helper->setBackgroundColorRedGreenBlue(0xFF, 0xAA, 0xAA);
-$helper->setForegroundColorRedGreenBlue(0x00, 0x00, 0x00);
-
-// Add error message
-$helper->setImageString("Genereller Fehler!");
-
-// Flush content to the template engine
-$helper->flushContent();
-
-// Comment this out if image is done
-//$this->debugInstance();
-?>
--- /dev/null
+<?php
+// Needed in every image template to initialy set the image type
+$helper = ImageHelper::createImageHelper($this, "png");
+$helper->setImageName("emergency_exit");
+$helper->setBaseImage("base_image");
+
+// Set image dimensions
+$helper->setWidth(200);
+$helper->setHeight(100);
+
+// Background and foreground color
+$helper->setBackgroundColorRedGreenBlue(0xA0, 0x00, 0x30);
+$helper->setForegroundColorRedGreenBlue(0xFF, 0xFF, 0xFF);
+
+// Add header line
+$helper->addTextLine("header");
+$helper->setCoord(18, 10);
+$helper->setFontSize(5);
+$helper->setImageString("Fehler-Code: {?code?}");
+
+// Add info line
+$helper->addTextLine("info");
+$helper->setCoord(68, 40);
+$helper->setFontSize(5);
+$helper->setImageString("Info:");
+
+// Add extra line
+$helper->addTextLine("extra");
+$helper->setCoord(18, 70);
+$helper->setFontSize(2);
+$helper->setImageString("{?extra?}");
+
+// Flush content to the template engine
+$helper->flushContent();
+
+// Comment this out if image is done
+//$this->debugInstance();
+
+// [EOF]
+?>