// SET NEW CACHED RATINGS $database->database_query("UPDATE se_videos SET video_cache_rating='{$new_rating}', video_cache_rating_weighted='{$new_rating_weighted}', video_cache_rating_total='{$new_total}' WHERE video_id='{$video_info['video_id']}'"); $allowed_to_rate = 0; $video_info['video_rating_full'] = floor($new_rating); $video_info['video_rating_part'] = $new_rating - $video_info['video_rating_full'] == 0 ? 0 : 1; $video_info['video_rating_none'] = 5 - $video_info['video_rating_full'] - $video_info['video_rating_part']; $video_info['video_rating_total'] = $new_total; } } $response_array = array('allowed_to_rate' => (bool) $allowed_to_rate, 'rating_full' => (int) $video_info['video_rating_full'], 'rating_part' => (int) $video_info['video_rating_part'], 'rating_none' => (int) $video_info['video_rating_none'], 'rating_total' => (int) $video_info['video_rating_total']); // OUTPUT JSON echo json_encode($response_array); exit; } // GET USER'S VIDEOS FOR CAROUSEL $total_videos = $video->video_total("(video_is_converted='1')"); $video_array = $video->video_list(0, $video->video_total(), "video_id DESC", "(video_is_converted='1')", 1); // GET VIDEO COMMENTS $comment = new se_comment('video', 'video_id', $video_info['video_id']); $total_comments = $comment->comment_total(); // UPDATE VIDEO VIEWS if ($user->user_info['user_id'] != $owner->user_info['user_id']) { $video_views_new = $video_info['video_views'] + 1; $database->database_query("UPDATE se_videos SET video_views='{$video_views_new}' WHERE video_id='{$video_info['video_id']}' LIMIT 1"); } // UPDATE NOTIFICATIONS if ($user->user_info['user_id'] == $owner->user_info['user_id']) { $database->database_query("DELETE FROM se_notifys USING se_notifys LEFT JOIN se_notifytypes ON se_notifys.notify_notifytype_id=se_notifytypes.notifytype_id WHERE se_notifys.notify_user_id='{$owner->user_info['user_id']}' AND se_notifytypes.notifytype_name='videocomment' AND notify_object_id='{$video_info['video_id']}'"); } // SET GLOBAL PAGE TITLE $global_page_title[0] = 5500151;
if ($f_owner != "") { $where_clause[] = "(se_users.user_username LIKE '%{$f_owner}%' OR CONCAT(se_users.user_fname, ' ', se_users.user_lname) LIKE '%{$f_owner}%')"; } if ($f_title != "") { $where_clause[] = " se_videos.video_title LIKE '%{$f_title}%'"; } if (count($where_clause) != 0) { $where = "(" . implode(" AND ", $where_clause) . ")"; } // DELETE NECESSARY VIDEOS $start = ($p - 1) * $videos_per_page; if ($task == "delete") { $video->video_delete_selected($start, $videos_per_page, $sort, $where); } // GET TOTAL VIDEOS $total_videos = $video->video_total($where); // MAKE VIDEO PAGES $page_vars = make_page($total_videos, $videos_per_page, $p); $page_array = array(); for ($x = 0; $x <= $page_vars[2] - 1; $x++) { if ($x + 1 == $page_vars[1]) { $link = "1"; } else { $link = "0"; } $page_array[$x] = array('page' => $x + 1, 'link' => $link); } // GET VIDEO ARRAY $videos = $video->video_list($page_vars[0], $videos_per_page, $sort, $where); // ASSIGN VARIABLES AND SHOW VIEW VIDEOS PAGE $smarty->assign('total_videos', $total_videos);
$task = !empty($_POST['task']) ? $_POST['task'] : (!empty($_GET['task']) ? $_GET['task'] : 'create'); $video_id = !empty($_POST['video_id']) ? $_POST['video_id'] : (!empty($_GET['video_id']) ? $_GET['video_id'] : NULL); $video_type = !empty($_POST['video_type']) ? $_POST['video_type'] : (!empty($_GET['video_type']) ? $_GET['video_type'] : 0); // User may not upload videos if ((!$user->level_info['level_video_allow'] || empty($setting['setting_video_ffmpeg_path'])) && ($task == "create" || $task == "docreate" || $task == "upload")) { header("Location: user_home.php"); exit; } if (!$user->level_info['level_youtube_allow'] && ($task == "youtube" || $task == "doembed")) { header("Location: user_home.php"); exit; } // CREATE VIDEO OBJECT $video = new se_video($user->user_info['user_id'], $video_id); // User has too many videos $total_videos = $video->video_total(); if ($total_videos >= $user->level_info['level_video_maxnum']) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 5500201); $smarty->assign('error_submit', 641); include "footer.php"; } // GET PRIVACY SETTINGS $level_video_privacy = unserialize($user->level_info['level_video_privacy']); rsort($level_video_privacy); $level_video_comments = unserialize($user->level_info['level_video_comments']); rsort($level_video_comments); // SET RESULT AND ERROR VARS $result = FALSE; $is_error = 0;
function he_wall_youtube_video_upload($new_action_id, $video_url, $video_privacy_level) { global $setting, $user, $url; if (!$user->level_info['level_youtube_allow']) { return array('result' => 0, 'message' => SE_Language::get(690706078)); } $video = new se_video($user->user_info['user_id'], 0); $total_videos = $video->video_total(); if ($total_videos >= $user->level_info['level_video_maxnum']) { return array('result' => 0, 'message' => SE_Language::get(5500201)); } // GET PRIVACY SETTINGS $level_video_privacy = unserialize($user->level_info['level_video_privacy']); rsort($level_video_privacy); $level_video_comments = unserialize($user->level_info['level_video_comments']); rsort($level_video_comments); $video->video_info = array('video_title' => '', 'video_desc' => '', 'video_search' => true, 'video_privacy' => $video_privacy_level, 'video_comments' => $level_video_comments[0]); $video_code = extract_youtube_code($video_url); $video_info_json = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/{$video_code}?alt=json"); if ($video_info_json === false) { return array('result' => 0, 'message' => SE_Language::get(690706074)); } $video_info = $video_info_json ? json_decode($video_info_json, true) : array(); $video_title = isset($video_info['entry']['title']['$t']) ? $video_info['entry']['title']['$t'] : ''; $video_description = isset($video_info['entry']['content']['$t']) ? $video_info['entry']['content']['$t'] : ''; $video_duration = isset($video_info['entry']['media$group']['yt$duration']['seconds']) ? $video_info['entry']['media$group']['yt$duration']['seconds'] : ''; $video_thumb = isset($video_info['entry']['media$group']['media$thumbnail'][3]) ? $video_info['entry']['media$group']['media$thumbnail'][3] : ''; $video_thumb_src = $video_thumb['url']; $thumb_dimensions = array($video_thumb['width'], $video_thumb['height']); $video_thumb_dimensions = array($setting['setting_video_thumb_width'], $setting['setting_video_thumb_height']); $video_id = he_wall::add_youtube_video($video_code, censor(str_replace(array("\r", "\n"), "<br>", $video_title)), censor(str_replace(array("\r", "\n"), "<br>", $video_description)), true, $video_privacy_level, $level_video_comments[0]); he_wall::add_video_action_link($user->user_info['user_id'], $new_action_id, $video_id); $video_directory = $video->video_dir($user->user_info['user_id'], true); $destination = $video_directory . $video_id . '_thumb.jpg'; $video_result = he_wall_update_video_thumb($video_thumb_src, $destination, $thumb_dimensions, $video_thumb_dimensions); $video_result['result'] = 1; $video_result['title'] = $video_title; $video_result['description'] = $video_description; $video_result['media_src'] = $url->url_base . substr($destination, 2); $video_result['video_url'] = $url->url_base . 'wall_action.php?id=' . $new_action_id; $video_result['video_length'] = he_wall_format_duration($video_duration); $width = $setting['setting_he_wall_video_player_width']; $height = $setting['setting_he_wall_video_player_height']; $video_result['player'] = '<object width="' . $width . '" height="' . $height . '"><param name="wmode" value="transparent"></param><param name="movie" value="http://www.youtube.com/v/' . $video_code . '&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/' . $video_code . '&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' . $width . '" height="' . $height . '"></embed></object>'; return $video_result; }