From c9bd2fe4fd7384dfdd1bda45c702ecab347d14fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 22:28:23 +0000 Subject: [PATCH 1/3] Initial plan From 978afc48194f5010121db11c5cf55e39b065d26c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 22:35:29 +0000 Subject: [PATCH 2/3] Replace numeric status codes with descriptive words in billing system Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- index.php | 2 +- modules/billing/create_servers.php | 12 ++++++------ modules/billing/cron-shop.php | 24 ++++++++++++------------ modules/gamemanager/server_monitor.php | 18 +++++++++--------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/index.php b/index.php index 6a119121..705563a4 100644 --- a/index.php +++ b/index.php @@ -327,7 +327,7 @@ function ogpHome() $db->logger( get_lang("logging_in") ."..."); $db->query("DELETE FROM `OGP_DB_PREFIXban_list` WHERE client_ip='$client_ip';"); //find number of servers user has. if zero, then redirect to the shop page. - $result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE user_id='".$_SESSION['user_id']."' AND status < 1 "); + $result = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXbilling_orders WHERE user_id='".$_SESSION['user_id']."' AND status IN ('in-cart', 'unknown') "); $servercount = 0; foreach($result as $servers) { diff --git a/modules/billing/create_servers.php b/modules/billing/create_servers.php index c7723aa7..55045108 100644 --- a/modules/billing/create_servers.php +++ b/modules/billing/create_servers.php @@ -297,12 +297,12 @@ function exec_ogp_module() if($order['finish_date'] == 0){ $finish_date = strtotime('+'.$order['qty'].' day'); - $status = 1; + $status = 'paid'; } else{ //this is a renewel, start from end of previous order $finish_date = strtotime('+'.$order['qty'].' day',$order['finish_date']); - $status = 1; + $status = 'paid'; } } @@ -311,13 +311,13 @@ function exec_ogp_module() // this is a new order if($order['finish_date'] == 0){ $finish_date = strtotime('+'.$order['qty'].' month'); - $status = 1; + $status = 'paid'; } else{ //this is a renewel, start from end of previous order $finish_date = strtotime('+'.$order['qty'].' month',$order['finish_date']); - $status = 1; + $status = 'paid'; } } elseif ($order['invoice_duration'] == "year") @@ -325,12 +325,12 @@ function exec_ogp_module() // this is a new order if($order['finish_date'] == 0){ $finish_date = strtotime('+'.$order['qty'].' year'); - $status = 1; + $status = 'paid'; } else{ //this is a renewel, start from end of previous order $finish_date = strtotime('+'.$order['qty'].' year',$order['finish_date']); - $status = 1; + $status = 'paid'; } diff --git a/modules/billing/cron-shop.php b/modules/billing/cron-shop.php index b206f1f2..329fc4ff 100644 --- a/modules/billing/cron-shop.php +++ b/modules/billing/cron-shop.php @@ -55,10 +55,10 @@ $db->logger("AUTO-CLEAN: Server Cleanup running at ".$rundate); //THESE SERVERS HAVE REACHED THE DATE FOR INVOICE, FINISH_DATE - 7 (OR WHAT IS IN SETTINGS) //SET STATUS -1 MEANING INVOICED -//LOOP THROUGH ALL SERVERS WITH STATUS = 1 (ACTIVE) ----------------------------------------------------------- +//LOOP THROUGH ALL SERVERS WITH STATUS = 'paid' (ACTIVE) ----------------------------------------------------------- $user_homes = $db->resultQuery( "SELECT * FROM " . $table_prefix . "billing_orders - WHERE status > 0 AND finish_date <" . $invoice_date); + WHERE status = 'paid' AND finish_date <" . $invoice_date); if (!is_array($user_homes)) { @@ -72,9 +72,9 @@ else $home_id = $user_home['home_id']; - // Reset the STATUS -1 so cart.php will create an invoice + // Reset the STATUS 'invoiced' so cart.php will create an invoice $db->query( "UPDATE " . $table_prefix . "billing_orders - SET status=-1 + SET status='invoiced' WHERE order_id=".$db->realEscapeSingle($user_home['order_id'])); // SEND EMAIL @@ -99,10 +99,10 @@ else //THESE ARE THE SERVERS THAT HAVE NOT BEEN PAID AND THE FINISH_DATE IS TODAY //THESE SERVERS GET SUSPENDED -//LOOP THROUGH ALL ORDERS WITH STATUS 0 OR -1 (INACTIVE OR INVOICED) +//LOOP THROUGH ALL ORDERS WITH STATUS 'invoiced' OR 'in-cart' OR 'unknown' (INACTIVE OR INVOICED) $user_homes = $db->resultQuery( "SELECT * FROM " . $table_prefix . "billing_orders - WHERE (status = -1 OR status = 0) AND finish_date < ".$today); + WHERE status IN ('invoiced', 'in-cart', 'unknown') AND finish_date < ".$today); if (!is_array($user_homes)) { @@ -128,10 +128,10 @@ else } $db->unassignHomeFrom("user", $user_id, $home_id); - // Reset the invoice end date to -2 + // Reset the invoice end date to 'suspended' // User can still RENEW server $db->query( "UPDATE " . $table_prefix . "billing_orders - SET status=-2 + SET status='suspended' WHERE order_id=".$db->realEscapeSingle($user_home['order_id'])); //logger @@ -152,11 +152,11 @@ else } } -// end date = -2 (suspended) and its been suspended for $removal_date days -//set removed servers as -99 +// end date = 'suspended' (suspended) and its been suspended for $removal_date days +//set removed servers as 'deleted' $user_homes = $db->resultQuery( "SELECT * FROM " . $table_prefix . "billing_orders - WHERE status = -2 AND finish_date < ".$removal_date ); + WHERE status = 'suspended' AND finish_date < ".$removal_date ); if (!is_array($user_homes)) { @@ -181,7 +181,7 @@ else // Reset the invoice end date $db->query( "UPDATE " . $table_prefix . "billing_orders - SET status=-3 + SET status='deleted' WHERE order_id=".$db->realEscapeSingle($user_home['order_id'])); diff --git a/modules/gamemanager/server_monitor.php b/modules/gamemanager/server_monitor.php index 2c6af740..a1008fec 100644 --- a/modules/gamemanager/server_monitor.php +++ b/modules/gamemanager/server_monitor.php @@ -341,31 +341,31 @@ echo "