diff --git a/Core/Frameworks/Baikal/Core/Tools.php b/Core/Frameworks/Baikal/Core/Tools.php index 6879258..25f7808 100644 --- a/Core/Frameworks/Baikal/Core/Tools.php +++ b/Core/Frameworks/Baikal/Core/Tools.php @@ -35,23 +35,23 @@ class Tools { static function assertEnvironmentIsOk() { # Asserting Baikal Context if (!defined("BAIKAL_CONTEXT") || BAIKAL_CONTEXT !== true) { - die("Bootstrap.php may not be included outside the Baikal context"); + exit("Bootstrap.php may not be included outside the Baikal context"); } # Asserting PDO if (!defined('PDO::ATTR_DRIVER_NAME')) { - die('Baikal Fatal Error: PDO is unavailable. It\'s required by Baikal.'); + exit('Baikal Fatal Error: PDO is unavailable. It\'s required by Baikal.'); } # Asserting PDO::SQLite or PDO::MySQL $aPDODrivers = \PDO::getAvailableDrivers(); if (!in_array('sqlite', $aPDODrivers, true) && !in_array('mysql', $aPDODrivers, true)) { - die('Baikal Fatal Error: Both PDO::sqlite and PDO::mysql are unavailable. One of them at least is required by Baikal.'); + exit('Baikal Fatal Error: Both PDO::sqlite and PDO::mysql are unavailable. One of them at least is required by Baikal.'); } # Assert that the temp folder is writable if (!\is_writable(\sys_get_temp_dir())) { - die('Baikal Fatal Error: The system temp directory is not writable.'); + exit('Baikal Fatal Error: The system temp directory is not writable.'); } } diff --git a/Core/Frameworks/Baikal/WWWRoot/index.php b/Core/Frameworks/Baikal/WWWRoot/index.php index d70abc6..1aa057c 100644 --- a/Core/Frameworks/Baikal/WWWRoot/index.php +++ b/Core/Frameworks/Baikal/WWWRoot/index.php @@ -40,7 +40,7 @@ if (file_exists(getcwd() . "/Core")) { } if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { - die('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); + exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); } require PROJECT_PATH_ROOT . 'vendor/autoload.php'; diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index 25b4953..6d7f882 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -39,7 +39,7 @@ class Initialize extends \Flake\Core\Controller { $message = "

Error - Insufficient permissions on the configuration folders

"; $message .= "

In order to work properly, Baïkal needs to have write permissions in the Specific/ and config/ folder.

"; - die($message); + exit($message); } $this->createHtaccessFilesIfNeeded(); diff --git a/Core/Frameworks/BaikalAdmin/WWWRoot/index.php b/Core/Frameworks/BaikalAdmin/WWWRoot/index.php index 0f9d83e..31afd48 100644 --- a/Core/Frameworks/BaikalAdmin/WWWRoot/index.php +++ b/Core/Frameworks/BaikalAdmin/WWWRoot/index.php @@ -41,7 +41,7 @@ if (file_exists(dirname(getcwd()) . "/Core")) { } if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { - die('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); + exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); } require PROJECT_PATH_ROOT . 'vendor/autoload.php'; diff --git a/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php b/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php index 93038d3..ba3414b 100644 --- a/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php +++ b/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php @@ -48,7 +48,7 @@ if (file_exists(dirname(dirname(getcwd())) . "/Core")) { } if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { - die('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); + exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); } require PROJECT_PATH_ROOT . "vendor/autoload.php"; @@ -92,7 +92,7 @@ if (!$config || !isset($config['system']["configured_version"])) { $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Database()); } else { echo "Installation was already completed. Please head to the admin interface to modify any settings.\n"; - die(); + exit(); } } diff --git a/Core/Frameworks/Flake/Controller/Cli.php b/Core/Frameworks/Flake/Controller/Cli.php index 9fd8032..4f41a27 100644 --- a/Core/Frameworks/Flake/Controller/Cli.php +++ b/Core/Frameworks/Flake/Controller/Cli.php @@ -81,7 +81,7 @@ class Cli extends \Flake\Core\Render\Container { function syntaxError() { $sStr = $this->rawLine("Syntax error.\nUsage: " . $this->getSyntax()); - die("\n\n" . $sStr . "\n\n"); + exit("\n\n" . $sStr . "\n\n"); } function log($sStr) { diff --git a/Core/Frameworks/Flake/Controller/Page.php b/Core/Frameworks/Flake/Controller/Page.php index 7d4e1de..5267409 100644 --- a/Core/Frameworks/Flake/Controller/Page.php +++ b/Core/Frameworks/Flake/Controller/Page.php @@ -115,7 +115,7 @@ class Page extends \Flake\Core\Render\Container { if (!file_exists($sCompiledPath)) { @mkdir($sCompiledPath); if (!file_exists($sCompiledPath)) { - die("Page: Cannot create " . $sCompiledPath); + exit("Page: Cannot create " . $sCompiledPath); } } diff --git a/Core/Frameworks/Flake/Core/Database.php b/Core/Frameworks/Flake/Core/Database.php index 8a17d47..4bc0b8a 100644 --- a/Core/Frameworks/Flake/Core/Database.php +++ b/Core/Frameworks/Flake/Core/Database.php @@ -37,7 +37,7 @@ abstract class Database extends \Flake\Core\FLObject { protected function messageAndDie($sMessage) { $sError = "

" . get_class($this) . ": " . $sMessage . "

"; - die($sError); + exit($sError); } function exec_INSERTquery($table, $fields_values, $no_quote_fields = false) { @@ -102,7 +102,7 @@ abstract class Database extends \Flake\Core\FLObject { return $query; } } else { - die('Fatal Error: "Where" clause argument for UPDATE query was not a string in $this->UPDATEquery() !'); + exit('Fatal Error: "Where" clause argument for UPDATE query was not a string in $this->UPDATEquery() !'); } } @@ -124,7 +124,7 @@ abstract class Database extends \Flake\Core\FLObject { return $query; } else { - die('Fatal Error: "Where" clause argument for DELETE query was not a string in $this->DELETEquery() !'); + exit('Fatal Error: "Where" clause argument for DELETE query was not a string in $this->DELETEquery() !'); } } diff --git a/Core/Frameworks/Flake/Core/Datastructure/Chainable.php b/Core/Frameworks/Flake/Core/Datastructure/Chainable.php index dd15903..2277514 100644 --- a/Core/Frameworks/Flake/Core/Datastructure/Chainable.php +++ b/Core/Frameworks/Flake/Core/Datastructure/Chainable.php @@ -35,5 +35,5 @@ interface Chainable extends \ArrayAccess, \Iterator, \Countable { function &last(); - function chain(\Flake\Core\Datastructure\Chain $chain, $key); + function chain(Chain $chain, $key); } diff --git a/Core/Frameworks/Flake/Core/Route.php b/Core/Frameworks/Flake/Core/Route.php index f80d719..f2f539f 100644 --- a/Core/Frameworks/Flake/Core/Route.php +++ b/Core/Frameworks/Flake/Core/Route.php @@ -27,9 +27,11 @@ namespace Flake\Core; +use Flake\Core\Render\Container; + abstract class Route extends \Flake\Core\FLObject { # should be abstract, but is not, due to PHP strict standard - static function layout(\Flake\Core\Render\Container &$oRenderContainer) { + static function layout(Container &$oRenderContainer) { } static function parametersMap() { diff --git a/Core/Frameworks/Flake/Framework.php b/Core/Frameworks/Flake/Framework.php index b3fc227..9f88bd1 100644 --- a/Core/Frameworks/Flake/Framework.php +++ b/Core/Frameworks/Flake/Framework.php @@ -95,7 +95,7 @@ class Framework extends \Flake\Core\Framework { static function bootstrap() { # Asserting PHP 5.5.0+ if (version_compare(PHP_VERSION, '5.5.0', '<')) { - die('Flake Fatal Error: Flake requires PHP 5.5.0+ to run properly. Your version is: ' . PHP_VERSION . '.'); + exit('Flake Fatal Error: Flake requires PHP 5.5.0+ to run properly. Your version is: ' . PHP_VERSION . '.'); } # Define safehash salt @@ -272,12 +272,12 @@ class Framework extends \Flake\Core\Framework { # Asserting DB file is writable if (file_exists($config['database']['sqlite_file']) && !is_writable($config['database']['sqlite_file'])) { - die("

DB file is not writable. Please give write permissions on file '" . $config['database']['sqlite_file'] . "'

"); + exit("

DB file is not writable. Please give write permissions on file '" . $config['database']['sqlite_file'] . "'

"); } # Asserting DB directory is writable if (!is_writable(dirname($config['database']['sqlite_file']))) { - die("

The FOLDER containing the DB file is not writable, and it has to.
Please give write permissions on folder '" . dirname($config['database']['sqlite_file']) . "'

"); + exit("

The FOLDER containing the DB file is not writable, and it has to.
Please give write permissions on folder '" . dirname($config['database']['sqlite_file']) . "'

"); } if (file_exists($config['database']['sqlite_file']) && is_readable($config['database']['sqlite_file']) && !isset($GLOBALS["DB"])) { @@ -291,19 +291,19 @@ class Framework extends \Flake\Core\Framework { protected static function initDbMysql(array $config) { if (!$config['database']['mysql_host']) { - die("

The constant PROJECT_DB_MYSQL_HOST, containing the MySQL host name, is not set.
You should set it in config/baikal.yaml

"); + exit("

The constant PROJECT_DB_MYSQL_HOST, containing the MySQL host name, is not set.
You should set it in config/baikal.yaml

"); } if (!$config['database']['mysql_dbname']) { - die("

The constant PROJECT_DB_MYSQL_DBNAME, containing the MySQL database name, is not set.
You should set it in config/baikal.yaml

"); + exit("

The constant PROJECT_DB_MYSQL_DBNAME, containing the MySQL database name, is not set.
You should set it in config/baikal.yaml

"); } if (!$config['database']['mysql_username']) { - die("

The constant PROJECT_DB_MYSQL_USERNAME, containing the MySQL database username, is not set.
You should set it in config/baikal.yaml

"); + exit("

The constant PROJECT_DB_MYSQL_USERNAME, containing the MySQL database username, is not set.
You should set it in config/baikal.yaml

"); } if (!$config['database']['mysql_password']) { - die("

The constant PROJECT_DB_MYSQL_PASSWORD, containing the MySQL database password, is not set.
You should set it in config/baikal.yaml

"); + exit("

The constant PROJECT_DB_MYSQL_PASSWORD, containing the MySQL database password, is not set.
You should set it in config/baikal.yaml

"); } try { @@ -317,7 +317,7 @@ class Framework extends \Flake\Core\Framework { # We now setup t6he connexion to use UTF8 $GLOBALS["DB"]->query("SET NAMES UTF8"); } catch (\Exception $e) { - die("

Baïkal was not able to establish a connexion to the configured MySQL database (as configured in config/baikal.yaml).

"); + exit("

Baïkal was not able to establish a connexion to the configured MySQL database (as configured in config/baikal.yaml).

"); } return true; diff --git a/Core/Frameworks/Flake/Util/Tools.php b/Core/Frameworks/Flake/Util/Tools.php index 839e7d8..07239c3 100644 --- a/Core/Frameworks/Flake/Util/Tools.php +++ b/Core/Frameworks/Flake/Util/Tools.php @@ -397,7 +397,7 @@ TEST; static function HTTPStatus($iCode, $sMessage) { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); - die("

HTTP Status " . $iCode . " : " . $sMessage . "

"); + exit("

HTTP Status " . $iCode . " : " . $sMessage . "

"); } static function number2Rank($a) { diff --git a/Core/Frameworks/Formal/Form.php b/Core/Frameworks/Formal/Form.php index ef4135d..c129a7a 100644 --- a/Core/Frameworks/Formal/Form.php +++ b/Core/Frameworks/Formal/Form.php @@ -27,6 +27,8 @@ namespace Formal; +use Formal\Form\Morphology; + class Form { protected $sModelClass = ""; protected $aOptions = [ @@ -233,7 +235,7 @@ class Form { } # public, as it may be called from a hook - function declareError(\Formal\Element $oElement, $sMessage = "") { + function declareError(Element $oElement, $sMessage = "") { $this->aErrors[] = [ "element" => $oElement, "message" => $sMessage, @@ -254,7 +256,7 @@ class Form { return false; } - function validateRequired($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement) { + function validateRequired($sValue, Morphology $oMorpho, Element $oElement) { if (trim($sValue) !== "") { return true; } @@ -262,7 +264,7 @@ class Form { return "" . $oElement->option("label") . " is required."; } - function validateEmail($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement) { + function validateEmail($sValue, Morphology $oMorpho, Element $oElement) { if (\Flake\Util\Tools::validEmail($sValue)) { return true; } @@ -270,7 +272,7 @@ class Form { return "" . $oElement->option("label") . " should be an email."; } - function validateSameas($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement, $sReferencePropName) { + function validateSameas($sValue, Morphology $oMorpho, Element $oElement, $sReferencePropName) { $sReferenceValue = $oMorpho->element($sReferencePropName)->value(); if ($sValue === $sReferenceValue) { return true; @@ -279,7 +281,7 @@ class Form { return "" . $oElement->option("label") . " does not match " . $oMorpho->element($sReferencePropName)->option("label") . "."; } - function validateUnique($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement) { + function validateUnique($sValue, Morphology $oMorpho, Element $oElement) { $oModelInstance = $this->modelInstance(); $oRequest = $oModelInstance->getBaseRequester()->addClauseEquals( @@ -306,7 +308,7 @@ class Form { return true; } - function validateTokenid($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement) { + function validateTokenid($sValue, Morphology $oMorpho, Element $oElement) { if (!preg_match("/^[a-z0-9\-_]+$/", $sValue)) { return "" . $oElement->option("label") . " is not valid. Allowed characters are digits, lowercase letters, the dash and underscore symbol."; } @@ -314,7 +316,7 @@ class Form { return true; } - function validateColor($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement) { + function validateColor($sValue, Morphology $oMorpho, Element $oElement) { if (!empty($sValue) && !preg_match("/^#[a-fA-F0-9]{6}([a-fA-F0-9]{2})?$/", $sValue)) { return "" . $oElement->option("label") . " is not a valid color with format '#RRGGBB' or '#RRGGBBAA' in hexadecimal values."; } diff --git a/html/cal.php b/html/cal.php index 3a52cc2..76eb025 100644 --- a/html/cal.php +++ b/html/cal.php @@ -42,7 +42,7 @@ if (file_exists(getcwd() . "/Core")) { } if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { - die('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); + exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); } require PROJECT_PATH_ROOT . 'vendor/autoload.php'; @@ -56,7 +56,7 @@ require PROJECT_PATH_ROOT . 'vendor/autoload.php'; try { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); } catch (\Exception $e) { - die('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); + exit('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); } if (!isset($config['system']["cal_enabled"]) || $config['system']["cal_enabled"] !== true) { diff --git a/html/card.php b/html/card.php index 91de6bd..6a41053 100644 --- a/html/card.php +++ b/html/card.php @@ -42,7 +42,7 @@ if (file_exists(getcwd() . "/Core")) { } if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { - die('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); + exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); } require PROJECT_PATH_ROOT . 'vendor/autoload.php'; @@ -56,7 +56,7 @@ require PROJECT_PATH_ROOT . 'vendor/autoload.php'; try { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); } catch (\Exception $e) { - die('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); + exit('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); } if (!isset($config['system']["card_enabled"]) || $config['system']["card_enabled"] !== true) { diff --git a/html/dav.php b/html/dav.php index be51362..642f6ba 100644 --- a/html/dav.php +++ b/html/dav.php @@ -42,7 +42,7 @@ if (file_exists(getcwd() . "/Core")) { } if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { - die('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); + exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); } require PROJECT_PATH_ROOT . 'vendor/autoload.php'; @@ -55,7 +55,7 @@ require PROJECT_PATH_ROOT . 'vendor/autoload.php'; try { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); } catch (\Exception $e) { - die('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); + exit('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); } $server = new \Baikal\Core\Server(