. * */ define("DSI_BASEPATH", "modules/dsi/"); require_once(DSI_BASEPATH . 'includes/functions_ui.php'); require_once('modules/config_games/server_config_parser.php'); function exec_ogp_module(){ global $db; global $view; echo "

".get_lang("dsi_admin_long")."

"; $server_homes = $db->getIpPorts(); if( $server_homes === FALSE ) { // If there are no games, then there can not be any mods either. print_failure(get_lang('no_game_homes_assigned')); echo "

" . get_lang("assign_game_homes") . "

"; return; } echo get_lang("dsi_select_server"); create_home_selector_address($_GET['m'], $_GET['p'], $server_homes); if( isset($_GET['home_id-mod_id-ip-port']) and $_GET['home_id-mod_id-ip-port'] != "") { list( $home_id, $mod_id, $ip, $port) = explode( "-", $_GET['home_id-mod_id-ip-port'] ); if( !is_numeric($home_id) or !is_numeric($mod_id) or !preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $ip) or !is_numeric($port) ) return; } else return; foreach ((array)$server_homes as $server_home) { if( $server_home['home_id'] == $home_id and $server_home['mod_id'] == $mod_id and $server_home['ip'] == $ip and $server_home['port'] == $port ) { $server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']); $public_ip = checkDisplayPublicIP($server_home['display_public_ip'],$server_home['ip'] != $server_home['agent_ip'] ? $server_home['ip'] : $server_home['agent_ip']); $mod = preg_replace("/[^a-z0-9_]/", "-", strtolower($server_home['mod_key'])); if ($server_xml->protocol == "gameq"){ $query_name = $server_xml->gameq_query_name; } elseif ($server_xml->protocol == "lgsl"){ $query_name = $server_xml->lgsl_query_name; } elseif ($server_xml->protocol == "teamspeak3"){ $query_name = 'ts3'; } else{ $query_name = $mod; /* If query name does not exist use mod key instead. */ } $title = $server_home['game_name']." (Mod: ".$mod.")"; $return = ""; if( isset($_POST) && isset($_FILES["file"]) ) { $types = array(); if(isset($_POST['type1']))$types[] = $_POST['type1']; if(isset($_POST['type2']))$types[] = $_POST['type2']; if(isset($_POST['type3']))$types[] = $_POST['type3']; if ( $_FILES["file"]["type"] == "image/png" && $_FILES["file"]["size"] < 200000 ) { if ($_FILES["file"]["error"] > 0) $return .= "Return Code: " . $_FILES["file"]["error"] . "
"; else { if(isset($types)) { include( DSI_BASEPATH.'includes/SimpleImage.php' ); foreach ((array)$types as $type) { if( file_exists(DSI_BASEPATH . "cache/$server_home[ip]_$server_home[port]-$type") ) unlink(DSI_BASEPATH . "cache/$server_home[ip]_$server_home[port]-$type"); $bg_location = DSI_BASEPATH . "images/$query_name/"; $bg_filename = $mod."_".$type.".png"; if (file_exists($bg_location . $bg_filename)) { unlink($bg_location . $bg_filename); } if( !file_exists($bg_location) ) mkdir($bg_location); $image = new SimpleImage(); $image->load($_FILES["file"]["tmp_name"]); if($type == "normal") $image->resize(359,76); elseif($type == "sky") $image->resize(180,260); elseif($type == "small") $image->resize(359,25); $image->save("$bg_location$bg_filename"); $return .= "

Saved as: $bg_location$bg_filename.

"; } } unlink($_FILES["file"]["tmp_name"]); } } else $return .= "

Invalid file, should be PNG format and file size should be less than 200Kb.

"; } ?>

Background for




Normal
Small
Sky