@ -1,3 +0,0 @@ |
||||
[2025-07-23 16:53:30] [WARNING] HydraterLicense\KeyGenerator::generatePublicKey(/var/www/ProjectCodeHydrater/protected/keydata/private.pem): Failed to open stream: No such file or directory in /var/www/ProjectCodeHydrater/protected/cli/makeLicense.php on line 109 |
||||
[2025-07-23 16:53:30] [WARNING] file_get_contents(/var/www/ProjectCodeHydrater/protected/keydata/private.pem): Failed to open stream: No such file or directory in /var/www/ProjectCodeHydrater/protected/cli/makeLicense.php on line 114 |
||||
[2025-07-23 16:53:30] [WARNING] openssl_sign(): Supplied key param cannot be coerced into a private key in /var/www/ProjectCodeHydrater/protected/cli/makeLicense.php on line 118 |
||||
@ -1,119 +0,0 @@ |
||||
<?php |
||||
|
||||
// Configuration |
||||
if (! defined('BaseDir')) { |
||||
define('LOG_FILE', __DIR__ . '/logs/error_log.txt'); |
||||
} else { |
||||
define('LOG_FILE', BaseDir . '/logs/error_log.txt'); |
||||
} |
||||
|
||||
if (! defined('ENVIRONMENT')) { |
||||
define('ENVIRONMENT', 'production'); // 'production' or 'development' |
||||
} |
||||
/** |
||||
* Format message with appropriate colors based on environment |
||||
*/ |
||||
function formatMessage($message, $type = 'error') { |
||||
if (PHP_SAPI === 'cli') { |
||||
// CLI color formatting |
||||
$colors = [ |
||||
'error' => "\033[31m", // red |
||||
'warning' => "\033[33m", // yellow |
||||
'notice' => "\033[36m", // cyan |
||||
'reset' => "\033[0m" // reset |
||||
]; |
||||
$color = $colors[$type] ?? $colors['error']; |
||||
return $color . $message . $colors['reset'] . PHP_EOL; |
||||
} else { |
||||
// Web HTML formatting |
||||
$styles = [ |
||||
'error' => 'color:red;', |
||||
'warning' => 'color:orange;', |
||||
'notice' => 'color:blue;' |
||||
]; |
||||
$style = $styles[$type] ?? $styles['error']; |
||||
return "<div style='{$style}padding:10px;border:1px solid #f99;margin:10px;'>$message</div>"; |
||||
} |
||||
} |
||||
|
||||
// Custom error handler |
||||
set_error_handler(function($errno, $errstr, $errfile, $errline) { |
||||
// Skip if error reporting is turned off |
||||
if (!(error_reporting() & $errno)) { |
||||
return false; |
||||
} |
||||
|
||||
$errorTypes = [ |
||||
E_ERROR => ['ERROR', 'error'], |
||||
E_WARNING => ['WARNING', 'warning'], |
||||
E_PARSE => ['PARSE ERROR', 'error'], |
||||
E_NOTICE => ['NOTICE', 'notice'], |
||||
E_CORE_ERROR => ['CORE ERROR', 'error'], |
||||
E_CORE_WARNING => ['CORE WARNING', 'warning'], |
||||
E_COMPILE_ERROR => ['COMPILE ERROR', 'error'], |
||||
E_COMPILE_WARNING => ['COMPILE WARNING', 'warning'], |
||||
E_USER_ERROR => ['USER ERROR', 'error'], |
||||
E_USER_WARNING => ['USER WARNING', 'warning'], |
||||
E_USER_NOTICE => ['USER NOTICE', 'notice'], |
||||
E_STRICT => ['STRICT', 'notice'], |
||||
E_RECOVERABLE_ERROR=> ['RECOVERABLE ERROR', 'error'], |
||||
E_DEPRECATED => ['DEPRECATED', 'warning'], |
||||
E_USER_DEPRECATED => ['USER DEPRECATED', 'warning'] |
||||
]; |
||||
|
||||
$errorInfo = $errorTypes[$errno] ?? ['UNKNOWN', 'error']; |
||||
$errorType = $errorInfo[0]; |
||||
$errorCategory = $errorInfo[1]; |
||||
|
||||
$logMessage = date('[Y-m-d H:i:s]') . " [$errorType] $errstr in $errfile on line $errline" . PHP_EOL; |
||||
$displayMessage = "$errorType: $errstr in $errfile on line $errline"; |
||||
|
||||
// Log to file |
||||
file_put_contents(LOG_FILE, $logMessage, FILE_APPEND); |
||||
|
||||
// Display in development environment |
||||
if (ENVIRONMENT === 'development') { |
||||
echo formatMessage($displayMessage, $errorCategory); |
||||
} |
||||
|
||||
// Prevent PHP's default error handler |
||||
return true; |
||||
}); |
||||
|
||||
// Handle exceptions |
||||
set_exception_handler(function($e) { |
||||
$logMessage = date('[Y-m-d H:i:s]') . " [EXCEPTION] " . $e->getMessage() . |
||||
" in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL; |
||||
$displayMessage = "UNCAUGHT EXCEPTION: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine(); |
||||
|
||||
file_put_contents(LOG_FILE, $logMessage, FILE_APPEND); |
||||
|
||||
if (ENVIRONMENT === 'development') { |
||||
echo formatMessage($displayMessage, 'error'); |
||||
} else { |
||||
// In production, show user-friendly message |
||||
echo PHP_SAPI === 'cli' |
||||
? "An error occurred. Our team has been notified." . PHP_EOL |
||||
: "An error occurred. Our team has been notified."; |
||||
} |
||||
}); |
||||
|
||||
// Handle fatal errors |
||||
register_shutdown_function(function() { |
||||
$error = error_get_last(); |
||||
if ($error && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR])) { |
||||
$logMessage = date('[Y-m-d H:i:s]') . " [FATAL] {$error['message']} in {$error['file']} on line {$error['line']}" . PHP_EOL; |
||||
$displayMessage = "FATAL ERROR: {$error['message']} in {$error['file']} on line {$error['line']}"; |
||||
|
||||
file_put_contents(LOG_FILE, $logMessage, FILE_APPEND); |
||||
|
||||
if (ENVIRONMENT === 'development') { |
||||
echo formatMessage($displayMessage, 'error'); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
// Test the error handler (uncomment to test) |
||||
// trigger_error("This is a test warning", E_USER_WARNING); |
||||
// throw new Exception("This is a test exception"); |
||||
// nonexistentFunction(); // Will trigger a fatal error in shutdown handler |
||||
@ -0,0 +1,6 @@ |
||||
This favicon was generated using the following font: |
||||
|
||||
- Font Title: Ubuntu Mono |
||||
- Font Author: Copyright 2011 Canonical Ltd. Licensed under the Ubuntu Font Licence 1.0 |
||||
- Font Source: http://fonts.gstatic.com/s/ubuntumono/v14/KFO8CneDtsqEr0keqCMhbCc_Mn33tYhkf3O1GVg.ttf |
||||
- Font License: Ubuntu Font License, 1.0 (http://font.ubuntu.com/ufl/)) |
||||
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1 @@ |
||||
{"name":"","short_name":"","icons":[{"src":"./android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"./android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} |
||||
|
After Width: | Height: | Size: 37 KiB |
@ -0,0 +1,20 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/** |
||||
* @author Robert Strutts <Bob_586@Yahoo.com> |
||||
* @copyright (c) 2025, Robert Strutts |
||||
* @license MIT |
||||
*/ |
||||
|
||||
define("BaseDir", dirname(__DIR__)); // Project DIR |
||||
const CodeHydrater_PROJECT = BaseDir . "/protected/src/"; |
||||
const CodeHydrater_FRAMEWORK = BaseDir . "/protected/FWCodeHydrater/src/"; |
||||
|
||||
$testing = false; |
||||
|
||||
require_once CodeHydrater_FRAMEWORK . 'bootstrap/siteHelper.php'; |
||||
CodeHydrater\bootstrap\siteHelper::init(BaseDir, $_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD'], $testing); |
||||
|
||||
require_once CodeHydrater_FRAMEWORK . "bootstrap/main.php"; |
||||