Compare commits
4 Commits
bf8905f5f7
...
a1b9570553
| Author | SHA1 | Date | |
|---|---|---|---|
| a1b9570553 | |||
| ee0531b330 | |||
| 5d3db365b4 | |||
| 1dd3a3bc70 |
|
|
@ -31,6 +31,11 @@ function compareNames($a, $b) {
|
|||
return strnatcmp($a["name"], $b["name"]);
|
||||
}
|
||||
|
||||
$data["compath"] = $compath;
|
||||
$pathparts = pathinfo($compath);
|
||||
$data["parentpath"] = $pathparts['dirname'];
|
||||
$data["foldername"] = $pathparts['basename'];
|
||||
|
||||
$adultcomics = getAdultComics();
|
||||
|
||||
$compath = $_SESSION['compath'];
|
||||
|
|
@ -52,6 +57,7 @@ while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
|||
$folders = array();
|
||||
$issues = array();
|
||||
$entries = scandir($fullcompath);
|
||||
$data["makethumb"] = array();
|
||||
foreach ( $entries as $entry ) {
|
||||
if ( ($entry == ".") || ($entry == "..") ) continue;
|
||||
if ( (ADULTMODE || !$_SESSION['adult']) && in_array($entry, $adultcomics) ) continue;
|
||||
|
|
@ -79,7 +85,7 @@ foreach ( $entries as $entry ) {
|
|||
$info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "<br />", $entry) : $entry), 0, -4);
|
||||
$info["relcomic"] = base64_encode($compath . (($compath == "/") ? "" : "/") . $entry);
|
||||
$info["mtime"] = filemtime($fullcompath . $entry);
|
||||
$info["thumburl"] = htmlentities(THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4), ENT_QUOTES) . ".jpg";
|
||||
$info["thumburl"] = THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4) . ".jpg";
|
||||
if ( in_array($entry, $issues_read) ) {
|
||||
$info["read"] = true;
|
||||
$readclass = " readborder";
|
||||
|
|
@ -91,9 +97,11 @@ foreach ( $entries as $entry ) {
|
|||
$info["div"] .= "<img class='issue' data-relcomic=\"{$info["relcomic"]}\" data-comname=\"{$info["comname"]}\" border=0 src=\"{$info["thumburl"]}\">";
|
||||
$info["div"] .= "<br clear=all /><a href=\"downloadcomic.php?comic={$info["relcomic"]}\">{$info["comname"]}</a></div>";
|
||||
$issues[] = $info;
|
||||
$thumbfile = "../" . THUMBSDIR . $data['compath'] . "/" . $info['comname'] . ".jpg";
|
||||
}
|
||||
}
|
||||
if ( isset($info["thumburl"]) && !file_exists("../" . $info["thumburl"]) ) {
|
||||
$data["makethumb"][] = $info["thumburl"];
|
||||
$havethumb = makeThumb($fullcompath . $entry);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,10 +115,6 @@ if ( $_SESSION["sortorder"] == SORTBYNAME ) {
|
|||
// Always sort issues by name
|
||||
usort($issues, "compareNames");
|
||||
|
||||
$data["compath"] = $compath;
|
||||
$pathparts = pathinfo($compath);
|
||||
$data["parentpath"] = $pathparts['dirname'];
|
||||
$data["foldername"] = $pathparts['basename'];
|
||||
$data["contents"] = array_merge($folders, $issues);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ if ( $extracted ) {
|
|||
//$myext = substr($imgname, -3);
|
||||
if ( ! isset(pathinfo($imgname)['extension']) ) continue;
|
||||
$myext = strtolower(pathinfo($imgname)['extension']);
|
||||
if ( ($myext == "jpeg") || ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
|
||||
if ( in_array($myext, VALIDIMAGETYPES) ) {
|
||||
$imgname = str_replace("#", "", $imgname);
|
||||
$imgcontents = $zip->getFromIndex($i);
|
||||
$written = file_put_contents($comicoutputfull . $imgname, $imgcontents);
|
||||
|
|
@ -84,7 +84,7 @@ if ( $extracted ) {
|
|||
$entry->extract(false, $comicoutputfull . $outfile);
|
||||
if ( ! isset(pathinfo($outfile)['extension']) ) continue;
|
||||
$myext = strtolower(pathinfo($outfile)['extension']);
|
||||
if ( ($myext == "jpeg") || ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
|
||||
if ( in_array($myext, VALIDIMAGETYPES) ) {
|
||||
$files[] = basename($outfile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,3 +43,4 @@ define('DBNAME', 'comics');
|
|||
define('SORTBYNAME', "Name");
|
||||
define('SORTBYDATE', "Date");
|
||||
define('SORTBYREAD', "Read");
|
||||
define('VALIDIMAGETYPES', array("jpg", "jpeg", "gif", "png", "webp"));
|
||||
|
|
|
|||
|
|
@ -35,24 +35,24 @@ a, a:link, a:visited, a:active {
|
|||
font-weight: bold;
|
||||
font-family: var(--default-font);
|
||||
text-align: center;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
border-bottom: 2px solid var(--foreground-color);
|
||||
background-color: var(--background-color);
|
||||
width: 100%;
|
||||
top: 0;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
}
|
||||
.sorter {
|
||||
float: left;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.name {
|
||||
float: right;
|
||||
top: 0px;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.list {
|
||||
width: 100%;
|
||||
margin: 10px auto auto auto;
|
||||
margin: 2em auto auto auto;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ function getAdultComics() {
|
|||
return $adultcomics;
|
||||
}
|
||||
|
||||
function safeFileName($file = "") {
|
||||
$to_remove = array("<", ">", "#", "\"", "/", "\\", "*", "?", "|");
|
||||
return str_replace($to_remove, '', $file);
|
||||
}
|
||||
|
||||
function makeThumb($item = "") {
|
||||
if ( $item == "" ) { return false; }
|
||||
$prefix = (substr(getcwd(), -4) == "ajax") ? "../" : "";
|
||||
|
|
@ -57,11 +62,7 @@ function makeThumb($item = "") {
|
|||
$parts = pathinfo($imgname);
|
||||
if ( isset($parts['extension']) ) {
|
||||
$imgext = strtolower($parts['extension']);
|
||||
if ( (strcmp($lowest, $imgname) > 0)
|
||||
&& ((strcasecmp($imgext, "jpg") == 0)
|
||||
|| (strcasecmp($imgext, "jpeg") == 0)
|
||||
|| (strcasecmp($imgext, "png") == 0)
|
||||
|| (strcasecmp($imgext, "webp") == 0)) ) {
|
||||
if ( (strcmp($lowest, $imgname) > 0) && in_array($imgext, VALIDIMAGETYPES) ) {
|
||||
$lowest = $imgname;
|
||||
$imgdata = $zip->getFromIndex($i);
|
||||
}
|
||||
|
|
@ -81,11 +82,7 @@ function makeThumb($item = "") {
|
|||
$parts = pathinfo($imgname);
|
||||
if ( isset($parts['extension']) ) {
|
||||
$imgext = strtolower($parts['extension']);
|
||||
if ( (strcmp($lowest, $imgname) > 0)
|
||||
&& ((strcasecmp($imgext, "jpg") == 0)
|
||||
|| (strcasecmp($imgext, "jpeg") == 0)
|
||||
|| (strcasecmp($imgext, "png") == 0)
|
||||
|| (strcasecmp($imgext, "webp") == 0)) ) {
|
||||
if ( (strcmp($lowest, $imgname) > 0) && in_array($imgext, VALIDIMAGETYPES) ) {
|
||||
$lowest = $imgname;
|
||||
$didwrite = $entry->extract(false, $outfile);
|
||||
if ( !$didwrite ) { return false; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user