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