From a8aa4bceed8e7ad0c5af2646a83d6a2da2e0b23a Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 26 Mar 2010 21:07:39 +0000 Subject: Changed line endings to unix-style for videolist plugin. --- actions/addvideo.php | 432 +++++++------- actions/comments_delete/add.php | 114 ++-- actions/delete.php | 74 +-- actions/save.php | 16 +- actions/tubesearch.php | 660 ++++++++++----------- browse.php | 88 +-- index.php | 92 +-- languages/en.php | 33 +- manifest.xml | 2 +- new.php | 94 +-- start.php | 253 ++++---- views/default/forms/add.php | 352 +++++------ views/default/forms/browsetube.php | 514 ++++++++-------- views/default/forms/labels/googlevideos.php | 18 +- views/default/forms/labels/metacafe.php | 18 +- views/default/forms/labels/vimeo.php | 16 +- views/default/forms/labels/youtube.php | 18 +- views/default/object/watch.php | 90 +-- views/default/river/object/videolist/annotate.php | 24 +- views/default/river/object/videolist/create.php | 34 +- views/default/staticvideo/index.php | 16 +- views/default/videolist/css.php | 398 ++++++------- views/default/videolist/groupprofile_videolist.php | 106 ++-- views/default/videolist/notfound.php | 40 +- views/default/widgets/videolist_view/edit.php | 42 +- views/default/widgets/videolist_view/view.php | 16 +- views/rss/videolist/contentwrapper.php | 24 +- views/rss/videolist/videolist.php | 30 +- watch.php | 88 +-- world.php | 76 +-- 30 files changed, 1890 insertions(+), 1888 deletions(-) diff --git a/actions/addvideo.php b/actions/addvideo.php index 519f6ae04..40c231518 100644 --- a/actions/addvideo.php +++ b/actions/addvideo.php @@ -1,216 +1,216 @@ - - * @copyright Prateek Choudhary - */ - -// Make sure we're logged in (send us to the front page if not) -gatekeeper(); - -// Get the current page's owner -set_page_owner($_SESSION['container_guid']); - -$page_owner = page_owner_entity(); - -if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); -} - -if($page_owner->type == "group") - $entity_referer = $page_owner->type.":".$page_owner->getGUID(); -else - $entity_referer = $page_owner->username; - -require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php"); - -function fetchyoutubeDatatitle($videoid){ - $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid); - /** - ** generate XML View - **/ - $xml_buffer = new SimpleXMLElement($buffer); - $vidDataTitle = $xml_buffer->video_details->title; - return $vidDataTitle; - //return ""; -} - -function fetchyoutubeDatadesc($videoid){ - $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid); - /** - ** generate XML View - **/ - $xml_buffer = new SimpleXMLElement($buffer); - $vidDataDesc = $xml_buffer->video_details->description; - return $vidDataDesc; - //return ""; -} - -function getVimeoInfoDataTitle($iGetVideoId){ - // Now lets do the search query. We will get an response object containing everything we need - $oResponse = VimeoVideosRequest::getInfo($iGetVideoId); - // We want the result videos as an array of objects - $aoVideos = $oResponse->getVideo(); - $title = $aoVideos->getTitle(); - return $title; -} - -function getVimeoInfoDataDesc($iGetVideoId){ - // Now lets do the search query. We will get an response object containing everything we need - $oResponse = VimeoVideosRequest::getInfo($iGetVideoId); - // We want the result videos as an array of objects - $aoVideos = $oResponse->getVideo(); - $description = $aoVideos->getCaption(); - return $description; -} - -function getVimeoInfoImage($iGetVideoId){ - // Now lets do the search query. We will get an response object containing everything we need - $oResponse = VimeoVideosRequest::getInfo($iGetVideoId); - // We want the result videos as an array of objects - $aoVideos = $oResponse->getVideo(); - //get all thumbnails - - $aThumbnails = array(); - foreach($aoVideos->getThumbnails() as $oThumbs) { - $aThumbnails[] = $oThumbs->getImageContent(); - } - - foreach($aThumbnails as $thumbnailArray){ - $thumbnail = $thumbnailArray; - break; - } - - return $thumbnail; -} - -function fetchyoutubeDatathumbnail($videoId){ - $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg"; - return $thumbnail; -} - -function metacafeFetchData($getVideoId){ - $feedURL = "http://www.metacafe.com/api/item/".$getVideoId; - $sxml = new DomDocument; - $sxml->load($feedURL); - $myitem = $sxml->getElementsByTagName('item'); - return $myitem; -} - -function fetchmetacafeTitle($getVideoId){ - $myitem = metacafeFetchData($getVideoId); - foreach($myitem as $searchNode){ - $xmlTitle = $searchNode->getElementsByTagName("title"); - $valueTitle = $xmlTitle->item(0)->nodeValue; - } - return $valueTitle; -} - -function fetchmetacafeDesc($getVideoId){ - $myitem = metacafeFetchData($getVideoId); - foreach($myitem as $searchNode){ - $xmlDesc = $searchNode->getElementsByTagName("description"); - $valueDesc = $xmlDesc->item(0)->nodeValue; - $ot = "

"; - $ct = "

"; - $string = trim($valueDesc); - $start = intval(strpos($string, $ot) + strlen($ot)); - $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start)); - } - return $desc_src; -} - -function fetchmetacafeImg($getVideoId){ - $myitem = metacafeFetchData($getVideoId); - foreach($myitem as $searchNode){ - $xmlDesc = $searchNode->getElementsByTagName("description"); - $valueDesc = $xmlDesc->item(0)->nodeValue; - $pattern = '/]+src[\\s=\'"]'; - $pattern .= '+([^"\'>\\s]+)/is'; - if(preg_match($pattern,$valueDesc,$match)){ - $thumbnail = $match[1]; - } - } - return $thumbnail; -} - - $pageContainer = $_SESSION['Pagecontainer']; - - - // Initialise a new ElggObject - $videolist = new ElggObject(); - // Tell the system it's a blog post - $videolist->subtype = "videolist"; - // Set its owner to the current user - $videolist->owner_guid = $_SESSION['user']->getGUID(); - - // Set container of the video whether it was uploaded to groups or profile - $videolist->container_guid = $_SESSION['container_guid']; - // For now, set its access to public (we'll add an access dropdown shortly) - $videolist->access_id = $_SESSION['candidate_profile_video_access_id']; - - // In order to Set its title and description appropriately WE need the video ID - $videolist->url = $_SESSION['candidate_profile_video']; - - if($pageContainer == "youtube"){ - $videoIDArray = split("/v/", $videolist->url); - $videolist->video_id = $videoIDArray[1]; - // Now set the video title and description appropriately - $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]); - $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]); - $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]); - $videolist->videotype = "youtube"; - } - else if($pageContainer == "metacafe"){ - $videolist->video_id = $_SESSION['candidate_profile_video']; - // Now set the video title and description appropriately - $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']); - $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']); - $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']); - $videolist->videotype = "metacafe"; - } - else if($pageContainer == "vimeo"){ - $videolist->video_id = $_SESSION['candidate_profile_video']; - - // Now set the video title and description appropriately - $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']); - $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']); - $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']); - $videolist->videotype = "vimeo"; - } - - // Before we can set metadata, we need to save the blog post - if (!$videolist->save()) { - register_error(elgg_echo("videolist:error")); - forward("pg/videolist/new"); - } - //add video tags - $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']); - if (is_array($videolist_tags_array)) { - $videolist->tags = $videolist_tags_array; - } - - // add to river - add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid); - - // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid); - // Success message - system_message(elgg_echo("videolist:posted")); - // Remove the videolist cache - unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']); - unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']); - // Forward to the main videolist page - -forward("pg/videolist/owned/".page_owner_entity()->username); - -// Remove the videolist cache - unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']); - unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']); - -?> + + * @copyright Prateek Choudhary + */ + +// Make sure we're logged in (send us to the front page if not) +gatekeeper(); + +// Get the current page's owner +set_page_owner($_SESSION['container_guid']); + +$page_owner = page_owner_entity(); + +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); +} + +if($page_owner->type == "group") + $entity_referer = $page_owner->type.":".$page_owner->getGUID(); +else + $entity_referer = $page_owner->username; + +require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php"); + +function fetchyoutubeDatatitle($videoid){ + $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid); + /** + ** generate XML View + **/ + $xml_buffer = new SimpleXMLElement($buffer); + $vidDataTitle = $xml_buffer->video_details->title; + return $vidDataTitle; + //return ""; +} + +function fetchyoutubeDatadesc($videoid){ + $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid); + /** + ** generate XML View + **/ + $xml_buffer = new SimpleXMLElement($buffer); + $vidDataDesc = $xml_buffer->video_details->description; + return $vidDataDesc; + //return ""; +} + +function getVimeoInfoDataTitle($iGetVideoId){ + // Now lets do the search query. We will get an response object containing everything we need + $oResponse = VimeoVideosRequest::getInfo($iGetVideoId); + // We want the result videos as an array of objects + $aoVideos = $oResponse->getVideo(); + $title = $aoVideos->getTitle(); + return $title; +} + +function getVimeoInfoDataDesc($iGetVideoId){ + // Now lets do the search query. We will get an response object containing everything we need + $oResponse = VimeoVideosRequest::getInfo($iGetVideoId); + // We want the result videos as an array of objects + $aoVideos = $oResponse->getVideo(); + $description = $aoVideos->getCaption(); + return $description; +} + +function getVimeoInfoImage($iGetVideoId){ + // Now lets do the search query. We will get an response object containing everything we need + $oResponse = VimeoVideosRequest::getInfo($iGetVideoId); + // We want the result videos as an array of objects + $aoVideos = $oResponse->getVideo(); + //get all thumbnails + + $aThumbnails = array(); + foreach($aoVideos->getThumbnails() as $oThumbs) { + $aThumbnails[] = $oThumbs->getImageContent(); + } + + foreach($aThumbnails as $thumbnailArray){ + $thumbnail = $thumbnailArray; + break; + } + + return $thumbnail; +} + +function fetchyoutubeDatathumbnail($videoId){ + $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg"; + return $thumbnail; +} + +function metacafeFetchData($getVideoId){ + $feedURL = "http://www.metacafe.com/api/item/".$getVideoId; + $sxml = new DomDocument; + $sxml->load($feedURL); + $myitem = $sxml->getElementsByTagName('item'); + return $myitem; +} + +function fetchmetacafeTitle($getVideoId){ + $myitem = metacafeFetchData($getVideoId); + foreach($myitem as $searchNode){ + $xmlTitle = $searchNode->getElementsByTagName("title"); + $valueTitle = $xmlTitle->item(0)->nodeValue; + } + return $valueTitle; +} + +function fetchmetacafeDesc($getVideoId){ + $myitem = metacafeFetchData($getVideoId); + foreach($myitem as $searchNode){ + $xmlDesc = $searchNode->getElementsByTagName("description"); + $valueDesc = $xmlDesc->item(0)->nodeValue; + $ot = "

"; + $ct = "

"; + $string = trim($valueDesc); + $start = intval(strpos($string, $ot) + strlen($ot)); + $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start)); + } + return $desc_src; +} + +function fetchmetacafeImg($getVideoId){ + $myitem = metacafeFetchData($getVideoId); + foreach($myitem as $searchNode){ + $xmlDesc = $searchNode->getElementsByTagName("description"); + $valueDesc = $xmlDesc->item(0)->nodeValue; + $pattern = '/]+src[\\s=\'"]'; + $pattern .= '+([^"\'>\\s]+)/is'; + if(preg_match($pattern,$valueDesc,$match)){ + $thumbnail = $match[1]; + } + } + return $thumbnail; +} + + $pageContainer = $_SESSION['Pagecontainer']; + + + // Initialise a new ElggObject + $videolist = new ElggObject(); + // Tell the system it's a blog post + $videolist->subtype = "videolist"; + // Set its owner to the current user + $videolist->owner_guid = $_SESSION['user']->getGUID(); + + // Set container of the video whether it was uploaded to groups or profile + $videolist->container_guid = $_SESSION['container_guid']; + // For now, set its access to public (we'll add an access dropdown shortly) + $videolist->access_id = $_SESSION['candidate_profile_video_access_id']; + + // In order to Set its title and description appropriately WE need the video ID + $videolist->url = $_SESSION['candidate_profile_video']; + + if($pageContainer == "youtube"){ + $videoIDArray = split("/v/", $videolist->url); + $videolist->video_id = $videoIDArray[1]; + // Now set the video title and description appropriately + $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]); + $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]); + $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]); + $videolist->videotype = "youtube"; + } + else if($pageContainer == "metacafe"){ + $videolist->video_id = $_SESSION['candidate_profile_video']; + // Now set the video title and description appropriately + $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']); + $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']); + $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']); + $videolist->videotype = "metacafe"; + } + else if($pageContainer == "vimeo"){ + $videolist->video_id = $_SESSION['candidate_profile_video']; + + // Now set the video title and description appropriately + $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']); + $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']); + $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']); + $videolist->videotype = "vimeo"; + } + + // Before we can set metadata, we need to save the blog post + if (!$videolist->save()) { + register_error(elgg_echo("videolist:error")); + forward("pg/videolist/new"); + } + //add video tags + $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']); + if (is_array($videolist_tags_array)) { + $videolist->tags = $videolist_tags_array; + } + + // add to river + add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid); + + // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid); + // Success message + system_message(elgg_echo("videolist:posted")); + // Remove the videolist cache + unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']); + unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']); + // Forward to the main videolist page + +forward("pg/videolist/owned/".page_owner_entity()->username); + +// Remove the videolist cache + unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']); + unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']); + +?> diff --git a/actions/comments_delete/add.php b/actions/comments_delete/add.php index a2d672fe9..d65e6c05b 100644 --- a/actions/comments_delete/add.php +++ b/actions/comments_delete/add.php @@ -1,58 +1,58 @@ - - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.org/ - */ - - // Make sure we're logged in; forward to the front page if not - gatekeeper(); - action_gatekeeper(); - - // Get input - $entity_guid = (int) get_input('entity_guid'); - $comment_text = get_input('generic_comment'); - - // Let's see if we can get an entity with the specified GUID - if ($entity = get_entity($entity_guid)) { - - // If posting the comment was successful, say so - if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) { - - if ($entity->owner_guid != $_SESSION['user']->getGUID()) - notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'), - sprintf( - elgg_echo('generic_comment:email:body'), - $entity->title, - $_SESSION['user']->name, - $comment_text, - $entity->getURL(), - $_SESSION['user']->name, - $_SESSION['user']->getURL() - ) - ); - - system_message(elgg_echo("generic_comment:posted")); - //add to river - add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid); - - - } else { - register_error(elgg_echo("generic_comment:failure")); - } - - } else { - - register_error(elgg_echo("generic_comment:notfound")); - - } - - // Forward to the - forward($_SERVER['HTTP_REFERER']); - + + * @copyright Curverider Ltd 2008-2009 + * @link http://elgg.org/ + */ + + // Make sure we're logged in; forward to the front page if not + gatekeeper(); + action_gatekeeper(); + + // Get input + $entity_guid = (int) get_input('entity_guid'); + $comment_text = get_input('generic_comment'); + + // Let's see if we can get an entity with the specified GUID + if ($entity = get_entity($entity_guid)) { + + // If posting the comment was successful, say so + if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) { + + if ($entity->owner_guid != $_SESSION['user']->getGUID()) + notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'), + sprintf( + elgg_echo('generic_comment:email:body'), + $entity->title, + $_SESSION['user']->name, + $comment_text, + $entity->getURL(), + $_SESSION['user']->name, + $_SESSION['user']->getURL() + ) + ); + + system_message(elgg_echo("generic_comment:posted")); + //add to river + add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid); + + + } else { + register_error(elgg_echo("generic_comment:failure")); + } + + } else { + + register_error(elgg_echo("generic_comment:notfound")); + + } + + // Forward to the + forward($_SERVER['HTTP_REFERER']); + ?> diff --git a/actions/delete.php b/actions/delete.php index da3ad0c3b..3b5b6ddde 100644 --- a/actions/delete.php +++ b/actions/delete.php @@ -1,44 +1,44 @@ - * @copyright Prateek Choudhary +/** + * Elgg Videolist Plugin - + * This plugin allows users to delete videos + * + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ // Make sure we're logged in (send us to the front page if not) -gatekeeper(); - - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - - // Get input data - $guid = (int) get_input('video_id'); - - // Make sure we actually have permission to edit - $videos = get_entity($guid); - if ($videos->getSubtype() == "videolist" && $videos->canEdit()) { - - // Get owning user +gatekeeper(); + + // Get the current page's owner + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + + // Get input data + $guid = (int) get_input('video_id'); + + // Make sure we actually have permission to edit + $videos = get_entity($guid); + if ($videos->getSubtype() == "videolist" && $videos->canEdit()) { + + // Get owning user $owner = get_entity($videos->getOwner()); - // Delete it! - $rowsaffected = $videos->delete(); - if ($rowsaffected > 0) { - // Success message - system_message(elgg_echo("videos:deleted")); - } else { - register_error(elgg_echo("videos:notdeleted")); - } - // Forward to the main video list page + // Delete it! + $rowsaffected = $videos->delete(); + if ($rowsaffected > 0) { + // Success message + system_message(elgg_echo("videos:deleted")); + } else { + register_error(elgg_echo("videos:notdeleted")); + } + // Forward to the main video list page //forward("pg/videolist/owned/" . page_owner_entity()->username); - forward($_SERVER['HTTP_REFERER']); + forward($_SERVER['HTTP_REFERER']); + + } - } - ?> diff --git a/actions/save.php b/actions/save.php index 61f3eb401..fa6ff585e 100644 --- a/actions/save.php +++ b/actions/save.php @@ -1,13 +1,13 @@ - * @copyright Prateek Choudhary + /** + * Elgg Candidate Profile Video Plugin + * This plugin allows users to create a library of youtube videos + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ diff --git a/actions/tubesearch.php b/actions/tubesearch.php index d1a83722c..3930aaaa0 100644 --- a/actions/tubesearch.php +++ b/actions/tubesearch.php @@ -1,330 +1,330 @@ - - * @copyright Prateek Choudhary - */ - -// Get the current page's owner -//set_page_owner($_SESSION['container_guid']); - -$page_ownerx = get_entity(get_input('container')); -if(!$page_ownerx) - $page_ownerx = get_user_by_username(get_input('container')); -set_page_owner($page_ownerx->getGUID()); -$page_owner = page_owner_entity(); - -if($page_owner->type == "group") - $container = "group:".$page_ownerx->getGUID(); -else - $container = $page_ownerx->username; - -if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); -} - -global $CONFIG; - $queryFeed = get_input('q'); - $start_index = get_input('start_index'); - $results_perpage = 10; - $queryCatgory = get_input('page'); -if (!isset($queryFeed) || empty($queryFeed)) { - -} -else -{ - $q = $queryFeed; - if($queryCatgory == "youtube") - { - $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10"; - $sxml = simplexml_load_file($feedURL); - - $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/'); - $total = $counts->totalResults; - $startOffset = $counts->startIndex; - $endOffset = ($startOffset-1) + $counts->itemsPerPage; - - $body = '
'; - $rem = floor($total/10); - $rem*=10; - if($rem<$total) - $last = $rem+1; - $lpVid = $total - $rem; - if($startOffset==1 && ($endOffset)==$total){} - else if($startOffset==1 && ($endOffset)<$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - else if($startOffset>1 && ($endOffset)<$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - else if($startOffset>1 && ($endOffset+$lpVid)>=$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - $body .= '
'; - $body .= '
'; - $k = 0;$counter = 0; - foreach ($sxml->entry as $entry) { - $k++; - $media = $entry->children('http://search.yahoo.com/mrss/'); - $attrs = $media->group->player->attributes(); - $watch = $attrs['url']; - $vid_array = explode("?v=", $watch); - if(preg_match("/&/", $vid_array[1])){ - $vid_array = explode("&", $vid_array[1]); - $vid_array[1] = $vid_array[0]; - } - - $attrs = $media->group->thumbnail[0]->attributes(); - $thumbnail = $attrs['url']; - $yt = $media->children('http://gdata.youtube.com/schemas/2007'); - $attrs = $yt->duration->attributes(); - $length = $attrs['seconds']; - $gd = $entry->children('http://schemas.google.com/g/2005'); - if ($gd->rating) { - $attrs = $gd->rating->attributes(); - $rating = $attrs['average']; - } else { - $rating = 0; - } - $tags = array(); - $tags[] = $media->group->keywords; - $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch); - $body .= '
'; - $body .= ''; - - $body .= ''; - - $body .= ''; - - //$body .= ""; - - $body .= ""; - - $body .= ''; - $body .= '
'; - $body .= ""; - $body .= '
'; - $body .= "".$media->group->title."
"; - $body .= "Duration : " . sprintf("%0.2f", $length/60) . " min.
user rating : ".$rating."
"; - $body .= "Description : ".substr($media->group->description, 0, 140)." ..."; - $body .= '
play | add wwwroot."pg/videolist/new/".$container."/title_videourl/".$vid_array[1]."/page/".$queryCatgory."\");\">
'; - } - $body .= '
'; - print $body; - } - else if($queryCatgory == "metacafe") - { - - - $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10"; - - - $sxml = new DomDocument; - $sxml->load($feedURL); - $total = 999; - $startOffset = $start_index; - $endOffset = ($startOffset-1) + $results_perpage; - - $body = '
'; - $rem = floor($total/10); - $rem*=10; - if($rem<$total) - $last = $rem+1; - $lpVid = $total - $rem; - if($startOffset==1 && ($endOffset)==$total){} - else if($startOffset==1 && ($endOffset)<$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - else if($startOffset>1 && ($endOffset)<$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - else if($startOffset>1 && ($endOffset+$lpVid)>=$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - $body .= '
'; - $k = 0; - $body .= '
'; - $myitem = $sxml->getElementsByTagName('item'); - foreach($myitem as $searchNode){ - $k++; - $xmlTitle = $searchNode->getElementsByTagName("title"); - $valueTitle = $xmlTitle->item(0)->nodeValue; - - $xmlLink = $searchNode->getElementsByTagName("link"); - $valueLink = $xmlLink->item(0)->nodeValue; - - $xmlDesc = $searchNode->getElementsByTagName("description"); - $valueDesc = $xmlDesc->item(0)->nodeValue; - - $pattern = '/]+src[\\s=\'"]'; - $pattern .= '+([^"\'>\\s]+)/is'; - if(preg_match($pattern,$valueDesc,$match)){ - $thumbnail = $match[1]; - } - - $pattern = '/]+href[\\s=\'"]'; - $pattern .= '+([^"\'>\\s]+)/is'; - if(preg_match($pattern,$valueDesc,$match)){ - $anchor_src = $match[1]; - } - - $encodedVideoUrlArray = explode("/watch/", $valueLink); - $showEncodedVideo = $encodedVideoUrlArray[1]; - $metacafevideoIdArray = explode("/", $showEncodedVideo); - - $ot = "

"; - $ct = "

"; - $string = trim($valueDesc); - $start = intval(strpos($string, $ot) + strlen($ot)); - $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start)); - - $body .= '
'; - $body .= ''; - $body .= ''; - - $body .= ''; - - $body .= ''; - - //$body .= ""; - - $body .= ""; - - $body .= ''; - $body .= '
'; - $body .= ""; - $body .= '
'; - $body .= "".$valueTitle."
"; - //$body .= "Duration : " . sprintf("%0.2f", $length/60) . " min.
user rating : ".$rating."
"; - $body .= "Description : ".$desc_src; - $body .= '
play | add wwwroot."pg/videolist/new/".$container."/title_videourl/".$metacafevideoIdArray[0]."/page/".$queryCatgory."\");\">
'; - $body .= '
'; - } - $body .= '
'; - print $body; - } - else if($queryCatgory == "vimeo") - { - require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php"); - // Now lets do the search query. We will get an response object containing everything we need - $oResponse = VimeoVideosRequest::search($queryFeed); - - // We want the result videos as an array of objects - $aoVideos = $oResponse->getVideos(); - - // Just for code completion - $oVideo = new VimeoVideoEntity(); - - $total = count($aoVideos); - $startOffset = $start_index; - - $endOffset = ($startOffset-1) + $results_perpage; - $body = '
'; - $rem = floor($total/10); - $rem*=10; - if($rem<$total) - $last = $rem+1; - $lpVid = $total - $rem; - if($startOffset==1 && ($endOffset)==$total){} - else if($startOffset==1 && ($endOffset)<$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - else if($startOffset>1 && ($endOffset)<$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - else if($startOffset>1 && ($endOffset+$lpVid)>=$total){ - $body .= 'first | '; - $body .= 'previous | '; - $body .= 'next | '; - $body .= 'last'; - } - $body .= '
'; - $body .= '
'; - $counter = 0;$k = 0; - foreach($aoVideos as $oVideo) { - $k++; - if(($counter > $startOffset) && ($counter < $endOffset)) - { - //get all thumbnails - $aThumbnails = array(); - foreach($oVideo->getThumbnails() as $oThumbs) { - $aThumbnails[] = $oThumbs->getImageContent(); - } - - foreach($aThumbnails as $thumbnailArray){ - $thumbnail = $thumbnailArray; - break; - } - //print_r($oVideo); - $title = $oVideo->getTitle(); - $description = $oVideo->getCaption(); - $url = $oVideo->getUrl(); - $rating = $oVideo->getNumberOfLikes(); - $playedTimes = $oVideo->getNumberOfPlays(); - // Print all tags - $aTags = array(); - foreach($oVideo->getTags() as $oTag) { - $aTags[] = $oTag->getTag(); - } - $play_idArray = explode("http://vimeo.com/", $url); - $embedidArray = explode("/", $play_idArray[1]); - $body .= '
'; - $body .= ''; - $body .= ''; - - $body .= ''; - - $body .= ''; - - $body .= ""; - - $body .= ''; - $body .= '
'; - $body .= ""; - $body .= '
'; - $body .= "".$title."
"; - $body .= "User Likes : ".$rating."
"; - $body .= "Played : ".$playedTimes." times
"; - $body .= "Description : ".$description." ...
"; - $body .= "Tags : ".implode(', ', $aTags); - $body .= '
wwwroot."pg/videolist/new/".$container."/title_videourl/".$embedidArray[0]."/page/".$queryCatgory."\");\">
'; - $body .= '
'; - } - $counter++; - } - $body .= '
'; - print $body; - } -} -exit; -?> + + * @copyright Prateek Choudhary + */ + +// Get the current page's owner +//set_page_owner($_SESSION['container_guid']); + +$page_ownerx = get_entity(get_input('container')); +if(!$page_ownerx) + $page_ownerx = get_user_by_username(get_input('container')); +set_page_owner($page_ownerx->getGUID()); +$page_owner = page_owner_entity(); + +if($page_owner->type == "group") + $container = "group:".$page_ownerx->getGUID(); +else + $container = $page_ownerx->username; + +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); +} + +global $CONFIG; + $queryFeed = get_input('q'); + $start_index = get_input('start_index'); + $results_perpage = 10; + $queryCatgory = get_input('page'); +if (!isset($queryFeed) || empty($queryFeed)) { + +} +else +{ + $q = $queryFeed; + if($queryCatgory == "youtube") + { + $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10"; + $sxml = simplexml_load_file($feedURL); + + $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/'); + $total = $counts->totalResults; + $startOffset = $counts->startIndex; + $endOffset = ($startOffset-1) + $counts->itemsPerPage; + + $body = '
'; + $rem = floor($total/10); + $rem*=10; + if($rem<$total) + $last = $rem+1; + $lpVid = $total - $rem; + if($startOffset==1 && ($endOffset)==$total){} + else if($startOffset==1 && ($endOffset)<$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + else if($startOffset>1 && ($endOffset)<$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + else if($startOffset>1 && ($endOffset+$lpVid)>=$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + $body .= '
'; + $body .= '
'; + $k = 0;$counter = 0; + foreach ($sxml->entry as $entry) { + $k++; + $media = $entry->children('http://search.yahoo.com/mrss/'); + $attrs = $media->group->player->attributes(); + $watch = $attrs['url']; + $vid_array = explode("?v=", $watch); + if(preg_match("/&/", $vid_array[1])){ + $vid_array = explode("&", $vid_array[1]); + $vid_array[1] = $vid_array[0]; + } + + $attrs = $media->group->thumbnail[0]->attributes(); + $thumbnail = $attrs['url']; + $yt = $media->children('http://gdata.youtube.com/schemas/2007'); + $attrs = $yt->duration->attributes(); + $length = $attrs['seconds']; + $gd = $entry->children('http://schemas.google.com/g/2005'); + if ($gd->rating) { + $attrs = $gd->rating->attributes(); + $rating = $attrs['average']; + } else { + $rating = 0; + } + $tags = array(); + $tags[] = $media->group->keywords; + $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch); + $body .= '
'; + $body .= ''; + + $body .= ''; + + $body .= ''; + + //$body .= ""; + + $body .= ""; + + $body .= ''; + $body .= '
'; + $body .= ""; + $body .= '
'; + $body .= "".$media->group->title."
"; + $body .= "Duration : " . sprintf("%0.2f", $length/60) . " min.
user rating : ".$rating."
"; + $body .= "Description : ".substr($media->group->description, 0, 140)." ..."; + $body .= '
play | add wwwroot."pg/videolist/new/".$container."/title_videourl/".$vid_array[1]."/page/".$queryCatgory."\");\">
'; + } + $body .= '
'; + print $body; + } + else if($queryCatgory == "metacafe") + { + + + $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10"; + + + $sxml = new DomDocument; + $sxml->load($feedURL); + $total = 999; + $startOffset = $start_index; + $endOffset = ($startOffset-1) + $results_perpage; + + $body = '
'; + $rem = floor($total/10); + $rem*=10; + if($rem<$total) + $last = $rem+1; + $lpVid = $total - $rem; + if($startOffset==1 && ($endOffset)==$total){} + else if($startOffset==1 && ($endOffset)<$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + else if($startOffset>1 && ($endOffset)<$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + else if($startOffset>1 && ($endOffset+$lpVid)>=$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + $body .= '
'; + $k = 0; + $body .= '
'; + $myitem = $sxml->getElementsByTagName('item'); + foreach($myitem as $searchNode){ + $k++; + $xmlTitle = $searchNode->getElementsByTagName("title"); + $valueTitle = $xmlTitle->item(0)->nodeValue; + + $xmlLink = $searchNode->getElementsByTagName("link"); + $valueLink = $xmlLink->item(0)->nodeValue; + + $xmlDesc = $searchNode->getElementsByTagName("description"); + $valueDesc = $xmlDesc->item(0)->nodeValue; + + $pattern = '/]+src[\\s=\'"]'; + $pattern .= '+([^"\'>\\s]+)/is'; + if(preg_match($pattern,$valueDesc,$match)){ + $thumbnail = $match[1]; + } + + $pattern = '/]+href[\\s=\'"]'; + $pattern .= '+([^"\'>\\s]+)/is'; + if(preg_match($pattern,$valueDesc,$match)){ + $anchor_src = $match[1]; + } + + $encodedVideoUrlArray = explode("/watch/", $valueLink); + $showEncodedVideo = $encodedVideoUrlArray[1]; + $metacafevideoIdArray = explode("/", $showEncodedVideo); + + $ot = "

"; + $ct = "

"; + $string = trim($valueDesc); + $start = intval(strpos($string, $ot) + strlen($ot)); + $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start)); + + $body .= '
'; + $body .= ''; + $body .= ''; + + $body .= ''; + + $body .= ''; + + //$body .= ""; + + $body .= ""; + + $body .= ''; + $body .= '
'; + $body .= ""; + $body .= '
'; + $body .= "".$valueTitle."
"; + //$body .= "Duration : " . sprintf("%0.2f", $length/60) . " min.
user rating : ".$rating."
"; + $body .= "Description : ".$desc_src; + $body .= '
play | add wwwroot."pg/videolist/new/".$container."/title_videourl/".$metacafevideoIdArray[0]."/page/".$queryCatgory."\");\">
'; + $body .= '
'; + } + $body .= '
'; + print $body; + } + else if($queryCatgory == "vimeo") + { + require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php"); + // Now lets do the search query. We will get an response object containing everything we need + $oResponse = VimeoVideosRequest::search($queryFeed); + + // We want the result videos as an array of objects + $aoVideos = $oResponse->getVideos(); + + // Just for code completion + $oVideo = new VimeoVideoEntity(); + + $total = count($aoVideos); + $startOffset = $start_index; + + $endOffset = ($startOffset-1) + $results_perpage; + $body = '
'; + $rem = floor($total/10); + $rem*=10; + if($rem<$total) + $last = $rem+1; + $lpVid = $total - $rem; + if($startOffset==1 && ($endOffset)==$total){} + else if($startOffset==1 && ($endOffset)<$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + else if($startOffset>1 && ($endOffset)<$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + else if($startOffset>1 && ($endOffset+$lpVid)>=$total){ + $body .= 'first | '; + $body .= 'previous | '; + $body .= 'next | '; + $body .= 'last'; + } + $body .= '
'; + $body .= '
'; + $counter = 0;$k = 0; + foreach($aoVideos as $oVideo) { + $k++; + if(($counter > $startOffset) && ($counter < $endOffset)) + { + //get all thumbnails + $aThumbnails = array(); + foreach($oVideo->getThumbnails() as $oThumbs) { + $aThumbnails[] = $oThumbs->getImageContent(); + } + + foreach($aThumbnails as $thumbnailArray){ + $thumbnail = $thumbnailArray; + break; + } + //print_r($oVideo); + $title = $oVideo->getTitle(); + $description = $oVideo->getCaption(); + $url = $oVideo->getUrl(); + $rating = $oVideo->getNumberOfLikes(); + $playedTimes = $oVideo->getNumberOfPlays(); + // Print all tags + $aTags = array(); + foreach($oVideo->getTags() as $oTag) { + $aTags[] = $oTag->getTag(); + } + $play_idArray = explode("http://vimeo.com/", $url); + $embedidArray = explode("/", $play_idArray[1]); + $body .= '
'; + $body .= ''; + $body .= ''; + + $body .= ''; + + $body .= ''; + + $body .= ""; + + $body .= ''; + $body .= '
'; + $body .= ""; + $body .= '
'; + $body .= "".$title."
"; + $body .= "User Likes : ".$rating."
"; + $body .= "Played : ".$playedTimes." times
"; + $body .= "Description : ".$description." ...
"; + $body .= "Tags : ".implode(', ', $aTags); + $body .= '
wwwroot."pg/videolist/new/".$container."/title_videourl/".$embedidArray[0]."/page/".$queryCatgory."\");\">
'; + $body .= '
'; + } + $counter++; + } + $body .= '
'; + print $body; + } +} +exit; +?> diff --git a/browse.php b/browse.php index 064ce9574..b5ef13987 100644 --- a/browse.php +++ b/browse.php @@ -1,44 +1,44 @@ - - * @copyright Prateek Choudhary - */ -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - //get videolist GUID - $container_guid = get_input('container'); - $parent_container = ""; - if(isset($container_guid) && !empty($container_guid)){ - $container_guid = explode(":", $container_guid); - if($container_guid[0] == "group"){ - $container = get_entity($container_guid[1]); - set_page_owner($container->getGUID()); - $page_owner = page_owner_entity(); - set_context("groupsvideos"); - } - else{ - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - } - } - // Get the current page's owner - - - $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name); - - $area2 = elgg_view_title($title); - $area2 .= elgg_view("forms/browsetube"); - - $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2); - - page_draw($title, $body); -?> + + * @copyright Prateek Choudhary + */ +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + //get videolist GUID + $container_guid = get_input('container'); + $parent_container = ""; + if(isset($container_guid) && !empty($container_guid)){ + $container_guid = explode(":", $container_guid); + if($container_guid[0] == "group"){ + $container = get_entity($container_guid[1]); + set_page_owner($container->getGUID()); + $page_owner = page_owner_entity(); + set_context("groupsvideos"); + } + else{ + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + } + } + // Get the current page's owner + + + $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name); + + $area2 = elgg_view_title($title); + $area2 .= elgg_view("forms/browsetube"); + + $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2); + + page_draw($title, $body); +?> diff --git a/index.php b/index.php index 95026ec24..9c2b446a4 100644 --- a/index.php +++ b/index.php @@ -1,46 +1,46 @@ - - * @copyright Prateek Choudhary - */ - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - $owner = page_owner_entity(); - - //get videolist GUID - $container_guid = get_input('username'); - if(isset($container_guid) && !empty($container_guid)){ - $container_guid = explode(":", $container_guid); - if($container_guid[0] == "group"){ - $container = get_entity($container_guid[1]); - set_context("groupsvideos"); - //$page_owner = page_owner_entity(); - } - else{ - - } - } - //set page owner - //set_page_owner($videolist_guid); - - $title = sprintf(elgg_echo("videolist:home"), "$owner->name"); - - // Get objects - $area2 = elgg_view_title($title); - //set_input('search_viewtype', 'gallery'); - $area2 .= list_entities("object","videolist", page_owner(), 10); - - //$area2 .= elgg_view("staticvideo/index"); - - set_context('videolist'); - $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2); - - // Finally draw the page - page_draw($title, $body); -?> + + * @copyright Prateek Choudhary + */ + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + $owner = page_owner_entity(); + + //get videolist GUID + $container_guid = get_input('username'); + if(isset($container_guid) && !empty($container_guid)){ + $container_guid = explode(":", $container_guid); + if($container_guid[0] == "group"){ + $container = get_entity($container_guid[1]); + set_context("groupsvideos"); + //$page_owner = page_owner_entity(); + } + else{ + + } + } + //set page owner + //set_page_owner($videolist_guid); + + $title = sprintf(elgg_echo("videolist:home"), "$owner->name"); + + // Get objects + $area2 = elgg_view_title($title); + //set_input('search_viewtype', 'gallery'); + $area2 .= list_entities("object","videolist", page_owner(), 10); + + //$area2 .= elgg_view("staticvideo/index"); + + set_context('videolist'); + $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2); + + // Finally draw the page + page_draw($title, $body); +?> diff --git a/languages/en.php b/languages/en.php index d0c5555b0..7ea20abfe 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1,14 +1,15 @@ - - * @copyright Prateek Choudhary - */ - $english = array( + + * @copyright Prateek Choudhary + */ + $english = array( + "videolist" => "My Videos", "videolist:home" => '%s \'s Videos', @@ -48,9 +49,9 @@ "videolist:searchTubeVideos:googlevideos" => "Search video.google.com", "videolist:group" => "Group Videos", "videolist:groupall" => "All Group Videos", - "videolist:none" => "This group does not have any videos yet", - ); - - add_translation("en",$english); - + "videolist:none" => "This group does not have any videos yet", + ); + + add_translation("en",$english); + ?> diff --git a/manifest.xml b/manifest.xml index 0c2db8e00..36b3dc842 100644 --- a/manifest.xml +++ b/manifest.xml @@ -4,6 +4,6 @@ - + diff --git a/new.php b/new.php index 726245eb5..aa092284f 100644 --- a/new.php +++ b/new.php @@ -1,47 +1,47 @@ - - * @copyright Prateek Choudhary - */ - - - // Render the video upload page - // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); - - //get videolist GUID - $container_guid = get_input('container'); - if(isset($container_guid) && !empty($container_guid)){ - $container_guid = explode(":", $container_guid); - if($container_guid[0] == "group"){ - $container = get_entity($container_guid[1]); - set_page_owner($container->getGUID()); - $page_owner = page_owner_entity(); - set_context("groupsvideos"); - set_input("container_guid", $container->getGUID()); - } - else{ - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - set_input("container_guid", $_SESSION['guid']); - } - } - } - - $title = sprintf(elgg_echo("videolist:new"), $page_owner->name); - - $area2 = elgg_view_title($title); - $area2 .= elgg_view("forms/add"); - $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2); - - page_draw($title, $body); -?> + + * @copyright Prateek Choudhary + */ + + + // Render the video upload page + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + //get videolist GUID + $container_guid = get_input('container'); + if(isset($container_guid) && !empty($container_guid)){ + $container_guid = explode(":", $container_guid); + if($container_guid[0] == "group"){ + $container = get_entity($container_guid[1]); + set_page_owner($container->getGUID()); + $page_owner = page_owner_entity(); + set_context("groupsvideos"); + set_input("container_guid", $container->getGUID()); + } + else{ + // Get the current page's owner + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + set_input("container_guid", $_SESSION['guid']); + } + } + } + + $title = sprintf(elgg_echo("videolist:new"), $page_owner->name); + + $area2 = elgg_view_title($title); + $area2 .= elgg_view("forms/add"); + $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2); + + page_draw($title, $body); +?> diff --git a/start.php b/start.php index 4158dd35a..e7f6d6085 100644 --- a/start.php +++ b/start.php @@ -1,126 +1,127 @@ - - * @copyright Prateek Choudhary - */ - function videolist_init() { - - // Load system configuration - global $CONFIG; + + * @copyright Prateek Choudhary + */ + function videolist_init() { + + // Load system configuration + global $CONFIG; if (isloggedin()) { add_menu(elgg_echo('videolist'), $CONFIG->wwwroot . "pg/videolist/owned/" . $_SESSION['user']->username); } - + // Extend system CSS with our own styles - extend_view('css','videolist/css'); - // Load the language file - default is english + extend_view('css','videolist/css'); + + // Load the language file - default is english register_translations($CONFIG->pluginspath . "videolist/languages/"); - // Register a page handler, so we can have nice URLs + // Register a page handler, so we can have nice URLs register_page_handler('videolist','videolist_page_handler'); //extend this plugin for groups extend_view('groups/left_column','videolist/groupprofile_videolist'); - // Add a new videolist widget + // Add a new videolist widget add_widget_type('videolist_view',elgg_echo("videolist:widget"),elgg_echo("videolist:widget:description"), 'profile'); - if (is_callable('register_notification_object')) - register_notification_object('object', 'videolist', elgg_echo('videolist:new')); + if (is_callable('register_notification_object')) + register_notification_object('object', 'videolist', elgg_echo('videolist:new')); register_plugin_hook('object:notifications','object','videolist_object_notifications_intercept'); // Register URL handler - register_entity_url_handler('video_url','object', 'videolist'); + register_entity_url_handler('video_url','object', 'videolist'); register_entity_url_handler('video_url','object', 'watch'); //register entity url handler register_entity_url_handler('videolist_url','object','videolist'); - // Register entity type + // Register entity type register_entity_type('object','videolist'); - - } - - /** - * videolist page handler; allows the use of fancy URLs - * - * @param array $page From the page_handler function - * @return true|false Depending on success - */ + + } + + /** + * videolist page handler; allows the use of fancy URLs + * + * @param array $page From the page_handler function + * @return true|false Depending on success + */ function videolist_page_handler($page) { - - if (isset($page[0])) { - switch($page[0]) { + + if (isset($page[0])) { + switch($page[0]) { case "owned": if (isset($page[1])) set_input('username',$page[1]); @include(dirname(__FILE__) . "/index.php"); break; - case "search": @include(dirname(__FILE__) . "/world.php"); + case "search": @include(dirname(__FILE__) . "/world.php"); + break; + case "video": @include(dirname(__FILE__) . "/video.php"); break; - case "video": @include(dirname(__FILE__) . "/video.php"); - break; case "new": if (isset($page[3])) set_input('add_videourl',$page[3]); if (isset($page[5])) set_input('page',$page[5]); if (isset($page[1])) set_input('container',$page[1]); - @include(dirname(__FILE__) . "/new.php"); + @include(dirname(__FILE__) . "/new.php"); break; case "watch": set_input('video_id',$page[1]); - @include(dirname(__FILE__) . "/watch.php"); + @include(dirname(__FILE__) . "/watch.php"); break; case "browse": if (isset($page[1])) set_input('container',$page[1]); - @include(dirname(__FILE__) . "/browse.php"); + @include(dirname(__FILE__) . "/browse.php"); break; default : if (isset($page[1])) set_input('username',$page[1]); @include(dirname(__FILE__) . "/index.php"); - break; - } - // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file + break; + } + // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file } else { if (isset($page[1])) set_input('username',$page[1]); @include(dirname(__FILE__) . "/index.php"); - return true; - } - - return false; - - } + return true; + } + + return false; + + } - function videolist_pagesetup() { - - global $CONFIG; + function videolist_pagesetup() { + + global $CONFIG; $page_owner = page_owner_entity(); - if ($page_owner instanceof ElggGroup && get_context() == "groups") { - add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username); - } - //add submenu options - else if (get_context() == "videolist") { + if ($page_owner instanceof ElggGroup && get_context() == "groups") { + add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username); + } + //add submenu options + else if (get_context() == "videolist") { /********************************************************************************************** ****if user is OR is not registered user then show him following page menus to choose from ***********************************************************************************************/ /* - add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username); + add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username); add_submenu_item(elgg_echo('videolist:new'),$CONFIG->wwwroot."pg/videolist/new"); add_submenu_item(elgg_echo('videolist:find'),$CONFIG->wwwroot."pg/videolist/search/"); */ - if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) { - add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username); + if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) { + add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username); add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username); - add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username); - add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/"); - } else if (page_owner() && $page_owner instanceof ElggUser) { - add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username); - } + add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username); + add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/"); + } else if (page_owner() && $page_owner instanceof ElggUser) { + add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username); + } } else if (get_context() == "groupsvideos") { add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username); @@ -128,87 +129,87 @@ add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username); add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username); } - } - } + } + } - function video_url($entity) { + function video_url($entity) { global $CONFIG; - $video_id = $entity->video_id; - return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id; - + $video_id = $entity->video_id; + return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id; + } - function videolist_url($videolistpage) { - + function videolist_url($videolistpage) { + global $CONFIG; $owner = $videolistpage->container_guid; - $userdata = get_entity($owner); - $title = $videolistpage->title; + $userdata = get_entity($owner); + $title = $videolistpage->title; $title = friendly_title($title); - return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID(); + return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID(); } - /** - * Event handler for videolist - * - */ - function videolist_object_notifications($event, $object_type, $object) { - - static $flag; - if (!isset($flag)) $flag = 0; - - if (is_callable('object_notifications')) - if ($object instanceof ElggObject) { - if ($object->getSubtype() == 'videolist') { - if ($flag == 0) { - $flag = 1; - object_notifications($event, $object_type, $object); - } - } - } + /** + * Event handler for videolist + * + */ + function videolist_object_notifications($event, $object_type, $object) { + + static $flag; + if (!isset($flag)) $flag = 0; + + if (is_callable('object_notifications')) + if ($object instanceof ElggObject) { + if ($object->getSubtype() == 'videolist') { + if ($flag == 0) { + $flag = 1; + object_notifications($event, $object_type, $object); + } + } + } } - /** - * Intercepts the notification on an event of new video being created and prevents a notification from going out - * (because one will be sent on the annotation) - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - * @return unknown - */ - function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) { - if (isset($params)) { - if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) { - if ($params['object']->getSubtype() == 'videolist') { - return true; - } - } - } - return null; + /** + * Intercepts the notification on an event of new video being created and prevents a notification from going out + * (because one will be sent on the annotation) + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + * @return unknown + */ + function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) { + if (isset($params)) { + if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) { + if ($params['object']->getSubtype() == 'videolist') { + return true; + } + } + } + return null; } - - // Register a handler for adding videos - register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener'); - - // Register a handler for delete videos + + // Register a handler for adding videos + register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener'); + + // Register a handler for delete videos register_elgg_event_handler('delete', 'videolist', 'videolist_delete_event_listener'); - - // Make sure the status initialisation function is called on initialisation - register_elgg_event_handler('init','system','videolist_init'); + + // Make sure the status initialisation function is called on initialisation + register_elgg_event_handler('init','system','videolist_init'); register_elgg_event_handler('pagesetup','system','videolist_pagesetup'); - register_elgg_event_handler('annotate','all','videolist_object_notifications'); + register_elgg_event_handler('annotate','all','videolist_object_notifications'); - // Register actions - global $CONFIG; + // Register actions + global $CONFIG; register_action("videolist/addvideo", false, $CONFIG->pluginspath . "videolist/actions/addvideo.php"); register_action("videolist/tubesearch", false, $CONFIG->pluginspath . "videolist/actions/tubesearch.php"); //register_action("videolist/addcomment", false, $CONFIG->pluginspath . "videolist/actions/comments/add.php"); register_action("videolist/remove", false, $CONFIG->pluginspath . "videolist/actions/delete.php"); - + ?> diff --git a/views/default/forms/add.php b/views/default/forms/add.php index f9837ede4..b387731f8 100644 --- a/views/default/forms/add.php +++ b/views/default/forms/add.php @@ -1,176 +1,176 @@ - - * @copyright Prateek Choudhary - */ -// Make sure we're logged in (send us to the front page if not) - gatekeeper(); - $page_owner = page_owner_entity(); - $error = array( - 'no-video' => 1 - ); - $error_msg = array( - 'no-video' => "Please enter a valid video url" - ); - - $container_guid = get_input("container_guid"); - set_page_owner($container_guid); - - $confirm_action = get_input('video_action'); - $guid = get_input('guid'); - $access_id = get_input('access_id'); - $title_videourl = get_input('title_videourl'); - $Pagecontainer = get_input('page'); - $get_addvideourl = get_input('add_videourl'); - $timestamp = time(); - $token = generate_action_token(time()); - if(!empty($get_addvideourl) && ($Pagecontainer == "youtube")) - $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl; - else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) - $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl; - else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) - $title_add_videourl = "http://vimeo.com/".$get_addvideourl; - else - $title_add_videourl = ""; - - - $tags = get_input('videolisttags'); - - function video_youtube_parse_url($url) - { - if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches)) - { - return false; - } - - $domain = $matches[2] . $matches[3]; - $path = $matches[4]; - - if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches)) - { - return false; - } - - $hash = $matches[2]; - - - return $domain . 'v/' . $hash; - } - - function video_vimeo_parse_url($url) - { - if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) - { - return false; - } - - $domain = $matches[2] . $matches[3]; - $path = $matches[4]; - - $hash = $matches[2]; - - - return $domain . '/' . $hash; - } - - function video_metacafe_parse_url($url) - { - if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) - { - return false; - } - - $domain = $matches[2] . $matches[3]; - $path = $matches[4]; - - $hash = $matches[2]; - - - return $domain . '/' . $hash; - } - - if(isset($confirm_action) && ($confirm_action == 'add_video')) - { - if(isset($title_videourl) && ($title_videourl != '')) - { - if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){ - if(preg_match("/youtube/i", $title_videourl)) - $Pagecontainer = "youtube"; - if(preg_match("/vimeo/i", $title_videourl)) - $Pagecontainer = "vimeo"; - if(preg_match("/metacafe/i", $title_videourl)) - $Pagecontainer = "metacafe"; - } - if($Pagecontainer == "youtube") - $is_valid_video = video_youtube_parse_url($title_videourl); - else if($Pagecontainer == "vimeo"){ - $is_valid_video = video_vimeo_parse_url($title_videourl); - $is_valid_video = $get_addvideourl; - } - else if($Pagecontainer == "metacafe"){ - $is_valid_video = video_metacafe_parse_url($title_videourl); - $is_valid_video = $get_addvideourl; - } - if($is_valid_video) - { - $error['no-video'] = 1; - $_SESSION['candidate_profile_video'] = $is_valid_video; - $_SESSION['candidate_profile_video_access_id'] = $access_id; - $_SESSION['videolisttags'] = $tags; - $_SESSION['Pagecontainer'] = $Pagecontainer; - $_SESSION['container_guid'] = $container_guid; - //echo $_SESSION['candidate_profile_video']; - $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}"; - forward($url); - } - else - $error['no-video'] = 0; - } - else - { - $error['no-video'] = 0; - } - } - - - - $body = '
'; - - $body .= '
'; - $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video')); - $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); - - - $body .= '

'.$error_msg['no-video'].'
'; - } - $body .= '

'; - - $body .= '

'; - - $body .= '

'; - $body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit'))); - $body .= '
'; - $body .= '
'; - - print $body."

"; - - -?> - - + + * @copyright Prateek Choudhary + */ +// Make sure we're logged in (send us to the front page if not) + gatekeeper(); + $page_owner = page_owner_entity(); + $error = array( + 'no-video' => 1 + ); + $error_msg = array( + 'no-video' => "Please enter a valid video url" + ); + + $container_guid = get_input("container_guid"); + set_page_owner($container_guid); + + $confirm_action = get_input('video_action'); + $guid = get_input('guid'); + $access_id = get_input('access_id'); + $title_videourl = get_input('title_videourl'); + $Pagecontainer = get_input('page'); + $get_addvideourl = get_input('add_videourl'); + $timestamp = time(); + $token = generate_action_token(time()); + if(!empty($get_addvideourl) && ($Pagecontainer == "youtube")) + $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl; + else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) + $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl; + else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) + $title_add_videourl = "http://vimeo.com/".$get_addvideourl; + else + $title_add_videourl = ""; + + + $tags = get_input('videolisttags'); + + function video_youtube_parse_url($url) + { + if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches)) + { + return false; + } + + $domain = $matches[2] . $matches[3]; + $path = $matches[4]; + + if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches)) + { + return false; + } + + $hash = $matches[2]; + + + return $domain . 'v/' . $hash; + } + + function video_vimeo_parse_url($url) + { + if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) + { + return false; + } + + $domain = $matches[2] . $matches[3]; + $path = $matches[4]; + + $hash = $matches[2]; + + + return $domain . '/' . $hash; + } + + function video_metacafe_parse_url($url) + { + if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) + { + return false; + } + + $domain = $matches[2] . $matches[3]; + $path = $matches[4]; + + $hash = $matches[2]; + + + return $domain . '/' . $hash; + } + + if(isset($confirm_action) && ($confirm_action == 'add_video')) + { + if(isset($title_videourl) && ($title_videourl != '')) + { + if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){ + if(preg_match("/youtube/i", $title_videourl)) + $Pagecontainer = "youtube"; + if(preg_match("/vimeo/i", $title_videourl)) + $Pagecontainer = "vimeo"; + if(preg_match("/metacafe/i", $title_videourl)) + $Pagecontainer = "metacafe"; + } + if($Pagecontainer == "youtube") + $is_valid_video = video_youtube_parse_url($title_videourl); + else if($Pagecontainer == "vimeo"){ + $is_valid_video = video_vimeo_parse_url($title_videourl); + $is_valid_video = $get_addvideourl; + } + else if($Pagecontainer == "metacafe"){ + $is_valid_video = video_metacafe_parse_url($title_videourl); + $is_valid_video = $get_addvideourl; + } + if($is_valid_video) + { + $error['no-video'] = 1; + $_SESSION['candidate_profile_video'] = $is_valid_video; + $_SESSION['candidate_profile_video_access_id'] = $access_id; + $_SESSION['videolisttags'] = $tags; + $_SESSION['Pagecontainer'] = $Pagecontainer; + $_SESSION['container_guid'] = $container_guid; + //echo $_SESSION['candidate_profile_video']; + $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}"; + forward($url); + } + else + $error['no-video'] = 0; + } + else + { + $error['no-video'] = 0; + } + } + + + + $body = '
'; + + $body .= '
'; + $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video')); + $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); + + + $body .= '

'.$error_msg['no-video'].'
'; + } + $body .= '

'; + + $body .= '

'; + + $body .= '

'; + $body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit'))); + $body .= '
'; + $body .= '
'; + + print $body."

"; + + +?> + + diff --git a/views/default/forms/browsetube.php b/views/default/forms/browsetube.php index 50fa7b164..601fb4e6a 100644 --- a/views/default/forms/browsetube.php +++ b/views/default/forms/browsetube.php @@ -1,257 +1,257 @@ - - * @copyright Prateek Choudhary - */ - -$getcontainer_guid = get_input("container"); -$container_guid = explode(":", $getcontainer_guid); -if($container_guid[0] == "group"){ - $container = $container_guid[1]; -} -else{ - $container = $getcontainer_guid; -} - $error = array( - 'no-search' => 1 - ); - $error_msg = array( - 'no-search' => "Please enter a valid search term" - ); - $browseCat = get_input('q'); - if(empty($browseCat) || !isset($browseCat)) - $browseCat = "youtube"; - $confirm_action = get_input('video_action'); - - if(isset($confirm_action) && ($confirm_action == 'search_video')) - { - if(isset($title_search) && ($title_search != '')) - $error['no-search'] = 0; - else - $error['no-search'] = 1; - } - - - //$body = '
'; - //Load youtube menu - $body .= "
"; - $body .= "
    "; - $body .= "
  • "; - $body .= "YouTube"; - $body .= "
  • "; - $body .= "
  • "; - $body .= "Metacafe"; - $body .= "
  • "; - $body .= "
  • "; - $body .= "Vimeo"; - $body .= "
  • "; - /* - $body .= "
  • "; - $body .= "Google Videos"; - $body .= "
  • "; - */ - $body .= "
"; - $body .= "
"; - - $body .= "
"; - - //$body .= "
"; - $body .= '
'; - //$body .= ""; - $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'search_video')); - $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); - //$body .= elgg_view('input/hidden',array('internalname'=>'start_index', 'value'=>1)); - - switch($browseCat) - { - case "youtube" : - $body .= elgg_view('forms/labels/youtube'); - break; - case "metacafe" : - $body .= elgg_view('forms/labels/metacafe'); - break; - case "vimeo" : - $body .= elgg_view('forms/labels/vimeo'); - break; - case "googlevideos" : - $body .= elgg_view('forms/labels/googlevideos'); - break; - default : - $body .= elgg_view('forms/labels/youtube'); - break; - } - $body .= elgg_view('input/hidden',array('internalname'=>'page', 'value'=>$browseCat)); - $body .= '
'; - //$body .= '
'; - //$body .= '
'; - - $body .= '
'; - $body .= '
'; - $body .= '
'; - $body .= '
'; - $body .= '
'; - $body .= '
'; - - print $body."

"; - - -?> - - + + * @copyright Prateek Choudhary + */ + +$getcontainer_guid = get_input("container"); +$container_guid = explode(":", $getcontainer_guid); +if($container_guid[0] == "group"){ + $container = $container_guid[1]; +} +else{ + $container = $getcontainer_guid; +} + $error = array( + 'no-search' => 1 + ); + $error_msg = array( + 'no-search' => "Please enter a valid search term" + ); + $browseCat = get_input('q'); + if(empty($browseCat) || !isset($browseCat)) + $browseCat = "youtube"; + $confirm_action = get_input('video_action'); + + if(isset($confirm_action) && ($confirm_action == 'search_video')) + { + if(isset($title_search) && ($title_search != '')) + $error['no-search'] = 0; + else + $error['no-search'] = 1; + } + + + //$body = '
'; + //Load youtube menu + $body .= "
"; + $body .= "
    "; + $body .= "
  • "; + $body .= "YouTube"; + $body .= "
  • "; + $body .= "
  • "; + $body .= "Metacafe"; + $body .= "
  • "; + $body .= "
  • "; + $body .= "Vimeo"; + $body .= "
  • "; + /* + $body .= "
  • "; + $body .= "Google Videos"; + $body .= "
  • "; + */ + $body .= "
"; + $body .= "
"; + + $body .= "
"; + + //$body .= "
"; + $body .= '
'; + //$body .= ""; + $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'search_video')); + $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid'])); + //$body .= elgg_view('input/hidden',array('internalname'=>'start_index', 'value'=>1)); + + switch($browseCat) + { + case "youtube" : + $body .= elgg_view('forms/labels/youtube'); + break; + case "metacafe" : + $body .= elgg_view('forms/labels/metacafe'); + break; + case "vimeo" : + $body .= elgg_view('forms/labels/vimeo'); + break; + case "googlevideos" : + $body .= elgg_view('forms/labels/googlevideos'); + break; + default : + $body .= elgg_view('forms/labels/youtube'); + break; + } + $body .= elgg_view('input/hidden',array('internalname'=>'page', 'value'=>$browseCat)); + $body .= '
'; + //$body .= '
'; + //$body .= '
'; + + $body .= '
'; + $body .= '
'; + $body .= '
'; + $body .= '
'; + $body .= '
'; + $body .= '
'; + + print $body."

"; + + +?> + + diff --git a/views/default/forms/labels/googlevideos.php b/views/default/forms/labels/googlevideos.php index de263c1c9..76673c10b 100644 --- a/views/default/forms/labels/googlevideos.php +++ b/views/default/forms/labels/googlevideos.php @@ -1,13 +1,13 @@ - * @copyright Prateek Choudhary + /** + * Elgg User Profile Video Plugin + * This plugin allows users to browse youtube videos + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ $body = '

'; $body .= '
Loading...
'; print $body; diff --git a/views/default/forms/labels/metacafe.php b/views/default/forms/labels/metacafe.php index 79e87d1be..7003b6743 100644 --- a/views/default/forms/labels/metacafe.php +++ b/views/default/forms/labels/metacafe.php @@ -1,13 +1,13 @@ - * @copyright Prateek Choudhary + /** + * Elgg Video Plugin + * This plugin allows users to create a library of youtube/vimeo/metacafe videos + * @file - load metacafe label + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ $body = '

'; print $body; diff --git a/views/default/forms/labels/vimeo.php b/views/default/forms/labels/vimeo.php index e5cf21235..6a15909b4 100644 --- a/views/default/forms/labels/vimeo.php +++ b/views/default/forms/labels/vimeo.php @@ -1,13 +1,13 @@ - * @copyright Prateek Choudhary + * @file - load vimeo label + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ $body = '

'; print $body; diff --git a/views/default/forms/labels/youtube.php b/views/default/forms/labels/youtube.php index 40be100ee..4ec53b27a 100644 --- a/views/default/forms/labels/youtube.php +++ b/views/default/forms/labels/youtube.php @@ -1,13 +1,13 @@ - * @copyright Prateek Choudhary + /** + * Elgg Video Plugin + * This plugin allows users to create a library of youtube/vimeo/metacafe videos + * @file - load youtube label + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ $body = '

'; print $body; diff --git a/views/default/object/watch.php b/views/default/object/watch.php index c33a7b988..9b3de9626 100644 --- a/views/default/object/watch.php +++ b/views/default/object/watch.php @@ -1,45 +1,45 @@ - - * @copyright Prateek Choudhary - */ -$videodiv = ''; -$width = "600"; -$height = "400"; -$file = $vars['entity']; -if(isset($vars['entity'])) -{ - -$videos = get_entity($vars['entity']); -$title = $videos->title; -$url = $videos->url; -$videoid = $videos->video_id; -$videodiv = "

".$title."

"; -if($videos->videotype == "youtube"){ - $videodiv .= "
"; -} -else if($videos->videotype == "metacafe"){ - $videoid_id = $videoid; - $path = explode("/", $videos->thumbnail); - $path = array_reverse($path); - $thumbnailArray = explode(".", $path[0]); - $videoid = $videoid_id."/".$thumbnailArray[0].".swf"; - $videodiv .= "
"; - -} -else if($videos->videotype == "vimeo"){ - $videodiv .= "
"; -} -$videodiv .= "
"; -$videodiv .= elgg_view_likes($videos); -$videodiv .= elgg_view_comments($videos); -print $videodiv; - -//echo elgg_view_comments($videos); -} -?> + + * @copyright Prateek Choudhary + */ +$videodiv = ''; +$width = "600"; +$height = "400"; +$file = $vars['entity']; +if(isset($vars['entity'])) +{ + +$videos = get_entity($vars['entity']); +$title = $videos->title; +$url = $videos->url; +$videoid = $videos->video_id; +$videodiv = "

".$title."

"; +if($videos->videotype == "youtube"){ + $videodiv .= "
"; +} +else if($videos->videotype == "metacafe"){ + $videoid_id = $videoid; + $path = explode("/", $videos->thumbnail); + $path = array_reverse($path); + $thumbnailArray = explode(".", $path[0]); + $videoid = $videoid_id."/".$thumbnailArray[0].".swf"; + $videodiv .= "
"; + +} +else if($videos->videotype == "vimeo"){ + $videodiv .= "
"; +} +$videodiv .= "
"; +$videodiv .= elgg_view_likes($videos); +$videodiv .= elgg_view_comments($videos); +print $videodiv; + +//echo elgg_view_comments($videos); +} +?> diff --git a/views/default/river/object/videolist/annotate.php b/views/default/river/object/videolist/annotate.php index d243c7ef3..6c03d4445 100644 --- a/views/default/river/object/videolist/annotate.php +++ b/views/default/river/object/videolist/annotate.php @@ -1,13 +1,13 @@ -getSubject(); - $object = $statement->getObject(); - - $url = "getURL()}\">{$performed_by->name}"; - $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " "; - $string .= "getURL() . "\">" . elgg_echo("videolist:river:item") . ""; - - echo $string; - +getSubject(); + $object = $statement->getObject(); + + $url = "getURL()}\">{$performed_by->name}"; + $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " "; + $string .= "getURL() . "\">" . elgg_echo("videolist:river:item") . ""; + + echo $string; + ?> diff --git a/views/default/river/object/videolist/create.php b/views/default/river/object/videolist/create.php index 061d01dd5..0ed570378 100644 --- a/views/default/river/object/videolist/create.php +++ b/views/default/river/object/videolist/create.php @@ -1,18 +1,18 @@ -subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $thumbnail = $object->thumbnail; - //$url = $object->getURL(); - - $url = "getURL()}\">{$performed_by->name}"; - $title = $object->title; - if(!$title) - $title = "untitled"; - $string = sprintf(elgg_echo("videolist:river:created"),$url) . " "; - $string .= elgg_echo("videolist:river:item") . " titled getURL() . "\">" . $title . ""; - $string .= "
"; - $string .= "getURL() . "\">"; - $string .= "
"; - +subject_guid); // $statement->getSubject(); + $object = get_entity($vars['item']->object_guid); + $thumbnail = $object->thumbnail; + //$url = $object->getURL(); + + $url = "getURL()}\">{$performed_by->name}"; + $title = $object->title; + if(!$title) + $title = "untitled"; + $string = sprintf(elgg_echo("videolist:river:created"),$url) . " "; + $string .= elgg_echo("videolist:river:item") . " titled getURL() . "\">" . $title . ""; + $string .= "
"; + $string .= "getURL() . "\">"; + $string .= "
"; + echo $string; \ No newline at end of file diff --git a/views/default/staticvideo/index.php b/views/default/staticvideo/index.php index a95625f3c..1b32f316b 100644 --- a/views/default/staticvideo/index.php +++ b/views/default/staticvideo/index.php @@ -1,12 +1,12 @@ - * @copyright Prateek Choudhary +/** + * Elgg Candidate Profile Plugin - file search.php + * This plugin allows users to create custom candidate profile + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ diff --git a/views/default/videolist/css.php b/views/default/videolist/css.php index 76f23941d..8c52b0e6c 100644 --- a/views/default/videolist/css.php +++ b/views/default/videolist/css.php @@ -1,199 +1,199 @@ - - * @copyright Prateek Choudhary - */ - - -?> - -.error{ -color:red; -font-weight:bold; -font-size:11px; -} -#video-list-main{ -padding:10px; -} -#videocontainer{ -width:100%; -margin-bottom:10px; -} -.search_gallery_item{ -border:0px solid #CCCCCC; -} -#videobox{ -width:98%; -text-align:center; -margin-top:10px; -} -#videoDescbox{ -width:95%; -margin:0px 5px 0px 8px; -} -#videoActionbox{ -width:90%; -margin:0px 5px 0px 8px; -float:left; -} -#videothumbnail-box{ -float:left; -width:35%; -background: #333333; -text-align:center; -padding:3px 1px 3px 0px; -} -#videotitle-box{ -width:60%; -float:left; -font-size:12px; -font-weight:bold; -text-align:left; -padding-left:5px; -color:#474B9F; -} -.title{ -font-weight:bold; -} -#profile_video_widget_container{ -margin:0px 10px 10px 10px; -padding:8px; --moz-border-radius-topleft:8px; --moz-border-radius-topright:8px; --moz-border-radius-bottomleft:8px; --moz-border-radius-bottomright:8px; -border:0px solid #C3C3C3; -background: #FFFFFF; -max-height:250px; -overflow-y:auto; -} -#profile_video_image_container{ -float:left; -width:95%; -margin:6px 2px 0px 6px; -border-bottom:1px solid #CCC; -padding-bottom:3px; -} - -#widget_container_header{ -color:#474B9F; -margin:0px 0px 5px 0px; -font-weight:bold; -font-size:13px; -} -#loadingSearch{ -width:100%; -} -#SearchContainer{ -width:100%; -} -#responseSearch{ -padding:15px; -} -#paginateSearch{ --moz-border-radius-topleft:5px; --moz-border-radius-topright:5px; -padding:2px 5px 2px 0px; -text-align:right; -background:#FFF; -border:0px solid #CCC; -color:#666; -} -th{ -text-align:center; -font-weight:bold; -font-size:13px; -} -#parentTab{ --moz-border-radius-bottomleft:8px; --moz-border-radius-bottomright:8px; --moz-border-radius-topleft:8px; --moz-border-radius-topright:8px; -border-top:1px solid #CCC; -border-bottom:6px solid #CCC; -border-left:1px solid #CCC; -border-right:5px solid #CCC; -background:#FFFFFF; -margin-top:7px; -} -.tabcellDesc{ -padding:5px 5px 5px 10px; -text-align: left; -} -.tabcellText{ -padding:5px; -text-align: center; -} -.videoDisp{ -position:absolute; --moz-border-radius-topleft:5px; --moz-border-radius-topright:5px; --moz-border-radius-bottomleft:5px; --moz-border-radius-bottomright:5px; -border:1px solid #000000; -display:none; -padding:10px; -margin-left:120px; -margin-top:-100px; -background:#FFFFFF; -z-index:300000; -} -.videolist-content{ --moz-border-radius-topleft:5px; --moz-border-radius-topright:5px; --moz-border-radius-bottomleft:5px; --moz-border-radius-bottomright:5px; -border:1px solid #C3C3C3; -width:675px; -margin:10px 0px 10px 10px; -padding:10px; -background:#FFFFFF; -} -.tubesearch{ --moz-border-radius-topleft:5px; --moz-border-radius-topright:5px; --moz-border-radius-bottomleft:5px; --moz-border-radius-bottomright:5px; -border:1px solid #666666; -} -#comment_area_video_title{ -padding:10px; --moz-border-radius-topleft:5px; --moz-border-radius-topright:5px; --moz-border-radius-bottomleft:5px; --moz-border-radius-bottomright:5px; -border:1px solid #CCCCCC; -border:1px solid #CCCCCC; -background:#FFFFFF; -} -.vid-comment-widget{ -font-size:11px; -font-weight:normal; -} -.searchvideorow{ -padding:10px; --moz-border-radius-topleft:5px; --moz-border-radius-topright:5px; --moz-border-radius-bottomleft:5px; --moz-border-radius-bottomright:5px; -border:1px solid #CCCCCC; -} -#videosearch-tablecontainer{ --moz-border-radius-bottomleft:5px; --moz-border-radius-bottomright:5px; -border:1px solid #CCCCCC; -background:#FFF; -padding:10px; -} -#videosearch-interface{ -border-color:#CCCCCC; -border-style:solid; -border-width:0 1px 1px; -margin-top:-15px; -padding:15px 0 15px 20px; -} + + * @copyright Prateek Choudhary + */ + + +?> + +.error{ +color:red; +font-weight:bold; +font-size:11px; +} +#video-list-main{ +padding:10px; +} +#videocontainer{ +width:100%; +margin-bottom:10px; +} +.search_gallery_item{ +border:0px solid #CCCCCC; +} +#videobox{ +width:98%; +text-align:center; +margin-top:10px; +} +#videoDescbox{ +width:95%; +margin:0px 5px 0px 8px; +} +#videoActionbox{ +width:90%; +margin:0px 5px 0px 8px; +float:left; +} +#videothumbnail-box{ +float:left; +width:35%; +background: #333333; +text-align:center; +padding:3px 1px 3px 0px; +} +#videotitle-box{ +width:60%; +float:left; +font-size:12px; +font-weight:bold; +text-align:left; +padding-left:5px; +color:#474B9F; +} +.title{ +font-weight:bold; +} +#profile_video_widget_container{ +margin:0px 10px 10px 10px; +padding:8px; +-moz-border-radius-topleft:8px; +-moz-border-radius-topright:8px; +-moz-border-radius-bottomleft:8px; +-moz-border-radius-bottomright:8px; +border:0px solid #C3C3C3; +background: #FFFFFF; +max-height:250px; +overflow-y:auto; +} +#profile_video_image_container{ +float:left; +width:95%; +margin:6px 2px 0px 6px; +border-bottom:1px solid #CCC; +padding-bottom:3px; +} + +#widget_container_header{ +color:#474B9F; +margin:0px 0px 5px 0px; +font-weight:bold; +font-size:13px; +} +#loadingSearch{ +width:100%; +} +#SearchContainer{ +width:100%; +} +#responseSearch{ +padding:15px; +} +#paginateSearch{ +-moz-border-radius-topleft:5px; +-moz-border-radius-topright:5px; +padding:2px 5px 2px 0px; +text-align:right; +background:#FFF; +border:0px solid #CCC; +color:#666; +} +th{ +text-align:center; +font-weight:bold; +font-size:13px; +} +#parentTab{ +-moz-border-radius-bottomleft:8px; +-moz-border-radius-bottomright:8px; +-moz-border-radius-topleft:8px; +-moz-border-radius-topright:8px; +border-top:1px solid #CCC; +border-bottom:6px solid #CCC; +border-left:1px solid #CCC; +border-right:5px solid #CCC; +background:#FFFFFF; +margin-top:7px; +} +.tabcellDesc{ +padding:5px 5px 5px 10px; +text-align: left; +} +.tabcellText{ +padding:5px; +text-align: center; +} +.videoDisp{ +position:absolute; +-moz-border-radius-topleft:5px; +-moz-border-radius-topright:5px; +-moz-border-radius-bottomleft:5px; +-moz-border-radius-bottomright:5px; +border:1px solid #000000; +display:none; +padding:10px; +margin-left:120px; +margin-top:-100px; +background:#FFFFFF; +z-index:300000; +} +.videolist-content{ +-moz-border-radius-topleft:5px; +-moz-border-radius-topright:5px; +-moz-border-radius-bottomleft:5px; +-moz-border-radius-bottomright:5px; +border:1px solid #C3C3C3; +width:675px; +margin:10px 0px 10px 10px; +padding:10px; +background:#FFFFFF; +} +.tubesearch{ +-moz-border-radius-topleft:5px; +-moz-border-radius-topright:5px; +-moz-border-radius-bottomleft:5px; +-moz-border-radius-bottomright:5px; +border:1px solid #666666; +} +#comment_area_video_title{ +padding:10px; +-moz-border-radius-topleft:5px; +-moz-border-radius-topright:5px; +-moz-border-radius-bottomleft:5px; +-moz-border-radius-bottomright:5px; +border:1px solid #CCCCCC; +border:1px solid #CCCCCC; +background:#FFFFFF; +} +.vid-comment-widget{ +font-size:11px; +font-weight:normal; +} +.searchvideorow{ +padding:10px; +-moz-border-radius-topleft:5px; +-moz-border-radius-topright:5px; +-moz-border-radius-bottomleft:5px; +-moz-border-radius-bottomright:5px; +border:1px solid #CCCCCC; +} +#videosearch-tablecontainer{ +-moz-border-radius-bottomleft:5px; +-moz-border-radius-bottomright:5px; +border:1px solid #CCCCCC; +background:#FFF; +padding:10px; +} +#videosearch-interface{ +border-color:#CCCCCC; +border-style:solid; +border-width:0 1px 1px; +margin-top:-15px; +padding:15px 0 15px 20px; +} diff --git a/views/default/videolist/groupprofile_videolist.php b/views/default/videolist/groupprofile_videolist.php index 279f2af81..1df34a7b2 100644 --- a/views/default/videolist/groupprofile_videolist.php +++ b/views/default/videolist/groupprofile_videolist.php @@ -1,62 +1,62 @@ - - * @copyright Prateek Choudhary + + * @copyright Prateek Choudhary */ ?> -
-

- -num_display; - if (!$number) - $number = 5; - - //get the user's files - $videos = get_user_objects($vars['entity']->guid, "videolist", $number, 0); - - //if there are some files, go get them - if ($videos) { - +
+

+ +num_display; + if (!$number) + $number = 5; + + //get the user's files + $videos = get_user_objects($vars['entity']->guid, "videolist", $number, 0); + + //if there are some files, go get them + if ($videos) { + //display in list mode - echo "
"; - foreach($videos as $f){ - + echo "
"; + foreach($videos as $f){ + $mime = $f->mimetype; - $owner = get_entity($f->getOwner()); - $numcomments = elgg_count_comments($f); - echo ""; - echo "
"; - echo "

guid}\">" . $f->title ."


by username}\">{$owner->name}"; + $owner = get_entity($f->getOwner()); + $numcomments = elgg_count_comments($f); + echo ""; + echo "
"; + echo ""; - echo "

" . friendly_time($f->time_created) . "

"; - echo "
"; - - } - echo "
"; - - //get a link to the users files - $users_file_url = $vars['url'] . "pg/videolist/owned/" . page_owner_entity()->username; - - echo ""; - - } else { - - echo "
" . elgg_echo("videolist:none") . "
"; - - } - -?> -
+ echo "

" . friendly_time($f->time_created) . "

"; + echo "
"; + + } + echo "
"; + + //get a link to the users files + $users_file_url = $vars['url'] . "pg/videolist/owned/" . page_owner_entity()->username; + + echo ""; + + } else { + + echo "
" . elgg_echo("videolist:none") . "
"; + + } + +?> +
diff --git a/views/default/videolist/notfound.php b/views/default/videolist/notfound.php index 79df22779..ec69b700c 100644 --- a/views/default/videolist/notfound.php +++ b/views/default/videolist/notfound.php @@ -1,21 +1,21 @@ - - * @copyright Curverider Ltd 2008 - * @link http://elgg.com/ - */ - -?> - -

- + + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + +?> + +

+

diff --git a/views/default/widgets/videolist_view/edit.php b/views/default/widgets/videolist_view/edit.php index ec5b34bae..936d37c34 100644 --- a/views/default/widgets/videolist_view/edit.php +++ b/views/default/widgets/videolist_view/edit.php @@ -1,21 +1,21 @@ -

- : - - num_display == '') $vars['entity']->num_display = 6; - ?> - -

+

+ : + + num_display == '') $vars['entity']->num_display = 6; + ?> + +

diff --git a/views/default/widgets/videolist_view/view.php b/views/default/widgets/videolist_view/view.php index 889ee5726..aac2a288b 100644 --- a/views/default/widgets/videolist_view/view.php +++ b/views/default/widgets/videolist_view/view.php @@ -1,12 +1,12 @@ - * @copyright Prateek Choudhary +/** + * Elgg Videolist Plugin + * This plugin allows users to create a library of youtube videos + * + * @package ElggProfile + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary + * @copyright Prateek Choudhary */ diff --git a/views/rss/videolist/contentwrapper.php b/views/rss/videolist/contentwrapper.php index b967ab371..c8e2438d5 100644 --- a/views/rss/videolist/contentwrapper.php +++ b/views/rss/videolist/contentwrapper.php @@ -1,15 +1,15 @@ - - * @copyright Prateek Choudhary + + * @copyright Prateek Choudhary */ - - echo $vars['body']; - + + echo $vars['body']; + ?> diff --git a/views/rss/videolist/videolist.php b/views/rss/videolist/videolist.php index f88300d98..86ea686ba 100644 --- a/views/rss/videolist/videolist.php +++ b/views/rss/videolist/videolist.php @@ -1,17 +1,17 @@ - - * @copyright Prateek Choudhary + + * @copyright Prateek Choudhary */ - - if ($foreach = get_entities('object','',$vars['entity']->guid)) { - foreach($foreach as $videos) - echo elgg_view_entity($videos); - } - + + if ($foreach = get_entities('object','',$vars['entity']->guid)) { + foreach($foreach as $videos) + echo elgg_view_entity($videos); + } + ?> diff --git a/watch.php b/watch.php index 6d0542a2f..982bb8851 100644 --- a/watch.php +++ b/watch.php @@ -1,44 +1,44 @@ - - * @copyright Prateek Choudhary - */ -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - - // Get objects - $video_id = (int) get_input('video_id'); - - // If we can get out the video corresponding to video_id object ... - if ($videos = get_entity($video_id)) { - set_page_owner($videos->container_guid); - $videos_container = get_entity($videos->container_guid); - if($videos_container->type == "group") - set_context("groupsvideos"); - $page_owner = page_owner_entity(); - $title = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name); - // Display it - $area2 = elgg_view("object/watch",array( - 'entity' => $video_id, - 'entity_owner' => $page_owner, - 'full' => true - )); - //$area2 .= elgg_view("videolist/comments", array('entity' => $videos)); - $body = elgg_view_layout("one_column_with_sidebar", $area1 . $area2); - } - else - { - // Display the 'post not found' page instead - $body = elgg_view("videolist/notfound"); - $title = elgg_echo("video:none"); - - } - // Finally draw the page - page_draw($title, $body); -?> + + * @copyright Prateek Choudhary + */ +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + + // Get objects + $video_id = (int) get_input('video_id'); + + // If we can get out the video corresponding to video_id object ... + if ($videos = get_entity($video_id)) { + set_page_owner($videos->container_guid); + $videos_container = get_entity($videos->container_guid); + if($videos_container->type == "group") + set_context("groupsvideos"); + $page_owner = page_owner_entity(); + $title = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name); + // Display it + $area2 = elgg_view("object/watch",array( + 'entity' => $video_id, + 'entity_owner' => $page_owner, + 'full' => true + )); + //$area2 .= elgg_view("videolist/comments", array('entity' => $videos)); + $body = elgg_view_layout("one_column_with_sidebar", $area1 . $area2); + } + else + { + // Display the 'post not found' page instead + $body = elgg_view("videolist/notfound"); + $title = elgg_echo("video:none"); + + } + // Finally draw the page + page_draw($title, $body); +?> diff --git a/world.php b/world.php index 57af731de..34817bc5b 100644 --- a/world.php +++ b/world.php @@ -1,38 +1,38 @@ - - * @copyright Prateek Choudhary - */ -// Render the video upload page - // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); - - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - - $title = sprintf(elgg_echo("videolist:search")); - - // Get objects - $area2 = elgg_view_title($title); - set_input('show_viewtype', 'all'); - $area2 .= list_entities("object","videolist", 0, 10, $fullview=true, $viewtypetoggle=false,$pagination=true); - - //$area2 .= elgg_view("staticvideo/index"); - - set_context('videolist'); - $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2); - - // Finally draw the page - page_draw($title, $body); - -?> + + * @copyright Prateek Choudhary + */ +// Render the video upload page + // Load Elgg engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + gatekeeper(); + + // Get the current page's owner + $page_owner = page_owner_entity(); + if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($_SESSION['guid']); + } + + $title = sprintf(elgg_echo("videolist:search")); + + // Get objects + $area2 = elgg_view_title($title); + set_input('show_viewtype', 'all'); + $area2 .= list_entities("object","videolist", 0, 10, $fullview=true, $viewtypetoggle=false,$pagination=true); + + //$area2 .= elgg_view("staticvideo/index"); + + set_context('videolist'); + $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2); + + // Finally draw the page + page_draw($title, $body); + +?> -- cgit v1.2.3