mirror of https://github.com/kurisufriend/mlPHP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
861 B
37 lines
861 B
<?php
|
|
include_once("routes.php");
|
|
class ml
|
|
{
|
|
public $info;
|
|
public $db;
|
|
function __construct()
|
|
{
|
|
$this->info = json_decode(file_get_contents("db/info.json"), $associative = true);
|
|
$this->db = json_decode(file_get_contents("db/test.json"), $associative = true);
|
|
}
|
|
function getManga($id)
|
|
{
|
|
foreach ($this->db["manga"] as $manga)
|
|
{
|
|
if ($manga["info"]["id"] == $id)
|
|
{
|
|
return($manga);
|
|
}
|
|
}
|
|
return(0);
|
|
}
|
|
function getAllMangaInfo()
|
|
{
|
|
$response = [];
|
|
foreach ($this->db["manga"] as $manga)
|
|
{
|
|
array_push($response, $manga["info"]);
|
|
}
|
|
return $response;
|
|
}
|
|
function run()
|
|
{
|
|
echo(route($_SERVER["PATH_INFO"], $this));
|
|
}
|
|
}
|
|
?>
|