$Logs = SPrintF('%s/logs', $Tmp); #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- if (File_Exists($Logs)) { #----------------------------------------------------------------------------- $Files = IO_Scan($Logs); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Table = $Options = array(); #----------------------------------------------------------------------------- if (Count($Files)) { #--------------------------------------------------------------------------- Sort($Files); #--------------------------------------------------------------------------- foreach ($Files as $File) { $Options[$File] = $File; } } #----------------------------------------------------------------------------- $Comp = Comp_Load('Form/Select', array('name' => 'Log'), $Options); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Table[] = array('Текущий лог', $Comp); #----------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'text', 'size' => 5, 'name' => 'Lines', 'value' => 15)); if (Is_Error($Comp)) {
private function HandleResponse($File, $Data) { if ($File === 'API/SupportedAPIList.json') { $Data = JSON_Decode($Data, true); if (!isset($Data['apilist']['interfaces'])) { return false; } foreach ($Data['apilist']['interfaces'] as $Interface) { $File = __DIR__ . '/API/' . $Interface['name'] . '.json'; $Interface = JSON_Encode($Interface, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL; if (!File_Exists($File) || StrCmp(File_Get_Contents($File), $Interface) !== 0) { File_Put_Contents($File, $Interface); } } return true; } else { if ($File === 'ClientManifest/steam_client_publicbeta_osx' || $File === 'ClientManifest/steam_cmd_publicbeta_osx') { foreach ($this->ClientArchives as $Archive) { if (Preg_Match('/"' . Str_Replace('.', '\\.', $Archive) . '\\.([a-f0-9]{40})"/m', $Data, $Test) === 1) { $Test = $Test[1]; if (!isset($this->ETags[$Archive]) || $this->ETags[$Archive] !== $Test) { $this->Log('Downloading {lightblue}' . $Archive . '{normal} - checksum: ' . $Test); $this->ETags[$Archive] = $Test; $this->URLsToFetch[] = array('URL' => 'https://steamcdn-a.akamaihd.net/client/' . $Archive . '.' . $Test, 'File' => '.support/' . $Archive); } else { $this->Log('Matched {lightblue}' . $Archive . '{normal}, but we already have it cached'); } } else { $this->Log('{yellow}Failed to find {lightblue}' . $Archive); } } unset($Test); } else { if ($File === 'Random/ValveGroup.json' || $File === 'Random/SteamModerators.json') { LibXML_Use_Internal_Errors(true); $Data = SimpleXML_Load_String($Data); if ($Data === false || empty($Data->members->steamID64)) { return false; } $Data = Array_Values((array) $Data->members->steamID64); Sort($Data); $Data = JSON_Encode($Data, JSON_PRETTY_PRINT); } else { if ($File === 'Scripts/Dota2/heropickerdata.json') { $Data = JSON_Decode($Data, true); $Data = JSON_Encode($Data, JSON_PRETTY_PRINT); } else { if ($File === 'Scripts/Dota2/heropedia.js') { $Data = preg_replace('/\\?v=[0-9]+/', '?v=ayyvalve', $Data); } else { if (SubStr($File, 0, 13) === 'ItemSchemaURL') { $Data = JSON_Decode($Data, true); if (isset($Data['result']['items_game_url'])) { $this->URLsToFetch[] = array('URL' => $Data['result']['items_game_url'], 'File' => str_replace('ItemSchemaURL', 'ItemSchema', $File)); } return true; } else { if (SubStr($File, -4) === '.zip') { $File = __DIR__ . '/' . $File; File_Put_Contents($File, $Data); $Archive = SubStr(StrrChr($File, '/'), 1); if (SHA1_File($File) !== $this->ETags[$Archive]) { $this->Log('{lightred}Checksum mismatch for ' . $Archive); return false; } $this->ExtractClientArchives = true; return true; } else { if (SubStr($File, -5) === '.html') { if (StrrPos($Data, '</html>') === false) { return false; } } } } } } } } } $File = __DIR__ . '/' . $File; $Folder = dirname($File); if (!is_dir($Folder)) { $this->Log('{lightblue}Creating ' . $Folder); mkdir($Folder, 0755, true); } if (File_Exists($File) && StrCmp(File_Get_Contents($File), $Data) === 0) { return false; } File_Put_Contents($File, $Data); return true; }
$Folder = SPrintF('%s/patches/%s/files', SYSTEM_PATH, $HostID); #------------------------------------------------------------------------------- if (!File_Exists($Folder)) { continue; } #------------------------------------------------------------------------------- $PatchesIDs = IO_Scan($Folder); if (Is_Error($PatchesIDs)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!Count($PatchesIDs)) { continue; } #------------------------------------------------------------------------------- Sort($PatchesIDs); #------------------------------------------------------------------------------- $File = SPrintF('%s/hosts/%s/.LastPatchFiles', SYSTEM_PATH, $HostID); #------------------------------------------------------------------------------- if (!File_Exists($File)) { #------------------------------------------------------------------------------- $LastPatchFiles = IntVal(End($PatchesIDs)); #------------------------------------------------------------------------------- $IsWrite = IO_Write($File, (string) $LastPatchFiles, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $LastPatchFiles = IO_Read($File);
function get_images($pfad, $sub = 1, $tubes_only = 0) { global $phpbb_root_path; // Generate Image Picker $dir = @opendir($phpbb_root_path . $pfad); while ($file = @readdir($dir)) { if ($file != "." && $file != "..") { if (@is_dir(phpbb_realpath($phpbb_root_path . $pfad . '/' . $file)) && $sub) { $dir2 = @opendir($phpbb_root_path . $pfad . '/' . $file); while ($file2 = @readdir($dir2)) { if (!@is_dir(phpbb_realpath($phpbb_root_path . $pfad . '/' . $file . '/' . $file2))) { $img_size = @getimagesize($phpbb_root_path . $pfad . '/' . $file . '/' . $file2); if ($img_size[0] && $img_size[1]) { if ($tubes_only) { $filename = explode(".", $file2); $var = count($filename) - 1; if (strtolower($filename[$var]) == 'png' || strtolower($filename[$var]) == 'gif') { $xxx_images[] = $file . '/' . $file2; } } else { $xxx_images[] = $file . '/' . $file2; } } } } @closedir($dir2); } else { $img_size = @getimagesize($phpbb_root_path . $pfad . '/' . $file); if ($img_size[0] && $img_size[1]) { if ($tubes_only) { $filename = explode(".", $file); $var = count($filename) - 1; if (strtolower($filename[$var]) == 'png' || strtolower($filename[$var]) == 'gif') { $xxx_images[] = $file; } } else { $xxx_images[] = $file; } } } } } @closedir($dir); Sort($xxx_images); return $xxx_images; }