diff options
author | Minteck <contact@minteck.org> | 2022-02-05 15:55:51 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-02-05 15:55:51 +0100 |
commit | cee23ce48ea81612eefe30552da1cc286138af0b (patch) | |
tree | e0eca8d2a62139f47d63d00076b84e033ce1d68f /includes | |
parent | ed531165841a1de9200782b00b99b174bf2289cd (diff) | |
download | movies-cee23ce48ea81612eefe30552da1cc286138af0b.tar.gz movies-cee23ce48ea81612eefe30552da1cc286138af0b.tar.bz2 movies-cee23ce48ea81612eefe30552da1cc286138af0b.zip |
Update
Diffstat (limited to 'includes')
-rw-r--r-- | includes/construct.php | 51 | ||||
-rw-r--r-- | includes/header.php | 24 | ||||
-rw-r--r-- | includes/plus.php | 2 | ||||
-rw-r--r-- | includes/session.php | 11 |
4 files changed, 76 insertions, 12 deletions
diff --git a/includes/construct.php b/includes/construct.php new file mode 100644 index 0000000..6d32c7d --- /dev/null +++ b/includes/construct.php @@ -0,0 +1,51 @@ +<?php + +$_SERVER = [ + 'DOCUMENT_ROOT' => "/mnt/faminema" +]; + +echo("Loading database...\n"); +$times = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/durations.json"), true); + +function id3time($file) { + $fparts = explode("/", $file); + $afile = $fparts[count($fparts) - 1]; + + global $times; + $date = (int)date('U'); + + if (in_array($afile, $times["@items"]) && ($date - $times[$afile]["date"] < 108000)) { + echo("$file => metadata too recent\n"); + return $times[$afile]["duration"]; + } else { + include_once($_SERVER['DOCUMENT_ROOT'] . "/includes/getid3/getid3.php"); + $getID3 = new getID3; + $id3 = $getID3->analyze($file); + + if (isset($id3["playtime_string"])) { + $str = $id3["playtime_string"]; + $str2 = (int)round($id3["playtime_seconds"]); + } else { + $str = "-:--"; + $str2 = 0; + } + + $times[$afile] = [ + "duration" => $str, + "seconds" => $str2, + "date" => $date + ]; + $times["@items"][] = $afile; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/durations.json", json_encode($times, JSON_PRETTY_PRINT)); + + echo("$file => metadata updated\n"); + return $str; + } +} + +foreach (scandir($_SERVER['DOCUMENT_ROOT'] . "/data/films/video") as $file) { + if ($file !== "." && $file !== "..") { + echo("Constructing metadata for $file\n"); + id3time($_SERVER['DOCUMENT_ROOT'] . "/data/films/video/" . $file); + } +}
\ No newline at end of file diff --git a/includes/header.php b/includes/header.php index fffd3ea..21e4892 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,8 +1,8 @@ -<?php $_SYSVERSION="10.0"; +<?php $_SYSVERSION="10.1"; if (isset($_GET['_t'])) { $exp = (new DateTime('tomorrow'))->format("U"); - setcookie("FL_SESSION_TOKEN", $_GET['_t'], $exp, "/", "Familine Movies.ddns.net", true, true); + setcookie("FL_SESSION_TOKEN", $_GET['_t'], $exp, "/", "Familine Films.ddns.net", true, true); header("Location: /"); die(); } @@ -23,15 +23,16 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/plus.php"; <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> - <title><?php if (isset($_TITLE)) { echo($_TITLE . " | Familine Movies" . (isset($_FamilineMoviesPlus) && $_FamilineMoviesPlus ? "+" : "")); } else { echo("Familine Movies" . (isset($_FamilineMoviesPlus) && $_FamilineMoviesPlus ? "+" : "")); } ?></title> + <title><?php if (isset($_TITLE)) { echo($_TITLE . " | Familine Films"); } ?></title> <style>* { scroll-behavior: smooth; }</style> </head> -<body id="body"> +<body id="body" style="overflow:hidden;"> <div id="loader" style="position:fixed;top:32px;left:0;right:0;bottom:0;background:whitesmoke;z-index:9999;display:flex;align-items:center;justify-content:center;"> <img src="/loader.png" style="filter: hue-rotate(0deg);width:128px;animation-name: loadingimg;animation-duration: 2s;animation-iteration-count: infinite;animation-direction: alternate-reverse;"> <style> + * { outline: none; } @@ -84,13 +85,13 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/plus.php"; </div> <div class="modal-body"> - <p>Le contenu présent sur Familine Movies est protégé par les lois sur les droits d'auteurs en France, au Canada et dans d'autres pays.</p> - <p>De ce fait, toute copie/modification/réplication/publication du présent contenu peut faire l'objet de poursuites judiciaires. L'utilisation du contenu hébergé sur Familine Movies ne doit s'effectuer que dans le cadre des services proposés par Familine.</p> - <p>Lors de votre accès à Familine Movies par le biais d'un compte Familine ou d'un compte sur l'instance JetBrains Space de Familine, vous êtes légalement décerné le droit d'accéder au contenu présent sur Familine Movies. Vous ne possédez pas le contenu, seulement le droit d'y accéder.</p> + <p>Le contenu présent sur Familine Films est protégé par les lois sur les droits d'auteurs en France, au Canada et dans d'autres pays.</p> + <p>De ce fait, toute copie/modification/réplication/publication du présent contenu peut faire l'objet de poursuites judiciaires. L'utilisation du contenu hébergé sur Familine Films ne doit s'effectuer que dans le cadre des services proposés par Familine.</p> + <p>Lors de votre accès à Familine Films par le biais d'un compte Familine, vous êtes légalement décerné le droit d'accéder au contenu présent sur Familine Films. Vous ne possédez pas le contenu, seulement le droit d'y accéder.</p> </div> <div class="modal-footer"> - <button type="button" class="btn btn-success" onclick="localStorage.setItem('copyright', '1');" data-dismiss="modal">J'accepte</button> + <button type="button" class="btn btn-success" onclick="localStorage.setItem('copyright', '1');location.reload();" data-dismiss="modal">J'accepte</button> </div> </div> @@ -99,11 +100,18 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/plus.php"; <script> if (localStorage.getItem("copyright") !== "1") { + window.history.replaceState({}, document.title, "/app/copyright"); $("#copyright").modal(); } + document.getElementById('body').style.overflow = "auto"; + window.scrollTo(0, 0); + document.getElementById('body').style.overflow = "hidden"; + window.addEventListener('load', () => { setTimeout(() => { + document.getElementById('body').style.overflow = "auto"; + window.scrollTo(0, 0); $("#loader").fadeOut(200); }, 3000) }) diff --git a/includes/plus.php b/includes/plus.php index b9402f2..f8c0fb9 100644 --- a/includes/plus.php +++ b/includes/plus.php @@ -1,3 +1,3 @@ <?php -$_FamilineMoviesPlus = false;
\ No newline at end of file +$_FamilineMoviesPlus = true;
\ No newline at end of file diff --git a/includes/session.php b/includes/session.php index 9f38ca4..bf642ed 100644 --- a/includes/session.php +++ b/includes/session.php @@ -5,11 +5,16 @@ $_CONFIG = json_decode(file_get_contents("/mnt/familine/private/FamilineConfig.j if ($_SERVER['REMOTE_ADDR'] !== "127.0.0.1" && $_SERVER['REMOTE_ADDR'] !== "::0") { if (isset($_COOKIE['FL_SESSION_TOKEN'])) { + if (strpos($_COOKIE['FL_SESSION_TOKEN'], ".") !== false || strpos($_COOKIE['FL_SESSION_TOKEN'], "/") !== false) { + header("Location: https://" . $_CONFIG["Global"]["domain"] . "/login/?r=" . urlencode("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")); + die(); + } + if (file_exists("/mnt/familine/private/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['FL_SESSION_TOKEN'])))) { $_PROFILE = json_decode(file_get_contents("/mnt/familine/private/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['FL_SESSION_TOKEN']))), true); if (isset($_PROFILE['familine'])) { - header("Location: https://" . $_CONFIG["Global"]["domain"] . "/welcome"); + header("Location: https://" . $_CONFIG["Global"]["domain"] . "/login/?r=" . urlencode("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")); die(); } @@ -17,11 +22,11 @@ if ($_SERVER['REMOTE_ADDR'] !== "127.0.0.1" && $_SERVER['REMOTE_ADDR'] !== "::0" $_SUID = $_PROFILE['login']; $_FULLNAME = $_PROFILE['name']; } else { - header("Location: https://" . $_CONFIG["Global"]["domain"] . "/welcome"); + header("Location: https://" . $_CONFIG["Global"]["domain"] . "/login/?r=" . urlencode("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")); die(); } } else { - header("Location: https://" . $_CONFIG["Global"]["domain"] . "/welcome"); + header("Location: https://" . $_CONFIG["Global"]["domain"] . "/login/?r=" . urlencode("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")); die(); } |