inc/classes/main/filter/verifier/.htaccess -text
inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php -text
inc/classes/main/filter/verifier/class_EmailValidatorFilter.php -text
+inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php -text
inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php -text
inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php -text
inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php -text
inc/output.php -text
inc/selector.php -text
/index.php -text
+/package.sh -text
/rebuild_doc.sh -text
templates/.htaccess -text
templates/_compiled/.htaccess -text
throw new InvalidArrayCountException(array($this, "curr", count($curr), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
} elseif (!isset($curr['template_class']) || (!isset($curr['app_instance']))) {
// Expected entries missing
- throw new MissingArrayElementsException(array($this, "curr", array('template_class', 'app_instance')), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
+ throw new MissingArrayElementsException(array($this, "curr", array("template_class", "app_instance")), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
}
die("<pre>".print_r($curr, true)."</pre>");
// CFG: CAPTCHA-ENCRYPT-VALIDATOR-CLASS
$cfg->setConfigEntry('captcha_encrypt_validator_class', "CaptchaEncryptFilter");
+// CFG: CAPTCHA-GUEST-VERIFIER-CLASS
+$cfg->setConfigEntry('captcha_guest_verifier_class', "GraphicalCodeCaptchaVerifierFilter");
+
+// CFG: CAPTCHA-USER-VERIFIER-CLASS
+$cfg->setConfigEntry('captcha_user_verifier_class', "GraphicalCodeCaptchaVerifierFilter");
+
// CFG: NEWS-HOME-LIMIT
$cfg->setConfigEntry('news_home_limit', 10);
* @todo Add more filters
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
- // Add username
+ // Add username verifier filter
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_class'));
// Add password verifier filter
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_class'));
+
+ // Add CAPTCHA verifier code
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_class'));
}
}
// Password verifier filter
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_class'));
+
+ // Add filter for CAPTCHA
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_class'));
}
}
// Add new personell object to our list
public function addRandomPersonell () {
// Gender list...
- $genders = array('M', 'F');
+ $genders = array("M", "F");
// Create new personell members
$personellInstance = new SimulatorPersonell();
$this->setCacheCond($serialized);
// Create cached list
- $this->setAllCacheList(new FrameworkArrayObject("FakedCacheList"));
+ $this->setAllCacheList(new FrameworkArrayObject('FakedCacheList'));
// Search all unemployed personells
for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) {
// Get a helper instance without a form tag
$captchaHelper = WebFormHelper::createWebFormHelper($this, 'captcha_code', false, false);
$captchaHelper->addFieldText('captcha_code', "Bitte wiederhole den Code:");
-$captchaHelper->addInputTextField('captcha_code');
+$captchaHelper->addInputTextField('c_code');
$captchaHelper->addInputHiddenField('hash', $this->readVariable('captcha_hash'));
$captchaHelper->flushContent();
-For scripts, except templates and compileable templates see COPYING.software.
+For scripts, except shell scripts, templates and compileable templates see
+COPYING.software.
For documents see COPYING.documents.
+
+The rest of the scripts (shell, templates, code templates) are given away
+"AS IS" and "WITHOUT ANY WARRANTY". So it shall be public domain.
*/
protected function initCache () {
// Now create the "data cache"
- $this->dataCache = new FrameworkArrayObject("FakedDataCache");
+ $this->dataCache = new FrameworkArrayObject('FakedDataCache');
}
/**
*/
public function __destruct() {
// Is this object already destroyed?
- if ($this->__toString() != "DestructedObject") {
- // Debug message
- if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
- $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wird zerstört.",
- __CLASS__, $this->__toString()
- ));
- } // END - if
-
+ if ($this->__toString() != 'DestructedObject') {
// Destroy all informations about this class but keep some text about it alive
- $this->setObjectDescription(sprintf("Entferntes Objekt <em>%s</em>", $this->__toString()));
- $this->setRealClass("DestructedObject");
+ $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
)));
// Initialization done! :D
- Registry::isInitialized("OK");
- } elseif ($this->__toString() == "DebugMiddleware") {
+ Registry::isInitialized('OK');
+ } elseif ($this->__toString() == 'DebugMiddleware') {
// Set configuration instance
$this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
}
* 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
+ * @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
+ * more than two elements
*/
public final function getPathFileNameFromObject () {
// Get the main object's unique ID. We use this as a path/filename combination
// 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);
+ 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);
+ throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
// Auto-append missing trailing slash
<?php
/**
- * A command for the "home" page
+ * A command for the home page
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the home template
- $templateInstance->loadCodeTemplate("home");
+ $templateInstance->loadCodeTemplate('home');
// Assign the home template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable("home", "content");
+ $templateInstance->assignTemplateWithVariable('home', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the matching template
$templateInstance->loadCodeTemplate($this->actionName);
$templateInstance->assignTemplateWithVariable($this->actionName, "login_content");
// Load main template
- $templateInstance->loadCodeTemplate("login_main");
+ $templateInstance->loadCodeTemplate('login_main');
// Assign the main template with the master template as a content ... ;)
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("login_main", "content");
+ $templateInstance->assignTemplateWithVariable('login_main', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName."_title"));
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title'));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the home template
- $templateInstance->loadCodeTemplate("login_form");
+ $templateInstance->loadCodeTemplate('login_form');
// Assign the home template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable("login_form", "content");
+ $templateInstance->assignTemplateWithVariable('login_form', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the login_failed template
- $templateInstance->loadCodeTemplate("login_failed");
+ $templateInstance->loadCodeTemplate('login_failed');
// Assign the login_failed template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable("login_failed", "content");
+ $templateInstance->assignTemplateWithVariable('login_failed', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the logout_done template
- $templateInstance->loadCodeTemplate("logout_done");
+ $templateInstance->loadCodeTemplate('logout_done');
// Assign the logout_done template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable("logout_done", "content");
+ $templateInstance->assignTemplateWithVariable('logout_done', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the register template
- $templateInstance->loadCodeTemplate("register_form");
+ $templateInstance->loadCodeTemplate('register_form');
// Assign the register template with the master template as a content ... ;)
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("register_form", "content");
+ $templateInstance->assignTemplateWithVariable('register_form', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
$mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class');
// Load the mail template
- $mailerInstance->loadTemplate("resend_link");
+ $mailerInstance->loadTemplate('resend_link');
// Add the recipient
$mailerInstance->addRecipientByUser($userInstance);
if ($inConstructor) {
return false;
} else {
- throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
+ throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED);
}
} elseif (count($pathFile) != 2) {
// Invalid ID returned!
if ($inConstructor) {
return false;
} else {
- throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
}
// Auto-initialization
if (is_null($this->limitArray)) {
// Initialize this array
- $this->limitArray = new FrameworkArrayObject("FakedLimitArray");
+ $this->limitArray = new FrameworkArrayObject('FakedLimitArray');
}
// Add the object's name to it
*/
public function createConfiguredCache () {
// Read the config entry
- $cacheType = $this->getConfigInstance()->readConfig("cache_class");
+ $cacheType = $this->getConfigInstance()->readConfig('cache_class');
// And get a new instance
$cacheInstance = ObjectFactory::createObjectByName($cacheType);
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating code graphical CAPTCHAs with hashes
+ *
+ * @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 GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ 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();
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createGraphicalCodeCaptchaVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new GraphicalCodeCaptchaVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ $requestInstance->debugInstance();
+ }
+}
+
+// [EOF]
+?>
$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_bg_red" , $this->backgroundColor['red']);
- $templateInstance->assignVariable("image_bg_green", $this->backgroundColor['green']);
- $templateInstance->assignVariable("image_bg_blue" , $this->backgroundColor['blue']);
- $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_name' , $this->getImageName());
+ $templateInstance->assignVariable('image_type' , $this->getImageType());
+ $templateInstance->assignVariable('image_width' , $this->getWidth());
+ $templateInstance->assignVariable('image_height' , $this->getHeight());
+ $templateInstance->assignVariable('image_bg_red' , $this->backgroundColor['red']);
+ $templateInstance->assignVariable('image_bg_green', $this->backgroundColor['green']);
+ $templateInstance->assignVariable('image_bg_blue' , $this->backgroundColor['blue']);
+ $templateInstance->assignVariable('image_fg_red' , $this->foregroundColor['red']);
+ $templateInstance->assignVariable('image_fg_green', $this->foregroundColor['green']);
+ $templateInstance->assignVariable('image_fg_blue' , $this->foregroundColor['blue']);
// Add all strings
foreach ($this->imageStrings as $id=>$imageString) {
$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());
+ $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
$templateInstance = $helperInstance->getTemplateInstance();
// Load a template for this CAPTCHA
- $templateInstance->loadCodeTemplate("captch_graphic_code");
+ $templateInstance->loadCodeTemplate('captch_graphic_code');
// Rename variable
$templateInstance->renameVariable('captcha_code', $helperInstance->getFormName().'_captcha');
} // END - if
// Generate the content
- $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s_field\" name=\"%s\" value=\"%s\" />",
+ $inputContent = sprintf("<input type=\"text\" class=\"textfield %s_field\" name=\"%s\" value=\"%s\" />",
$fieldName,
$fieldName,
$fieldValue
} // END - if
// Generate the content
- $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s_field\" name=\"%s\" value=\"%s\" />",
+ $inputContent = sprintf("<input type=\"password\" class=\"password %s_field\" name=\"%s\" value=\"%s\" />",
$fieldName,
$fieldName,
$fieldValue
if ($fieldChecked === false) $checked = " ";
// Generate the content
- $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox\" id=\"%s_field\" value=\"1\"%s/>",
+ $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
$fieldName,
$fieldName,
$checked
* @return $isSecured Wether this form is secured by a CAPTCHA
*/
public function ifFormSecuredWithCaptcha () {
- $isSecured = ($this->getConfigInstance()->readConfig($this->getFormName()."_captcha_secured") == "Y");
+ $isSecured = ($this->getConfigInstance()->readConfig($this->getFormName().'_captcha_secured') === "Y");
return $isSecured;
}
parent::__construct(__CLASS__);
// Set part description
- $this->setObjectDescription("");
+ $this->setObjectDescription("PNG image");
// Create unique ID number
$this->generateUniqueId();
$imageInstance->setTemplateInstance($templateInstance);
// Set image type
- $imageInstance->setImageType("png");
+ $imageInstance->setImageType('png');
// Return the instance
return $imageInstance;
// Is the header (maybe) valid?
if (count($header) != 4) {
// Throw an exception
- throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
} elseif (substr($rawLine, 0, 5) == "@data") {
// Is a data line!
// Was a header found?
if (count($header) != 4) {
// Throw an exception
- throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
// Decode all from Base64
if (class_exists($this->getClassName())) {
// This class does exist. :-)
$isValid = true;
- } elseif (($this->getClassName() != $this->controllerPrefix."DefaultController") && ($this->getClassName() != $this->controllerPrefix."DefaultNewsController")) {
+ } elseif (($this->getClassName() != $this->controllerPrefix.'DefaultController') && ($this->getClassName() != $this->controllerPrefix.'DefaultNewsController')) {
// Do we have news?
if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
// Yes, display news in home then set default controller with news
- $this->setClassName($this->controllerPrefix."DefaultNewsController");
+ $this->setClassName($this->controllerPrefix.'DefaultNewsController');
} else {
- // No news at "home" page or non-news page
- $this->setClassName($this->controllerPrefix."DefaultController");
+ // No news at home page or non-news page
+ $this->setClassName($this->controllerPrefix.'DefaultController');
}
} else {
// All is tried, give it up here
$controllerInstance = null;
// Default controller
- $this->setClassName("ImageDefaultController");
+ $this->setClassName('ImageDefaultController');
// Generate the class name
//* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
));
} else {
// Default controller
- $this->setClassName("ImageDefaultController");
+ $this->setClassName('ImageDefaultController');
}
//* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
$controllerInstance = null;
// Default controller
- $this->setClassName("WebDefaultController");
+ $this->setClassName('WebDefaultController');
// Generate the class name
//* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
));
} elseif ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
// Yes, display news in home then set default controller with news
- $this->setClassName("WebDefaultNewsController");
+ $this->setClassName('WebDefaultNewsController');
} else {
- // No news at "home" page or non-news page
- $this->setClassName("WebDefaultController");
+ // No news at home page or non-news page
+ $this->setClassName('WebDefaultController');
}
//* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
/**
* Current variable group
*/
- private $currGroup = "general";
+ private $currGroup = 'general';
/**
* All template groups except "general"
*/
private function addVariable ($var, $value) {
// Set general variable group
- $this->setVariableGroup("general");
+ $this->setVariableGroup('general');
// Add it to the stack
$this->addGroupVariable($var, $value);
//* DEBIG: */ echo __METHOD__.": currGroup=".$groupName."<br />\n";
$this->currGroup = $groupName;
- // Skip group "general"
- if (($groupName != "general") && ($add === true)) {
- $this->varGroups[$groupName] = "OK";
+ // Skip group 'general'
+ if (($groupName != 'general') && ($add === true)) {
+ $this->varGroups[$groupName] = 'OK';
} // END - if
}
}
/**
- * Try to assign an extracted template variable as a "content" or "config"
+ * Try to assign an extracted template variable as a "content" or 'config'
* variable.
*
* @param $varName The variable's name (shall be content orconfig) by
*/
private function assignTemplateVariable ($varName, $var) {
// Is it not a config variable?
- if ($varName != "config") {
+ if ($varName != 'config') {
// Regular template variables
$this->assignVariable($var, "");
} else {
*/
public function assignApplicationData (ManageableApplication $appInstance) {
// Get long name and assign it
- $this->assignVariable("app_full_name" , $appInstance->getAppName());
+ $this->assignVariable('app_full_name' , $appInstance->getAppName());
// Get short name and assign it
- $this->assignVariable("app_short_name", $appInstance->getAppShortName());
+ $this->assignVariable('app_short_name', $appInstance->getAppShortName());
// Get version number and assign it
- $this->assignVariable("app_version" , $appInstance->getAppVersion());
+ $this->assignVariable('app_version' , $appInstance->getAppVersion());
}
/**
*/
class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
/**
- * Main nodes in the XML tree ("image" is ignored)
+ * Main nodes in the XML tree ('image' is ignored)
*/
private $mainNodes = array("base", "type", "resolution", "background-color", "foreground-color", "image-string");
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
xml_set_object($xmlParser, $this);
// Set handler call-backs
- xml_set_element_handler($xmlParser, "startElement", "endElement");
- xml_set_character_data_handler($xmlParser, "characterHandler");
+ xml_set_element_handler($xmlParser, 'startElement', 'endElement');
+ xml_set_character_data_handler($xmlParser, 'characterHandler');
// Now parse the XML tree
if (!xml_parse($xmlParser, $imageContent)) {
*/
public function startElement ($resource, $element, array $attributes) {
// Initial method name which will never be called...
- $methodName = "initImage";
+ $methodName = 'initImage';
// Make the element name lower-case
$element = strtolower($element);
//* DEBUG: */ echo "START: >".$element."<<br />\n";
if (in_array($element, $this->mainNodes)) {
// Okay, main node found!
- $methodName = "setImage" . $this->convertToClassName($element);
+ $methodName = 'setImage' . $this->convertToClassName($element);
} elseif (in_array($element, $this->subNodes)) {
// Sub node found
- $methodName = "setImageProperty" . $this->convertToClassName($element);
- } elseif ($element != "image") {
+ $methodName = 'setImageProperty' . $this->convertToClassName($element);
+ } elseif ($element != 'image') {
// Invalid node name found
throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN);
}
}
// Construct method name
- $methodName = "finish" . $this->convertToClassName($nodeName);
+ $methodName = 'finish' . $this->convertToClassName($nodeName);
// Call the corresponding method
call_user_func_array(array($this->imageInstance, $methodName), array());
*/
private function setImageType ($imageType) {
// Set group to general
- $this->setVariableGroup("general");
+ $this->setVariableGroup('general');
// Try to compile it first to get the value from variable stack
$imageType = $this->compileRawCode($imageType);
// Now make a class name of it
- $className = $this->convertToClassName($imageType."_image");
+ $className = $this->convertToClassName($imageType.'_image');
// And try to initiate it
$this->imageInstance = ObjectFactory::createObjectByName($className, array($this));
// Set current main node to type
- $this->currMainNode = "type";
+ $this->currMainNode = 'type';
}
/**
$this->imageInstance->initResolution();
// Current main node is resolution
- $this->currMainNode = "resolution";
+ $this->currMainNode = 'resolution';
}
/**
$this->imageInstance->initBase();
// Current main node is resolution
- $this->currMainNode = "base";
+ $this->currMainNode = 'base';
}
/**
$this->imageInstance->initBackgroundColor();
// Current main node is background-color
- $this->currMainNode = "background-color";
+ $this->currMainNode = 'background-color';
}
/**
$this->imageInstance->initForegroundColor();
// Current main node is foreground-color
- $this->currMainNode = "foreground-color";
+ $this->currMainNode = 'foreground-color';
}
/**
* @return void
* @see ImageTemplateEngine::setImageResolution
*/
- private function setImageImageString ($groupable = "single") {
+ private function setImageImageString ($groupable = 'single') {
// Call the image class
$this->imageInstance->initImageString($groupable);
// Current main node is foreground-color
- $this->currMainNode = "image-string";
+ $this->currMainNode = 'image-string';
}
/**
*/
public function getImageCacheFqfn () {
// Get the FQFN ready
- $fqfn = $this->getBasePath()."_cache/" . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType();
+ $fqfn = $this->getBasePath().'_cache/' . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType();
// Return it
return $fqfn;
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
--- /dev/null
+#!/bin/sh
+
+echo "$0: Cleaning up..."
+rm -f shipsimu_dev*.zip
+
+echo "$0: Packaging..."
+zip -9 shipsimu_dev.zip docs/* Doxyfile index.php rebuild_doc.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
+
+echo "$0: Renaming..."
+mv shipsimu_dev.zip shipsimu_dev_`date +%Y%m%d_%H%M%S`.zip
+
+echo "$0: All done."