mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 22:27:34 +02:00
PHP Notice removal
This commit is contained in:
61
thumb.php
61
thumb.php
@@ -24,19 +24,42 @@
|
|||||||
|
|
||||||
define('e107_INIT', true);
|
define('e107_INIT', true);
|
||||||
|
|
||||||
// error_reporting(E_ALL);
|
|
||||||
|
|
||||||
function thumbErrorHandler()
|
function thumbExceptionHandler(Exception $exception)
|
||||||
{
|
{
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
echo "Fatal Thumbnail Error";
|
echo "Fatal Thumbnail Error\n";
|
||||||
|
echo $exception->getMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_exception_handler('thumbErrorHandler'); // disable to troubleshoot.
|
function thumbErrorHandler($errno, $errstr, $errfile, $errline)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch($errno)
|
||||||
|
{
|
||||||
|
case E_USER_ERROR:
|
||||||
|
echo "<b>My ERROR</b> [$errno] $errstr<br />\n";
|
||||||
|
echo " Fatal error on line $errline in file $errfile";
|
||||||
|
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
|
||||||
|
echo "Aborting...<br />\n";
|
||||||
|
thumbExceptionHandler(new Exception);
|
||||||
|
exit(1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
set_exception_handler('thumbExceptionHandler'); // disable to troubleshoot.
|
||||||
|
set_error_handler("thumbErrorHandler"); // disable to troubleshoot.
|
||||||
|
|
||||||
|
// error_reporting(0); // suppress all errors or image will be corrupted.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
error_reporting(0); // suppress all errors or image will be corrupted.
|
|
||||||
ini_set('gd.jpeg_ignore_warning', 1);
|
ini_set('gd.jpeg_ignore_warning', 1);
|
||||||
//require_once './e107_handlers/benchmark.php';
|
//require_once './e107_handlers/benchmark.php';
|
||||||
//$bench = new e_benchmark();
|
//$bench = new e_benchmark();
|
||||||
@@ -96,13 +119,22 @@ class e_thumbpage
|
|||||||
// initial path
|
// initial path
|
||||||
$self = realpath(dirname(__FILE__));
|
$self = realpath(dirname(__FILE__));
|
||||||
|
|
||||||
|
$e_ROOT = $self."/";
|
||||||
|
|
||||||
|
if ((substr($e_ROOT,-1) !== '/') && (substr($e_ROOT,-1) !== '\\') )
|
||||||
|
{
|
||||||
|
$e_ROOT .= DIRECTORY_SEPARATOR; // Should function correctly on both windows and Linux now.
|
||||||
|
}
|
||||||
|
|
||||||
|
define('e_ROOT', $e_ROOT);
|
||||||
|
|
||||||
$mySQLdefaultdb = '';
|
$mySQLdefaultdb = '';
|
||||||
$HANDLERS_DIRECTORY = '';
|
$HANDLERS_DIRECTORY = '';
|
||||||
$mySQLprefix = '';
|
$mySQLprefix = '';
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
|
|
||||||
include($self.'/e107_config.php');
|
include($self.DIRECTORY_SEPARATOR.'e107_config.php');
|
||||||
|
|
||||||
// support early include feature
|
// support early include feature
|
||||||
if(isset($CLASS2_INCLUDE) && !empty($CLASS2_INCLUDE))
|
if(isset($CLASS2_INCLUDE) && !empty($CLASS2_INCLUDE))
|
||||||
@@ -113,12 +145,17 @@ class e_thumbpage
|
|||||||
|
|
||||||
ob_end_clean(); // Precaution - clearout utf-8 BOM or any other garbage in e107_config.php
|
ob_end_clean(); // Precaution - clearout utf-8 BOM or any other garbage in e107_config.php
|
||||||
|
|
||||||
$tmp = $self.'/'.$HANDLERS_DIRECTORY;
|
if(empty($HANDLERS_DIRECTORY))
|
||||||
|
{
|
||||||
|
$HANDLERS_DIRECTORY = 'e107_handlers/'; // quick fix for CLI Unit test.
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = $self.DIRECTORY_SEPARATOR.$HANDLERS_DIRECTORY;
|
||||||
|
|
||||||
//Core functions - now API independent
|
//Core functions - now API independent
|
||||||
@require($tmp.'/core_functions.php');
|
@require($tmp.DIRECTORY_SEPARATOR.'core_functions.php');
|
||||||
//e107 class
|
//e107 class
|
||||||
@require($tmp.'/e107_class.php');
|
@require($tmp.DIRECTORY_SEPARATOR.'e107_class.php');
|
||||||
|
|
||||||
$e107_paths = compact(
|
$e107_paths = compact(
|
||||||
'ADMIN_DIRECTORY',
|
'ADMIN_DIRECTORY',
|
||||||
@@ -151,12 +188,12 @@ class e_thumbpage
|
|||||||
$e107->file_path = $e107->fix_windows_paths($self)."/";
|
$e107->file_path = $e107->fix_windows_paths($self)."/";
|
||||||
$e107->set_base_path();
|
$e107->set_base_path();
|
||||||
$e107->set_request(false);
|
$e107->set_request(false);
|
||||||
$e107->set_urls(false); //todo check if this is still required after the 'prepare' issue is fixed.
|
// $e107->set_urls(false); //todo check if this is still required after the 'prepare' issue is fixed.
|
||||||
unset($tmp, $self);
|
unset($tmp, $self);
|
||||||
|
$e107->set_urls(false);
|
||||||
// basic Admin area detection - required for proper path parsing
|
// basic Admin area detection - required for proper path parsing
|
||||||
define('ADMIN', strpos(e_SELF, ($e107->getFolder('admin')) !== false || strpos(e_PAGE, 'admin') !== false));
|
define('ADMIN', strpos(e_SELF, ($e107->getFolder('admin')) !== false || strpos(e_PAGE, 'admin') !== false));
|
||||||
$e107->set_urls(false);
|
|
||||||
// Next function call maintains behavior identical to before; might not be needed
|
// Next function call maintains behavior identical to before; might not be needed
|
||||||
// See https://github.com/e107inc/e107/issues/3033
|
// See https://github.com/e107inc/e107/issues/3033
|
||||||
$e107->set_urls_deferred();
|
$e107->set_urls_deferred();
|
||||||
|
Reference in New Issue
Block a user