Compare commits
No commits in common. "a1b9570553323a0314ccd5f03e2113acb0559c1d" and "bf8905f5f73c66edd857104b0d459b1f5ae4ef3f" have entirely different histories.
a1b9570553
...
bf8905f5f7
|
|
@ -31,11 +31,6 @@ 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'];
|
||||||
|
|
@ -57,7 +52,6 @@ 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;
|
||||||
|
|
@ -85,7 +79,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"] = THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4) . ".jpg";
|
$info["thumburl"] = htmlentities(THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . substr($entry, 0, -4), ENT_QUOTES) . ".jpg";
|
||||||
if ( in_array($entry, $issues_read) ) {
|
if ( in_array($entry, $issues_read) ) {
|
||||||
$info["read"] = true;
|
$info["read"] = true;
|
||||||
$readclass = " readborder";
|
$readclass = " readborder";
|
||||||
|
|
@ -97,11 +91,9 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -115,6 +107,10 @@ 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 ( in_array($myext, VALIDIMAGETYPES) ) {
|
if ( ($myext == "jpeg") || ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
|
||||||
$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 ( in_array($myext, VALIDIMAGETYPES) ) {
|
if ( ($myext == "jpeg") || ($myext == "jpg") || ($myext == "png") || ($myext == "webp") ) {
|
||||||
$files[] = basename($outfile);
|
$files[] = basename($outfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,3 @@ 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: 2em auto auto auto;
|
margin: 10px auto auto auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,6 @@ 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") ? "../" : "";
|
||||||
|
|
@ -62,7 +57,11 @@ 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) && in_array($imgext, VALIDIMAGETYPES) ) {
|
if ( (strcmp($lowest, $imgname) > 0)
|
||||||
|
&& ((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);
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +81,11 @@ 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) && in_array($imgext, VALIDIMAGETYPES) ) {
|
if ( (strcmp($lowest, $imgname) > 0)
|
||||||
|
&& ((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