Add ADULTMODE feature to hide adult themed comics
This commit is contained in:
		
							parent
							
								
									65ce549848
								
							
						
					
					
						commit
						3ea9a2a5dd
					
				| 
						 | 
					@ -18,6 +18,8 @@ function compareNames($a, $b) {
 | 
				
			||||||
    return strnatcmp($a["name"], $b["name"]);
 | 
					    return strnatcmp($a["name"], $b["name"]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$adultcomics = getAdultComics();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$compath = $_SESSION['compath'];
 | 
					$compath = $_SESSION['compath'];
 | 
				
			||||||
$fullcompath = COMICSDIR . (($compath == "/") ? "" : $compath) . "/";
 | 
					$fullcompath = COMICSDIR . (($compath == "/") ? "" : $compath) . "/";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,6 +42,7 @@ $issues = array();
 | 
				
			||||||
$entries = scandir($fullcompath);
 | 
					$entries = scandir($fullcompath);
 | 
				
			||||||
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;
 | 
				
			||||||
    $info = array();
 | 
					    $info = array();
 | 
				
			||||||
    $info["name"] = $entry;
 | 
					    $info["name"] = $entry;
 | 
				
			||||||
    $info["namesafe"] = htmlspecialchars($entry, ENT_QUOTES);
 | 
					    $info["namesafe"] = htmlspecialchars($entry, ENT_QUOTES);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,15 @@ function microtime_float() {
 | 
				
			||||||
   return ((float)$usec + (float)$sec);
 | 
					   return ((float)$usec + (float)$sec);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getAdultComics() {
 | 
				
			||||||
 | 
					   $adultlist = COMICSDIR . "/adultcomics.json";
 | 
				
			||||||
 | 
					   $adultcomics = array();
 | 
				
			||||||
 | 
					   if ( file_exists($adultlist) ) {
 | 
				
			||||||
 | 
					      $adultcomics = json_decode(file_get_contents($adultlist), true);
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					   return $adultcomics;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function makeThumb($item = "") {
 | 
					function makeThumb($item = "") {
 | 
				
			||||||
   if ( $item == "" ) { return false; }
 | 
					   if ( $item == "" ) { return false; }
 | 
				
			||||||
   $prefix = (substr(getcwd(), -4) == "ajax") ? "../" : "";
 | 
					   $prefix = (substr(getcwd(), -4) == "ajax") ? "../" : "";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,11 @@ define('THUMBSDIR', 'thumbs');
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
define('EXTRACTSDIR', 'comics');
 | 
					define('EXTRACTSDIR', 'comics');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Whether the system will display "adult" comics (i.e. PG-13+)
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					define('ADULTMODE', false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Database information for tracking last read page
 | 
					// Database information for tracking last read page
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user