Esempio n. 1
0
/**
 * Loads ClipBucket players...
 * 
 * @global type $Cbucket
 * @global type $swfobj
 * @param type $param
 * @return boolean
 * 
 * @todo Write documentation on this function..
 */
function cb_video_player($param)
{
    global $Cbucket, $swfobj;
    $param['player_div'] = $param['player_div'] ? $param['player_div'] : 'videoPlayer';
    $key = $param['key'];
    $code = $param['code'];
    $flv_url = $file;
    $embed = $param['embed'];
    $code = $param['code'];
    $height = $param['height'] ? $param['height'] : config('player_height');
    $width = $param['width'] ? $param['width'] : config('player_width');
    $param['height'] = $height;
    $param['width'] = $width;
    if (!$param['autoplay']) {
        $param['autoplay'] = config('autoplay_video');
    }
    if (!$param['files']) {
        global $cbvid;
        $files = $cbvid->get_video_files($param['video']);
        $param['files'] = $files;
    }
    assign('player_params', $param);
    $param = apply_filters($param, 'play_video');
    //Calling actions for play_video
    $output = call_actions('play_video', $param);
    if ($output) {
        $player_code = $output;
        return $output;
    }
    if (function_exists('cbplayer') && empty($player_code)) {
        $player_code = cbplayer($param, true);
    }
    if ($player_code) {
        if (!$pak_player && $show_player) {
            assign("player_js_code", $player_code);
            Template(PLAYER_DIR . '/player.html', false);
            return false;
        } else {
            return false;
        }
    }
    return blank_screen($param);
}
Esempio n. 2
0
 /**
  * Function used to get user details using userid
  */
 function get_user_details($id = NULL, $checksess = false, $profile = false, $cond = NULL, $username = false)
 {
     global $db, $sess;
     $fields_arr = array('user' => get_user_fields(), 'profile' => array('profile_id', 'show_my_collections', 'profile_title', 'profile_desc', 'channel_tagline', 'featured_video', 'first_name', 'last_name', 'avatar', 'show_dob', 'postal_code', 'time_zone', 'profile_tags', 'rating', 'voters', 'rated_by'));
     if (!$profile) {
         unset($fields_arr['profile']);
     }
     $fields = tbl_fields($fields_arr);
     $query = "SELECT " . $fields . " FROM " . tbl('users') . " AS user ";
     if ($profile) {
         $query .= " LEFT JOIN " . tbl('user_profile') . " AS profile ";
         $query .= " on users.userid = profile.userid ";
     }
     $is_email = strstr($id, '@');
     if ($username || !is_numeric($id)) {
         if ($is_email) {
             $query .= " WHERE user.email ='{$id}' ";
             $data_mode = 'get_user_with_email';
             $set_mode = 'select_user_with_email';
         } else {
             $query .= " WHERE user.username = '******' ";
             $data_mode = 'get_user_with_username';
             $set_mode = 'select_user_with_username';
         }
     } else {
         $query .= " WHERE user.userid='{$id}' ";
         $data_mode = 'get_user';
         $set_mode = 'select_user';
     }
     if ($cond) {
         $query .= $cond;
     }
     $query .= " LIMIT 1 ";
     $start = microtime(true);
     $data = call_actions($data_mode, $id);
     if ($data) {
         $udetails = $data;
     } else {
         $results = db_select($query);
         if ($results) {
             $udetails = $results[0];
         }
         if ($results) {
             call_actions($set_mode, $results);
         }
     }
     $end = microtime(true);
     if (!$checksess) {
         return apply_filters($udetails, 'get_user');
     } else {
         $session = $this->sessions['smart_sess'];
         $smart_sess = md5($udetails['user_session_key'] . $sess->get('sess_salt'));
         if ($smart_sess == $session['session_value']) {
             $this->is_login = true;
             return apply_filters($udetails, 'get_user');
         } else {
             return false;
         }
     }
 }
Esempio n. 3
0
 /**
  * Function used to get list of video files
  * 
  * @param STRING $file_name
  */
 function get_video_files($video)
 {
     global $db;
     $file = $video['file_name'];
     $version = $video['version'];
     //Checking if the system is old..
     $folder = "";
     if ($video['file_directory']) {
         $folder = '/' . $video['file_directory'];
     }
     if (file_exists(VIDEOS_DIR . $folder . '/' . $file . '.flv') || file_exists(VIDEOS_DIR . $folder . '/' . $file . '.mp4')) {
         $files = array();
         if (file_exists(VIDEOS_DIR . $folder . '/' . $file . '.flv')) {
             $files['flv'] = VIDEOS_URL . $folder . '/' . $file . '.flv';
         }
         if (file_exists(VIDEOS_DIR . $folder . '/' . $file . '.mp4')) {
             $files['mp4'] = VIDEOS_URL . $folder . '/' . $file . '.mp4';
         }
         //For mobile now..
         if (file_exists(VIDEOS_DIR . $folder . '/' . $file . '-m.mp4')) {
             $files['mobile'] = VIDEOS_URL . $folder . '/' . $file . '-m.mp4';
         }
         return $files;
     }
     if ($version < 3) {
         global $Cbucket;
         $files = array();
         if (is_array($Cbucket->custom_video_file_funcs)) {
             foreach ($Cbucket->custom_video_file_funcs as $func) {
                 if (function_exists($func)) {
                     $func_returned = $func($video);
                     if ($func_returned) {
                         $data = $func_returned;
                         $files['flv'] = $data;
                     }
                     $func_returned = $func($video, true);
                     if ($func_returned) {
                         $data = $func_returned;
                         $files['mp4'] = $data;
                     }
                     $func_returned = $func($video, 'mobile');
                     if ($func_returned) {
                         $data = $func_returned;
                         $files['mobile'] = $data;
                     }
                 }
             }
         }
         return $files;
     }
     $function_data = call_actions('get_video_files', $video);
     if ($function_data) {
         return $function_data;
     }
     $query = "SELECT * FROM " . ($query .= tbl('video_files'));
     $query .= " LEFT JOIN " . tbl('video_profiles');
     $query .= " ON " . tbl('video_files.profile_id') . " = " . tbl('video_profiles.profile_id');
     $query .= " WHERE " . tbl('video_files.file_name') . "='{$file}'";
     $data = $db->execute($query);
     $db->num_rows = $data->_numOfRows;
     $db->total_queries++;
     $db->total_queries_sql[] = $query;
     //Now Get Rows and return that data
     if ($db->num_rows > 0) {
         $files = $data->getrows();
         $new_files = array();
         if ($files) {
             foreach ($files as $file) {
                 $file_url = VIDEOS_URL . '/';
                 $file_url .= $video['file_directory'];
                 $file_url .= '/' . $video['file_name'];
                 $file_url .= $file['suffix'];
                 $file_url .= '.' . $file['ext'];
                 $file['file_path'] = $file_url;
                 $new_files[] = $file;
             }
         }
         return $new_files;
     } else {
         return false;
     }
 }
Esempio n. 4
0
 /**
  * function create content
  * 
  * @param STRING type
  * @param STRING id
  * @param ARRAY content 
  */
 function get_content($type, $id = NULL, $content = NULL)
 {
     $the_content = null;
     global $cbvid, $cbphoto, $cbgroup;
     if (!$content) {
         $content = $id;
     }
     $the_content = get_content($type, $content);
     $action_array = array('type' => $type, $id => $id, 'content' => $the_content);
     if (!$the_content) {
         $the_content = call_actions('get_feed_content', $action_array);
     }
     if ($the_content) {
         $the_content = apply_filters($the_content, 'get_feed_content');
     } else {
         return false;
     }
     return $the_content;
 }