'rebuilt missing sales and staff pages
This commit is contained in:
parent
484a36ce11
commit
60bcc67056
680 changed files with 33650 additions and 43 deletions
|
|
@ -32,6 +32,10 @@ foreach ($websiteConfigFiles as $configFile) {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_readable(__DIR__ . '/billing.php')) {
|
||||
require_once __DIR__ . '/billing.php';
|
||||
}
|
||||
|
||||
$websiteDefaults = [
|
||||
'site_name' => 'Gameservers.World',
|
||||
'site_tagline' => 'Developer-backed game hosting for modern and legacy communities, with full server access, daily backups, and optional custom engineering help through Runlevel Systems.',
|
||||
|
|
@ -311,7 +315,7 @@ function website_database_settings(): ?array
|
|||
$merged = array_replace($merged, website_read_php_assignments($billingConfig, $keys));
|
||||
}
|
||||
|
||||
foreach (['db_host', 'db_user', 'db_name', 'table_prefix'] as $requiredKey) {
|
||||
foreach (['db_host', 'db_user', 'db_name'] as $requiredKey) {
|
||||
if (empty($merged[$requiredKey])) {
|
||||
$settings = null;
|
||||
return $settings;
|
||||
|
|
@ -418,7 +422,7 @@ function website_panel_user_by_id(int $userId): ?array
|
|||
{
|
||||
$db = website_db();
|
||||
$prefix = website_table_prefix();
|
||||
if (!$db instanceof mysqli || $prefix === '' || $userId <= 0) {
|
||||
if (!$db instanceof mysqli || $userId <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +443,7 @@ function website_panel_user_by_login(string $login): ?array
|
|||
{
|
||||
$db = website_db();
|
||||
$prefix = website_table_prefix();
|
||||
if (!$db instanceof mysqli || $prefix === '' || $login === '') {
|
||||
if (!$db instanceof mysqli || $login === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +536,7 @@ function website_log_activity(string $message, int $userId = 0, string $eventTyp
|
|||
{
|
||||
$db = website_db();
|
||||
$prefix = website_table_prefix();
|
||||
if (!$db instanceof mysqli || $prefix === '') {
|
||||
if (!$db instanceof mysqli) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -602,14 +606,18 @@ function website_checkout_url(): string
|
|||
|
||||
function website_register_url(string $returnPath = 'cart.php'): string
|
||||
{
|
||||
return panel_url('index.php?m=register');
|
||||
$path = 'register.php';
|
||||
if ($returnPath !== '') {
|
||||
$path .= '?return=' . rawurlencode(website_safe_return_path($returnPath, 'cart.php'));
|
||||
}
|
||||
return website_url($path);
|
||||
}
|
||||
|
||||
function website_fetch_service_by_id(int $serviceId): ?array
|
||||
{
|
||||
$db = website_db();
|
||||
$prefix = website_table_prefix();
|
||||
if (!$db instanceof mysqli || $prefix === '' || $serviceId <= 0) {
|
||||
if (!$db instanceof mysqli || $serviceId <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -658,7 +666,7 @@ function website_service_name(array $service): string
|
|||
|
||||
function website_service_min_slots(array $service): int
|
||||
{
|
||||
foreach (['min_slots', 'minimum_slots', 'slots_min'] as $column) {
|
||||
foreach (['slot_min_qty', 'min_slots', 'minimum_slots', 'slots_min'] as $column) {
|
||||
if (isset($service[$column]) && (int)$service[$column] > 0) {
|
||||
return (int)$service[$column];
|
||||
}
|
||||
|
|
@ -670,7 +678,7 @@ function website_service_min_slots(array $service): int
|
|||
|
||||
function website_service_max_slots(array $service): int
|
||||
{
|
||||
foreach (['max_slots', 'maximum_slots', 'slots_max', 'max_players'] as $column) {
|
||||
foreach (['slot_max_qty', 'max_slots', 'maximum_slots', 'slots_max', 'max_players'] as $column) {
|
||||
if (isset($service[$column]) && (int)$service[$column] > 0) {
|
||||
return (int)$service[$column];
|
||||
}
|
||||
|
|
@ -687,7 +695,7 @@ function website_service_locations(array $service): array
|
|||
}
|
||||
|
||||
$locations = [];
|
||||
foreach (preg_split('/\s*,\s*/', $raw) ?: [] as $remoteServerId) {
|
||||
foreach (preg_split('/[\s,]+/', $raw) ?: [] as $remoteServerId) {
|
||||
$remoteServerId = trim($remoteServerId);
|
||||
if ($remoteServerId === '' || !ctype_digit($remoteServerId)) {
|
||||
continue;
|
||||
|
|
@ -732,7 +740,7 @@ function website_cart_total(): float
|
|||
{
|
||||
$total = 0.0;
|
||||
foreach (website_cart_items() as $item) {
|
||||
$total += (float)($item['monthly_total'] ?? 0);
|
||||
$total += (float)($item['line_total'] ?? $item['monthly_total'] ?? 0);
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
|
@ -805,7 +813,7 @@ function website_service_image_url(string $imageValue): string
|
|||
return website_asset('images/games/' . $fileName);
|
||||
}
|
||||
|
||||
function website_fetch_services(int $limit = 0): array
|
||||
function website_fetch_services(int $limit = 0, bool $includeDisabled = false): array
|
||||
{
|
||||
$db = website_db();
|
||||
if (!$db instanceof mysqli) {
|
||||
|
|
@ -813,24 +821,16 @@ function website_fetch_services(int $limit = 0): array
|
|||
}
|
||||
|
||||
$prefix = website_table_prefix();
|
||||
if ($prefix === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
$sql = "SELECT bs.service_id,
|
||||
bs.service_name,
|
||||
bs.description,
|
||||
bs.img_url,
|
||||
bs.price_monthly,
|
||||
bs.remote_server_id,
|
||||
$sql = "SELECT bs.*,
|
||||
ch.game_name AS cfg_game_name,
|
||||
ch.game_key AS cfg_game_key,
|
||||
ch.home_cfg_file AS cfg_file
|
||||
FROM `{$prefix}billing_services` bs
|
||||
LEFT JOIN `{$prefix}config_homes` ch ON ch.home_cfg_id = bs.home_cfg_id
|
||||
WHERE bs.enabled = 1
|
||||
WHERE " . ($includeDisabled ? '1 = 1' : "bs.enabled = 1
|
||||
AND bs.remote_server_id <> ''
|
||||
AND bs.remote_server_id IS NOT NULL
|
||||
AND bs.remote_server_id IS NOT NULL") . "
|
||||
ORDER BY bs.service_name ASC";
|
||||
|
||||
if ($limit > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue