Update codebase
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
<?php
|
||||
//encrypt_decrypt.php
|
||||
// ⚠️ هذا الملف للتوافقية فقط. استخدم core/Security/EncryptionHelper.php للتشفير الجديد
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
// vendor يقع داخل backend/ لا فوقه. المسار السابق '/../vendor/autoload.php'
|
||||
// يشير إلى /var/www/vendor غير الموجود، و realpath() تُعيد false عندئذٍ،
|
||||
// فيصبح الاستدعاء require_once('') ويسقط بخطأ قاتل يُحلّ من مجلد العمل
|
||||
// الحالي — وهو ما ظهر في السجل كـ "Failed opening required ''".
|
||||
$autoloadPath = __DIR__ . '/vendor/autoload.php';
|
||||
if (!file_exists($autoloadPath)) {
|
||||
$autoloadPath = __DIR__ . '/../vendor/autoload.php';
|
||||
}
|
||||
if (file_exists($autoloadPath)) {
|
||||
require_once $autoloadPath;
|
||||
}
|
||||
|
||||
require_once 'load_env.php';
|
||||
$siteUser = get_current_user();
|
||||
@@ -34,6 +44,12 @@ if (!$key) {
|
||||
$iv = getenv('initializationVector'); // 16 bytes
|
||||
|
||||
|
||||
// الصنف نفسه معرَّف أيضاً في core/Security/EncryptionHelper.php، وأي ملف
|
||||
// يحمّل bootstrap.php ثم يصل إلى هنا كان ينهار بـ "Cannot declare class
|
||||
// EncryptionHelper, because the name is already in use" — وهو ما أسقط
|
||||
// blacklist_manager.php. نُبقي أول تعريف محمَّل (النسخة الحديثة في core)
|
||||
// ونتخطّى هذه النسخة القديمة المتروكة للتوافقية.
|
||||
if (!class_exists('EncryptionHelper', false)) {
|
||||
class EncryptionHelper {
|
||||
private $key;
|
||||
private $iv;
|
||||
@@ -150,6 +166,7 @@ class EncryptionHelper {
|
||||
return $decrypted;
|
||||
}
|
||||
}
|
||||
} // نهاية حارس class_exists
|
||||
// ✅ Load the key and IV from .env or use default values
|
||||
|
||||
// ✅ Ensure the lengths are correct
|
||||
|
||||
Reference in New Issue
Block a user