| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- class core
- {
- public static function switch(){
- if($_SERVER['REQUEST_METHOD'] === 'POST'){
- if(isset($_POST["from"])){
- if($_POST["from"] == "cse.invent" AND isset($_POST["token"])){
- include_once "../core/submit/record.jwt.php";
- } elseif($_POST["from"] == "video.form.add") {
- include_once "../core/submit/video.add.php";
- } elseif($_POST["from"] == "video.form") {
- include_once "../core/submit/video.edit.php";
- } elseif($_POST["from"] == "video.cut") {
- include_once "../core/submit/video.cut.php";
- } else {
- echo "Error : switch :. from else post";
- var_dump($_POST);
- exit();
- }
- } else {
- echo "Error : switch :. from post";
- exit();
- }
-
- } elseif($_SERVER['REQUEST_METHOD'] === 'GET') {
-
- if(isset($_GET["video"])){
- include_once "../core/page/video.show.php";
- } elseif(isset($_GET["preview"])){
- include_once "../core/page/video.preview.php";
- } elseif(isset($_GET["delete"])){
- include_once "../core/submit/video.delete.php";
- } else {
- require_once "../core/controllers/session.php";
- include_once "../core/page/_header.php";
- if(empty($_GET["video"]) AND empty($_GET["preview"]) AND empty($_GET["edit"]) AND empty($_GET["cut"])){
- include_once "../core/page/videos.all.php";
- } elseif(isset($_GET["edit"]) AND $_GET["edit"] == "add"){
- include_once "../core/page/video.form.add.php";
- } elseif(isset($_GET["edit"]) AND $_GET["edit"] != "add"){
- include_once "../core/page/video.form.php";
- } elseif(isset($_GET["cut"])){
- include_once "../core/page/video.cut.php";
- } else {
- echo "Error : switch :. from get";
- exit();
- }
- include_once "../core/page/_footer.php";
- }
- } else {
- echo "Error : switch";
- exit();
- }
- }
-
- public static function print_r($_debug, int $_exit = NULL)
- {
- echo "<pre>";
- if(is_array($_debug)) {
- print_r($_debug);
- } elseif(is_object($_debug)){
- var_dump($_debug);
- } else {
- echo $_debug;
- }
- echo "</pre>";
- ($_exit != NULL) ? exit() : NULL;
- }
- public static function formatDuration(float $seconds = NULL, string $type = NULL) {
- if($seconds == NULL){
- return NULL;
- }
- // Calculer les heures
- $hours = floor($seconds / 3600);
-
- // Calculer les minutes restantes après avoir soustrait les heures
- $minutes = floor(($seconds % 3600) / 60);
-
- // Calculer les secondes restantes après avoir soustrait les minutes
- $remainingSeconds = $seconds % 60;
-
- // Retourner la durée formatée en "H:i:s"
- if($type == ":"){
- return sprintf("%02d:%02d:%02d", $hours, $minutes, $remainingSeconds);
- } else {
- return sprintf("%02dh %02dm %02ds", $hours, $minutes, $remainingSeconds);
- }
-
- }
- }
|