make library less of a hacky mess

This commit is contained in:
olebeck 2022-09-19 16:40:47 +02:00
parent 2214aa8154
commit 7d9a8c7491
4 changed files with 345 additions and 381 deletions

View File

@ -1,3 +1,2 @@
</body> </body>
</html> </html>

View File

@ -9,11 +9,6 @@
$description = ""; $description = "";
$image = ""; $image = "";
/*
* Write title
*/
echo("<title>");
$url = $_SERVER['REQUEST_URI']; $url = $_SERVER['REQUEST_URI'];
if(strpos($url, 'libary.php') !== false) if(strpos($url, 'libary.php') !== false)
{ {
@ -49,8 +44,10 @@
$title .= "PSM Reborn"; $title .= "PSM Reborn";
echo($title); /*
echo("</title>\n"); * Write title
*/
echo("<title>".$title."</title>\n");
if(strpos($url, 'libary.php') !== false) if(strpos($url, 'libary.php') !== false)
{ {
@ -124,13 +121,10 @@
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<div class="sitename"> <a href="/" class="sitename">
<a href="/" class="image">
<img src="img/logo.png" alt="PSMReborn" width="40" height="40"> <img src="img/logo.png" alt="PSMReborn" width="40" height="40">
<span>PSMReborn</span> <span>PSMReborn</span>
</a> </a>
</div>
<div class="sitemap"> <div class="sitemap">
<ul> <ul>

View File

@ -3,10 +3,8 @@ include("header.php");
?> ?>
<?php <?php
function getSdkType(SimpleXMLElement $xml)
{
function getSdkType(SimpleXMLElement $xml)
{
if(isset($xml->app_xml_format)) if(isset($xml->app_xml_format))
{ {
if($xml->app_xml_format->attributes()->sdk_type == "PSM SDK") if($xml->app_xml_format->attributes()->sdk_type == "PSM SDK")
@ -22,10 +20,10 @@ function getSdkType(SimpleXMLElement $xml)
{ {
return "PSM"; return "PSM";
} }
} }
if(isset($_GET["game"])) if(isset($_GET["game"]))
{ {
$game = htmlspecialchars($_GET["game"], ENT_QUOTES); $game = htmlspecialchars($_GET["game"], ENT_QUOTES);
$game = str_replace("/", "",$game); $game = str_replace("/", "",$game);
@ -37,8 +35,10 @@ if(isset($_GET["game"]))
echo("This is not the bug your looking for :P"); echo("This is not the bug your looking for :P");
die(); die();
} }
echo("<script src=\"/zrif.js\"></script>"); ?>
echo("<a id=\"zrif-bin-worker\" href=\"\"></a>"); <script src="zrif.js"></script>
<a id="zrif-bin-worker" href=""></a>
<?php
$title = getTitle($game); $title = getTitle($game);
@ -59,9 +59,6 @@ if(isset($_GET["game"]))
$metadataXML = simplexml_load_file('gameinfo/' . $game . "/". $latestVersion ."/metadata.xml", 'SimpleXMLElement', LIBXML_NOENT); $metadataXML = simplexml_load_file('gameinfo/' . $game . "/". $latestVersion ."/metadata.xml", 'SimpleXMLElement', LIBXML_NOENT);
$description = $metadataXML->localizedMetadataList->children(); $description = $metadataXML->localizedMetadataList->children();
$screenshot = $metadataXML->screenShotList->screenShot; $screenshot = $metadataXML->screenShotList->screenShot;
$defaultLocale = (string)$metadataXML->localizedMetadataList->attributes()->default_locale;
$isplayable = ""; $isplayable = "";
if($zrifinfo == "MISSING" && $zrifPendingInfo == "MISSING") if($zrifinfo == "MISSING" && $zrifPendingInfo == "MISSING")
@ -80,83 +77,61 @@ if(isset($_GET["game"]))
{ {
$isplayable = "<a class=\"white\" onclick=\"copy_text('".$zrifPendingInfo."')\">Maybe, Ulthough it hasnt been tested yet- Copy zRIF String</a> or <a class=\"white\" onclick=\"convert2('".$zrifPendingInfo."')\">Download FAKE.RIF</a>"; $isplayable = "<a class=\"white\" onclick=\"copy_text('".$zrifPendingInfo."')\">Maybe, Ulthough it hasnt been tested yet- Copy zRIF String</a> or <a class=\"white\" onclick=\"convert2('".$zrifPendingInfo."')\">Download FAKE.RIF</a>";
} }
?>
echo('<div class="bg-content" style="background-image: url(\'/gameinfo/'.$game.'/splash_854x480.png\');"> <div class="bg-content" style="background-image: url('/gameinfo/<?php echo $game ?>/splash_854x480.png');"></div>
</div>
<div class="psm-meta"> <div class="psm-meta">
<div id="psm-title"> <div id="psm-title"><?php echo($title.' ('.$game.')') ?></div>
'. $title .' ('.$game.')
</div>
<div id="psm-top-part"> <div id="psm-top-part">
<div id="psm-icon"> <div id="psm-icon">
<img src="/gameinfo/'. $game .'/icon_256x256.png" /> <img src="/gameinfo/<?php echo $game ?>/icon_256x256.png" />
</div> </div>
<div id="psm-infos"> <div id="psm-infos">
<ul> <ul>
<li><p>Playable: '.$isplayable.'</p></li> <li><p>Playable: <?php echo $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>, <a href="/gameinfo/'.$game.'/version.xml" class="white">version.xml</a>, <a href="/gameinfo/'.$game.'/'.$latestVersion.'/metadata.xml" class="white">metadata.xml</a></p></li> <li><p>Metadata: <a href="/gameinfo/<?php echo $game ?>/app.xml" class="white">app.xml</a>, <a href="/gameinfo/<?php echo $game ?>/text.txt" class="white">copyright.txt</a>, <a href="/gameinfo/<?php echo $game ?>/version.xml" class="white">version.xml</a>, <a href="/gameinfo/<?php echo $game ?>/<?php echo $latestVersion ?>/metadata.xml" class="white">metadata.xml</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>' . printScreenshotsLinks($screenshot, $latestVersion, $game) . '</p></li> <li><p>Images: <a href="/gameinfo/<?php echo $game ?>/icon_128x128.png" class="white">icon_128x128.png</a>, <a href="/gameinfo/<?php echo $game ?>/icon_256x256.png" class="white">icon_256x256.png</a>, <a href="/gameinfo/<?php echo $game ?>/icon_512x512.png" class="white">icon_512x512.png</a>, <a href="/gameinfo/<?php echo $game ?>/splash_854x480.png" class="white">splash_854x480.png</a><?php printScreenshotsLinks($screenshot, $latestVersion, $game) ?></p></li>
<li><p>Supported locale: <b>'.printLanguageList($languageList).'</b></p></li> <li><p>Supported locale: <b><?php printLanguageList($languageList) ?></b></p></li>
<li><p>Genres: <b>'.printGenreList($genreList).'</b></p></li> <li><p>Genres: <b><?php printGenreList($genreList) ?></b></p></li>
<li><p>Type: <b>'.$SDKType.'</b></p></li> <li><p>Type: <b><?php echo $SDKType ?></b></p></li>
</ul> </ul>
</div> </div>
</div> </div>
<div id="psm-description"> <div id="psm-description">
<hr> <hr><?php echo printDescription($description, "en") ?><hr>
'. printDescription($description, $defaultLocale) .'
<hr>
</div> </div>
<div id="psm-screenshots"> <div id="psm-screenshots">
'.printScreenshotsImgTags($screenshot, $latestVersion, $game).' <?php echo printScreenshotsImgTags($screenshot, $latestVersion, $game) ?>
</div> </div>
<div id="psm-downloads"> <div id="psm-downloads">
<div class="button-enabled" id="pkg-sony" onclick="open_url('<?php echo $pkgSony ?>')">
<div class="button-enabled" id="pkg-sony" onclick="open_url(\''.$pkgSony.'\')"> <a href="<?php echo($pkgSony) ?>" class="nostyle">PKG (Sony Server)</a>
<a href="'.$pkgSony.'" class="nostyle">PKG (Sony Server)</a>
</div> </div>
<div class="button-enabled" id="pkg-psmrb" onclick="open_url(\''.$pkgReborn.'\')"> <div class="button-enabled" id="pkg-psmrb" onclick="open_url('<?php echo $pkgReborn ?>')">
<a href="'.$pkgReborn.'" class="nostyle">PKG (PSMReborn Server)</a> <a href="<?php echo $pkgReborn ?>" class="nostyle">PKG (PSMReborn Server)</a>
</div> </div>
');
if($zrifinfo == "MISSING"){ <?php if($zrifinfo == "MISSING"){ ?>
echo('<div class="button-disabled" id="fake-rif"> <div class="button-disabled" id="fake-rif">NoPsmDrm License</div>
NoPsmDrm License <?php } else { ?>
</div>'); <div class="button-enabled" id="fake-rif" onclick="convert2('<?php echo $zrifinfo ?>')">
} <a class="nostyle" onclick="convert2('<?php echo $zrifinfo ?>')">NoPsmDrm License</a>
else{ </div>
echo(' <?php } ?>
<div class="button-enabled" id="fake-rif" onclick="convert2(\''.$zrifinfo.'\')">
<a class="nostyle" onclick="convert2(\''.$zrifinfo.'\')">NoPsmDrm License</a>
</div>');
}
echo('<div class="'); <?php if(file_exists($simulatorZip)) { ?>
if(file_exists($simulatorZip)) <div class="button-enabled" onclick="open_url('<?php echo $simulatorZip ?>')">
{ <a href="<?php echo $simulatorZip ?>" class="nostyle">Decrypted Files (For Simulator)</a>
echo 'button-enabled" onclick="open_url(\''.$simulatorZip.'\')"> </div>
<a href="'.$simulatorZip.'" class="nostyle">Decrypted Files (For Simulator)</a>'; <?php } else { ?>
} <div class="button-disabled">Decrypted Files (For Simulator)</div>
else <?php } ?>
{
echo 'button-disabled">
Decrypted Files (For Simulator)';
}
echo '</div>
<select onchange="pkg_change_version()" class="version-select"> <select onchange="pkg_change_version()" class="version-select">
'; <?php
$dirlist = glob("pkg/".$game."_00/*"); $dirlist = glob("pkg/".$game."_00/*");
$vercount = count($dirlist); $vercount = count($dirlist);
for($i = 0; $i < $vercount; $i++) for($i = 0; $i < $vercount; $i++)
@ -172,15 +147,11 @@ if(isset($_GET["game"]))
echo'<option value="'.$ver.'">'.$ver.'</option>'; echo'<option value="'.$ver.'">'.$ver.'</option>';
} }
} }
?>
echo'
</select> </select>
</div> </div>
</div> </div>
'; <?php } else {
}
else
{
$searchUsed = isset($_GET["search"]); $searchUsed = isset($_GET["search"]);
$simulatorSearch = false; $simulatorSearch = false;
@ -204,67 +175,64 @@ else
if($_GET["playable"] == "on") if($_GET["playable"] == "on")
$playableSearch = true; $playableSearch = true;
} }
?>
echo'<div id="search-form"> <div id="search-form">
<form action="" method="get"> <form action="" method="get">
<input type="text" name="search" value="'; <input type="text" name="search" value="<?php
if(isset($_GET["search"])) if(isset($_GET["search"])) {
{
echo htmlspecialchars($_GET["search"], ENT_QUOTES); echo htmlspecialchars($_GET["search"], ENT_QUOTES);
} }
echo '"></input> ?>"/>
<input type="submit"></input><br>
<input type="radio" name="searchby" value="title" '; <input type="submit">Submit</input><br>
if(!$searchUsed || isset($_GET["searchby"]))
{ <input type="radio" name="searchby" value="title" <?php
if(!$searchUsed || $_GET["searchby"] == "title" ) if(!$searchUsed || isset($_GET["searchby"])) {
{ if(!$searchUsed || $_GET["searchby"] == "title" ) {
echo 'checked="checked"'; echo 'checked="checked"';
} }
} }
echo '>Title</input> ?>>Title</input>
<input type="radio" name="searchby" value="titleid" ';
if(isset($_GET["searchby"])) <input type="radio" name="searchby" value="titleid" <?php
{ if(isset($_GET["searchby"])) {
if($_GET["searchby"] == "titleid") if($_GET["searchby"] == "titleid") {
{
echo 'checked="checked"'; echo 'checked="checked"';
} }
} }
echo '>Title ID</input> ?>>Title ID</input>
<input type="radio" name="searchby" value="dev" ';
if(isset($_GET["searchby"])) <input type="radio" name="searchby" value="dev" <?php
{ if(isset($_GET["searchby"])) {
if($_GET["searchby"] == "dev") if($_GET["searchby"] == "dev") {
{
echo 'checked="checked"'; echo 'checked="checked"';
} }
} }
echo '>Developer</input><br> ?>>Developer</input><br>
<input type="checkbox" name="playable" ';
if(!$searchUsed || $playableSearch) <input type="checkbox" name="playable" <?php
{ if(!$searchUsed || $playableSearch) {
echo 'checked="checked"'; echo 'checked="checked"';
} }
echo'>Show Playable (Has zRIF)</input> ?>>Show Playable (Has zRIF)</input>
<input type="checkbox" name="simulator" ';
if(!$searchUsed || $simulatorSearch) <input type="checkbox" name="simulator" <?php
{ if(!$searchUsed || $simulatorSearch) {
echo 'checked="checked"'; echo 'checked="checked"';
} }
echo '>Show Simulator-Ready</input> ?>>Show Simulator-Ready</input>
<input type="checkbox" name="unplayable" ';
if(!$searchUsed || $unplayableSearch) <input type="checkbox" name="unplayable" <?php
{ if(!$searchUsed || $unplayableSearch) {
echo 'checked="checked"'; echo 'checked="checked"';
} }
echo '>Show Unplayable (Only PKG)</input> ?>>Show Unplayable (Only PKG)</input>
</form> </form>
</div> </div>
';
<div id="psm-gamelist">
echo('<div id="psm-gamelist">'); <?php
$dirlist = glob("gameinfo/*"); $dirlist = glob("gameinfo/*");
$playableList = getPlayableList(); $playableList = getPlayableList();
$playablePendingList = getPendingPlayableList(); $playablePendingList = getPendingPlayableList();
@ -285,7 +253,6 @@ else
{ {
$search = $_GET["search"]; $search = $_GET["search"];
if(isset($_GET["searchby"]) && $search !== "") if(isset($_GET["searchby"]) && $search !== "")
{ {
$searchby = $_GET["searchby"]; $searchby = $_GET["searchby"];
@ -337,30 +304,21 @@ else
} }
} }
} }
?>
<a class="psm-game" href="?game=<?php echo $titleid ?>">
<img src="/gameinfo/<?php echo $titleid ?>/icon_128x128.png" width="124" height="124">
<div class="psm-game-info">
<span><?php echo $title ?></span>
<?php if(getSdkType($xml) == "PSM Unity") { ?>
echo '<div class="psm-game" onclick="open_url(\'?game='.$titleid.'\')""> <img src="/img/unity.png" title="Made With Unity" width="10" height="10">
<a href="?game='.$titleid.'" class="nostyle"> <?php } if($isPlayable) { ?>
<img src="/gameinfo/'. $titleid .'/icon_128x128.png" width="124" height="124"> <img src="/img/playable.png" title="zRIF Known" width="10" height="10">
'; <?php } if($isPlayablePending) { ?>
<img src="/img/pending_playable.png" title="zRIF Maybe Known" width="10" height="10" >
if(getSdkType($xml) == "PSM Unity") <?php } if($hasSimulator) { ?>
{ <img src="/img/simulator.png" title="Simulator Files Avalible" width="10" height="10" >
echo '<img src="/img/unity.png" title="Made With Unity" width="10" height="10" >'; <?php }
}
if($isPlayable)
{
echo '<img src="/img/playable.png" title="zRIF Known" width="10" height="10" >';
}
if($isPlayablePending)
{
echo '<img src="/img/pending_playable.png" title="zRIF Maybe Known" width="10" height="10" >';
}
if($hasSimulator)
{
echo '<img src="/img/simulator.png" title="Simulator Files Avalible" width="10" height="10" >';
}
$authorUrl = "libary.php?search=".urlencode($author)."&searchby=dev"; $authorUrl = "libary.php?search=".urlencode($author)."&searchby=dev";
if($playableSearch === true || $searchUsed === false) if($playableSearch === true || $searchUsed === false)
$authorUrl .= "&playable=on"; $authorUrl .= "&playable=on";
@ -368,22 +326,22 @@ else
$authorUrl .= "&simulator=on"; $authorUrl .= "&simulator=on";
if($unplayableSearch === true || $searchUsed === false) if($unplayableSearch === true || $searchUsed === false)
$authorUrl .= "&unplayable=on"; $authorUrl .= "&unplayable=on";
?>
echo '<span id="psm-info"> <table>
<p> <tbody>
<b>'.$title.'</b><br> <tr><td>Genre:</td><td><?php echo $genre ?></td></tr>
Genre: <b>'.$genre.'</b><br> <tr><td>Version:</td><td><?php echo $version ?></td></tr>
Version: <b>'.$version.'</b><br> <tr><td>Author:</td><td><a class="white" href="<?php echo $authorUrl ?>"><?php echo $author ?></a></td></tr>
<b>Author: <a class="white" href="'.$authorUrl.'">'.$author.'</a><br> <tr><td>Website:</td><td><a class="white" href="<?php echo $website ?>"><?php echo $website ?></a></td></tr>
Website: <a class="white" href="'.$website.'">'.$website.'</a><br></b> </tbody>
</p> </table>
</span> </div>
</a> </a>
</div>';
<?php
}
} }
echo('</div>');
}
include("footer.php"); include("footer.php");
?> ?>

View File

@ -2,18 +2,24 @@
* header.php * header.php
*/ */
.sitename img { .sitename img {
vertical-align: top; vertical-align: top;
} }
.sitename{ .sitename {
text-decoration: none;
font-weight: bold; font-weight: bold;
float: left; float: left;
height: 40px; height: 40px;
} }
.sitemap{ .sitename > span {
float:right; height: 100%;
display: inline-block;
}
.sitemap {
float: right;
height: 40px; height: 40px;
margin: 0; margin: 0;
line-height: 100%; line-height: 100%;
@ -101,6 +107,8 @@
#psm-gamelist { #psm-gamelist {
position: inherit; position: inherit;
text-align:center; text-align:center;
display: flex;
flex-wrap: wrap;
} }
#search-form{ #search-form{
@ -151,9 +159,9 @@
} }
.psm-game img{ .psm-game > img{
float: left; float: left;
margin-right:1rem; margin-right:0.5rem;
} }
.psm-game a:link, a:visited{ .psm-game a:link, a:visited{
@ -170,20 +178,22 @@
.psm-game{ .psm-game{
display: flex;
padding: 5px; padding: 5px;
width: 400px; width: 20%;
height: 124px; min-width: 400px;
height: 150px;
margin: 10px; margin: 10px;
background-color: #0094ff; background-color: #0094ff;
color: white; color: white;
border-radius: 5px; border-radius: 5px;
text-align: left; text-align: left;
white-space: nowrap;
overflow: hidden; overflow: hidden;
white-space: nowrap;
display: inline-block;
vertical-align: middle; vertical-align: middle;
text-decoration: none;
} }
.psm-game:hover{ .psm-game:hover{
@ -214,9 +224,10 @@
.psm-meta > #psm-downloads{ .psm-meta > #psm-downloads{
color: white; color: white;
display: flex; display: flex;
flex-direction: row;
width: 100%;
justify-content: center; justify-content: center;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
} }
.psm-meta > #psm-description{ .psm-meta > #psm-description{
@ -270,9 +281,11 @@
height:100%; height:100%;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center;
left:0px; left:0px;
top:0px; top:0px;
position: fixed; position: fixed;
filter: blur(10px);
} }
/* /*