Ejemplo n.º 1
0
 public function getAnime($id)
 {
     $animeM = new AnimeMapper();
     $animes = $animeM->getAnimes();
     $return = array();
     foreach ($animes as $anime) {
         if ($anime->id == $id) {
             for ($i = 3; $i > 0; $i--) {
                 $replaceStr = "";
                 while (strlen($replaceStr) < $i) {
                     $replaceStr .= "%";
                 }
                 if (strpos($anime->FileNameSyntax, $replaceStr) !== false) {
                     break;
                 }
             }
             for ($i = 1; $i < $anime->Folgen + 1; $i++) {
                 if (strlen($replaceStr) == strlen($i) || strlen($replaceStr) < strlen($i)) {
                     $newStr = $i;
                 } else {
                     $newI = $i;
                     while (strlen($replaceStr) > strlen($newI)) {
                         $newI = "0" . $newI;
                     }
                     $newStr = $newI;
                 }
                 $anime->episodes[$i] = str_replace($replaceStr, $newStr, $anime->FileNameSyntax);
             }
             return $anime;
         }
     }
 }
Ejemplo n.º 2
0
 public function init()
 {
     if (isset($_COOKIE["masterpw"]) || isset($_POST["password"])) {
         $authC = new AuthController();
         $authC->auth();
     }
     $data = array("navbar" => NULL, "list" => NULL);
     if (SessionController::getAuth()) {
         if (isset($_GET["scan"])) {
             $animeC = new AnimeController();
             $animeC->scanNew();
             header("location: " . str_replace("?scan", "", $_SERVER['REQUEST_URI']));
         } elseif (isset($_GET["anime"]) && isset($_GET["episode"])) {
             $animeC = new AnimeController();
             $data["video"] = array("model" => $animeC->getAnime($_GET["anime"]));
         } else {
             $animeM = new AnimeMapper();
             $data["list"] = array("model" => $animeM->getAnimes());
         }
         if (isset($_COOKIE["lastEpisode"])) {
             $arr = explode("|", $_COOKIE["lastEpisode"]);
             $data["list"]["lastEpisode"]["id"] = $arr[0];
             $data["list"]["lastEpisode"]["nr"] = $arr[1];
             $data["navbar"]["lastEpisode"]["id"] = $arr[0];
             $data["navbar"]["lastEpisode"]["nr"] = $arr[1];
             $data["video"]["lastEpisode"]["id"] = $arr[0];
             $data["video"]["lastEpisode"]["nr"] = $arr[1];
             $data["video"]["lastEpisode"]["timestamp"] = $arr[2];
         }
     }
     $this->renderView($data);
 }
Ejemplo n.º 3
0
<?php

$ds = DIRECTORY_SEPARATOR;
include_once '..' . $ds . '..' . $ds . 'protected' . $ds . 'config' . $ds . 'autoload.php';
unlink(".." . $ds . "data" . $ds . "anime" . $ds . $_POST["folder"] . $ds . "downloading.tmp");
$animeM = new AnimeMapper();
foreach ($animeM->getAnimes() as $anime) {
    if ($_POST["folder"] == $anime->Ordner) {
        echo "exists";
        exit;
    }
}
$animeC = new AnimeController();
$animeC->addAnime($_POST["folder"], $_POST["name"]);