Page MenuHomeDevCentral

D3794.diff
No OneTemporary

D3794.diff

diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
],
"require": {
"keruald/database": "0.5.2",
- "keruald/omnitools": "0.15.0",
+ "keruald/omnitools": "0.15.1",
"smarty/smarty": "^5.6.0",
"ext-mysqli": "*"
},
diff --git a/workspaces/composer.json b/workspaces/composer.json
--- a/workspaces/composer.json
+++ b/workspaces/composer.json
@@ -4,7 +4,7 @@
"type": "project",
"require": {
"keruald/database": "0.5.2",
- "keruald/omnitools": "0.15.0",
+ "keruald/omnitools": "0.15.1",
"smarty/smarty": "^5.6.0"
},
"require-dev": {
diff --git a/workspaces/src/Engines/Errors/ErrorHandling.php b/workspaces/src/Engines/Errors/ErrorHandling.php
new file mode 100644
--- /dev/null
+++ b/workspaces/src/Engines/Errors/ErrorHandling.php
@@ -0,0 +1,116 @@
+<?php
+
+namespace Waystone\Workspaces\Engines\Errors;
+
+use Keruald\OmniTools\Debug\Debugger;
+
+use ErrorException;
+
+class ErrorHandling {
+
+ public static function init () : void {
+ error_reporting(E_ALL);
+
+ $minorRecoverableErrors =
+ E_NOTICE | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED;
+
+ set_error_handler([static::class, 'throwExceptionErrorHandler'],
+ E_ALL ^ $minorRecoverableErrors);
+
+ Debugger::register();
+ }
+
+ /**
+ * A callback method for the error handler, which throws exceptions on errors
+ *
+ * @param int $errno the level of the error raised
+ * @param string $errstr the error message
+ * @param string $errfile the filename that the error was raised in
+ * @param int $errline the line number the error was raised at
+ *
+ * @return boolean true when the error has been handled ; otherwise, false,
+ * to let the normal error handler continues.
+ * @throws ErrorException
+ */
+ public static function throwExceptionErrorHandler (
+ int $errno, string $errstr, string $errfile, int $errline
+ ) : bool {
+ if (error_reporting() === 0) {
+ return false;
+ }
+
+ throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
+ }
+
+ /**
+ * Prints an error message and dies
+ *
+ * @param int $code A constant identifying the type of error (SQL_ERROR, HACK_ERROR or GENERAL_ERROR)
+ * @param string|null $text the error description
+ * @param string|null $title the error title
+ * @param int|null $line the file line the error have occurred (typically __LINE__)
+ * @param string|null $file the file the error have occurred (typically __FILE__)
+ * @param string|null $sql the sql query which caused the error
+ *
+ * @return never
+ */
+ public static function messageAndDie (
+ int $code,
+ ?string $text = null,
+ ?string $title = null,
+ ?int $line = null,
+ ?string $file = null,
+ ?string $sql = null,
+ ) : never {
+ //Ensures we've an error text
+ $text ??= "An error have occurred";
+
+ //Adds file and line information to error text
+ if ($file !== null) {
+ $text .= " — $file";
+ if ($line !== null) {
+ $text .= ", line $line";
+ }
+ }
+
+ //Ensures we've an error title and adds relevant extra information
+ switch ($code) {
+ case HACK_ERROR:
+ $title ??= "Access non authorized";
+ break;
+
+ case SQL_ERROR:
+ global $db;
+ $title ??= "SQL error";
+
+ //Gets SQL error information
+ if ($db !== null) {
+ $sqlError = $db->error();
+ if ($sqlError['message'] != '') {
+ $text .= "<br />Error n° $sqlError[code]: $sqlError[message]";
+ }
+ $text .= '<br />&nbsp;';
+ }
+
+ $text .= '<br />Query: ';
+ $text .= $sql;
+
+ break;
+
+ default:
+ //TODO: here can be added code to handle error error ;-)
+ //Falls to GENERAL_ERROR
+
+ case GENERAL_ERROR:
+ $title ??= "General error";
+ break;
+ }
+
+ //HTML output of $title and $text variables
+ echo '<div class="FatalError"><p class="FatalErrorTitle">', $title,
+ '</p><p>', $text, '</p></div>';
+
+ exit;
+ }
+
+}
diff --git a/workspaces/src/includes/GlobalFunctions.php b/workspaces/src/includes/GlobalFunctions.php
--- a/workspaces/src/includes/GlobalFunctions.php
+++ b/workspaces/src/includes/GlobalFunctions.php
@@ -57,16 +57,6 @@
if ($amount >= 2 || $amount <= -2 ) return 's';
}
-/*
- * Prints human-readable information about a variable, wrapped in a <pre> block
- * @param mixed $mixed the variable to dump
- */
-function dprint_r ($mixed) {
- echo '<pre>';
- print_r($mixed);
- echo '</pre>';
-}
-
/**
* Gets file extension
* @param string $file the file to get the extension
diff --git a/workspaces/src/includes/cache/cache.php b/workspaces/src/includes/cache/cache.php
--- a/workspaces/src/includes/cache/cache.php
+++ b/workspaces/src/includes/cache/cache.php
@@ -31,6 +31,8 @@
*
*/
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
+
/**
* Cache caller
*/
@@ -71,12 +73,12 @@
$engine_class = 'Cache' . ucfirst($engine);
if (!file_exists($engine_file)) {
- message_die(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />$engine_file not found.", 'Cache');
+ ErrorHandling::messageAndDie(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />$engine_file not found.", 'Cache');
}
require_once($engine_file);
if (!class_exists($engine_class)) {
- message_die(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />$engine_class class not found.", 'Cache');
+ ErrorHandling::messageAndDie(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />$engine_class class not found.", 'Cache');
}
return call_user_func(array($engine_class, 'load'));
diff --git a/workspaces/src/includes/cache/memcached.php b/workspaces/src/includes/cache/memcached.php
--- a/workspaces/src/includes/cache/memcached.php
+++ b/workspaces/src/includes/cache/memcached.php
@@ -16,6 +16,8 @@
*
*/
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
+
/**
* Memcached cache
*
@@ -52,9 +54,9 @@
//Checks extension is okay
if (!extension_loaded('memcached')) {
if (extension_loaded('memcache')) {
- message_die(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />PHP extension memcached not loaded.<br /><strong>!!! This class uses the Memcached extension AND NOT the Memcache extension (this one is loaded) !!!</strong>", 'Cache');
+ ErrorHandling::messageAndDie(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />PHP extension memcached not loaded.<br /><strong>!!! This class uses the Memcached extension AND NOT the Memcache extension (this one is loaded) !!!</strong>", 'Cache');
} else {
- message_die(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />PHP extension memcached not loaded.", 'Cache');
+ ErrorHandling::messageAndDie(GENERAL_ERROR, "Can't initialize $engine cache engine.<br />PHP extension memcached not loaded.", 'Cache');
}
}
diff --git a/workspaces/src/includes/error.php b/workspaces/src/includes/error.php
deleted file mode 100755
--- a/workspaces/src/includes/error.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-/**
- * _, __, _, _ __, _ _, _, _
- * / \ |_) (_ | | \ | /_\ |\ |
- * \ / |_) , ) | |_/ | | | | \|
- * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
- *
- * Error handling
- *
- * There are 3 standard error types:
- * - SQL_ERROR error during a sql query
- * - HACK_ERROR error trying to access a protected resource
- * - GENERAL_ERROR miscelleanous error
- *
- * The message_die/SQL_ERROR idea were found in phpBB 2 code.
- *
- * @package ObsidianWorkspaces
- * @subpackage Keruald
- * @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
- * @license http://www.opensource.org/licenses/bsd-license.php BSD
- * @filesource
- *
- */
-
-//Error code constants
-define ("SQL_ERROR", 65);
-define ("HACK_ERROR", 99);
-define ("GENERAL_ERROR", 117);
-
-/**
- * Prints human-readable information about a variable
- * wrapped in a general error and dies
- *
- * @param mixed $mixed the variable to dump
- */
-function dieprint_r ($var, $title = '') {
- if (!$title) $title = 'Debug';
-
- //GENERAL_ERROR with print_r call as message
- message_die(GENERAL_ERROR, '<pre>' . print_r($var, true) .'</pre>', $title);
-}
-
-/**
- * A callback method for the error handler, which throws exceptions on errors
- *
- * @param int $errno the level of the error raised
- * @param string $errstr the error message
- * @param string $errfile the filename that the error was raised in
- * @param int $errline the line number the error was raised at
- *
- * @return boolean true when the error has been handled ; otherwise, false,
- * to let the normal error handler continues.
- * @throws \ErrorException
- */
-function throwExceptionErrorHandler (int $errno, string $errstr, string $errfile, int $errline) : bool {
- if (error_reporting() === 0) {
- return false;
- }
-
- throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
-}
-
-/**
- * Prints an error message and dies
- *
- * @param int $code A constant identifying the type of error (SQL_ERROR, HACK_ERROR or GENERAL_ERROR)
- * @param string $text the error description
- * @param string $text the error title
- * @param int $line the file line the error have occured (typically __LINE__)
- * @param string $file the file the error have occured (typically __FILE__)
- * @param string $sql the sql query which caused the error
- */
-function message_die ($code, $text = '', $title = '', $line = '', $file = '', $sql = '') {
- //Ensures we've an error text
- $text = $text ? $text : "An error have occured";
-
- //Adds file and line information to error text
- if ($file) {
- $text .= " — $file";
- if ($line) {
- $text .= ", line $line";
- }
- }
-
- //Ensures we've an error title and adds relevant extra information
- switch ($code) {
- case HACK_ERROR:
- $title = $title ? $title : "Access non authorized";
- break;
-
- case SQL_ERROR:
- global $db;
- $title = $title ? $title : "SQL error";
-
- //Gets SQL error information
- $sqlError = $db->error();
- if ($sqlError['message'] != '') {
- $text .= "<br />Error n° $sqlError[code]: $sqlError[message]";
- }
- $text .= '<br />&nbsp;<br />Query: ';
- $text .= $sql;
-
- break;
-
- default:
- //TODO: here can be added code to handle error error ;-)
- //Falls to GENERAL_ERROR
-
- case GENERAL_ERROR:
- $title = $title ? $title : "General error";
- break;
- }
-
- //HTML output of $title and $text variables
- echo '<div class="FatalError"><p class="FatalErrorTitle">', $title,
- '</p><p>', $text, '</p></div>';
-
- exit;
-}
diff --git a/workspaces/src/includes/login.php b/workspaces/src/includes/login.php
--- a/workspaces/src/includes/login.php
+++ b/workspaces/src/includes/login.php
@@ -16,13 +16,15 @@
*
*/
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
+
$action = array_key_exists('action', $_GET) ? $_GET['action'] : '';
if (array_key_exists('LogIn', $_POST)) {
//User have submitted login form
$username = $db->escape($_POST['username']);
$sql = "SELECT user_password, user_id FROM " . TABLE_USERS . " WHERE username = '$username'";
- if ( !($result = $db->query($sql)) ) message_die(SQL_ERROR, "Can't get user information", '', __LINE__, __FILE__, $sql);
+ if ( !($result = $db->query($sql)) ) ErrorHandling::messageAndDie(SQL_ERROR, "Can't get user information", '', __LINE__, __FILE__, $sql);
if ($row = $db->fetchRow($result)) {
if (!$row['user_password']) {
diff --git a/workspaces/src/includes/objects/user.php b/workspaces/src/includes/objects/user.php
--- a/workspaces/src/includes/objects/user.php
+++ b/workspaces/src/includes/objects/user.php
@@ -16,6 +16,8 @@
*
*/
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
+
/**
* User class
*/
@@ -85,7 +87,7 @@
function load_from_database () {
global $db;
$sql = "SELECT * FROM " . TABLE_USERS . " WHERE user_id = '" . $this->id . "'";
- if ( !($result = $db->query($sql)) ) message_die(SQL_ERROR, "Unable to query users", '', __LINE__, __FILE__, $sql);
+ if ( !($result = $db->query($sql)) ) ErrorHandling::messageAndDie(SQL_ERROR, "Unable to query users", '', __LINE__, __FILE__, $sql);
if (!$row = $db->fetchRow($result)) {
$this->lastError = "User unknown: " . $this->id;
return false;
@@ -128,7 +130,7 @@
//Updates or inserts
$sql = "REPLACE INTO " . TABLE_USERS . " (`user_id`, `username`, `user_password`, `user_active`, `user_email`, `user_regdate`) VALUES ($id, '$name', '$password', $active, '$email', $regdate)";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Unable to save user", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Unable to save user", '', __LINE__, __FILE__, $sql);
}
if (!$this->id) {
@@ -143,13 +145,13 @@
function save_field ($field) {
global $db;
if (!$this->id) {
- message_die(GENERAL_ERROR, "You're trying to update a record not yet saved in the database");
+ ErrorHandling::messageAndDie(GENERAL_ERROR, "You're trying to update a record not yet saved in the database");
}
$id = $db->escape($this->id);
$value = $db->escape($this->$field);
$sql = "UPDATE " . TABLE_USERS . " SET `$field` = '$value' WHERE user_id = '$id'";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Unable to save $field field", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Unable to save $field field", '', __LINE__, __FILE__, $sql);
}
}
@@ -167,7 +169,7 @@
$this->id = mt_rand(2001, 9999);
$sql = "SELECT COUNT(*) FROM " . TABLE_USERS . " WHERE user_id = $this->id";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't check if a user id is free", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't check if a user id is free", '', __LINE__, __FILE__, $sql);
}
$row = $db->fetchRow($result);
} while ($row[0]);
@@ -191,7 +193,7 @@
global $db;
$sql = "SELECT COUNT(*) FROM " . TABLE_USERS . " WHERE username = '$login'";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't check if the specified login is available", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't check if the specified login is available", '', __LINE__, __FILE__, $sql);
}
$row = $db->fetchRow($result);
return ($row[0] == 0);
@@ -219,7 +221,7 @@
global $db;
$sql = "SELECT * FROM " . TABLE_USERS . " WHERE user_email = '$mail'";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't get user", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't get user", '', __LINE__, __FILE__, $sql);
}
if ($row = $db->fetchRow($result)) {
@@ -252,7 +254,7 @@
$sql = "SELECT user_id FROM " . TABLE_USERS_AUTH . " WHERE "
. "auth_type = '$authType' AND auth_identity = '$remoteUserId'";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't get user", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't get user", '', __LINE__, __FILE__, $sql);
}
if ($row = $db->fetchRow($result)) {
@@ -276,7 +278,7 @@
$sql = "INSERT INTO " . TABLE_USERS_AUTH . " (auth_type, auth_identity, auth_properties, user_id) "
. "VALUES ('$authType', '$remoteUserId', $properties, $this->id)";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Can't set user remote identity provider information", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't set user remote identity provider information", '', __LINE__, __FILE__, $sql);
}
}
@@ -302,7 +304,7 @@
global $db;
$sql = "SELECT count(*) FROM users_groups_members WHERE group_id = $group->id AND user_id = $this->id";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't determine if the user belongs to the group", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't determine if the user belongs to the group", '', __LINE__, __FILE__, $sql);
}
$row = $db->fetchRow($result);
@@ -320,7 +322,7 @@
$isAdmin = $isAdmin ? 1 : 0;
$sql = "REPLACE INTO users_groups_members VALUES ($group->id, $this->id, $isAdmin)";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Can't add user to group", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't add user to group", '', __LINE__, __FILE__, $sql);
}
}
@@ -373,7 +375,7 @@
'$resourceType', $resourceId,
'$permissionName', $permissionFlag)";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Can't set user permission", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't set user permission", '', __LINE__, __FILE__, $sql);
}
}
@@ -387,7 +389,7 @@
global $db;
$sql = "SELECT group_id FROM " . TABLE_UGROUPS_MEMBERS . " WHERE user_id = " . $user_id;
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't get user groups", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't get user groups", '', __LINE__, __FILE__, $sql);
}
$gids = array();
while ($row = $db->fetchRow($result)) {
diff --git a/workspaces/src/includes/objects/usergroup.php b/workspaces/src/includes/objects/usergroup.php
--- a/workspaces/src/includes/objects/usergroup.php
+++ b/workspaces/src/includes/objects/usergroup.php
@@ -15,6 +15,8 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
+
/**
* UserGroup class
*
@@ -65,7 +67,7 @@
global $db;
$id = $db->escape($this->id);
$sql = "SELECT * FROM " . TABLE_UGROUPS . " WHERE group_id = '" . $id . "'";
- if (!$result = $db->query($sql)) message_die(SQL_ERROR, "Unable to query users_groups", '', __LINE__, __FILE__, $sql);
+ if (!$result = $db->query($sql)) ErrorHandling::messageAndDie(SQL_ERROR, "Unable to query users_groups", '', __LINE__, __FILE__, $sql);
if (!$row = $db->fetchRow($result)) {
$this->lastError = "UserGroup unknown: " . $this->id;
return false;
@@ -84,7 +86,7 @@
global $db;
$code = $db->escape($code);
$sql = "SELECT * FROM " . TABLE_UGROUPS . " WHERE group_code = '" . $code . "'";
- if (!$result = $db->query($sql)) message_die(SQL_ERROR, "Unable to query group", '', __LINE__, __FILE__, $sql);
+ if (!$result = $db->query($sql)) ErrorHandling::messageAndDie(SQL_ERROR, "Unable to query group", '', __LINE__, __FILE__, $sql);
if (!$row = $db->fetchRow($result)) {
throw new Exception("Group unknown: " . $code);
}
@@ -108,7 +110,7 @@
//Updates or inserts
$sql = "REPLACE INTO " . TABLE_UGROUPS . " (`group_id`, `group_code`, `group_title`, `group_description`) VALUES ('$id', '$code', '$title', '$description')";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
}
if (!$this->id) {
diff --git a/workspaces/src/includes/workspaces/Workspace.php b/workspaces/src/includes/workspaces/Workspace.php
--- a/workspaces/src/includes/workspaces/Workspace.php
+++ b/workspaces/src/includes/workspaces/Workspace.php
@@ -15,6 +15,7 @@
* @filesource
*/
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
use Waystone\Workspaces\Engines\Framework\Context;
/**
@@ -78,7 +79,7 @@
global $db;
$code = $db->escape($code);
$sql = "SELECT * FROM " . TABLE_WORKSPACES . " WHERE workspace_code = '" . $code . "'";
- if (!$result = $db->query($sql)) message_die(SQL_ERROR, "Unable to query workspaces", '', __LINE__, __FILE__, $sql);
+ if (!$result = $db->query($sql)) ErrorHandling::messageAndDie(SQL_ERROR, "Unable to query workspaces", '', __LINE__, __FILE__, $sql);
if (!$row = $db->fetchRow($result)) {
throw new Exception("Workspace unknown: " . $code);
}
@@ -95,7 +96,7 @@
global $db;
$id = $db->escape($this->id);
$sql = "SELECT * FROM " . TABLE_WORKSPACES . " WHERE workspace_id = '" . $id . "'";
- if (!$result = $db->query($sql)) message_die(SQL_ERROR, "Unable to query workspaces", '', __LINE__, __FILE__, $sql);
+ if (!$result = $db->query($sql)) ErrorHandling::messageAndDie(SQL_ERROR, "Unable to query workspaces", '', __LINE__, __FILE__, $sql);
if (!$row = $db->fetchRow($result)) {
$this->lastError = "Workspace unknown: " . $this->id;
return false;
@@ -119,7 +120,7 @@
//Updates or inserts
$sql = "REPLACE INTO " . TABLE_WORKSPACES . " (`workspace_id`, `workspace_code`, `workspace_name`, `workspace_created`, `workspace_description`) VALUES ('$id', '$code', '$name', '$created', '$description')";
if (!$db->query($sql)) {
- message_die(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
}
if (!$this->id) {
@@ -186,7 +187,7 @@
p.permission_flag > 0 AND
($clause)";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't get user workspaces", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't get user workspaces", '', __LINE__, __FILE__, $sql);
}
$workspaces = array();
@@ -216,7 +217,7 @@
$code = $db->escape($code);
$sql = "SELECT count(*) FROM " . TABLE_WORKSPACES . " WHERE workspace_code = '$code'";
if (!$result = $db->query($sql)) {
- message_die(SQL_ERROR, "Can't check workspace code", '', __LINE__, __FILE__, $sql);
+ ErrorHandling::messageAndDie(SQL_ERROR, "Can't check workspace code", '', __LINE__, __FILE__, $sql);
}
$row = $db->fetchRow($result);
return ($row[0] == 1);
diff --git a/workspaces/src/index.php b/workspaces/src/index.php
--- a/workspaces/src/index.php
+++ b/workspaces/src/index.php
@@ -17,6 +17,7 @@
*/
use Keruald\Database\Database;
+use Waystone\Workspaces\Engines\Errors\ErrorHandling;
////////////////////////////////////////////////////////////////////////////////
///
@@ -46,7 +47,7 @@
$context->workspace->loadConfiguration($context);
}
} catch (Exception $ex) {
- message_die(GENERAL_ERROR, $ex->getMessage(), Language::get('CantLoadWorkspace'));
+ ErrorHandling::messageAndDie(GENERAL_ERROR, $ex->getMessage(), Language::get('CantLoadWorkspace'));
}
//Handles login or logout
@@ -69,7 +70,7 @@
//If a workspace has been selected, ensures the current logged in user has access to it.
if ($context->workspace && !$context->workspace->userCanAccess($context->user)) {
- message_die(HACK_ERROR, "You don't have access to this workspace.", 'Access control');
+ ErrorHandling::messageAndDie(HACK_ERROR, "You don't have access to this workspace.", 'Access control');
}
$controller = count($context->url) > 0 ? $context->url[0] : '';

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 24, 00:54 (19 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3099651
Default Alt Text
D3794.diff (24 KB)

Event Timeline