private function handlePOST_deleteMedia($request_data) { global $error, $error_msg; // echo "<pre>".print_r($request_data,1)."</pre>"; // deleting media if (!empty($request_data['media_id'])) { $id = $request_data['media_id']; try { if ($request_data['type'] == 'Images') { $new_image = new Image(); $new_image->content_id = $id; $new_image->parent_collection_id = !empty($request_data['gid']) ? $request_data['gid'] : -1; $new_image->delete($id); $success_delete = TRUE; $error_msg = 2004; } if ($request_data['type'] == 'Audios') { $new_image = new Audio(); $new_image->content_id = $id; $new_image->delete($id); $success_delete = TRUE; $error_msg = 2005; } if ($request_data['type'] == 'Videos') { $new_image = new TekVideo(); $new_image->content_id = $id; $new_image->delete_video($id); $success_delete = TRUE; $error_msg = 2006; } } catch (PAException $e) { $error_msg = "{$e->message}"; $error = TRUE; } } }
require_once "web/includes/blocks/submit_abuse.php"; if (isset($_GET['err'])) { $error_msg = strip_tags(urldecode($_GET['err'])); } } $cid = $_GET['cid']; if ($content_info = Content::load_content($cid, $login_uid)) { $info = ContentCollection::get_collection_type($content_info->parent_collection_id); if ($content_info->type == 'Image') { $show_media = new Image(); } else { if ($content_info->type == 'Audio') { $show_media = new Audio(); } else { if ($content_info->type == 'TekVideo') { $show_media = new TekVideo(); } else { die("Content ID {$cid} is non-media (not image, audio, or video)"); } } } $show_media->load($cid); // loading tags for media $tags_array = Tag::load_tags_for_content($show_media->content_id); $tag_string = NULL; if (!empty($tags_array)) { $t = array(); for ($i = 0; $i < count($tags_array); $i++) { $name = $tags_array[$i]['name']; $uid = isset($_SESSION['user']['id']) ? $_SESSION['user']['id'] : null; // TODO: check this, maybe -1 is better value
* [filename] is a part of PeopleAggregator. * [description including history] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @author [creator, or "Original Author"] * @license http://bit.ly/aVWqRV PayAsYouGo License * @copyright Copyright (c) 2010 Broadband Mechanics * @package PeopleAggregator */ $login_required = TRUE; $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include_once "web/includes/page.php"; require_once 'api/TekVideo/TekVideo.php'; if ($_GET['status'] == 'TRUE') { $network_extra = unserialize(PA::$network_info->extra); $new_video = new TekVideo(); $new_video->file_name = $_GET['video_id']; $new_video->author_id = PA::$login_uid; $new_video->title = !empty($_GET['title']) ? $_GET['title'] : ''; $new_video->body = !empty($_GET['description']) ? $_GET['description'] : ''; $new_video->email_id = PA::$user->email; $new_video->allow_comments = 1; if (!empty($_GET['group_id'])) { $perm = 1; $album = $_GET['group_id']; } else { $perm = !empty($_GET['video_perm']) ? $_GET['video_perm'] : 1; // get the actual album for this user!!! $video_albums = Album::load_all(PA::$login_uid, VIDEO_ALBUM); if (!empty($video_albums[0])) { $album = $video_albums[0]['collection_id'];
/** function which gives all the data by given user_id */ public static function get($params = NULL, $condition = NULL, $count = FALSE) { Logger::log("Enter: TekVideo::get()"); $sort_by = !empty($params['sort_by']) ? $params['sort_by'] : 'C.created'; $direction = !empty($params['direction']) ? $params['direction'] : 'DESC'; $order_by = $sort_by . ' ' . $direction; //setting limits for pagination if (empty($params['show']) || $params['show'] == 'ALL' || $count == TRUE) { $limit = ''; } else { $page = !empty($params['page']) ? $params['page'] : 1; $start = ($page - 1) * $params['show']; $limit = 'LIMIT ' . $start . ',' . $params['show']; } $sql = "SELECT U.first_name, M.*, C.* FROM {contentcollections} AS CC, {users} AS U, {media_videos} as M INNER JOIN {contents} AS C ON M.content_id = C.content_id WHERE C.is_active = ? AND C.type = ? AND U.user_id = C.author_id AND C.collection_id = CC.collection_id "; $data = array(ACTIVE, TEK_VIDEO); if (!empty($condition) && is_array($condition)) { foreach ($condition as $key => $val) { if (is_array($val)) { $string = implode(', ', $val); $sql .= " AND {$key} IN ({$string})"; } else { $sql .= " AND {$key} = ?"; array_push($data, $val); } } } else { if (!empty($condition)) { $sql .= $condition; } } $sql .= " ORDER BY {$order_by} {$limit}"; $res = Dal::query($sql, $data); if ($count) { return $res->numRows(); } $result_array = array(); if ($res->numRows()) { while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { if (!empty($row->video_id)) { $tekvideo = new TekVideo(); $tekvideo->verify_status($row->video_id, $row->content_id, $row->status); $row->tags = get_tag_string($row->content_id); $result_array[] = $row; } } } Logger::log("Exit: TekVideo::get()"); return $result_array; }
function generate_inner_html() { global $login_uid; $video_data = NULL; if (!isset($_GET['gid']) || empty($_GET['gid'])) { parent::set_vars(); $frnd_list = null; if (!empty($_GET['view'])) { $frnd_list = $this->friend_list; } $sb_videos = array(); $new_album = new Album(VIDEO_ALBUM); if ($this->album_id) { $new_album = new Album(); $new_album->album_type = VIDEO_ALBUM; $new_album->load($this->album_id); $album_data['album_id'] = $new_album->collection_id; $album_data['album_name'] = $new_album->title; } else { $new_album->collection_id = $this->default_album_id; $album_data['album_id'] = $this->default_album_id; $album_data['album_name'] = $this->default_album_name; } $params = $condition = array(); if (!empty(PA::$page_uid) || PA::$login_uid != PA::$page_uid) { $condition['M.video_perm'] = !empty($this->friend_list) && in_array(PA::$page_uid, $this->friend_list) ? array(WITH_IN_DEGREE_1, ANYONE) : ANYONE; } $condition['C.collection_id'] = $album_data['album_id']; $video_info = TekVideo::get($params, $condition); $video_ids = objtoarray($video_info); if (!empty($video_ids)) { $k = 0; $ids = array(); for ($i = 0; $i < count($video_ids); $i++) { if ($video_ids[$i]['type'] != 7) { // Type 7 is for SB Content $ids[$i] = $video_ids[$i]['content_id']; } else { $tags = Tag::load_tags_for_content($video_ids[$i]['content_id']); $tags = show_tags($tags, null); //show_tags function is defined in uihelper.php $sb_videos[] = array('content_id' => $video_ids[$i]['content_id'], 'title' => $video_ids[$i]['title'], 'type' => $video_ids[$i]['type'], 'created' => $video_ids[$i]['created'], 'tags' => $tags); } } if (count($video_ids) > 0) { $video_data = $video_ids; } // Merging Media Gallery content and SB Content for ($counter = 0; $counter < count($sb_videos); $counter++) { $video_data[$k]['content_id'] = $sb_videos[$counter]['content_id']; $video_data[$k]['title'] = $sb_videos[$counter]['title']; $video_data[$k]['type'] = $sb_videos[$counter]['type']; $video_data[$k]['video_caption'] = $sb_videos[$counter]['title']; $video_data[$k]['created'] = $sb_videos[$counter]['created']; $video_data[$k]['tags'] = $sb_videos[$counter]['tags']; $k++; } } if (!empty($_GET['view'])) { if (empty($frnd_list)) { $video_data = NULL; } } $inner_template = NULL; switch ($this->mode) { default: $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public.tpl'; } $obj_inner_template = new Template($inner_template); $obj_inner_template->set('links', $video_data); $obj_inner_template->set('album_data', $album_data); $obj_inner_template->set('uid', $this->uid); $obj_inner_template->set('frnd_list', $frnd_list); $obj_inner_template->set('my_all_album', $this->my_all_album); $obj_inner_template->set('show_view', $this->show_view); $inner_html = $obj_inner_template->fetch(); return $inner_html; } else { // ----- Calling parents function which set all the Require variables parent::set_group_media_gallery(); //------------- Handling the Groups Media gallery ----------- $group = ContentCollection::load_collection((int) $_GET['gid'], $_SESSION['user']['id']); $params = $condition = array(); $album_data['album_id'] = $group->collection_id; $album_data['album_name'] = $group->title; $condition['C.collection_id'] = $album_data['album_id']; $video_info = TekVideo::get($params, $condition); $video_data = objtoarray($video_info); // $video_data = Video::load_videos_for_collection_id ($_GET['gid'], $limit = 0); $i = 0; if (!empty($video_data)) { foreach ($video_data as $data) { $tags_array = Tag::load_tags_for_content($data['content_id']); $tags_string = ""; $tags_string = show_all_contents_for_tag($tags_array); $video_data[$i]['tags'] = $tags_string; $i++; } } $inner_template = NULL; switch ($this->mode) { default: $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_groups.tpl'; } $obj_inner_template = new Template($inner_template); $obj_inner_template->set('links', $video_data); $obj_inner_template->set('album_data', $album_data); $obj_inner_template->set('show_view', $this->show_view); $obj_inner_template->set('my_all_groups', $this->group_ids); $inner_html = $obj_inner_template->fetch(); return $inner_html; } }
function render() { $pic = $aud = $vid = NULL; switch ($this->page) { case 'homepage': $pic = Image::load_recent_media_image(0, $this->subject); $aud = Audio::load_recent_media_audio(0, $this->subject); $vid = TekVideo::get_media_recent_tekvideo(0, $this->subject); break; case 'grouppage': $pic = Image::load_images_for_collection_id((int) $this->gid); $aud = Audio::load_audios_for_collection_id((int) $this->gid); $tekvid = TekVideo::get(NULL, array('C.collection_id' => $this->group_details->collection_id)); $vid = objtoarray($tekvid); break; case 'userpage': $pic = Image::load_user_gallery_images($this->uid, 10, PA::$login_uid); $aud = Audio::load_user_gallery_audio($this->uid, 10, PA::$login_uid); if (!empty(PA::$page_uid) || PA::$login_uid != PA::$page_uid) { $condition['M.video_perm'] = !empty($this->friend_list) && in_array(PA::$page_uid, $this->friend_list) ? array(WITH_IN_DEGREE_1, ANYONE) : ANYONE; } $tekvid = TekVideo::get(array('show' => 10, 'page' => 1), array('C.author_id' => $this->uid)); $vid = objtoarray($tekvid); $this->view_all_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$this->subject}"; break; } //even if we got more media, we can display only 6 $pictures = array(); $max = count($pic) < 6 ? count($pic) : ($max = 6); for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } $audios = array(); $max = count($aud) < 6 ? count($aud) : ($max = 6); for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } $videos = array(); $max = count($vid) < 6 ? count($vid) : ($max = 6); for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } if (!empty($this->group_details) && (!empty($pictures) || !empty($audios) || !empty($videos))) { $this->view_all_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/view=groups_media&gid=" . (int) $this->group_details->collection_id; } $gallery = array('images' => $pictures, 'audios' => $audios, 'videos' => $videos); $this->links = $gallery; $this->inner_HTML = $this->generate_inner_html($this->links); if (empty($gallery['images']) && empty($gallery['audios']) && empty($gallery['videos'])) { $this->height = 70; $this->view_all_url = ''; } else { $this->height = 260; } $content = parent::render(); return $content; }