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); }
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) { $allowed_to_rate = 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; }