aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:56:18 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:56:18 -0300
commita7be81c3f81c807d43ed32965ee7ac11ebe71895 (patch)
tree71751c05eb80ae6e348790f3e46652c9dfe0be7d /mod
parentf3beeb45f9f192aee6ede0c9b6f0fa8b8d82a9ef (diff)
parent059badecbc0be895c6165430e5096a9ab653027e (diff)
downloadelgg-a7be81c3f81c807d43ed32965ee7ac11ebe71895.tar.gz
elgg-a7be81c3f81c807d43ed32965ee7ac11ebe71895.tar.bz2
Merge commit '059badecbc0be895c6165430e5096a9ab653027e' as 'mod/livestream'
Diffstat (limited to 'mod')
-rwxr-xr-xmod/livestream/README0
-rwxr-xr-xmod/livestream/actions/delete.php15
-rwxr-xr-xmod/livestream/actions/new.php23
-rwxr-xr-xmod/livestream/languages/en.php32
-rwxr-xr-xmod/livestream/languages/es.php28
-rwxr-xr-xmod/livestream/languages/it.php26
-rwxr-xr-xmod/livestream/libraries.php133
-rwxr-xr-xmod/livestream/manifest.xml16
-rwxr-xr-xmod/livestream/pages/livestream/delete.php17
-rwxr-xr-xmod/livestream/pages/livestream/list.php21
-rwxr-xr-xmod/livestream/pages/livestream/new.php14
-rwxr-xr-xmod/livestream/pages/livestream/view.php23
-rwxr-xr-xmod/livestream/start.php95
-rwxr-xr-xmod/livestream/views/default/delete.php37
-rwxr-xr-xmod/livestream/views/default/list.php15
-rwxr-xr-xmod/livestream/views/default/livestream/groupprofile_livestream.php32
-rwxr-xr-xmod/livestream/views/default/new.php27
-rwxr-xr-xmod/livestream/views/default/object/list.php14
-rwxr-xr-xmod/livestream/views/default/object/livestream.php38
-rwxr-xr-xmod/livestream/views/default/view.php50
20 files changed, 656 insertions, 0 deletions
diff --git a/mod/livestream/README b/mod/livestream/README
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/mod/livestream/README
diff --git a/mod/livestream/actions/delete.php b/mod/livestream/actions/delete.php
new file mode 100755
index 000000000..bd4757f55
--- /dev/null
+++ b/mod/livestream/actions/delete.php
@@ -0,0 +1,15 @@
+<?php
+ require_once "{$CONFIG->pluginspath}livestream/libraries.php";
+
+ // get object guid from URL
+ $object_guid = get_input('stream_id');
+ $container_name = livestream_get_container_name($object_guid);
+
+ if(livestream_delete($object_guid)){
+ forward('livestream/'.$container_name);
+ }else{
+ elgg_echo ("livestream:internal_error");
+
+ }
+
+?>
diff --git a/mod/livestream/actions/new.php b/mod/livestream/actions/new.php
new file mode 100755
index 000000000..0deb95275
--- /dev/null
+++ b/mod/livestream/actions/new.php
@@ -0,0 +1,23 @@
+<?php
+ require_once "{$CONFIG->pluginspath}livestream/libraries.php";
+
+ $params = Array();
+ $params['title'] = get_input('title', '');
+ $params['mediatype'] = get_input('mediatype', '');
+ $params['src'] = get_input('src', '');
+ $params['width'] = get_input('width', '');
+ $params['height'] = get_input('height', '');
+
+ $params['owner_guid'] = page_owner();
+ $params['container_guid'] = get_input('container_guid', '');
+
+ $myObject = livestream_addnew($params);
+
+ if($myObject){
+ $container = livestream_get_container($myObject);
+ forward('livestream/'.$container->username);
+ }else{
+ elgg_echo ("livestream:internal_error");
+ }
+
+?>
diff --git a/mod/livestream/languages/en.php b/mod/livestream/languages/en.php
new file mode 100755
index 000000000..b4be35123
--- /dev/null
+++ b/mod/livestream/languages/en.php
@@ -0,0 +1,32 @@
+<?php
+
+// @translated by psy (https://lorea.cc)
+
+$labels = array(
+ 'livestream:new_item' => "New stream",
+ 'livestream:title' => "Title",
+ 'livestream:uri:help' => "Introduce an icecast stream url.",
+ 'livestream:src' => "URL Icecast",
+ 'livestream:width' => "W",
+ 'livestream:height' => "H",
+ 'livestream:save' => "Save",
+ 'livestream:back' => "Back",
+ 'livestream:livestream' => "Livestream",
+ 'livestream:enable' => "enable Livestream",
+ 'livestream:permission_denied' => 'operation not permitted',
+ 'livestream:internal_error' => 'Internal error',
+ 'livestream:error:delete' => 'Error while deleting a stream',
+ 'livestream:success:delete' => 'Stream deleted successfully',
+ 'livestream:delete' => 'Delete',
+ 'livestream:delete:ask' => 'Are you sure?',
+ 'livestream:viewall' => 'View all',
+ 'livestream:untitled' => 'Untitled',
+ 'livestream:type' => 'Type of stream',
+ 'livestream:group' => 'Group livestream',
+ 'livestream:error:notfound' => 'Stream not found'
+
+);
+
+add_translation('en', $labels);
+
+?>
diff --git a/mod/livestream/languages/es.php b/mod/livestream/languages/es.php
new file mode 100755
index 000000000..a4972cd2e
--- /dev/null
+++ b/mod/livestream/languages/es.php
@@ -0,0 +1,28 @@
+<?php
+
+// @translated by psy (https://lorea.cc)
+
+$labels = array(
+ 'livestream:new_item' => "Nuevo stream",
+ 'livestream:src' => "URL Icecast",
+ 'livestream:url:help' => "Introduce una url de stream icecast.",
+ 'livestream:width' => "W",
+ 'livestream:height' => "H",
+ 'livestream:title' => "Título",
+ 'livestream:save' => "Grabar",
+ 'livestream:back' => "Atrás",
+ 'livestream:livestream' => "Stream de video",
+ 'livestream:enable' => "activar Livestream",
+ 'livestream:permission_denied' => 'operacion no permitida',
+ 'livestream:internal_error' => 'Error interno',
+ 'livestream:error:delete' => 'Error borrando el stream',
+ 'livestream:success:delete' => 'Stream borrado',
+ 'livestream:delete' => 'Borrar',
+ 'livestream:delete:ask' => 'Seguro?',
+ 'livestream:viewall' => 'Ver todos'
+
+);
+
+add_translation('es', $labels);
+
+?>
diff --git a/mod/livestream/languages/it.php b/mod/livestream/languages/it.php
new file mode 100755
index 000000000..0ee755589
--- /dev/null
+++ b/mod/livestream/languages/it.php
@@ -0,0 +1,26 @@
+<?php
+
+// @translated by psy (https://lorea.cc)
+
+$labels = array(
+ 'livestream:new_item' => "New stream",
+ 'livestream:src' => "URL",
+ 'livestream:width' => "W",
+ 'livestream:height' => "H",
+ 'livestream:save' => "Save",
+ 'livestream:back' => "Back",
+ 'livestream:livestream' => "Livestream",
+ 'livestream:enable' => "enable Livestream",
+ 'livestream:permission_denied' => 'operation not permitted',
+ 'livestream:internal_error' => 'Internal error',
+ 'livestream:error:delete' => 'Error while deleting a stream',
+ 'livestream:success:delete' => 'Stream deleted successfully',
+ 'livestream:delete' => 'Delete',
+ 'livestream:delete:ask' => 'Are you sure?',
+ 'livestream:viewall' => 'View all'
+
+);
+
+add_translation('it', $labels);
+
+?>
diff --git a/mod/livestream/libraries.php b/mod/livestream/libraries.php
new file mode 100755
index 000000000..ca46047aa
--- /dev/null
+++ b/mod/livestream/libraries.php
@@ -0,0 +1,133 @@
+<?php
+function livestream_addnew($vals = Array()){
+ $object = new ElggObject();
+ $object->subtype = "livestream";
+ $object->access_id = 2;
+
+ $object->save();
+
+ $object->title = $vals['title'];
+ $object->src = $vals['src'];
+ $object->width = $vals['width'];
+ $object->height = $vals['height'];
+ $object->mediatype = $vals['mediatype'];
+
+ //needs to be implemented - depending to it needs to put 'autoplay' as string in the player
+ //template row, by now let's default to false
+ $object->autoplay = false;
+
+ //ownership & container
+ $object->owner_guid = ($vals['owner_guid']) ? $vals['owner_guid'] : $object->owner_guid;
+ $object->container_guid = ($vals['container_guid']) ? $vals['container_guid'] : $object->owner_guid;
+
+ //check permissions
+
+ /**
+ * @todo verify that works with admin users
+ * if no add elgg_is_admin_user(get_loggedin_userid())
+ */
+ if(!$object->canEdit()){
+ elgg_echo('livestream:permission_denied');
+ $ret = false;
+ }else{
+ $object->save();
+ $ret = $object;
+ }
+
+ return $ret;
+
+}
+
+function livestream_stream_setdefaults(&$stream_object){
+ if(!$stream_object->title) $stream_object->title = elgg_echo("livestream:untitled");
+ if(!$stream_object->mediatype) $stream_object->mediatype = 'video';
+}
+
+function livestream_get($object_guid) {
+ $object = get_entity($object_guid);
+ if($object === false){
+ register_error(elgg_echo('livestream:error:notfound'));
+ }else{
+ livestream_stream_setdefaults($object);
+ }
+ return $object;
+}
+
+function livestream_get_owner($object){
+ $owner = get_user($object->getOwner());
+
+ //if is not set, it's owned by root
+ //@todo make username configurable
+ if(!$owner) $owner = get_user_by_username('root');
+
+ return $owner;
+}
+
+function livestream_delete($object_guid){
+ $object = new ElggObject($object_guid);
+
+ if(!$object_guid){
+ register_error(elgg_echo('livestream:error:delete'));
+ return false;
+ }
+
+ //check permissions
+ /**
+ * @todo verify that works with admin users
+ * if no add elgg_is_admin_user(get_loggedin_userid())
+ */
+ if(!$object->canEdit()){
+ register_error(elgg_echo('livestream:error:delete'));
+ elgg_echo('livestream:permission_denied');
+ $ret = false;
+ }else{
+ $ret = $object->delete();
+ }
+
+ return $ret;
+}
+
+function livestream_gettypes(){
+ return Array(
+ 'audio' => 'audio',
+ 'video' => 'video'
+ );
+}
+
+function deleteall(){
+ $page_owner = page_owner_entity();
+
+ $data = elgg_get_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'livestream',
+ 'container_guids' => Array($page_owner->guid)
+ ));
+
+ foreach($data as $x => $item){
+ if(!livestream_delete($item->guid)) {
+ //do something
+ return false;
+ }
+ }
+ return true;
+}
+
+function livestream_get_container_name($object_guid){
+ $myObject = livestream_get($object_guid);
+ $container = livestream_get_container($myObject);
+ return $container->username;
+}
+
+function livestream_get_container($myObject){
+ if ($myObject->container_guid){
+ $container = get_entity($myObject->container_guid);
+ }else{
+ $container = get_entity($myObject->owner_guid);
+ }
+ return $container;
+}
+
+function livestream_user_has_access(){
+ return (isloggedin() && can_write_to_container(get_loggedin_userid(), $page_owner->guid, 'livestream'));
+}
+?> \ No newline at end of file
diff --git a/mod/livestream/manifest.xml b/mod/livestream/manifest.xml
new file mode 100755
index 000000000..3fe112d14
--- /dev/null
+++ b/mod/livestream/manifest.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Livestream</name>
+ <author>laxertu</author>
+ <version>1.8</version>
+ <category>bundled</category>
+ <category>content</category>
+ <category>widget</category>
+ <description>Elgg Giss Livestream interface</description>
+ <website>https://n-1.cc/profile/laxertu</website>
+ <license>GNU Public License version 2</license>
+ <requires>
+ <type>elgg_version</type>
+ <version>2010030101</version>
+ </requires>
+</plugin_manifest>
diff --git a/mod/livestream/pages/livestream/delete.php b/mod/livestream/pages/livestream/delete.php
new file mode 100755
index 000000000..b84b1079b
--- /dev/null
+++ b/mod/livestream/pages/livestream/delete.php
@@ -0,0 +1,17 @@
+<?php
+require_once (dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php");
+
+global $CONFIG;
+$page_owner = page_owner_entity();
+
+if (livestream_user_has_access()) {
+ add_submenu_item(elgg_echo('livestream:new_item'), $CONFIG->wwwroot."livestream/".$page_owner->username."/new/");
+}
+
+//render
+$body = elgg_view('delete', Array('streamid' => get_input('streamid', '')));
+$layout_canvas = "two_column_left_sidebar";
+$layout_view = elgg_view_layout($layout_canvas, '', $body);
+
+page_draw($title, $layout_view);
+?>
diff --git a/mod/livestream/pages/livestream/list.php b/mod/livestream/pages/livestream/list.php
new file mode 100755
index 000000000..82a1c8722
--- /dev/null
+++ b/mod/livestream/pages/livestream/list.php
@@ -0,0 +1,21 @@
+<?php
+require_once (dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php");
+
+global $CONFIG;
+$page_owner = page_owner_entity();
+$logged_user = get_loggedin_user();
+
+if (livestream_user_has_access()) {
+ add_submenu_item(elgg_echo('livestream:new_item'), $CONFIG->wwwroot."livestream/".$page_owner->username."/new/");
+ add_submenu_item(elgg_echo('livestream:viewall'), $CONFIG->wwwroot."livestream/");
+}
+
+
+
+//render
+$body = elgg_view('list');
+$layout_canvas = "two_column_left_sidebar";
+$layout_view = elgg_view_layout($layout_canvas, '', $body);
+
+page_draw($title, $layout_view);
+?>
diff --git a/mod/livestream/pages/livestream/new.php b/mod/livestream/pages/livestream/new.php
new file mode 100755
index 000000000..eaa61dda8
--- /dev/null
+++ b/mod/livestream/pages/livestream/new.php
@@ -0,0 +1,14 @@
+<?php
+add_submenu_item(elgg_echo("livestream:new_item"), $CONFIG->url."livestream/new/" );
+/*
+$menu_properties = Array(
+ 'name' => 'livestream_menu_new'
+ ,'text' => elgg_echo("livestream:new_item"));
+if (!elgg_register_menu_item('livestream_menu_new', $menu_properties)) echo "acc";
+*/
+$body = elgg_view('new');
+$layout_canvas = "two_column_left_sidebar";
+$layout_view = elgg_view_layout($layout_canvas, '', $body);
+
+page_draw($title, $layout_view);
+?> \ No newline at end of file
diff --git a/mod/livestream/pages/livestream/view.php b/mod/livestream/pages/livestream/view.php
new file mode 100755
index 000000000..e6842416a
--- /dev/null
+++ b/mod/livestream/pages/livestream/view.php
@@ -0,0 +1,23 @@
+<?php
+require_once (dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php");
+
+global $CONFIG;
+$page_owner = page_owner_entity();
+$stream_id = get_input('streamid', '');
+
+
+
+if (livestream_user_has_access()) {
+ add_submenu_item(elgg_echo('livestream:new_item'), $CONFIG->wwwroot."livestream/".$page_owner->username."/new/");
+ add_submenu_item(elgg_echo('livestream:delete'), $CONFIG->wwwroot."livestream/".$page_owner->username."/delete/".$stream_id);
+}
+
+
+
+//render
+$body = elgg_view('view', Array('streamid' => get_input('streamid', '')));
+$layout_canvas = "two_column_left_sidebar";
+$layout_view = elgg_view_layout($layout_canvas, '', $body);
+
+page_draw($title, $layout_view);
+?>
diff --git a/mod/livestream/start.php b/mod/livestream/start.php
new file mode 100755
index 000000000..826c360d7
--- /dev/null
+++ b/mod/livestream/start.php
@@ -0,0 +1,95 @@
+<?php
+ /**
+ * Elgg livestream plugin
+ *
+ * @package LiveStream
+ */
+ require_once "{$CONFIG->pluginspath}livestream/libraries.php";
+
+
+ function livestream_init()
+ {
+ global $CONFIG;
+
+ // require libraries
+ require_once "{$CONFIG->pluginspath}livestream/libraries.php";
+
+ register_page_handler('livestream','livestream_page_handler');
+
+ //enable for groups
+ add_group_tool_option('groups',elgg_echo('livestream:enable'),true);
+
+ //put in group hp
+ elgg_extend_view('groups/right_column', 'livestream/groupprofile_livestream');
+
+
+ if (isloggedin())
+ {
+ add_menu(elgg_echo('livestream:livestream'), $CONFIG->wwwroot . "livestream/" . $page_owner->username);
+ }
+
+ register_elgg_event_handler('pagesetup','system','livestream_pagesetup');
+ //actions
+ register_action("livestream/new", false, $CONFIG->pluginspath . "livestream/actions/new.php");
+ register_action("livestream/delete", false, $CONFIG->pluginspath . "livestream/actions/delete.php");
+
+
+ }
+
+ function livestream_pagesetup(){
+ global $CONFIG;
+
+ //Link to group items if comes form group environment
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup && (get_context() == 'groups' || get_context() == 'group_profile')) {
+ add_submenu_item(elgg_echo("livestream:livestream"), $CONFIG->url ."livestream/". $page_owner->username );
+ }
+
+ //tools menu item
+ $logged_user = get_loggedin_user();
+ if($logged_user){
+ add_menu(elgg_echo('livestream:livestream'), $CONFIG->wwwroot . "livestream/" . $logged_user->username);
+ }
+ }
+
+ function livestream_page_handler($page)
+ {
+ global $_CONFIG;
+
+ if (isset($page[0]) && $page[0]) {
+ set_input('username',$page[0]);
+ }
+
+ if (isset($page[1]) && $page[1]) {
+ switch($page[1]){
+ case 'new':
+ include(dirname(__FILE__) . "/pages/livestream/new.php");
+ break;
+ case 'view':
+ set_input('username', $page[0]);
+ set_input('streamid', $page[2]);
+
+ include(dirname(__FILE__) . "/pages/livestream/view.php");
+ break;
+ case 'delete':
+ set_input('username', $page[0]);
+ set_input('streamid', $page[2]);
+
+ include(dirname(__FILE__) . "/pages/livestream/delete.php");
+ break;
+
+ default:
+ include(dirname(__FILE__) . "/pages/livestream/list.php");
+ break;
+ }
+ }else{
+ include(dirname(__FILE__) . "/pages/livestream/list.php");
+ }
+
+ return true;
+ }
+
+ register_elgg_event_handler('init','system','livestream_init');
+
+?>
diff --git a/mod/livestream/views/default/delete.php b/mod/livestream/views/default/delete.php
new file mode 100755
index 000000000..b6121e9ce
--- /dev/null
+++ b/mod/livestream/views/default/delete.php
@@ -0,0 +1,37 @@
+<?php
+ /**
+ * Elgg livestream plugin
+ *
+ * @package LiveStream
+ */
+$streamid = $vars['streamid'];
+$item = livestream_get($streamid);
+
+?>
+<div class="contentWrapper">
+<form action="<?php echo $vars['url']; ?>action/livestream/delete" enctype="multipart/form-data" method="post">
+<?php echo elgg_view('input/securitytoken'); ?>
+<p>
+ <label>
+ <?php echo elgg_echo("livestream:delete:ask"); ?><br />
+ </label>
+</p>
+
+
+<?php
+ if ($item->guid){
+ echo elgg_view(
+ 'input/hidden',
+ array(
+ 'internalname' => 'stream_id',
+ 'options_values' => $options,
+ 'value' => $item->guid
+ )
+ );
+ }
+?>
+
+<p><input type="submit" value="<?php echo elgg_echo('livestream:delete'); ?>" /></p>
+
+</form>
+</div>
diff --git a/mod/livestream/views/default/list.php b/mod/livestream/views/default/list.php
new file mode 100755
index 000000000..a5b10465e
--- /dev/null
+++ b/mod/livestream/views/default/list.php
@@ -0,0 +1,15 @@
+<?php
+$page_owner = page_owner_entity();
+$offset = get_input('offset', 0);
+
+$options = Array(
+ 'type' => 'object',
+ 'subtype' => 'livestream',
+ 'container_guids' => Array($page_owner->guid),
+ 'offset' => $offset,
+ 'limit' => 4
+);
+
+echo elgg_list_entities($options);
+
+?> \ No newline at end of file
diff --git a/mod/livestream/views/default/livestream/groupprofile_livestream.php b/mod/livestream/views/default/livestream/groupprofile_livestream.php
new file mode 100755
index 000000000..6cb8378a9
--- /dev/null
+++ b/mod/livestream/views/default/livestream/groupprofile_livestream.php
@@ -0,0 +1,32 @@
+<?php
+$page_owner = elgg_get_page_owner_entity();
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'livestream',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => 6,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+
+
+$content = elgg_list_entities($options);
+$new_link = elgg_view('output/url', array(
+ 'href' => $CONFIG->wwwroot.'livestream/'.$page_owner->username.'/new/',
+ 'text' => elgg_echo('livestream:new_item'),
+));
+$viewall_link = elgg_view('output/url', array(
+ 'href' => $CONFIG->wwwroot . "livestream/" . $page_owner->username,
+ 'text' => elgg_echo('livestream:viewall'),
+));
+
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('livestream:group'),
+ 'content' => $content,
+ 'add_link' => $new_link,
+ 'all_link' => $viewall_link
+));
+
+
+?>
diff --git a/mod/livestream/views/default/new.php b/mod/livestream/views/default/new.php
new file mode 100755
index 000000000..e318f70fd
--- /dev/null
+++ b/mod/livestream/views/default/new.php
@@ -0,0 +1,27 @@
+<?php
+ /**
+ * Elgg livestream plugin
+ *
+ * @package LiveStream
+ * @todo JS validation
+ */
+
+ $form_body = "";
+ $form_body.= elgg_echo("livestream:title")."<br />".elgg_view('input/text', array('internalname' => 'title', 'value' => ''))."<br />";
+ $form_body.= elgg_echo("livestream:type")."<br />".elgg_view('input/radio', array('internalname' => 'mediatype', 'value' => '', 'options' => livestream_gettypes()))."<br />";
+ $form_body.= elgg_echo("livestream:src").elgg_view('input/text', array('internalname' => 'src', 'value' => ''))."<br />";
+ $form_body.= elgg_echo("livestream:width").elgg_view('input/text', array('internalname' => 'width', 'value' => '80'))."<br />";
+ $form_body.= elgg_echo("livestream:height").elgg_view('input/text', array('internalname' => 'height', 'value' => '50'))."<br />";
+ $form_body.= elgg_view(
+ 'input/hidden',
+ array(
+ 'internalname' => 'container_guid',
+ 'options_values' => $options,
+ 'value' => $vars['entity']->container_id?(int)$vars['entity']->container_id : page_owner()
+ )
+ );
+ $form_body.= "<input type='submit' value='".elgg_echo("livestream:save")."'>";
+ echo elgg_view('input/form', array('body' => $form_body, 'action' => $vars['url']."action/livestream/new"));
+
+ //$object = new ElggObject();
+?>
diff --git a/mod/livestream/views/default/object/list.php b/mod/livestream/views/default/object/list.php
new file mode 100755
index 000000000..9ab6789bd
--- /dev/null
+++ b/mod/livestream/views/default/object/list.php
@@ -0,0 +1,14 @@
+<?php
+ $item = $vars['entity'];
+ $owner = livestream_get_owner($item);
+
+ $row = "
+ <div class=\"contentWrapper\">
+ <br />
+ <a href=\"".$CONFIG->wwwroot."livestream/".$owner->username."/view/".$item->guid."\">".$item->title."</a>
+ </div>
+ ";
+
+ echo elgg_echo($row);
+
+?>
diff --git a/mod/livestream/views/default/object/livestream.php b/mod/livestream/views/default/object/livestream.php
new file mode 100755
index 000000000..ea500aa10
--- /dev/null
+++ b/mod/livestream/views/default/object/livestream.php
@@ -0,0 +1,38 @@
+<?php
+$item = livestream_get($vars['entity']->guid);
+
+
+//foreach($data as $x => $item){
+ $src = $item->src;
+
+ $owner = livestream_get_owner($item);
+
+ /* the following html code raises this funny notice
+ *
+ * NOTICE: SELECT e.* from elgg_users_entity u join elgg_entities e on e.guid=u.guid where
+ *
+ * u.username='com.fluendo.player.Cortado.class'
+ *
+ * and ( (e.access_id = -2\n\t\t\tAND e.owner_guid
+ * IN (\n\t\t\t\tSELECT guid_one FROM
+ * elgg_entity_relationships\n\t\t\t\tWHERE relationship='friend' AND guid_two=6\n\t\t\t))
+ * OR (e.access_id IN (2,1,4,5,6)\n\t\t\tOR (e.owner_guid = 6)\n\t\t\tOR
+ * (\n\t\t\t\te.access_id = 0\n\t\t\t\tAND e.owner_guid = 6\n\t\t\t)\n\t\t)
+ * and e.enabled='yes') results cached, referer:
+ * http://localhost/lorea/elgg/livestream/alice
+ *
+ * */
+
+ $player = "<a href=\"".$CONFIG->wwwroot."livestream/".$owner->username."/view/".$item->guid."\">".$item->title."</a>";
+
+ $row = "
+ <div class=\"contentWrapper\">
+ $player
+ </div>
+ ";
+
+
+ echo elgg_echo($row);
+//}
+
+?>
diff --git a/mod/livestream/views/default/view.php b/mod/livestream/views/default/view.php
new file mode 100755
index 000000000..4c13dfbab
--- /dev/null
+++ b/mod/livestream/views/default/view.php
@@ -0,0 +1,50 @@
+<?php
+ /**
+ * Elgg livestream plugin
+ *
+ * @package LiveStream
+ */
+$streamid = $vars['streamid'];
+$item = livestream_get($streamid);
+
+if($item){
+ $src = $item->src;
+ /* the following html code raises this funny notice
+ *
+ * NOTICE: SELECT e.* from elgg_users_entity u join elgg_entities e on e.guid=u.guid where
+ *
+ * u.username='com.fluendo.player.Cortado.class'
+ *
+ * and ( (e.access_id = -2\n\t\t\tAND e.owner_guid
+ * IN (\n\t\t\t\tSELECT guid_one FROM
+ * elgg_entity_relationships\n\t\t\t\tWHERE relationship='friend' AND guid_two=6\n\t\t\t))
+ * OR (e.access_id IN (2,1,4,5,6)\n\t\t\tOR (e.owner_guid = 6)\n\t\t\tOR
+ * (\n\t\t\t\te.access_id = 0\n\t\t\t\tAND e.owner_guid = 6\n\t\t\t)\n\t\t)
+ * and e.enabled='yes') results cached, referer:
+ * http://localhost/lorea/elgg/livestream/alice
+ *
+ * */
+
+ $autoplay = ($item->autoplay) ? "autoplay" : "";
+
+ $row = "
+ <div>
+ $item->title<br />
+ <video $autoplay src='$src' controls width=320 height=240>
+ <applet code='com.fluendo.player.Cortado.class' archive='cortado.jar' height='240' width='320'>
+ <param name='url' value='".$item->src."'>
+ <param name='local' value='false'>
+ <param name='keepaspect' value='true'>
+ <param name='".$item->mediatype."' value='true'>
+ <param name='bufferSize' value='60'>
+ </applet>
+ </video>
+ <br />
+ </div>
+ ";
+
+ echo elgg_echo($row);
+}
+
+
+?>