diff --git a/objects/videoAddNew.json.php b/objects/videoAddNew.json.php index b3f61317c..e2e39be81 100644 --- a/objects/videoAddNew.json.php +++ b/objects/videoAddNew.json.php @@ -1,128 +1,131 @@ setClean_Title($_POST['clean_title']); $audioLinks = array('mp3', 'ogg'); $videoLinks = array('mp4', 'webm'); TimeLogEnd(__FILE__, __LINE__); if (!empty($_POST['videoLink'])) { //var_dump($config->getEncoderURL()."getLinkInfo/". base64_encode($_POST['videoLink']));exit; $path_parts = pathinfo($_POST['videoLink']); $extension = strtolower(@$path_parts["extension"]); if (empty($_POST['id']) && !(in_array($extension, $audioLinks) || in_array($extension, $videoLinks))) { $info = url_get_contents($config->getEncoderURL() . "getLinkInfo/" . base64_encode($_POST['videoLink'])); $infoObj = json_decode($info); $filename = uniqid("_YPTuniqid_", true); $filename = $obj->setFilename($filename); $obj->setTitle($infoObj->title); $obj->setClean_title($infoObj->title); $obj->setDuration($infoObj->duration); $obj->setDescription($infoObj->description); file_put_contents($global['systemRootPath'] . "videos/{$filename}.jpg", base64_decode($infoObj->thumbs64)); } else if (empty($_POST['id'])) { $filename = uniqid("_YPTuniqid_", true); $filename = $obj->setFilename($filename); $obj->setTitle($path_parts["filename"]); $obj->setClean_title($path_parts["filename"]); $obj->setDuration(""); $obj->setDescription(@$_POST['description']); } $obj->setVideoLink($_POST['videoLink']); if (in_array($extension, $audioLinks) || in_array($extension, $videoLinks)) { if (in_array($extension, $audioLinks)) { $obj->setType('linkAudio'); } else { $obj->setType('linkVideo'); } } else { $obj->setType('embed'); } if (!empty($_POST['videoLinkType'])) { $obj->setType($_POST['videoLinkType']); } if (empty($_POST['id'])) { $obj->setStatus('a'); } +}else if(!empty($obj->getType()) && ($obj->getType() == 'video' || $obj->getType() == 'serie' || $obj->getType() == 'audio')){ + $obj->setVideoLink(""); } + TimeLogEnd(__FILE__, __LINE__); if (!empty($_POST['isArticle'])) { $obj->setType("article"); if (empty($_POST['id'])) { $obj->setStatus('a'); } $filename = uniqid("_YPTuniqid_", true); $filename = $obj->setFilename($filename); } TimeLogEnd(__FILE__, __LINE__); $obj->setNext_videos_id($_POST['next_videos_id']); if (!empty($_POST['description'])) { $obj->setDescription($_POST['description']); } if (empty($advancedCustomUser->userCanNotChangeCategory) || User::isAdmin()) { $obj->setCategories_id($_POST['categories_id']); } $obj->setVideoGroups(empty($_POST['videoGroups']) ? array() : $_POST['videoGroups']); if (User::isAdmin()) { $obj->setUsers_id($_POST['users_id']); } TimeLogEnd(__FILE__, __LINE__); $obj->setCan_download(@$_POST['can_download']); $obj->setCan_share(@$_POST['can_share']); $obj->setOnly_for_paid(@$_POST['only_for_paid']); $obj->setTrailer1(@$_POST['trailer1']); $obj->setRrating(@$_POST['rrating']); $obj->setExternalOptions(@$_POST['externalOptions']); TimeLogEnd(__FILE__, __LINE__); $resp = $obj->save(true); // if is a new embed video if (empty($_POST['id']) && $obj->getType() == 'embed') { AVideoPlugin::afterNewVideo($resp); } AVideoPlugin::saveVideosAddNew($_POST, $resp); TimeLogEnd(__FILE__, __LINE__); $obj = new stdClass(); $obj->status = !empty($resp); $obj->msg = $msg; $obj->info = json_encode($info); $obj->infoObj = json_encode($infoObj); $obj->videos_id = intval($resp); $obj->video = Video::getVideo($obj->videos_id, false); TimeLogEnd(__FILE__, __LINE__); echo json_encode($obj);