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
|
|
@ -24,6 +24,24 @@
|
||||||
|
|
||||||
require_once("Crypt/XXTEA.php");
|
require_once("Crypt/XXTEA.php");
|
||||||
|
|
||||||
|
if (!defined('GSP_XMLRPC_READY')) {
|
||||||
|
if (!function_exists('xmlrpc_encode_request') || !function_exists('xmlrpc_decode')) {
|
||||||
|
$message = "GSP requires the PHP xmlrpc extension for agent communication.\n".
|
||||||
|
"Install the php-xmlrpc package for your PHP version (example: sudo apt install php8.3-xmlrpc on Ubuntu 24.04 or use PECL).\n".
|
||||||
|
"See https://www.php.net/manual/en/book.xmlrpc.php for installation instructions.";
|
||||||
|
if (PHP_SAPI === 'cli') {
|
||||||
|
fwrite(STDERR, $message . PHP_EOL);
|
||||||
|
} else {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('Content-Type: text/plain; charset=UTF-8', true, 500);
|
||||||
|
}
|
||||||
|
echo nl2br(htmlentities($message));
|
||||||
|
}
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
define('GSP_XMLRPC_READY', true);
|
||||||
|
}
|
||||||
|
|
||||||
// Screen type for servers
|
// Screen type for servers
|
||||||
define("OGP_SCREEN_TYPE_HOME","HOME");
|
define("OGP_SCREEN_TYPE_HOME","HOME");
|
||||||
define("OGP_SCREEN_TYPE_UPDATE","UPDATE");
|
define("OGP_SCREEN_TYPE_UPDATE","UPDATE");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Admin landing page
|
// Admin landing page
|
||||||
require_once(__DIR__ . '/includes/admin_auth.php');
|
require_once(__DIR__ . '/includes/admin_auth.php');
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
include(__DIR__ . '/includes/top.php');
|
include(__DIR__ . '/includes/top.php');
|
||||||
include(__DIR__ . '/includes/menu.php');
|
include(__DIR__ . '/includes/menu.php');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Admin config editor — lightweight editor for _website/includes/config.inc.php
|
// Admin config editor — lightweight editor for _website/includes/config.inc.php
|
||||||
require_once(__DIR__ . '/includes/admin_auth.php');
|
require_once(__DIR__ . '/includes/admin_auth.php');
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
include(__DIR__ . '/includes/top.php');
|
include(__DIR__ . '/includes/top.php');
|
||||||
include(__DIR__ . '/includes/menu.php');
|
include(__DIR__ . '/includes/menu.php');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Admin coupon management page - standalone billing module
|
// Admin coupon management page - standalone billing module
|
||||||
require_once(__DIR__ . '/includes/admin_auth.php');
|
require_once(__DIR__ . '/includes/admin_auth.php');
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
|
|
||||||
// Variables from config.inc.php (helps IDEs understand scope)
|
// Variables from config.inc.php (helps IDEs understand scope)
|
||||||
/** @var string $db_host Database host */
|
/** @var string $db_host Database host */
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Admin payments viewer — lists persisted PayPal webhook JSON files
|
// Admin payments viewer — lists persisted PayPal webhook JSON files
|
||||||
$session_name = session_name(); session_start();
|
$session_name = session_name(); session_start();
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
require_once(__DIR__ . '/includes/admin_auth.php');
|
require_once(__DIR__ . '/includes/admin_auth.php');
|
||||||
|
|
||||||
$dataDir = (isset($SITE_DATA_DIR) && $SITE_DATA_DIR) ? $SITE_DATA_DIR : realpath(__DIR__ . '/') . DIRECTORY_SEPARATOR . 'data';
|
$dataDir = (isset($SITE_DATA_DIR) && $SITE_DATA_DIR) ? $SITE_DATA_DIR : realpath(__DIR__ . '/') . DIRECTORY_SEPARATOR . 'data';
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Standalone billing module - uses only standard PHP mysqli
|
* Standalone billing module - uses only standard PHP mysqli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(__DIR__ . '/../includes/config.inc.php');
|
require_once(__DIR__ . '/../includes/config_loader.php');
|
||||||
|
|
||||||
// Prevent any output before JSON
|
// Prevent any output before JSON
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
ini_set('display_errors', '0');
|
ini_set('display_errors', '0');
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
require_once(__DIR__ . '/../includes/config.inc.php');
|
require_once(__DIR__ . '/../includes/config_loader.php');
|
||||||
// create_order for PayPal — adapted to run from _website/api
|
// create_order for PayPal — adapted to run from _website/api
|
||||||
$sandbox = true; // flip to false for Live
|
$sandbox = true; // flip to false for Live
|
||||||
$client_id = 'AfvY_C2zA_hTHxHq7TIhtOeub4xBdySYrt_Hjj3d_WYQwjWI9NfOAVOTeResx2rgZ_nP5tOoxQSAHw8c';
|
$client_id = 'AfvY_C2zA_hTHxHq7TIhtOeub4xBdySYrt_Hjj3d_WYQwjWI9NfOAVOTeResx2rgZ_nP5tOoxQSAHw8c';
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,7 @@
|
||||||
|
|
||||||
// Ensure session sync with panel happens first
|
// Ensure session sync with panel happens first
|
||||||
require_once __DIR__ . '/includes/session_bridge.php';
|
require_once __DIR__ . '/includes/session_bridge.php';
|
||||||
|
require_once __DIR__ . '/includes/config_loader.php';
|
||||||
// Load configuration (includes/config.inc.php) if present
|
|
||||||
$config_path = __DIR__ . '/includes/config.inc.php';
|
|
||||||
if (file_exists($config_path)) {
|
|
||||||
require_once $config_path;
|
|
||||||
} else {
|
|
||||||
trigger_error('Billing config not found: ' . $config_path, E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure $table_prefix exists (fallback to empty string)
|
// Ensure $table_prefix exists (fallback to empty string)
|
||||||
if (!isset($table_prefix)) {
|
if (!isset($table_prefix)) {
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,19 @@ echo "Session status (after start): " . session_status() . "\n";
|
||||||
echo "Session id: " . session_id() . "\n";
|
echo "Session id: " . session_id() . "\n";
|
||||||
echo "Session variables: \n" . print_r($_SESSION, true) . "\n";
|
echo "Session variables: \n" . print_r($_SESSION, true) . "\n";
|
||||||
|
|
||||||
// Check config file readability
|
// Check config file readability (panel root first, module local second)
|
||||||
$cfg = __DIR__ . '/includes/config.inc.php';
|
$panelCfgRoot = realpath(__DIR__ . '/../../..');
|
||||||
echo "Config file: " . $cfg . " exists=" . (file_exists($cfg) ? 'yes' : 'no') . " readable=" . (is_readable($cfg) ? 'yes' : 'no') . "\n";
|
$panelCfg = $panelCfgRoot ? $panelCfgRoot . '/includes/config.inc.php' : __DIR__ . '/../../..' . '/includes/config.inc.php';
|
||||||
if (file_exists($cfg)) {
|
$localCfg = __DIR__ . '/includes/config.inc.php';
|
||||||
echo "Config contents (first 200 chars):\n" . substr(file_get_contents($cfg),0,200) . "\n";
|
echo "Panel config: " . $panelCfg . " exists=" . (file_exists($panelCfg) ? 'yes' : 'no') . " readable=" . (is_readable($panelCfg) ? 'yes' : 'no') . "\n";
|
||||||
|
echo "Local config: " . $localCfg . " exists=" . (file_exists($localCfg) ? 'yes' : 'no') . " readable=" . (is_readable($localCfg) ? 'yes' : 'no') . "\n";
|
||||||
|
|
||||||
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
|
echo "Active config source: " . (defined('BILLING_CONFIG_PATH') ? BILLING_CONFIG_PATH : '(unknown)') . "\n";
|
||||||
|
if (defined('BILLING_CONFIG_PATH') && is_readable(BILLING_CONFIG_PATH)) {
|
||||||
|
echo "Active config preview (first 200 chars):\n" . substr(file_get_contents(BILLING_CONFIG_PATH), 0, 200) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt DB connection using site config (if readable)
|
|
||||||
if (file_exists($cfg)) require_once($cfg);
|
|
||||||
echo "Trying DB connection...\n";
|
echo "Trying DB connection...\n";
|
||||||
$ok = false;
|
$ok = false;
|
||||||
if (isset($db_host)) {
|
if (isset($db_host)) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include config
|
// Include config
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
|
|
||||||
// Set the docs directory
|
// Set the docs directory
|
||||||
$docsDir = __DIR__ . '/docs';
|
$docsDir = __DIR__ . '/docs';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../includes/admin_auth.php');
|
require_once(__DIR__ . '/../includes/admin_auth.php');
|
||||||
require_once(__DIR__ . '/../includes/config.inc.php');
|
require_once(__DIR__ . '/../includes/config_loader.php');
|
||||||
include(__DIR__ . '/../includes/top.php');
|
include(__DIR__ . '/../includes/top.php');
|
||||||
include(__DIR__ . '/../includes/menu.php');
|
include(__DIR__ . '/../includes/menu.php');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@ if (empty($_SESSION['website_user_id'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Require DB config and check role live from panel DB
|
// Require DB config and check role live from panel DB
|
||||||
|
require_once(__DIR__ . '/config_loader.php');
|
||||||
require_once(__DIR__ . '/config.inc.php');
|
|
||||||
|
|
||||||
// Variables from config.inc.php (helps IDEs understand scope)
|
// Variables from config.inc.php (helps IDEs understand scope)
|
||||||
/** @var string $db_host Database host */
|
/** @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;
|
$is_admin = false;
|
||||||
if ($is_logged_in) {
|
if ($is_logged_in) {
|
||||||
// load DB credentials
|
// load DB credentials
|
||||||
require_once(__DIR__ . '/config.inc.php');
|
require_once(__DIR__ . '/config_loader.php');
|
||||||
|
|
||||||
// Variables from config.inc.php (helps IDEs understand scope)
|
// Variables from config.inc.php (helps IDEs understand scope)
|
||||||
/** @var string $db_host Database host */
|
/** @var string $db_host Database host */
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,8 @@
|
||||||
* process_payment_record($record);
|
* process_payment_record($record);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Include the module-local config (must be present in the module includes folder).
|
// Load panel config first, falling back to a module-local copy if needed.
|
||||||
// Use ONLY `config.inc.php` — do NOT fall back to other filenames.
|
require_once __DIR__ . '/config_loader.php';
|
||||||
$moduleConfig = __DIR__ . '/config.inc.php';
|
|
||||||
if (is_file($moduleConfig)) {
|
|
||||||
require_once $moduleConfig;
|
|
||||||
} else {
|
|
||||||
error_log('[payment_processor] Module config not found: expected ' . $moduleConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables from config.inc.php (helps IDEs understand scope)
|
// Variables from config.inc.php (helps IDEs understand scope)
|
||||||
/** @var string $db_host Database host */
|
/** @var string $db_host Database host */
|
||||||
|
|
@ -226,3 +220,4 @@ function process_payment_record(array $record) {
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// User invoice history (reads payments/data/*.json)
|
// User invoice history (reads payments/data/*.json)
|
||||||
$session_name = session_name(); session_start();
|
$session_name = session_name(); session_start();
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
// Intentionally do not require login here; invoices should be viewable (or filtered) without forcing a login.
|
// Intentionally do not require login here; invoices should be viewable (or filtered) without forcing a login.
|
||||||
|
|
||||||
// try to get logged-in user's email for matching
|
// try to get logged-in user's email for matching
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
require_once(__DIR__ . '/includes/header.php');
|
require_once(__DIR__ . '/includes/header.php');
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
|
|
||||||
$invoice_ref = isset($_GET['invoice']) ? $_GET['invoice'] : '';
|
$invoice_ref = isset($_GET['invoice']) ? $_GET['invoice'] : '';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Standalone billing module - uses only standard PHP mysqli
|
* Standalone billing module - uses only standard PHP mysqli
|
||||||
*/
|
*/
|
||||||
session_start();
|
session_start();
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
|
|
||||||
// Variables from config.inc.php (helps IDEs understand scope)
|
// Variables from config.inc.php (helps IDEs understand scope)
|
||||||
/** @var string $db_host Database host */
|
/** @var string $db_host Database host */
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
|
|
||||||
$dataDir = (isset($SITE_DATA_DIR) && $SITE_DATA_DIR) ? $SITE_DATA_DIR : realpath(__DIR__ . '/') . DIRECTORY_SEPARATOR . 'data';
|
$dataDir = (isset($SITE_DATA_DIR) && $SITE_DATA_DIR) ? $SITE_DATA_DIR : realpath(__DIR__ . '/') . DIRECTORY_SEPARATOR . 'data';
|
||||||
$invoice = $_GET['invoice'] ?? '';
|
$invoice = $_GET['invoice'] ?? '';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../includes/config.inc.php');
|
require_once(__DIR__ . '/../includes/config_loader.php');
|
||||||
$db = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
|
$db = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
|
||||||
if (!$db) {
|
if (!$db) {
|
||||||
echo "DB connect failed: " . mysqli_connect_error() . PHP_EOL;
|
echo "DB connect failed: " . mysqli_connect_error() . PHP_EOL;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/includes/config.inc.php');
|
require_once(__DIR__ . '/includes/config_loader.php');
|
||||||
if (is_file(__DIR__ . '/includes/log.php')) require_once(__DIR__ . '/includes/log.php');
|
if (is_file(__DIR__ . '/includes/log.php')) require_once(__DIR__ . '/includes/log.php');
|
||||||
|
|
||||||
$config = [
|
$config = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue