static function saveNew(Profile $profile, $url, $options = array()) { $vid = new Video(); $vid->id = UUID::gen(); $vid->profile_id = $profile->id; $vid->url = $url; $options['object_type'] = Video::OBJECT_TYPE; if (!array_key_exists('uri', $options)) { $options['uri'] = common_local_url('showvideo', array('id' => $vid->id)); } if (!array_key_exists('rendered', $options)) { $options['rendered'] = sprintf("<video src=\"%s\">Sorry, your browser doesn't support the video tag.</video>", $url); } $vid->uri = $options['uri']; $vid->insert(); return Notice::saveNew($profile->id, '', 'web', $options); }
} if ($mode == "Add") { # echo "<pre>"; print_r($_FILES) ; exit; $redirect_file = "index.php?file=m-videoadd&mode=" . $mode . "&iVideoCategoryId=" . $iVideoCategoryId . "&iVideoId=" . $iVideoId . $qs; $GeneralObj->checkDuplicate('iVideoId', 'Video', array('vVideoName', 'iVideoCategoryId'), $redirect_file, "Video Title Already Exists ", $vVideoName, 'AND'); // $videoObj->setdCreated($dCreated); if (isset($_FILES['vVideoPath']['name']) && $_FILES['vVideoPath']['name'] != "") { $video_name = date('Ymdhis') . $_FILES['vVideoPath']['name']; if (copy($_FILES['vVideoPath']['tmp_name'], $CFG->datadirroot . "/video/" . $video_name)) { if ($video_name != '') { $videoObj->setvVideoPath($video_name); } } } //$videoObj->setiSGroupId($iSGroupId); $id1 = $videoObj->insert(); $msg = MSG_ADD; if ($eStatus == 'Active') { // for Notification of users $sql_Category_select = "select vCategoryName FROM VideoCategory WHERE iVideoCategoryId = " . $iVideoCategoryId; $catagery_Array = $obj->select($sql_Category_select); $user_emails = $userObj->getNotificationUsers($iSGroupId); if (is_Array($user_emails) && count($user_emails) > 0) { for ($i = 0; $i < count($user_emails); $i++) { $sql_insert = "INSERT INTO `cron_email` (`vEmail` ,`vUsername` ,`vName` ,`vAdmin_email` ,`vCategoryName` ,`eType` ,`iID`)\n\t\t\t\t\t\tVALUES ('" . $user_emails[$i]['vEmail'] . "', '" . $user_emails[$i]['vUsername'] . "', '" . $vVideoName . "', '" . $user_emails['admin_email'] . "', '" . $catagery_Array[0]['vCategoryName'] . "', 'Video', '" . $id1 . "')"; $id = $obj->insert($sql_insert); //$emailObj->send_add_videomail($user_emails[$i]['vUsername'],$vVideoName,$user_emails['admin_email'],$user_emails[$i]['vEmail'],$catagery_Array[0]['vCategoryName']); } } } $url = 'index.php?file=Video&AX=Yes&var_msg=' . $msg . '&iVideoCategoryId=' . $iVideoCategoryId . $qs;
/** * insert_local_video * This inserts a video file into the video file table the tag * information we can get is super sketchy so it's kind of a crap shoot * here */ public function insert_local_video($file, $options = array()) { /* Create the vainfo object and get info */ $gtypes = $this->get_gather_types('video'); $vainfo = new vainfo($file, $gtypes, '', '', '', $this->sort_pattern, $this->rename_pattern); $vainfo->get_info(); $tag_name = vainfo::get_tag_type($vainfo->tags, 'metadata_order_video'); $results = vainfo::clean_tag_info($vainfo->tags, $tag_name, $file); $results['catalog'] = $this->id; $id = Video::insert($results, $gtypes, $options); if ($results['art']) { $art = new Art($id, 'video'); $art->insert_url($results['art']); if (AmpConfig::get('generate_video_preview')) { Video::generate_preview($id); } } else { $this->added_videos_to_gather[] = $id; } $this->_filecache[strtolower($file)] = 'v_' . $id; return $id; }