<?php $page = "user_video"; include "header.php"; $task = isset($_POST['task']) ? $_POST['task'] : NULL; // ENSURE VIDEO IS ENABLED FOR THIS USER if (!($user->level_info['level_video_allow'] || $user->level_info['level_youtube_allow'])) { header("Location: user_home.php"); exit; } // CREATE VIDEO OBJECT $video = new se_video($user->user_info['user_id']); // 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); // DELETE VIDEO if ($task == "delete") { $video->video_delete($_POST['video_id']); } elseif ($task == "edit") { $video_id = $_POST['video_id']; $video_title = censor($_POST['video_title']); $video_desc = censor(str_replace("\r\n", "<br>", $_POST['video_desc'])); $video_search = $_POST['video_search']; $video_privacy = $_POST['video_privacy']; $video_comments = $_POST['video_comments']; // MAKE SURE SUBMITTED PRIVACY OPTIONS ARE ALLOWED, IF NOT, SET TO EVERYONE if (!in_array($video_privacy, $level_video_privacy)) { $video_privacy = $level_video_privacy[0]; }
if ($database->database_num_rows($video_query) != 1) { header("Location: " . $url->url_create('profile', $owner->user_info['user_username'])); exit; } $video_info = $database->database_fetch_assoc($video_query); // CHECK PRIVACY $privacy_max = $owner->user_privacy_max($user); if (!($video_info[video_privacy] & $privacy_max)) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 5500148); $smarty->assign('error_submit', 641); include "footer.php"; } // INSTANTIATE VIDEO AND SET VIDEO VARS $video = new se_video($owner->user_info['user_id']); $video_info['video_dir'] = $video->video_dir(); // ENSURE VIDEOS ARE ENABLED FOR THIS USER if ($video_info['video_type'] == 0 && !$owner->level_info['level_video_allow'] || $video_info['video_type'] == 1 && !$owner->level_info['level_youtube_allow']) { header("Location: " . $url->url_create('profile', $owner->user_info['user_username'])); exit; } $video_info['video_rating_full'] = floor($video_info['video_cache_rating']); $video_info['video_rating_part'] = $video_info['video_cache_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'] = $database->database_num_rows($database->database_query("SELECT NULL FROM se_videoratings WHERE videorating_video_id='{$video_info['video_id']}'")); // GET VIDEO COMMENT PRIVACY $allowed_to_comment = $privacy_max & $video_info['video_comments']; // CHECK IF USER IS ALLOWED TO RATE $allowed_to_rate = 1; if ($database->database_num_rows($database->database_query("SELECT NULL FROM se_videoratings WHERE videorating_video_id='{$video_info['video_id']}' AND videorating_user_id='{$user->user_info['user_id']}'")) != 0 || !$user->user_exists) {
$page = "user_video_upload"; include "header.php"; $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
function deleteuser_video($user_id) { global $database; // GET VIDEO OBJECT $video = new se_video($user_id); // DELETE VIDEOS, COMMENTS, AND RATINGS $database->database_query("DELETE FROM se_videos, se_videocomments, se_videoratings USING se_videos LEFT JOIN se_videocomments ON se_videos.video_id=se_videocomments.videocomments_video_id LEFT JOIN se_videoratings ON se_videos.video_id=se_videoratings.videorating_video_id WHERE se_videos.video_user_id='{$user_id}'"); // DELETE USER'S FILES if (is_dir($video->video_dir())) { $dir = $video->video_dir(); } else { $dir = "." . $video->video_dir(); } if ($dh = @opendir($dir)) { while (($file = @readdir($dh)) !== false) { if ($file != "." && $file != "..") { @unlink($dir . $file); } } @closedir($dh); } @rmdir($dir); }
$task = $_POST['task']; } elseif (isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; } if (isset($_POST['video_id'])) { $video_id = $_POST['video_id']; } elseif (isset($_GET['video_id'])) { $video_id = $_GET['video_id']; } else { $video_id = 0; } // CREATE VIDEO OBJECT $videos_per_page = 100; $video = new se_video(); // DELETE VIDEO if ($task == "deletevideo") { if ($database->database_num_rows($database->database_query("SELECT video_id FROM se_videos WHERE video_id='{$video_id}'")) == 1) { $video->video_delete($video_id); } } // SET VIDEO SORT-BY VARIABLES FOR HEADING LINKS $i = "id"; // VIDEO_ID $t = "t"; // VIDEO_TITLE $u = "u"; // OWNER OF VIDEO // SET SORT VARIABLE FOR DATABASE QUERY if ($s == "i") {
// INCLUDE VIDEO FILES include "./include/class_video.php"; include "./include/functions_video.php"; // PRELOAD LANGUAGE SE_Language::_preload(5500098); // SET MAIN MENU VARS if ($user->user_exists && ($user->level_info['level_video_allow'] || $user->level_info['level_youtube_allow']) || !$user->user_exists && $setting['setting_permission_video']) { $plugin_vars['menu_main'] = array('file' => 'browse_videos.php', 'title' => 5500098); } if ($user->user_exists && ($user->level_info['level_video_allow'] || $user->level_info['level_youtube_allow'])) { $plugin_vars['menu_user'] = array('file' => 'user_video.php', 'icon' => 'video_video16.gif', 'title' => 5500098); } // SET PROFILE MENU VARS if (($owner->level_info['level_video_allow'] || $owner->level_info['level_youtube_allow']) && $page == "profile") { // START VIDEO $video = new se_video($owner->user_info['user_id']); $sort = "video_id DESC"; // GET PRIVACY LEVEL AND SET WHERE $video_privacy_max = $owner->user_privacy_max($user); $where = "video_is_converted=1 AND (video_privacy & {$video_privacy_max})"; // GET TOTAL VIDEOS $total_videos = $video->video_total($where); // GET VIDEO ARRAY $videos = $video->video_list(0, $total_videos, $sort, $where); // ASSIGN VIDEOS SMARY VARIABLE $smarty->assign('videos', $videos); $smarty->assign('total_videos', $total_videos); // SET PROFILE MENU VARS if ($total_videos) { $plugin_vars['menu_profile_tab'] = array('file' => 'profile_video_tab.tpl', 'title' => 5500098, 'name' => 'video'); }
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; }