|
|
@ -53,96 +53,67 @@ class Book
|
|
|
|
$path = date("Y") . "/" . date("m");
|
|
|
|
$path = date("Y") . "/" . date("m");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($files)) {
|
|
|
|
$page_feature = '';
|
|
|
|
//var_dump($files);
|
|
|
|
$page_files = '';
|
|
|
|
if ($task != "create") {
|
|
|
|
|
|
|
|
$imageList = "";
|
|
|
|
if (isset($files["page_files"])) {
|
|
|
|
$fileList = "";
|
|
|
|
$imageList = "";
|
|
|
|
|
|
|
|
$fileList = "";
|
|
|
|
//var_dump($files["page_files"] );
|
|
|
|
//var_dump($files["page_files"] );
|
|
|
|
foreach ($files["page_files"] as $file) {
|
|
|
|
foreach ($files["page_files"] as $file) {
|
|
|
|
$type = $file->getClientMediaType();
|
|
|
|
$type = $file->getClientMediaType();
|
|
|
|
switch ($type) {
|
|
|
|
switch ($type) {
|
|
|
|
case "image/jpeg":
|
|
|
|
case "image/jpeg":
|
|
|
|
case "image/png":
|
|
|
|
case "image/png":
|
|
|
|
case "image/gif":
|
|
|
|
case "image/gif":
|
|
|
|
case "image/svg":
|
|
|
|
case "image/svg":
|
|
|
|
$imagesPath = "/assets/images/blog/" . $path . "/";
|
|
|
|
$imagesPath = "/assets/images/blog/" . $path . "/";
|
|
|
|
$imageList =
|
|
|
|
$imageList =
|
|
|
|
$imageList . $imagesPath . urlencode($file->getClientFileName()). ", ";
|
|
|
|
$imageList . $imagesPath . urlencode($file->getClientFileName()). ", ";
|
|
|
|
|
|
|
|
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
"../public/assets/images/blog/" . $path . "/",
|
|
|
|
"../public/assets/images/blog/" . $path . "/",
|
|
|
|
$file
|
|
|
|
$file
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "video/mp4":
|
|
|
|
case "video/mp4":
|
|
|
|
$videosPath = "/assets/video/blog/" . $path . "/";
|
|
|
|
$videosPath = "/assets/video/blog/" . $path . "/";
|
|
|
|
$imageList =
|
|
|
|
$imageList =
|
|
|
|
$imageList . $videosPath . urlencode($file->getClientFileName()) . ", ";
|
|
|
|
$imageList . $videosPath . urlencode($file->getClientFileName()) . ", ";
|
|
|
|
|
|
|
|
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
"../public/assets/video/blog/" . $path . "/",
|
|
|
|
"../public/assets/video/blog/" . $path . "/",
|
|
|
|
$file
|
|
|
|
$file
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "audio/mpeg":
|
|
|
|
case "audio/mpeg":
|
|
|
|
$soundPath = "/assets/sound/blog/" . $path . "/";
|
|
|
|
$soundPath = "/assets/sound/blog/" . $path . "/";
|
|
|
|
$fileList = $fileList . $soundPath . urlencode($file->getClientFileName()). ", ";
|
|
|
|
$fileList = $fileList . $soundPath . urlencode($file->getClientFileName()). ", ";
|
|
|
|
|
|
|
|
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
"../public/assets/sound/blog/" . $path . "/",
|
|
|
|
"../public/assets/sound/blog/" . $path . "/",
|
|
|
|
$file
|
|
|
|
$file
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'application/pdf':
|
|
|
|
case 'application/pdf':
|
|
|
|
case 'text/plain':
|
|
|
|
case 'text/plain':
|
|
|
|
case 'text/rtf':
|
|
|
|
case 'text/rtf':
|
|
|
|
$docPath = "/assets/docs/blog/" . $path . "/";
|
|
|
|
$docPath = "/assets/docs/blog/" . $path . "/";
|
|
|
|
$fileList = $fileList . $docPath . urlencode($file->getClientFileName()). ", ";
|
|
|
|
$fileList = $fileList . $docPath . urlencode($file->getClientFileName()). ", ";
|
|
|
|
|
|
|
|
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
FileUploader::uploadFile(
|
|
|
|
"../public/assets/docs/blog/" . $path . "/",
|
|
|
|
"../public/assets/docs/blog/" . $path . "/",
|
|
|
|
$file
|
|
|
|
$file
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$feature = $imageList;
|
|
|
|
|
|
|
|
$files = $fileList;
|
|
|
|
|
|
|
|
//var_dump($feature);
|
|
|
|
|
|
|
|
//return ["message" => "JUST DEBUGGING"];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//if creating a new page, from file payload and set $feature and $files
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
$feature =
|
|
|
|
|
|
|
|
"/assets/images/blog/" .
|
|
|
|
|
|
|
|
$path .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$image["feature_image"]->getClientFileName();
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$page_feature = $imageList;
|
|
|
|
|
|
|
|
$page_files = $fileList;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//if no files, do no file stuff
|
|
|
|
//if no files, just reset string from page object
|
|
|
|
/*
|
|
|
|
$page_feature = $page["feature"];
|
|
|
|
if (isset($body["feature_image"])) {
|
|
|
|
$page_files = $page["files"];
|
|
|
|
$url = explode("/", $body["feature_image"]);
|
|
|
|
|
|
|
|
$feature =
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$url[3] .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$url[4] .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$url[5] .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$url[6] .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$url[7] .
|
|
|
|
|
|
|
|
"/" .
|
|
|
|
|
|
|
|
$url[8];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//$task == "create" ? ($feature = "") : ($feature = $body["feature"]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($task == "delete") {
|
|
|
|
if ($task == "delete") {
|
|
|
@ -167,8 +138,8 @@ class Book
|
|
|
|
|
|
|
|
|
|
|
|
$body["id"] = $id;
|
|
|
|
$body["id"] = $id;
|
|
|
|
$body["uuid"] = $uuid;
|
|
|
|
$body["uuid"] = $uuid;
|
|
|
|
$body["feature"] = $feature;
|
|
|
|
$body["feature"] = $page_feature;
|
|
|
|
$body["files"] = $files;
|
|
|
|
$body["files"] = $page_files;
|
|
|
|
$body["path"] = $path;
|
|
|
|
$body["path"] = $path;
|
|
|
|
$body["author"] = $member["handle"];
|
|
|
|
$body["author"] = $member["handle"];
|
|
|
|
$body["created"] = $created->format("Y-m-d\TH:i:sP");
|
|
|
|
$body["created"] = $created->format("Y-m-d\TH:i:sP");
|
|
|
|