fixed missign config file and added check if xmlrpc istnt installed
This commit is contained in:
parent
70e05e57d8
commit
5f5008b377
21 changed files with 115 additions and 42 deletions
|
|
@ -20,8 +20,7 @@ if (empty($_SESSION['website_user_id'])) {
|
|||
}
|
||||
|
||||
// Require DB config and check role live from panel DB
|
||||
|
||||
require_once(__DIR__ . '/config.inc.php');
|
||||
require_once(__DIR__ . '/config_loader.php');
|
||||
|
||||
// Variables from config.inc.php (helps IDEs understand scope)
|
||||
/** @var string $db_host Database host */
|
||||
|
|
|
|||
64
modules/billing/includes/config_loader.php
Normal file
64
modules/billing/includes/config_loader.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* Billing config loader
|
||||
*
|
||||
* Attempts to load the main panel config file first (../includes/config.inc.php).
|
||||
* If that file is not readable, falls back to a module-local config.inc.php copy.
|
||||
* When neither file exists, output a plain-text error and stop execution so that
|
||||
* the admin knows to copy the config locally.
|
||||
*/
|
||||
if (defined('BILLING_CONFIG_LOADED')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$panelConfig = null;
|
||||
$projectRoot = realpath(__DIR__ . '/../../..');
|
||||
if ($projectRoot !== false) {
|
||||
$panelConfig = $projectRoot . '/includes/config.inc.php';
|
||||
} else {
|
||||
// Fallback relative path without resolving symlinks
|
||||
$panelConfig = __DIR__ . '/../../..' . '/includes/config.inc.php';
|
||||
}
|
||||
|
||||
$localConfig = __DIR__ . '/config.inc.php';
|
||||
$attempted = [];
|
||||
|
||||
if ($panelConfig && is_readable($panelConfig)) {
|
||||
$attempted[] = $panelConfig;
|
||||
require_once $panelConfig;
|
||||
if (!defined('BILLING_CONFIG_PATH')) {
|
||||
define('BILLING_CONFIG_PATH', $panelConfig);
|
||||
}
|
||||
define('BILLING_CONFIG_LOADED', true);
|
||||
return;
|
||||
}
|
||||
|
||||
$attempted[] = $panelConfig;
|
||||
if (is_readable($localConfig)) {
|
||||
$attempted[] = $localConfig;
|
||||
require_once $localConfig;
|
||||
if (!defined('BILLING_CONFIG_PATH')) {
|
||||
define('BILLING_CONFIG_PATH', $localConfig);
|
||||
}
|
||||
define('BILLING_CONFIG_LOADED', true);
|
||||
return;
|
||||
}
|
||||
|
||||
$attempted[] = $localConfig;
|
||||
|
||||
$message = "GSP Billing module cannot find config.inc.php.\n";
|
||||
$message .= "Looked in:\n";
|
||||
foreach ($attempted as $path) {
|
||||
if (!$path) {
|
||||
continue;
|
||||
}
|
||||
$message .= " - " . $path . "\n";
|
||||
}
|
||||
$message .= "\nCopy your panel's includes/config.inc.php into modules/billing/includes/config.inc.php ";
|
||||
$message .= "or ensure the panel config is readable so the billing pages can load database settings.\n";
|
||||
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: text/plain; charset=UTF-8', true, 500);
|
||||
}
|
||||
echo $message;
|
||||
exit(1);
|
||||
|
|
@ -22,7 +22,7 @@ if (isset($_SESSION['website_username']) && !empty($_SESSION['website_username']
|
|||
$is_admin = false;
|
||||
if ($is_logged_in) {
|
||||
// load DB credentials
|
||||
require_once(__DIR__ . '/config.inc.php');
|
||||
require_once(__DIR__ . '/config_loader.php');
|
||||
|
||||
// Variables from config.inc.php (helps IDEs understand scope)
|
||||
/** @var string $db_host Database host */
|
||||
|
|
|
|||
|
|
@ -12,14 +12,8 @@
|
|||
* process_payment_record($record);
|
||||
*/
|
||||
|
||||
// Include the module-local config (must be present in the module includes folder).
|
||||
// Use ONLY `config.inc.php` — do NOT fall back to other filenames.
|
||||
$moduleConfig = __DIR__ . '/config.inc.php';
|
||||
if (is_file($moduleConfig)) {
|
||||
require_once $moduleConfig;
|
||||
} else {
|
||||
error_log('[payment_processor] Module config not found: expected ' . $moduleConfig);
|
||||
}
|
||||
// Load panel config first, falling back to a module-local copy if needed.
|
||||
require_once __DIR__ . '/config_loader.php';
|
||||
|
||||
// Variables from config.inc.php (helps IDEs understand scope)
|
||||
/** @var string $db_host Database host */
|
||||
|
|
@ -226,3 +220,4 @@ function process_payment_record(array $record) {
|
|||
}
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue