예제 #1
0
 /**
  * Create new video entity
  * 
  * @return ElggEntity VIDEOS
  * 
  * @version 5.0
  */
 public function createVideoEntity()
 {
     if (!filter_var($this->input, FILTER_VALIDATE_URL)) {
         $this->errors[] = 'Not valid url, currently supported for OFFSERVER videos only';
         return FALSE;
     }
     // try saving the entity now
     $izap_videos = new IzapVideos();
     $izap_videos->access_id = ACCESS_PUBLIC;
     $return = $izap_videos->input($this->input, 'url');
     if (isset($return->status) && $return->status === FALSE) {
         $this->errors[] = $return->message;
         return FALSE;
     }
     if ($return->videosrc == '' || $return->filecontent == '') {
         $this->errors[] = elgg_echo('izap_videos:error');
         return FALSE;
     }
     $izap_videos->title = $return->title;
     $izap_videos->description = $return->description;
     $izap_videos->tags = string_to_tag_array($return->videotags);
     $izap_videos->videosrc = $return->videosrc;
     $izap_videos->videotype = $return->type;
     $izap_videos->orignal_thumb = "izap_videos/" . $return->type . "/orignal_" . $return->filename;
     $izap_videos->imagesrc = "izap_videos/" . $return->type . "/" . $return->filename;
     $izap_videos->videotype_site = $return->domain;
     $izap_videos->converted = 'yes';
     $izap_videos->setFilename($izap_videos->orignal_thumb);
     $izap_videos->open("write");
     if ($izap_videos->write($return->filecontent)) {
         $thumb = get_resized_image_from_existing_file($izap_videos->getFilenameOnFilestore(), 120, 90, true);
         $izap_videos->setFilename($izap_videos->imagesrc);
         $izap_videos->open("write");
         if (!$izap_videos->write($thumb)) {
             $this->errors[] = elgg_echo('izap_videos:error:saving_thumb');
             return FALSE;
         }
     } else {
         $this->errors[] = elgg_echo('izap_videos:error:saving_thumb');
         return FALSE;
     }
     // if every thing is good till here now we can save it.
     if (!$izap_videos->save()) {
         $this->errors[] = register_error(elgg_echo('izap_videos:error:save'));
         return FALSE;
     }
     return $izap_videos;
 }
예제 #2
0
파일: copy.php 프로젝트: rimpy/izap_videos
 * @Contact iZAP Team "<*****@*****.**>"
 * @Founder Tarun Jangra "<*****@*****.**>"
 * @link http://www.izap.in/
 * 
 */
$videoId = get_input('videoId');
$video = izapVideoCheck_izap_videos($videoId);
$attribs = $video->getAttributes();
$newVideo = new IzapVideos();
foreach ($attribs as $attribute => $value) {
    $newVideo->{$attribute} = $value;
}
$newVideo->views = 1;
$newVideo->owner_guid = get_loggedin_userid();
$newVideo->container_guid = get_loggedin_userid();
$newVideo->access_id = $video->access_id;
$newVideo->copiedFrom = $video->owner_guid;
$newVideo->copiedVideoId = $videoId;
$newVideo->copiedVideoUrl = $video->getUrl();
izapCopyFiles_izap_videos($video->owner_guid, $video->imagesrc);
if ($video->videotype == 'uploaded') {
    izapCopyFiles_izap_videos($video->owner_guid, $video->videofile);
    izapCopyFiles_izap_videos($video->owner_guid, $video->orignalfile);
}
if ($newVideo->save()) {
    system_message(elgg_echo('izap_videos:success:videoCopied'));
    forward($newVideo->getURL());
} else {
    system_message(elgg_echo('izap_videos:success:videoNotCopied'));
    forward($_SERVER['HTTP_REFERER']);
}
예제 #3
0
if (is_array($izap_videos->tags)) {
    $filtered_tags = FALSE;
    foreach ($izap_videos->tags as $tag) {
        if ($tag != '') {
            $filtered_tags[] = $tag;
        }
    }
    if ($filtered_tags) {
        $izap_videos->tags = array_unique($filtered_tags);
    }
} else {
    if ($izap_videos->tags == '' || !$izap_videos->tags) {
        unset($izap_videos->tags);
    }
}
if (!$izap_videos->save()) {
    register_error(elgg_echo('izap_videos:error:save'));
    forward($_SERVER['HTTP_REFERER']);
    exit;
}
// save the file info for converting it later  in queue
if ($postedArray['videoType'] == 'ONSERVER' && $postedArray['guid'] == 0) {
    $izap_videos->videosrc = $CONFIG->wwwroot . 'pg/izap_videos_files/file/' . $izap_videos->guid . '/' . friendly_title($izap_videos->title) . '.flv';
    if (izap_get_file_extension($tmpUploadedFile) != 'flv') {
        // will only send to queue if it is not flv
        izapSaveFileInfoForConverting_izap_videos($tmpUploadedFile, $izap_videos, $postedArray['access_id']);
    }
}
if ($postedArray['guid'] == 0) {
    add_to_river('river/object/izap_videos/create', 'create', $izap_videos->owner_guid, $izap_videos->guid);
}