'No game servers are assigned to your account.', 'uninstall_mods' => 'Uninstall mods', 'install_mods' => 'Install mods', 'back' => 'Back', 'settings_updated' => 'Settings updated.', 'failed_reading_xml_file' => 'Failed reading XML file: %s', 'mod_id_does_not_exists_in_home' => 'Mod ID %s does not exist in home %s.', 'mod_key_not_found_from_xml' => 'Mod key %s was not found in the XML.', 'unable_to_get_os_from_game_key' => 'Unable to determine OS from game key %s.', 'workshop_configuration_not_found' => 'Workshop configuration not found for this game/mod.', 'no_workshop_configuration_available_for_this_game' => 'No workshop configuration is available for this game.', 'workshop_configuration_file_has_bad_format' => 'Workshop configuration file has a bad format.', 'remote_server_offline' => 'Remote server is offline.', 'update_in_progress' => 'Update in progress...', 'refresh_steam_workshop_status' => 'Refresh Steam Workshop status', 'update_completed' => 'Update completed.', 'game_home_not_found' => 'Game home not found.', 'mod_does_not_belong_to_workshop' => 'Mod %s does not belong to this workshop.', 'mod_installation_started' => 'Mod installation started.', 'invalid_mod_id' => 'Invalid workshop ID.', 'failed_uninstalling_mod' => 'Failed uninstalling mod %s.', 'failed_to_start_steam_workshop' => 'Failed to start Steam Workshop.', 'connection_error' => 'Connection error.', 'select_at_least_one_mod_or_enter_mod_id' => 'Select at least one mod or enter a mod ID.', 'install_mod' => 'Install mod(s)', 'show_mod_info' => 'Show mod info', 'select_game' => 'Select a game', 'save_config' => 'Save config', 'remove_mods' => 'Remove selected mods', 'mod_installation_failed' => 'Mod installation failed.', 'there_are_no_mods_installed_on_this_game_server' => 'There are no mods installed on this game server.', 'installed_mods' => 'Installed mods', 'no_mods_found' => 'No mods found.', 'name' => 'Name', 'status' => 'Status', 'installed' => 'Installed', 'pending' => 'Pending', 'remove' => 'Remove', 'add_mod' => 'Add mod', 'workshop_id' => 'Workshop ID', 'add' => 'Add', 'collection_id' => 'Collection ID', 'actions' => 'Actions', ); if (!array_key_exists($key, $strings)) { return $key; } $text = $strings[$key]; return empty($args) ? $text : vsprintf($text, $args); } function create_drop_box_from_array_onchange($input_array,$listname,$current_value = "") { $only_one = count($input_array) == 1; $disabled = $only_one? "disabled=disabled":""; $retval = "\n"; return $retval; } function create_drop_box_from_array($input_array,$listname,$current_value = "") { $retval = "\n"; return $retval; } function get_mod_names_list($mods_list, $xml_mods) { $mod_names = ""; foreach(explode(',', $mods_list) as $workshop_mod_id) { foreach($xml_mods as $mod) { if($mod['id'] == $workshop_mod_id) { if($mod_names != "") $mod_names .= ","; $mod_names .= $mod->name; } } } return $mod_names; } function get_mod_info($workshop_mod_id) { $request = http_build_query(array('itemcount' => '1', 'publishedfileids[0]' => "$workshop_mod_id")); $context = stream_context_create (array('http' => array ( 'method' => "POST", 'header' => "Content-type: application/x-www-form-urlencoded", 'content' => $request, 'timeout' => 5 ))); $json = @file_get_contents('http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/', false, $context); $response_array = json_decode($json, true); $app_info = $response_array['response']['publishedfiledetails'][0]; return array($app_info['title'], $app_info['description'], $app_info['preview_url'], $app_info['file_url'], basename($app_info['filename']), $app_info['file_size']); } function belongs_to_workshop($workshop_mod_id, $workshop_id) { $request = http_build_query(array('itemcount' => '1', 'publishedfileids[0]' => "$workshop_mod_id")); $context = stream_context_create (array('http' => array ( 'method' => "POST", 'header' => "Content-type: application/x-www-form-urlencoded", 'content' => $request, 'timeout' => 5 ))); $json = @file_get_contents('http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/', false, $context); $response_array = json_decode($json, true); $app_info = $response_array['response']['publishedfiledetails'][0]; if($app_info['creator_app_id'] == $workshop_id) return true; else return false; } function get_installed_mods($home_cfg, $remote, $xml) { $workshop_id = $xml->workshop_id; $config = $xml->config; $regex = $config->regex; $mods_backreference_index = (int)$config->mods_backreference_index; $string_separator = stripcslashes($config->string_separator); $filepath = $config->filepath; $mods = $xml->mods->mod; $full_filepath = clean_path($home_cfg['home_path']."/$filepath"); if($remote->rfile_exists($full_filepath) === 0) return False; if($remote->remote_readfile($full_filepath, $file_content) !== 1) return False; if(preg_match("/$regex/m", $file_content, $matches)) { $full_regex_string = trim($matches[0]); $current_mods_string = trim($matches[$mods_backreference_index]); if($current_mods_string != '') { $retval = $remote->get_workshop_mods_info($mod_info_array); $current = explode($string_separator, $current_mods_string); $installed_mods = array(); foreach($current as $c) { if($c != "") { $mod_string = trim($c); if($retval == "1") $installed_mods["$mod_string"] = isset($mod_info_array["$mod_string"])?$mod_info_array["$mod_string"]:$mod_string; else $installed_mods["$mod_string"] = $mod_string; } } return $installed_mods; } else return False; } else return False; } function remove_mod($home_cfg, $remote, $xml, $mod_string) { $config = $xml->config; $regex = $config->regex; $mods_backreference_index = (int)$config->mods_backreference_index; $variable = $config->variable; $string_separator = stripcslashes($config->string_separator); $filepath = $config->filepath; $full_filepath = $home_cfg['home_path']."/$filepath"; $mods_full_path = clean_path($home_cfg['home_path'].'/'.$xml->mods_path); if($remote->rfile_exists($full_filepath) === 0) return False; $remote->remote_readfile($full_filepath, $file_content); if(preg_match("/$regex/m", $file_content, $matches)) { $full_regex_string = trim($matches[0]); $current_mods_string = trim($matches[$mods_backreference_index]); if($current_mods_string != '') { $current = explode($string_separator, $current_mods_string); foreach($current as $index => $c) { if(trim($c) == $mod_string) unset($current[$index]); } $current = array_filter($current); $new_mods_string = implode($string_separator, $current); $replacement = $variable.$new_mods_string; $file_content = str_replace($full_regex_string, $replacement, $file_content); } else return False; } else return False; $remote->remote_writefile($full_filepath, $file_content); $uninstall_filepath = clean_path($mods_full_path.'/postuninstall.sh'); $uninstallcmd = str_replace('%mods_full_path%', $mods_full_path, $xml->uninstall); $uninstallcmd = str_replace('%mod_string%', $mod_string, $uninstallcmd); $uninstallcmd .= "\nrm -f $uninstall_filepath"; $output = ""; if($remote->remote_writefile($uninstall_filepath, $uninstallcmd) === 1) $output .= $remote->exec("bash $uninstall_filepath"); return $output; } function get_blacklist() { return array( "232330","90","294420","251570","17515","34120","302550","42750","489650","748090","232290", "17585","739590","17555","232370","55280","17705","261140","222840","320850","317670","824360","381690", "41005","208050","105600","556450","402370"); } ?>