$npsTime + 60) { rename("NpsPsm.tsv","nps-backup/NpsPsm_".strval($npsTime).".tsv"); rename("NpsPendingPsm.tsv","nps-backup/NpsPendingPsm_".strval($npsPendingTime).".tsv"); file_put_contents("NpsPsm.tsv", file_get_contents("http://nopaystation.com/tsv/PSM_GAMES.tsv")); file_put_contents("NpsPendingPsm.tsv", file_get_contents("https://nopaystation.com/tsv/pending/PSM_GAMES.tsv")); } } update_rifs(); if(strcmp($_SERVER['HTTP_HOST'],"psmreborn.com") !== 0) { if(strcmp($_SERVER['HTTP_HOST'],"psm.cbps.xyz") !== 0) { header('HTTP/1.0 403 Forbidden'); die("\r\n\r\n403 Forbidden\r\n\r\n

Forbidden

\r\n

You don't have permission to access this resource.

\r\n
\r\n
Apache/2.4.41 (Ubuntu) Server at ".$_SERVER['HTTP_HOST']." Port 80
\r\n"); } } function printGenreList(SimpleXMLElement $xml) { $content = ""; $xcount = count($xml); for ($x = 0; $x < $xcount; $x++) { $genre = $xml[$x]->attributes()->value; $content = $content.$genre; if($xcount > 1 && $x+1 < $xcount) { $content = $content.", "; } } return $content; } function printLanguageList(SimpleXMLElement $xml) { $content = ""; $xcount = count($xml); for ($x = 0; $x < $xcount; $x++) { $language = $xml[$x]->attributes()->locale; $content = $content.$language; if($xcount > 1 && $x+1 < $xcount) { $content = $content.", "; } } return $content; } function printScreenshotsLinks(SimpleXMLElement $xml, $ver, $titleid) { $content = ""; $xcount = count($xml); if($xcount >= 1){ $content = ", "; } for ($x = 0; $x < $xcount; $x++) { $content = $content."".$xml[$x]." "; if($xcount > 1 && $x+1 < $xcount) { $content = $content . ", "; } } return $content; } function printScreenshotsImgTags(SimpleXMLElement $xml, $ver, $titleid) { $content = ""; $xcount = count($xml); for ($x = 0; $x < $xcount; $x++) { $content = $content.""; } return $content; } function printDescription(SimpleXMLElement $xml, $flocale){ $content = ""; $xcount = count($xml); for ($x = 0; $x < $xcount; $x++) { $locale = $xml[$x]->attributes()->locale; if($locale == $flocale){ $content = (string)$xml[$x]->description; } } return $content; } function getLatestVer(string $game){ $verXML = simplexml_load_file('gameinfo/' . $game . "/version.xml", 'SimpleXMLElement', LIBXML_NOENT); $latestVersion = (string)($verXML->appVersion); return $latestVersion; } function getDesc(string $game){ $version = getLatestVer($game); $mdxml = simplexml_load_file('gameinfo/' . $game . "/".$version."/metadata.xml", 'SimpleXMLElement', LIBXML_NOENT); $defaultLocale = (string)$mdxml->localizedMetadataList->attributes()->default_locale; return printDescription($mdxml->localizedMetadataList->children(), $defaultLocale); } function getTitle(string $game) { $xml = simplexml_load_file('gameinfo/' . $game . "/app.xml", 'SimpleXMLElement', LIBXML_NOENT); $title = $xml->name->localized_item[0]->attributes()->value; unset($xml); return $title; } function getPlayableList() { $playable_list = (array)null; $delimiter = "\t"; $fp = fopen("NpsPsm.tsv", 'r'); while (!feof($fp)) { $line = fgets($fp, 2048); $data = str_getcsv($line, $delimiter); $playable = 0; if($data[4] != "MISSING") { $playable = 1; } $playable_list[$data[0]] = $playable; } fclose($fp); return $playable_list; } function getPendingPlayableList() { $playable_list = (array)null; $delimiter = "\t"; $fp = fopen("NpsPendingPsm.tsv", 'r'); while (!feof($fp)) { $line = fgets($fp, 2048); $data = str_getcsv($line, $delimiter); $playable = 0; if($data[4] != "MISSING") { $playable = 1; } $gameTid = basename($data[3], "_00.pkg"); $playable_list[$gameTid] = $playable; } fclose($fp); return $playable_list; } function getZRIF(string $titleid) { $delimiter = "\t"; $fp = fopen("NpsPsm.tsv", 'r'); // Workaround for NPS having multiple entries for some reason $zrif = "MISSING"; while ( !feof($fp) ) { $line = fgets($fp, 2048); $data = str_getcsv($line, $delimiter); if($data[0] == $titleid) { $zrif = $data[4]; } } fclose($fp); return $zrif; } function getPendingZRIF(string $titleid) { $delimiter = "\t"; $fp = fopen("NpsPendingPsm.tsv", 'r'); while ( !feof($fp) ) { $line = fgets($fp, 2048); $data = str_getcsv($line, $delimiter); $gameTid = basename($data[3], "_00.pkg"); if($gameTid == $titleid) { return($data[4]); } } fclose($fp); return "MISSING"; } function getPKG(string $titleid) { $delimiter = "\t"; $fp = fopen("NpsPsm.tsv", 'r'); while ( !feof($fp) ) { $line = fgets($fp, 2048); $data = str_getcsv($line, $delimiter); if($data[0] == $titleid) { return($data[3]); } } fclose($fp); } ?>