コード例 #1
0
ファイル: attachments.php プロジェクト: erico-deh/ocPortal
/**
 * Get tempcode for a Comcode rich-media attachment.
 *
 * @param  ID_TEXT		The attachment tag
 * @set attachment attachment_safe attachment2
 * @param  array			A map of the attributes (name=>val) for the tag
 * @param  array			A map of the attachment properties (name=>val) for the attachment
 * @param  string			A special identifier to mark where the resultant tempcode is going to end up (e.g. the ID of a post)
 * @param  MEMBER			The member who is responsible for this Comcode
 * @param  boolean		Whether to check as arbitrary admin
 * @param  object			The database connection to use
 * @param  ?array			A list of words to highlight (NULL: none)
 * @param  ?MEMBER		The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (NULL: member evaluating)
 * @param  boolean		Whether to parse so as to create something that would fit inside a semihtml tag. It means we generate HTML, with Comcode written into it where the tag could never be reverse-converted (e.g. a block).
 * @return tempcode		The tempcode for the attachment
 */
function render_attachment($tag, $attributes, $attachment, $pass_id, $source_member, $as_admin, $connection, $highlight_bits = NULL, $on_behalf_of_member = NULL, $semiparse_mode = false)
{
    require_code('comcode_renderer');
    $extension = get_file_extension($attachment['a_original_filename']);
    require_code('mime_types');
    $mime_type = get_mime_type($extension);
    $attachment['CLEAN_SIZE'] = clean_file_size($attachment['a_file_size']);
    $attachment['MIME_TYPE'] = $mime_type;
    $attachment['PASS_ID'] = intval($pass_id) < 0 ? strval(mt_rand(0, 10000)) : $pass_id;
    $attachment['SCRIPT'] = find_script('attachment');
    $attachment['RAND'] = strval(mt_rand(0, 32000));
    if ($connection->connection_write != $GLOBALS['SITE_DB']->connection_write) {
        $attachment['SUP_PARAMS'] = '&forum_db=1';
        $attachment['FORUM_DB_BIN'] = '1';
    } else {
        $attachment['SUP_PARAMS'] = '';
        $attachment['FORUM_DB_BIN'] = '';
    }
    $type = trim(array_key_exists('type', $attributes) ? $attributes['type'] : 'auto');
    $attachment['id'] = strval($attachment['id']);
    $attachment['a_member_id'] = strval($attachment['a_member_id']);
    $attachment['a_file_size'] = strval($attachment['a_file_size']);
    $attachment['a_last_downloaded_time'] = is_null($attachment['a_last_downloaded_time']) ? '' : strval($attachment['a_last_downloaded_time']);
    $attachment['a_add_time'] = strval($attachment['a_add_time']);
    $attachment['a_num_downloads'] = integer_format($attachment['a_num_downloads']);
    require_code('images');
    $attachment['a_width'] = array_key_exists('width', $attributes) ? strval(intval($attributes['width'])) : '';
    $attachment['a_height'] = array_key_exists('height', $attributes) ? strval(intval($attributes['height'])) : '';
    if ($attachment['a_width'] == '' || $attachment['a_height'] == '') {
        if (addon_installed('galleries') && is_video($attachment['a_original_filename']) && url_is_local($attachment['a_url'])) {
            require_code('galleries2');
            $vid_details = get_video_details(get_custom_file_base() . '/' . rawurldecode($attachment['a_url']), $attachment['a_original_filename'], true);
            if ($vid_details !== false) {
                list($_width, $_height, ) = $vid_details;
                if ($attachment['a_width'] == '') {
                    $attachment['a_width'] = strval($_width);
                }
                if ($attachment['a_height'] == '') {
                    $attachment['a_height'] = strval($_height);
                }
            }
        }
        if ($attachment['a_width'] == '' || $attachment['a_height'] == '') {
            if ($attachment['a_width'] == '') {
                $attachment['a_width'] = '240';
            }
            if ($attachment['a_height'] == '') {
                $attachment['a_height'] = '216';
            }
        }
    }
    $attachment['a_align'] = array_key_exists('align', $attributes) ? $attributes['align'] : 'left';
    if (!array_key_exists('a_description', $attachment)) {
        if (array_key_exists('description', $attributes)) {
            $attachment['description'] = $attributes['description'];
        }
        if (!array_key_exists('description', $attachment)) {
            $attachment['description'] = '';
        }
        $attachment['a_description'] = is_object($attachment['description']) ? $attachment['description'] : comcode_to_tempcode($attachment['description'], $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, false, NULL, $on_behalf_of_member);
    } else {
        $attachment['a_description'] = comcode_to_tempcode($attachment['a_description'], $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, false, NULL, $on_behalf_of_member);
    }
    $attachment['a_type'] = $type;
    $attachment['a_thumb'] = array_key_exists('thumb', $attributes) ? $attributes['thumb'] : '1';
    if ($attachment['a_thumb'] != '0') {
        $attachment['a_thumb'] = '1';
    }
    $attachment['a_thumb_url'] = array_key_exists('thumb_url', $attributes) ? $attributes['thumb_url'] : $attachment['a_thumb_url'];
    switch ($type) {
        case 'email':
            require_code('mail');
            global $EMAIL_ATTACHMENTS;
            if (url_is_local($attachment['a_url'])) {
                $attachment['a_url'] = get_custom_base_url() . '/' . $attachment['a_url'];
            }
            $EMAIL_ATTACHMENTS[$attachment['a_url']] = $attachment['a_original_filename'];
            $temp_tpl = new ocp_tempcode();
            break;
        case 'code':
            $url = $attachment['a_url'];
            if (url_is_local($url)) {
                $url = get_custom_base_url() . '/' . $url;
            }
            $file_contents = http_download_file($url, 1024 * 1024 * 20);
            list($_embed, $title) = do_code_box($extension, make_string_tempcode($file_contents));
            if ($attachment['a_original_filename'] != '') {
                $title = escape_html($attachment['a_original_filename']);
            }
            $temp_tpl = do_template('COMCODE_CODE', array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true, 'STYLE' => '', 'TYPE' => $extension, 'CONTENT' => $_embed, 'TITLE' => $title));
            break;
        case 'hyperlink':
            if ($tag == 'attachment') {
                $keep = symbol_tempcode('KEEP');
                $_url = new ocp_tempcode();
                $_url->attach(find_script('attachment') . '?id=' . urlencode($attachment['id']) . $keep->evaluate());
                if (get_option('anti_leech') == '1') {
                    $_url->attach('&for_session=');
                    $_url->attach(symbol_tempcode('SESSION_HASHED'));
                }
            } else {
                $url = $attachment['a_url'];
                if (url_is_local($url)) {
                    $url = get_custom_base_url() . '/' . $url;
                }
                $_url = make_string_tempcode($url);
            }
            $temp_tpl = hyperlink($_url, is_object($attachment['a_description']) ? $attachment['a_description']->evaluate() : $attachment['a_description'] != '' ? $attachment['a_description'] : $attachment['a_original_filename'], true);
            break;
        default:
            if (is_image($attachment['a_original_filename'])) {
                if ($type == 'inline' || $type == 'left_inline' || $type == 'right_inline') {
                    $attachment['mini'] = '1';
                }
                require_code('images');
                ensure_thumbnail($attachment['a_url'], $attachment['a_thumb_url'], 'attachments', 'attachments', intval($attachment['id']), 'a_thumb_url');
                $temp_tpl = do_template('ATTACHMENT_IMG' . (array_key_exists('mini', $attachment) && $attachment['mini'] == '1' ? '_MINI' : ''), map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                if ($type == 'left' || $type == 'left_inline') {
                    $temp_tpl = do_template('ATTACHMENT_LEFT', array('_GUID' => 'aee2a6842d369c8dae212c3478a3a3e9', 'WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true, 'CONTENT' => $temp_tpl));
                }
                if ($type == 'right' || $type == 'right_inline') {
                    $temp_tpl = do_template('ATTACHMENT_RIGHT', array('_GUID' => '1a7209d67d91db740c86e7a331720195', 'WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true, 'CONTENT' => $temp_tpl));
                }
                break;
            } elseif ($extension == 'swf') {
                $temp_tpl = do_template('ATTACHMENT_SWF', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif (addon_installed('jwplayer') && ($mime_type == 'video/x-flv' || $mime_type == 'video/mp4' || $mime_type == 'video/webm')) {
                $temp_tpl = do_template('ATTACHMENT_FLV', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif ($mime_type == 'video/quicktime') {
                $temp_tpl = do_template('ATTACHMENT_QT', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif ($mime_type == 'audio/x-pn-realaudio') {
                $temp_tpl = do_template('ATTACHMENT_RM', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif (substr($mime_type, 0, 5) == 'video' || substr($mime_type, 0, 5) == 'audio') {
                $temp_tpl = do_template('ATTACHMENT_MEDIA', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            }
            // Continues on, as it's not a media type...
        // Continues on, as it's not a media type...
        case 'download':
            if (is_null($attachment['a_file_size'])) {
                $temp_tpl = do_template('ATTACHMENT_DOWNLOAD_REMOTE', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
            } else {
                $temp_tpl = do_template('ATTACHMENT_DOWNLOAD', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
            }
            break;
    }
    return $temp_tpl;
}
コード例 #2
0
ファイル: video.class.php プロジェクト: yukisky/clipbucket
 /**
  * Function used to update video
  */
 function update_video($array = NULL)
 {
     global $eh, $Cbucket, $db, $Upload;
     $Upload->validate_video_upload_form(NULL, TRUE);
     if (empty($eh->error_list)) {
         $required_fields = $Upload->loadRequiredFields($array);
         $location_fields = $Upload->loadLocationFields($array);
         $option_fields = $Upload->loadOptionFields($array);
         $upload_fields = array_merge($required_fields, $location_fields, $option_fields);
         //Adding Custom Upload Fields
         if (count($Upload->custom_upload_fields) > 0) {
             $upload_fields = array_merge($upload_fields, $Upload->custom_upload_fields);
         }
         //Adding Custom Form Fields
         if (count($Upload->custom_form_fields) > 0) {
             $upload_fields = array_merge($upload_fields, $Upload->custom_form_fields);
         }
         //Adding custom fields from group
         if (count($Upload->custom_form_fields_groups) > 0) {
             $custom_fields_from_group_fields = array();
             $custom_fields_from_group = $Upload->custom_form_fields_groups;
             foreach ($custom_fields_from_group as $cffg) {
                 $custom_fields_from_group_fields = array_merge($custom_fields_from_group_fields, $cffg['fields']);
             }
             $upload_fields = array_merge($upload_fields, $custom_fields_from_group_fields);
         }
         if (!$array) {
             $array = $_POST;
         }
         $vid = $array['videoid'];
         $the_video = get_video_details($vid);
         if (is_array($_FILES)) {
             $array = array_merge($array, $_FILES);
         }
         foreach ($upload_fields as $field) {
             $name = formObj::rmBrackets($field['name']);
             $val = $array[$name];
             if (empty($val) && $field['use_if_value']) {
             } else {
                 if ($field['use_func_val']) {
                     $val = $field['validate_function']($val);
                 }
                 if (!empty($field['db_field'])) {
                     $query_field[] = $field['db_field'];
                 }
                 if (is_array($val)) {
                     $new_val = '';
                     foreach ($val as $v) {
                         $new_val .= "#" . $v . "# ";
                     }
                     $val = $new_val;
                 }
                 if (!$field['clean_func'] || !apply_func($field['clean_func'], $val) && !is_array($field['clean_func'])) {
                     $val = $val;
                 } else {
                     $val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val));
                 }
                 if (!empty($field['db_field'])) {
                     $query_val[] = $val;
                 }
             }
         }
         #$query = "INSERT INTO video (";
         $total_fields = count($query_field);
         /* for($key=0;$key<$total_fields;$key++)
            {
            $query .= query_field[$key]." = '".$query_val[$key]."'" ;
            if($key<$total_fields-1)
            $query .= ',';
            } */
         if (has_access('admin_access', TRUE)) {
             if (!empty($array['status'])) {
                 $query_field[] = 'status';
                 $query_val[] = $array['status'];
             }
             if (!empty($array['duration']) && is_numeric($array['duration']) && $array['duration'] > 0) {
                 $query_field[] = 'duration';
                 $query_val[] = $array['duration'];
             }
             if (!empty($array['views'])) {
                 $query_field[] = 'views';
                 $query_val[] = $array['views'];
             }
             if (!empty($array['rating'])) {
                 $query_field[] = 'rating';
                 $rating = $array['rating'];
                 if (!is_numeric($rating) || $rating < 0 || $rating > 10) {
                     $rating = 1;
                 }
                 $query_val[] = $rating;
             }
             if (!empty($array['rated_by'])) {
                 $query_field[] = 'rated_by';
                 $query_val[] = $array['rated_by'];
             }
         }
         if (!userid()) {
             e(lang("you_dont_have_permission_to_update_this_video"));
         } elseif (!$this->video_exists($vid)) {
             e(lang("class_vdo_del_err"));
         } elseif (!$this->is_video_owner($vid, userid()) && !has_access('admin_access', TRUE)) {
             e(lang("no_edit_video"));
         } else {
             //pr($upload_fields);
             //Updating Slug
             if (config('auto_update_slug') != 'no' || !$the_video['slug']) {
                 if ($the_video['title'] != $array['title']) {
                     $slug = slug($array['title']);
                     if ($the_video['slug'] != $slug) {
                         $db->update(tbl('slugs'), array('in_use'), array('no'), "object_id='{$vid}' AND object_type='v' ");
                         $slug_arr = add_slug($slug, $vid, 'v');
                         $query_field[] = 'slug_id';
                         $query_val[] = $slug_arr['id'];
                     }
                 }
             }
             $db->update(tbl('video'), $query_field, $query_val, " videoid='{$vid}'");
             call_actions('update_video', array('videoid' => $vid, 'data' => $array));
             //echo $db->db_query;
             e(lang("class_vdo_update_msg"), 'm');
         }
     }
 }
コード例 #3
0
ファイル: upload_thumbs.php プロジェクト: Coding110/cbvideo
             $query = "UPDATE " . tbl("video") . " SET file_thumbs_count = " . (int) $response . "  WHERE videoid = " . $data['videoid'];
             $db->Execute($query);
         } else {
             e(lang($response), 'e');
         }
     } else {
         $Upload->upload_thumbs($data['file_name'], $_FILES['vid_thumb'], $data['file_directory']);
     }
 }
 //	# Uploading Big Thumb
 //	if(isset($_POST['upload_big_thumb'])) {
 //		$Upload->upload_big_thumb($data['file_name'],$_FILES['big_thumb']);
 //	}
 # Delete Thumb
 if (isset($_GET['delete'])) {
     $data = get_video_details($video);
     if ($data['files_thumbs_path'] != '') {
         #pr($data,true);
         $files_thumbs_path = $data['files_thumbs_path'];
         $serverApi = str_replace('/files/thumbs', '', $files_thumbs_path);
         $serverApi = $serverApi . '/actions/custom_thumb_upload.php';
         $postvars['mode'] = 'delete';
         $postvars['files_thumbs_path'] = $files_thumbs_path;
         $postvars['file_directory'] = $data['file_directory'];
         $postvars['delete_file_name'] = $_GET['delete'];
         $postvars['file_name'] = $data['file_name'];
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $serverApi);
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
         curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
         /* Tell cURL to return the output */
コード例 #4
0
ファイル: functions.php プロジェクト: yukisky/clipbucket
/**
 * Function used to incream number of view
 * in object
 */
function increment_views($id, $type = NULL)
{
    global $db;
    switch ($type) {
        case 'v':
        case 'video':
        default:
            $video = get_video_details($id);
            if (!$video) {
                return false;
            }
            if ($video['active'] != 'yes' || $video['status'] != 'Successful') {
                return false;
            }
            if (function_exists('vi_user_type')) {
                $_user = vi_user_type();
                if ($_user['user_type'] == 4) {
                    return false;
                }
            }
            if (!isset($_COOKIE['video_' . $id])) {
                $db->update(tbl("video"), array("views", "last_viewed"), array("|f|views+1", NOW()), " videoid='{$id}' OR videokey='{$id}'");
                setcookie('video_' . $id, 'watched', time() + 3600);
            }
            break;
        case 'u':
        case 'user':
        case 'channel':
            if (!isset($_COOKIE['user_' . $id])) {
                $db->update(tbl("users"), array("profile_hits"), array("|f|profile_hits+1"), " userid='{$id}'");
                setcookie('user_' . $id, 'watched', time() + 3600);
            }
            break;
        case 't':
        case 'topic':
            if (!isset($_COOKIE['topic_' . $id])) {
                $db->update(tbl("group_topics"), array("total_views"), array("|f|total_views+1"), " topic_id='{$id}'");
                setcookie('topic_' . $id, 'watched', time() + 3600);
            }
            break;
            break;
        case 'g':
        case 'group':
            if (!isset($_COOKIE['group_' . $id])) {
                $db->update(tbl("groups"), array("total_views"), array("|f|total_views+1"), " group_id='{$id}'");
                setcookie('group_' . $id, 'watched', time() + 3600);
            }
            break;
        case "c":
        case "collect":
        case "collection":
            if (!isset($_COOKIE['collection_' . $id])) {
                $db->update(tbl("collections"), array("views"), array("|f|views+1"), " collection_id = '{$id}'");
                setcookie('collection_' . $id, 'viewed', time() + 3600);
            }
            break;
        case "photos":
        case "photo":
        case "p":
            if (!isset($_COOKIE['photo_' . $id])) {
                $db->update(tbl('photos'), array("views", "last_viewed"), array("|f|views+1", NOW()), " photo_id = '{$id}'");
                setcookie('photo_' . $id, 'viewed', time() + 3600);
            }
    }
}
コード例 #5
0
ファイル: embed_player.php プロジェクト: Coding110/cbvideo
<?php

/**
 * License : CBLA
 * Author : Arslan
 */
/**
 * iFrame based embed player ClipBucket
 * reason to use iFrame instead of embed code
 * is to control player with full support of javascript
 */
define("THIS_PAGE", "watch_video");
include "../includes/config.inc.php";
$vid = $_GET['vid'];
//gettin video details
$vdetails = get_video_details($vid);
$width = @$_GET['width'];
$height = @$_GET['height'];
$autoplay = @$_GET['autoplay'];
if (!$width) {
    $width = '320';
}
if (!$height) {
    $height = '240';
}
if (!$autoplay) {
    $autoplay = 'no';
}
if (!$vdetails) {
    exit(json_encode(array("err" => "no video details found")));
}
コード例 #6
0
/**
 * Function used to get video link
 * @param ARRAY video details
 */
function video_link($vdetails, $type = NULL)
{
    global $myquery;
    #checking what kind of input we have
    if (is_array($vdetails)) {
        if (empty($vdetails['title'])) {
            #check for videoid
            if (empty($vdetails['videoid']) && empty($vdetails['vid']) && empty($vdetails['videokey'])) {
                return BASEURL;
            } else {
                if (!empty($vdetails['videoid'])) {
                    $vid = $vdetails['videoid'];
                } elseif (!empty($vdetails['vid'])) {
                    $vid = $vdetails['vid'];
                } elseif (!empty($vdetails['videokey'])) {
                    $vid = $vdetails['videokey'];
                } else {
                    return BASEURL;
                }
            }
        }
    } else {
        if (is_numeric($vdetails)) {
            $vid = $vdetails;
        } else {
            return BASEURL;
        }
    }
    #checking if we have vid , so fetch the details
    if (!empty($vid)) {
        $vdetails = get_video_details($vid);
    }
    //calling for custom video link functions
    $functions = cb_get_functions('video_link');
    if ($functions) {
        foreach ($functions as $func) {
            $array = array('vdetails' => $vdetails, 'type' => $type);
            if (function_exists($func['func'])) {
                $returned = $func['func']($array);
                if ($returned) {
                    $link = $returned;
                    return $link;
                    break;
                }
            }
        }
    }
    $plist = "";
    if (SEO == 'yes') {
        if ($vdetails['playlist_id']) {
            $plist = '?&play_list=' . $vdetails['playlist_id'];
        }
        $vdetails['title'] = strtolower($vdetails['title']);
        switch (config('seo_vido_url')) {
            default:
                $link = BASEURL . '/video/' . $vdetails['videokey'] . '/' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . $plist;
                break;
            case 1:
                $link = BASEURL . '/' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . '_v' . $vdetails['videoid'] . $plist;
                break;
            case 2:
                $link = BASEURL . '/video/' . $vdetails['videoid'] . '/' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . $plist;
                break;
            case 3:
                $link = BASEURL . '/video/' . $vdetails['videoid'] . '_' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . $plist;
                break;
        }
    } else {
        if ($vdetails['playlist_id']) {
            $plist = '&play_list=' . $vdetails['playlist_id'];
        }
        $link = BASEURL . '/watch_video.php?v=' . $vdetails['videokey'] . $plist;
    }
    if (!$type || $type == 'link') {
        return $link;
    } elseif ($type == 'download') {
        return BASEURL . '/download.php?v=' . $vdetails['videokey'];
    }
}
コード例 #7
0
/**
 * This function will activate the video if file exists
 */
function activate_video_with_file($vid)
{
    global $db;
    $vdetails = get_video_details($vid);
    $file_name = $vdetails['file_name'];
    $results = $db->select(tbl("conversion_queue"), "*", " cqueue_name='{$file_name}' AND cqueue_conversion='yes'");
    $result = $results[0];
    update_processed_video($result);
}
コード例 #8
0
ファイル: video.php プロジェクト: erico-deh/ocPortal
 /**
  * Convert a field value to something renderable.
  *
  * @param  array			The field details
  * @param  mixed			The raw value
  * @param  integer		Position in fieldset
  * @param  ?array			List of fields the output is being limited to (NULL: N/A)
  * @return mixed			Rendered field (tempcode or string)
  */
 function render_field_value($field, $ev, $i, $only_fields)
 {
     if (is_object($ev)) {
         return $ev;
     }
     if ($ev == '') {
         return '';
     }
     require_code('galleries');
     require_code('galleries2');
     require_code('transcoding');
     $ev = transcode_video($ev, 'catalogue_efv_short', 'cv_value', NULL, NULL, NULL);
     $thumb_url = create_video_thumb($ev);
     if (substr($ev, 0, strlen(get_custom_base_url() . '/')) == get_custom_base_url() . '/') {
         $ev = substr($ev, strlen(get_custom_base_url() . '/'));
     }
     if (url_is_local($ev)) {
         $width = 600;
         $height = 400;
         $length = 0;
     } else {
         list($width, $height, $length) = get_video_details(get_custom_file_base() . '/' . rawurldecode($ev), basename($ev));
     }
     return show_gallery_media($ev, $thumb_url, $width, $height, $length);
 }
コード例 #9
0
ファイル: cms_galleries.php プロジェクト: erico-deh/ocPortal
 /**
  * Extract video meta info from any uploaded video.
  *
  * @return array		A triplet of 3 "?integer"'s: video width, video height, video length
  */
 function get_special_video_info()
 {
     $video_length = post_param_integer('video_length', 0);
     $video_width = post_param_integer('video_width', 0);
     $video_height = post_param_integer('video_height', 0);
     if ($video_width == 0 || $video_height == 0 || $video_length == 0) {
         require_code('uploads');
         if (is_swf_upload(true) && array_key_exists('file', $_FILES) || array_key_exists('file', $_FILES) && is_uploaded_file($_FILES['file']['tmp_name'])) {
             list($_video_width, $_video_height, $_video_length) = get_video_details($_FILES['file']['tmp_name'], $_FILES['file']['name']);
         } else {
             $url = post_param('url', '');
             if ($url == '') {
                 return array(NULL, NULL, NULL);
             }
             $download_test = NULL;
             $temp_path = '';
             if ($url != '') {
                 $temp_path = ocp_tempnam('ocpafm');
                 $write_to_file = fopen($temp_path, 'wb');
                 $download_test = http_download_file($url, 1024 * 50, false, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $write_to_file);
                 rewind($write_to_file);
                 fclose($write_to_file);
             }
             if (!is_null($download_test)) {
                 list($_video_width, $_video_height, $_video_length) = get_video_details($temp_path, is_null($GLOBALS['HTTP_FILENAME']) ? basename(urldecode($url)) : $GLOBALS['HTTP_FILENAME']);
             } else {
                 list($_video_width, $_video_height, $_video_length) = array(NULL, NULL, NULL);
             }
             if ($temp_path != '') {
                 @unlink($temp_path);
             }
         }
         if ($video_width == 0) {
             $video_width = is_null($_video_width) ? intval(get_option('default_video_width')) : $_video_width;
         }
         if ($video_height == 0) {
             $video_height = is_null($_video_height) ? intval(get_option('default_video_height')) : $_video_height;
         }
         if ($video_length == 0) {
             $video_length = is_null($_video_length) ? 0 : $_video_length;
         }
     }
     return array($video_width, $video_height, $video_length);
 }
コード例 #10
0
ファイル: embed_player.php プロジェクト: yukisky/clipbucket
                $logo['left'] = $padding;
                break;
            case "br":
                $logo['bottom'] = $padding;
                $logo['right'] = $padding;
                break;
            case "bl":
                $logo['bottom'] = $padding;
                $logo['left'] = $padding;
                break;
        }
        $logo['opacity'] = 0.4;
        $logo['linkUrl'] = videoLink($video);
        $array['key'] = config("pak_license");
        $array['plugins'] = $plugins;
        $array['canvas'] = $canvas;
        $array['clip'] = $clip;
        $array['contextMenu'][][config("pakplayer_contextmsg")] = "";
        $array['logo'] = $logo;
        if (!$params['only_configs']) {
            return BASEURL . '/player/pak_player/' . $ppfile . '?config=' . json_encode($array);
        } else {
            return json_encode($array);
        }
    }
}
if ($_GET['json']) {
    echo embed_video_src(array("video" => get_video_details($vid), 'only_configs' => true));
} else {
    echo embed_video_src(array("video" => get_video_details($vid), 'only_configs' => false));
}