Compare commits

...

2 Commits

3 changed files with 21 additions and 5 deletions

View File

@ -77,10 +77,20 @@ foreach ( $entries as $entry ) {
$folders[] = $info; $folders[] = $info;
} else { } else {
if ( (substr($entry, -3) == "cbz") || (substr($entry, -3) == "cbr") ) { if ( (substr($entry, -3) == "cbz") || (substr($entry, -3) == "cbr") ) {
$info["comname"] = substr(((strpos($entry, " - ") !== false) ? str_replace(" - ", "<br />", $entry) : $entry), 0, -4); $withoutext = substr($entry, 0, -4);
if ( strlen($withoutext) <= ISSUELENGTHCUTOFF ) {
$info["comname"] = str_replace(" - ", "<br />", $withoutext);
} else {
if ( strpos($withoutext, " - ") !== false ) {
$info["comname"] = substr($withoutext, strpos($withoutext, " - ") + 3);
} else {
$info["comname"] = $withoutext;
}
}
//$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"] = THUMBSDIR . $compath . (($compath == "/") ? "" : "/") . $withoutext . ".jpg";
if ( in_array($entry, $issues_read) ) { if ( in_array($entry, $issues_read) ) {
$info["read"] = true; $info["read"] = true;
$readclass = " readborder"; $readclass = " readborder";

View File

@ -29,6 +29,12 @@ define('EXTRACTSDIR', 'comics');
// //
define('ADULTMODE', false); define('ADULTMODE', false);
//
// The character count in the comic title where, when exceeded
// the folder/comic/series name will be removed for readability.
//
define('ISSUELENGTHCUTOFF', 25);
// //
// Database information for tracking last read page // Database information for tracking last read page
// //

View File

@ -73,9 +73,9 @@ function makeThumb($item = "") {
$didwrite = file_put_contents($outfile, $imgdata); $didwrite = file_put_contents($outfile, $imgdata);
if ( !$didwrite ) return false; if ( !$didwrite ) return false;
} elseif ( substr($comic, -3) == "cbr" ) { } elseif ( substr($comic, -3) == "cbr" ) {
$rar_file = rar_open($comic); $rar_file = RarArchive::open($comic);
if ( $rar_file === false ) { return false; } if ( $rar_file === false ) { return false; }
$entries = rar_list($rar_file); $entries = $rar_file->getEntries();
$lowest = "~"; $lowest = "~";
foreach ( $entries as $entry ) { foreach ( $entries as $entry ) {
$imgname = $entry->getName(); $imgname = $entry->getName();
@ -89,7 +89,7 @@ function makeThumb($item = "") {
} }
} }
} }
rar_close($rar_file); $rar_file->close();
} else { } else {
return false; return false;
} }