diff --git a/brain/controller/RouteControl.inc.php b/brain/controller/RouteControl.inc.php index b207b1f..c54fc38 100644 --- a/brain/controller/RouteControl.inc.php +++ b/brain/controller/RouteControl.inc.php @@ -33,6 +33,8 @@ class RouteControl ): ResponseInterface { switch (isset($args["first"]) ? $args["first"] : "index") { case "api": + //$result = APIControl::post($request, $response, $args); + //var_dump($result); return APIControl::post($request, $response, $args); break; default: diff --git a/brain/data/Book.inc.php b/brain/data/Book.inc.php index 9af08c6..9708743 100644 --- a/brain/data/Book.inc.php +++ b/brain/data/Book.inc.php @@ -57,7 +57,7 @@ class Book //var_dump($files); if ($task != "create") { $imageList = ""; - $imagesPath = "/assets/images/blog/" . $path . "/"; + //var_dump($files["page_files"] ); foreach ($files["page_files"] as $file) { $type = $file->getClientMediaType(); switch ($type) { @@ -65,17 +65,30 @@ class Book case "image/png": case "image/gif": case "image/svg": + $imagesPath = "/assets/images/blog/" . $path . "/"; $imageList = - $imageList . $imagesPath . $file->getClientFileName() . ", "; + $imageList . $imagesPath . urlencode($file->getClientFileName()). ", "; FileUploader::uploadFile( "../public/assets/images/blog/" . $path . "/", $file ); break; + case "video/mp4": + $videosPath = "/assets/video/blog/" . $path . "/"; + $imageList = + $imageList . $videosPath . urlencode($file->getClientFileName()) . ", "; + + FileUploader::uploadFile( + "../public/assets/video/blog/" . $path . "/", + $file + ); + break; } } $feature = $imageList; + //var_dump($feature); + //return ["message" => "JUST DEBUGGING"]; } else { $feature = "/assets/images/blog/" . diff --git a/brain/data/Contents.inc.php b/brain/data/Contents.inc.php index f16cc9f..d2bb0d3 100644 --- a/brain/data/Contents.inc.php +++ b/brain/data/Contents.inc.php @@ -100,12 +100,13 @@ class Contents $scrubbed = $sanitizer->sanitize($result->getContent()); - $imageList = explode(",", $meta["feature"]); - $images = []; - foreach ($imageList as $item) { - $image = trim($item); + $featureList = explode(",", $meta["feature"]); + $media = []; + foreach ($featureList as $file) { + $item = trim($file); + $ext = explode(".", $item); if ($item != null || $item != "") { - array_push($images, $item); + array_push($media, ["file"=>$item, "type"=>trim($ext[1])]); } } @@ -133,7 +134,7 @@ class Contents "filePath" => $file, "content" => $parsed->getContent(), "html" => $scrubbed, - "media" => $images, + "media" => $media, ]; //checks for duplicates $uuid = $meta["uuid"]; diff --git a/brain/utility/FileUploader.inc.php b/brain/utility/FileUploader.inc.php index be3df13..47e3774 100644 --- a/brain/utility/FileUploader.inc.php +++ b/brain/utility/FileUploader.inc.php @@ -21,7 +21,7 @@ class FileUploader //echo "**FILE** " . $file->getClientFileName(); - $file->moveTo($directory . "/" . $file->getClientFileName()); + $file->moveTo($directory . "/" . urlencode($file->getClientFileName())); } catch (RuntimeException $e) { echo "ERROR " . $e->getMessage(); diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig index 5d02d9b..6ee6a92 100644 --- a/brain/views/dash/page-edit.twig +++ b/brain/views/dash/page-edit.twig @@ -34,7 +34,7 @@ {% endblock %} {% block stylesheets %} - + {% endblock %} {% block mainContent %} @@ -54,14 +54,19 @@ IMAGES AND VIDEO