From the panel site
This commit is contained in:
parent
d684ca74fb
commit
2fc04bcfac
1194 changed files with 154606 additions and 13040 deletions
|
|
@ -142,61 +142,6 @@ function exec_ogp_module()
|
|||
// Create new home directory if it doesn't already exist
|
||||
$remote->exec("mkdir -p " . clean_path($game_path) . (!$skipId ? $new_home_id : ""));
|
||||
|
||||
// Automatically assign an available IP to this server
|
||||
$remote_server_ips = $db->getRemoteServerIPs($rserver_id);
|
||||
if(!empty($remote_server_ips))
|
||||
{
|
||||
// Use the first available IP for this server
|
||||
$ip_id = $remote_server_ips[0]['ip_id'];
|
||||
$available_port = $db->getNextAvailablePort($ip_id, $home_cfg_id);
|
||||
if($available_port)
|
||||
{
|
||||
$db->addGameIpPort($new_home_id, $ip_id, $available_port);
|
||||
}
|
||||
}
|
||||
|
||||
// Assign a default mod to the game home
|
||||
$available_mods = $db->getCfgMods($home_cfg_id);
|
||||
if(!empty($available_mods))
|
||||
{
|
||||
$default_mod = $available_mods[0]; // Use first available mod as default
|
||||
$mod_cfg_id = $default_mod['mod_cfg_id'];
|
||||
$mod_id = $db->addModToGameHome($new_home_id, $mod_cfg_id);
|
||||
|
||||
// Set default parameters for the mod
|
||||
$max_players = 32; // Default max players
|
||||
$extra_params = ""; // No extra params
|
||||
$cpu_affinity = "NA"; // No CPU affinity
|
||||
$nice = "0"; // Default priority
|
||||
$db->updateGameModParams($max_players, $extra_params, $cpu_affinity, $nice, $new_home_id, $mod_cfg_id);
|
||||
}
|
||||
|
||||
// Create billing order entry with 30-day expiration
|
||||
$finish_date = strtotime('+30 day'); // 30 days from now
|
||||
$current_time = time();
|
||||
$order_query = "INSERT INTO OGP_DB_PREFIXbilling_orders
|
||||
(user_id, service_id, home_name, ip, qty, invoice_duration, max_players, price,
|
||||
remote_control_password, ftp_password, cart_id, home_id, status, finish_date, extended, coupon_id)
|
||||
VALUES (
|
||||
'".$db->realEscapeSingle($web_user_id)."',
|
||||
'0',
|
||||
'".$db->realEscapeSingle($server_name)."',
|
||||
'".$db->realEscapeSingle($rserver_id)."',
|
||||
'30',
|
||||
'day',
|
||||
'32',
|
||||
'0.00',
|
||||
'".$db->realEscapeSingle($control_password)."',
|
||||
'".$db->realEscapeSingle($ftppassword)."',
|
||||
'0',
|
||||
'".$db->realEscapeSingle($new_home_id)."',
|
||||
'1',
|
||||
'".$db->realEscapeSingle($finish_date)."',
|
||||
'0',
|
||||
'0'
|
||||
)";
|
||||
$db->query($order_query);
|
||||
|
||||
if($ftp)
|
||||
{
|
||||
$host_stat = $remote->status_chk();
|
||||
|
|
@ -205,7 +150,7 @@ function exec_ogp_module()
|
|||
$db->changeFtpStatus('enabled',$new_home_id);
|
||||
}
|
||||
print_success(get_lang('game_home_added'));
|
||||
$db->logger(get_lang('game_home_added')." ($server_name) - Billing order created with 30-day expiration");
|
||||
$db->logger(get_lang('game_home_added')." ($server_name)");
|
||||
$view->refresh("?m=user_games&p=edit&home_id=$new_home_id", 0);
|
||||
}else{
|
||||
print_failure(get_lang_f("failed_to_assign_home_to_user", $new_home_id, $web_user . " " . $db->getError()));
|
||||
|
|
|
|||
|
|
@ -24,11 +24,49 @@
|
|||
|
||||
// Module general information
|
||||
$module_title = "User games";
|
||||
$module_version = "1.0";
|
||||
$db_version = 0;
|
||||
$module_version = "1.3";
|
||||
$db_version = 3;
|
||||
$module_required = TRUE;
|
||||
$module_menus = array(
|
||||
array( 'subpage' => '', 'name'=>'Game Servers', 'group'=>'admin' )
|
||||
);
|
||||
$install_queries = array();
|
||||
$install_queries[0] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."user_homes`;",
|
||||
"CREATE TABLE IF NOT EXISTS ".OGP_DB_PREFIX."user_homes (
|
||||
`home_id` int(11) NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`access_rights` varchar(63) default NULL,
|
||||
PRIMARY KEY (`user_id`,`home_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;",
|
||||
"DROP TABLE IF EXISTS ".OGP_DB_PREFIX."user_group_remote_servers;",
|
||||
"CREATE TABLE ".OGP_DB_PREFIX."user_group_remote_servers (
|
||||
`remote_server_id` int(11) NOT NULL,
|
||||
`group_id` int(11) NOT NULL,
|
||||
`access_rights` varchar(63) default NULL,
|
||||
PRIMARY KEY (`remote_server_id`, `group_id`)
|
||||
)ENGINE=MyISAM DEFAULT CHARSET=latin1;",
|
||||
"DROP TABLE IF EXISTS ".OGP_DB_PREFIX."user_group_homes;",
|
||||
"CREATE TABLE ".OGP_DB_PREFIX."user_group_homes (
|
||||
`home_id` int(11) NOT NULL,
|
||||
`group_id` int(11) NOT NULL,
|
||||
`access_rights` varchar(63) default NULL,
|
||||
PRIMARY KEY (`home_id`, `group_id`)
|
||||
)ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
|
||||
$install_queries[1] = array(
|
||||
"DROP TABLE IF EXISTS `".OGP_DB_PREFIX."master_server_homes`;",
|
||||
"CREATE TABLE IF NOT EXISTS ".OGP_DB_PREFIX."master_server_homes (
|
||||
`home_id` int(11) NOT NULL,
|
||||
`home_cfg_id` int(11) NOT NULL,
|
||||
`remote_server_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`remote_server_id`, `home_cfg_id`)
|
||||
)ENGINE=MyISAM DEFAULT CHARSET=latin1;");
|
||||
|
||||
$install_queries[2] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."user_homes` ADD `user_expiration_date` VARCHAR(21) NOT NULL default 'X';",
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."user_group_homes` ADD `user_group_expiration_date` VARCHAR(21) NOT NULL default 'X';");
|
||||
|
||||
$install_queries[3] = array(
|
||||
"ALTER TABLE `".OGP_DB_PREFIX."game_mods` modify column `cpu_affinity` varchar(64) null AFTER `extra_params`, comment = 'utf8mb4_general_ci';");
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue