psmreborn/libary.php

314 lines
8.1 KiB
PHP

<?php
include("header.php");
?>
<?php
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 getSdkType(SimpleXMLElement $xml)
{
if(isset($xml->app_xml_format))
{
if($xml->app_xml_format->attributes()->sdk_type == "PSM SDK")
{
return "PSM";
}
else
{
return "PSM Unity";
}
}
else
{
return "PSM";
}
}
if(isset($_GET["game"]))
{
$game = htmlspecialchars($_GET["game"], ENT_QUOTES);
$game = str_replace("/", "",$game);
$game = str_replace(".", "",$game);
$game = str_replace("*", "",$game);
if(strlen($game) != 9)
{
echo("I like to see girls die,<br>This is not the bug your looking for :P");
die();
}
$title = getTitle($game);
$xml = simplexml_load_file('gameinfo/' . $game . "/app.xml", 'SimpleXMLElement', LIBXML_NOENT);
$genreList = $xml->genre_list->children();
$languageList = $xml->name->children();
$featureList = $xml->feature_list->children();
$SDKType = getSdkType($xml);
$zrifinfo = getZRIF($game);
$pkgSony = getPKG($game);
$pkgReborn = "/pkg/".$game."_00.pkg";
$simulatorZip = "decrypted-files/".$game.".zip";
$isplayable = "";
if(file_exists("psdp-packages/".$game.".psdp"))
{
$isplayable = "<a href=\"/psdp-packages/".$game.".psdp\" class=\"white\">Yes, with PSDP Package in Developer Assistant</a>";
}
elseif($zrifinfo == "MISSING")
{
$isplayable = "<a href=\"/faq.php#add-zrif\" class=\"white\">No, Missing zRIF - Do you have a working copy of this game?</a>";
}
else
{
$isplayable = "<a class=\"white\" onclick=\"copy_text('".$zrifinfo."')\">Yes! get zRIF.</a>";
}
echo'<div id="bg-content" style="width:100%; height:100%; background-image: url(\'/gameinfo/'.$game.'/splash_854x480.png\'); background-repeat: no-repeat; background-size: cover;height: 100%; background-size: cover;");>
<div class="psm-meta">
<img src="/gameinfo/'. $game .'/icon_256x256.png" id="psm-icon" width="256" height="256">
<div id="psm-title">
'. $title .' ('.$game.')
</div>
</img>
<div id="psm-infos">
<ul>
<li><p>Playable: '.$isplayable.'</p></li>
<li><p>Metadata: <a href="/gameinfo/'.$game.'/app.xml" class="white">app.xml</a>, <a href="/gameinfo/'.$game.'/text.txt" class="white">copyright.txt</a></p></li>
<li><p>Images: <a href="/gameinfo/'.$game.'/icon_128x128.png" class="white">icon_128x128.png</a>, <a href="/gameinfo/'.$game.'/icon_256x256.png" class="white">icon_256x256.png</a>, <a href="/gameinfo/'.$game.'/icon_512x512.png" class="white">icon_512x512.png</a>, <a href="/gameinfo/'.$game.'/splash_854x480.png" class="white">splash_854x480.png</a></p></li>
<li><p>Supported locale: <b>'.substr(printLanguageList($languageList),0,80).'</b></p></li>
<li><p>Genres: <b>'. substr(printGenreList($genreList),0,80) .'</b></p></li>
<li><p>Type: <b>'.$SDKType.'</b></p></li>
</ul>
</div>
<div id="psm-downloads">
<h1>Downloads: </h1>
<div class="button-enabled" onclick="open_url(\''.$pkgSony.'\')">
<a href="'.$pkgSony.'" class="nostyle">PKG (Sony Server)</a>
</div>
<div class="button-enabled" onclick="open_url(\''.$pkgReborn.'\')">
<a href="'.$pkgReborn.'" class="nostyle">PKG (PSMReborn Server)</a>
</div>
<div class="';
if(file_exists($simulatorZip))
{
echo 'button-enabled" onclick="open_url(\''.$simulatorZip.'\')">
<a href="'.$simulatorZip.'" class="nostyle">Decrypted Files (For Simulator)</a>';
}
else
{
echo 'button-disabled">
Decrypted Files (For Simulator)';
}
echo '</div>
</div>
</div>
</div>';
}
else
{
$searchUsed = isset($_GET["search"]);
echo'<div id="search-form">
<form action="" method="get">
<input type="text" name="search" value=';
if(isset($_GET["search"]))
{
echo htmlspecialchars($_GET["search"], ENT_QUOTES);
}
echo '></input>
<input type="submit"></input><br>
<input type="radio" name="searchby" value="title" ';
if(!$searchUsed || isset($_GET["searchby"]))
{
if(!$searchUsed || $_GET["searchby"] == "title" )
{
echo 'checked="checked"';
}
}
echo '>Title</input>
<input type="radio" name="searchby" value="titleid" ';
if(isset($_GET["searchby"]))
{
if($_GET["searchby"] == "titleid")
{
echo 'checked="checked"';
}
}
echo '>Title ID</input>
<input type="radio" name="searchby" value="dev" ';
if(isset($_GET["searchby"]))
{
if($_GET["searchby"] == "dev")
{
echo 'checked="checked"';
}
}
echo '>Developer</input><br>
<input type="checkbox" name="playable" ';
if(!$searchUsed || isset($_GET["playable"]))
{
echo 'checked="checked"';
}
echo'>Show Playable (Has zRIF)</input>
<input type="checkbox" name="simulator" ';
if(!$searchUsed || isset($_GET["simulator"]))
{
echo 'checked="checked"';
}
echo '>Show Simulator-Ready</input>
<input type="checkbox" name="unplayable" ';
if(!$searchUsed || isset($_GET["unplayable"]))
{
echo 'checked="checked"';
}
echo '>Show Unplayable (Only PKG)</input>
</form>
</div>
';
echo('<div id="psm-gamelist">');
$dirlist = glob("gameinfo/*");
$playableList = getPlayableList();
foreach ($dirlist as &$path) {
$dirname = basename($path);
$xml = simplexml_load_file($path . "/app.xml", 'SimpleXMLElement', LIBXML_NOENT);
$title = $xml->name->localized_item[0]->attributes()->value;
$version = $xml->attributes()->version;
$genre = $xml->genre_list->genre->attributes()->value;
$author = $xml->developer->name->attributes()->value;
$website = $xml->website->attributes()->href;
$isPlayable = $playableList[$dirname] == 1 || file_exists("psdp-packages/".$dirname.".psdp");
$hasSimulator = file_exists("decrypted-files/".$dirname.".zip");
if(isset($_GET["search"]))
{
$search = $_GET["search"];
if(isset($_GET["searchby"]) && $search != "")
{
$searchby = $_GET["searchby"];
if($searchby == "title")
{
if(strpos($title, $search) === false)
{
continue;
}
}
elseif($searchby == "titleid")
{
if(strpos($dirname, $search) === false)
{
continue;
}
}
elseif($searchby == "dev")
{
if(strpos($author, $search) === false)
{
continue;
}
}
}
if(!isset($_GET["simulator"]))
{
if($hasSimulator)
{
continue;
}
}
if(!isset($_GET["unplayable"]))
{
if(!$isPlayable)
{
continue;
}
}
if(!isset($_GET["playable"]))
{
if($isPlayable && !$hasSimulator)
{
continue;
}
}
}
echo '<div class="psm-game" onclick="open_url(\'?game='.$dirname.'\')"">
<a href="?game='.$dirname.'" class="nostyle">
<img src="/gameinfo/'. $dirname .'/icon_128x128.png" width="124" height="124">
';
if(getSdkType($xml) == "PSM Unity")
{
echo '<img src="/img/unity.png" title="Made With Unity" width="10" height="10" >';
}
if($isPlayable)
{
echo '<img src="/img/playable.png" title="zRIF Known" width="10" height="10" >';
}
if($hasSimulator)
{
echo '<img src="/img/simulator.png" title="Simulator Files Avalible" width="10" height="10" >';
}
echo '<span id="psm-info">
<p>
<b>'.$title.'</b><br>
Genre: <b>'.$genre.'</b><br>
Version: <b>'.$version.'</b><br>
Author: <b>'.substr($author,0,25).'</b><br>
Website: <a class="white" href="'.$website.'">'.substr($website,0,25).'</a><br>
</p>
</span>
</a>
</div>';
}
echo('</div>');
}
?>