Remove accidently added 3rd party apps

This commit is contained in:
Michael Gapczynski 2012-07-30 10:34:12 -04:00
Родитель bcdce09194
Коммит 3bd3555eb3
34 изменённых файлов: 0 добавлений и 1814 удалений

5
.gitignore поставляемый
Просмотреть файл

@ -1,5 +0,0 @@
3rdparty/*
news.kdev4
*~
.kdev4
img/*

Просмотреть файл

@ -1,37 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
$userid = OCP\USER::getUser();
$feedurl = trim($_POST['feedurl']);
$folderid = trim($_POST['folderid']);
$feed = OC_News_Utils::fetch($feedurl);
$feedmapper = new OC_News_FeedMapper();
$feedid = $feedmapper->save($feed, $folderid);
$l = OC_L10N::get('news');
if(!$feedid) {
OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.'))));
OCP\Util::writeLog('news','ajax/createfeed.php: Error adding feed: '.$_POST['feedurl'], OCP\Util::ERROR);
exit();
}
//TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations
OCP\JSON::success(array('data' => array('message' => $l->t('Feed added!'))));

Просмотреть файл

@ -1,41 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
$userid = OCP\USER::getUser();
$name = trim($_POST['name']);
$parentid = trim($_POST['parentid']);
$foldermapper = new OC_News_FolderMapper($userid);
if($parentid != 0)
$folder = new OC_News_Folder($name, NULL, $foldermapper->find($parentid));
else
$folder = new OC_News_Folder($name);
$folderid = $foldermapper->save($folder);
$l = OC_L10N::get('news');
if(!$folderid) {
OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.'))));
OCP\Util::writeLog('news','ajax/createfolder.php: Error adding folder: '.$_POST['name'], OCP\Util::ERROR);
}
else {
//TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations
OCP\JSON::success(array('data' => array('message' => $l->t('Folder added!'))));
}

Просмотреть файл

@ -1,33 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
$userid = OCP\USER::getUser();
$feedid = $_POST['feedid'];
$feedmapper = new OC_News_FeedMapper();
$success = $feedmapper->deleteById($feedid);
$l = OC_L10N::get('news');
if(!$success) {
OCP\JSON::error(array('data' => array('message' => $l->t('Error removing feed.'))));
OCP\Util::writeLog('news','ajax/deletefeed.php: Error removing feed: '.$_POST['feedid'], OCP\Util::ERROR);
exit();
}
OCP\JSON::success(array('data' => array( 'feedid' => $feedid )));

Просмотреть файл

@ -1,33 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
$userid = OCP\USER::getUser();
$folderid = trim($_POST['folderid']);
$foldermapper = new OC_News_FolderMapper();
$success = $foldermapper->deleteById($folderid);
$l = OC_L10N::get('news');
if(!$success) {
OCP\JSON::error(array('data' => array('message' => $l->t('Error removing folder.'))));
OCP\Util::writeLog('news','ajax/deletefolder.php: Error removing folder: '.$_POST['folderid'], OCP\Util::ERROR);
exit();
}
OCP\JSON::success(array('data' => array( 'folderid' => $folderid )));

Просмотреть файл

@ -1,7 +0,0 @@
<?php
include("populateroot.php");
$output = new OCP\Template("news", "part.addfeed");
$output -> assign('allfeeds', $allfeeds);
$output -> printpage();

Просмотреть файл

@ -1,7 +0,0 @@
<?php
include("populateroot.php");
$output = new OCP\Template("news", "part.addfolder");
$output -> assign('allfeeds', $allfeeds);
$output -> printpage();

Просмотреть файл

@ -1,35 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
$itemid = $_POST['itemid'];
$itemmapper = new OC_News_ItemMapper();
$item = $itemmapper->find($itemid);
$item->setRead();
$success = $itemmapper->update($item);
$l = OC_L10N::get('news');
if(!$success) {
OCP\JSON::error(array('data' => array('message' => $l->t('Error marking item as read.'))));
OCP\Util::writeLog('news','ajax/markitem.php: Error marking item as read: '.$_POST['itemid'], OCP\Util::ERROR);
exit();
}
//TODO: replace the following with a real success case. see contact/ajax/createaddressbook.php for inspirations
OCP\JSON::success(array('data' => array('itemid' => $itemid )));

Просмотреть файл

@ -1,18 +0,0 @@
<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
$foldermapper = new OC_News_FolderMapper(OCP\USER::getUser());
$allfeeds = $foldermapper->populate('Everything', 0);
if ($allfeeds) {
$feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null;
if ($feedid == null) {
}
}
else {
$feedid = 0;
}

Просмотреть файл

@ -1,42 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
OC::$CLASSPATH['OC_News_Item'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OC_News_Collection'] = 'apps/news/lib/collection.php';
OC::$CLASSPATH['OC_News_Feed'] = 'apps/news/lib/feed.php';
OC::$CLASSPATH['OC_News_Folder'] = 'apps/news/lib/folder.php';
OC::$CLASSPATH['OC_News_FeedMapper'] = 'apps/news/lib/feedmapper.php';
OC::$CLASSPATH['OC_News_ItemMapper'] = 'apps/news/lib/itemmapper.php';
OC::$CLASSPATH['OC_News_FolderMapper'] = 'apps/news/lib/foldermapper.php';
OC::$CLASSPATH['OC_News_Utils'] = 'apps/news/lib/utils.php';
$l = new OC_l10n('news');
OCP\App::registerPersonal('news', 'settings');
OCP\App::register( array(
'order' => 70,
'id' => 'news',
'name' => 'News'
));
OCP\App::addNavigationEntry( array(
'id' => 'news',
'order' => 74,
'href' => OC_Helper::linkTo( 'news', 'index.php' ),
'icon' => OC_Helper::imagePath( 'news', 'icon.svg' ),
'name' => $l->t('News')
));

Просмотреть файл

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
<charset>latin1</charset>
<table>
<name>*dbprefix*news_folders</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>
<field>
<name>parent_id</name>
<type>integer</type>
<notnull>false</notnull>
<length>4</length>
</field>
<field>
<name>name</name>
<type>text</type>
<notnull>true</notnull>
<length>100</length>
</field>
<field>
<name>user_id</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>64</length>
</field>
<index>
<name>folder_id</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>descending</sorting>
</field>
</index>
<index>
<name>user_id</name>
<field>
<name>user_id</name>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*news_feeds</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>
<field>
<name>url</name>
<type>text</type>
<notnull>true</notnull>
<length>100</length>
</field>
<field>
<name>title</name>
<type>text</type>
<notnull>true</notnull>
<length>100</length>
</field>
<field>
<name>added</name>
<type>integer</type>
<default></default>
<notnull>false</notnull>
<unsigned>true</unsigned>
<length>4</length>
</field>
<field>
<name>lastmodified</name>
<type>integer</type>
<default></default>
<notnull>false</notnull>
<unsigned>true</unsigned>
<length>4</length>
</field>
<field>
<name>folder_id</name>
<type>integer</type>
<notnull>true</notnull>
<length>4</length>
</field>
<index>
<name>feed_id</name>
<unique>true</unique>
<primary>true</primary>
<field>
<name>id</name>
<sorting>descending</sorting>
</field>
</index>
<index>
<name>feed_url</name>
<unique>true</unique>
<primary>false</primary>
<field>
<name>url</name>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*news_items</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>
<field>
<name>guid</name>
<type>text</type>
<notnull>true</notnull>
<length>100</length>
</field>
<field>
<name>url</name>
<type>text</type>
<length>100</length>
</field>
<field>
<name>title</name>
<type>text</type>
<length>100</length>
</field>
<field>
<name>feed_id</name>
<type>integer</type>
<notnull>true</notnull>
<length>4</length>
</field>
<field>
<name>body</name>
<type>text</type>
<length>4000</length>
</field>
<field>
<name>status</name>
<type>integer</type>
<length>1</length>
</field>
<index>
<name>item_id</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>descending</sorting>
</field>
</index>
<index>
<name>item_guid</name>
<unique>true</unique>
<field>
<name>guid</name>
</field>
<field>
<name>feed_id</name>
</field>
</index>
</declaration>
</table>
</database>

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0"?>
<info>
<id>news</id>
<name>News</name>
<description>An RSS/Atom feed reader</description>
<version>5.5</version>
<licence>AGPL</licence>
<author>Alessandro Cosentino</author>
<require>4</require>
</info>

Просмотреть файл

@ -1,52 +0,0 @@
li { padding-right: 0px !important; }
.collapsable { background: url('%webroot%/core/img/places/folder.svg') no-repeat left center; padding-left: 20px;}
.news_input { float:left; font-size:12px; padding:4px 2px; border:solid 1px #aacfe4; width:200px; }
.svg { border: inherit; background: inherit; }
#leftcontent { top: 3.5em !important; padding: 0; margin: 0; }
#rightcontent { top: 3.5em !important; padding-top: 5px; }
#feeds { background: #fff; width: 20em; left: 12.5em; top: 3.7em; bottom:3em; position: fixed; overflow: auto; padding: 0; margin: 0; }
/* #feeds a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; } */
#bottomcontrols { padding: 0; bottom:0px; overflow:visible; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;}
#feeds_delete { position: absolute; right: 0px; background: url('%webroot%/core/img/actions/delete.svg') no-repeat center; display: inline; }
#feeds_edit { position: absolute; right: 1.6em; background: url('%webroot%/core/img/actions/rename.svg') no-repeat center; display: inline; }
#dropdownBtn { width: 9em; padding-left: 0; padding-right:20px; background: url('%webroot%/core/img/actions/triangle-s.svg') no-repeat right center; }
#addfolder { background: url('%webroot%/core/img/places/folder.svg') no-repeat left center; padding-left: 20px; }
#addfeed { background: url('%appswebroot%/apps/news/img/rss.svg') no-repeat left center; padding-left: 20px; }
ul.controls li { float: left; }
.accordion .title_unread { background: #DCDCDC; font-size: 12px; border-bottom:1px solid #ccc; font-weight:bold;}
.accordion .title_read { background: #DCDCDC; font-size: 12px; border-bottom:1px solid #ccc;}
ul.menu { position: absolute; z-index:100; margin-left: 0.3em;
display: none;
background:#EEEEEE; /* default background for browsers without gradient support */
/* css3 */
background:-webkit-gradient(linear, 0 0, 0 100%, from(#DCDCDC), to(#EEEEEE));
background:-moz-linear-gradient(#DCDCDC, #EEEEEE);
background:-o-linear-gradient(#DCDCDC, #EEEEEE);
background:linear-gradient(#DCDCDC, #EEEEEE);
/*
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
*/
}
ul#dropdownmenu { left: 0em; box-shadow: 0px 0px 10px rgb(0, 0, 0); }
ul#feedfoldermenu { position:fixed; margin-left: 0; bottom: 2.8em; border-left:1px solid #ccc; border-top:1px solid #ccc; border-right:1px solid #ccc; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;}
li.menuItem { margin-left:0.7em; margin-right:0.7em; float: none !important; text-align: left; }
li.folder_list:hover { color: rgb(0, 0, 0) !important; background: none !important; }
li.feeds_list:hover { background: none repeat scroll 0% 0% rgb(221, 221, 221) !important; }
div.collapsable:hover { background-color: rgb(221, 221, 221); }
div.add_parentfolder { position: relative; }
div.dialog { overflow: visible; }

Просмотреть файл

@ -1,44 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('news');
OCP\App::setActiveNavigationEntry('news');
OCP\Util::addscript('news','news');
OCP\Util::addStyle('news','news');
$l = OC_L10N::get('news');
$foldermapper = new OC_News_FolderMapper(OCP\USER::getUser());
$allfeeds = $foldermapper->populate($l->t('Everything'), 0);
if ($allfeeds) {
$feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null;
if ($feedid == null) {
}
}
else {
$feedid = 0;
}
$tmpl = new OCP\Template( 'news', 'main', 'user' );
$tmpl->assign('allfeeds', $allfeeds);
$tmpl->assign('feedid', $feedid);
$tmpl->printPage();
?>

Просмотреть файл

@ -1,196 +0,0 @@
News={
DropDownMenu: {
fade:function(menu){
var list = $(menu).toggle();
return false;
},
dropdown:function(button){
var list = $(button).parent().find('ul#dropdownmenu');
if (list.css('display') == 'none')
list.slideDown('fast').show();
else
list.slideUp('fast');
return false;
},
selectItem:function(item, folderid){
var parent = $(item).parent().parent();
parent.find('#dropdownBtn').text($(item).text());
parent.find(':input[name="folderid"]').val(folderid);
parent.find('ul#dropdownmenu').slideUp('fast');
}
},
UI: {
overview:function(dialogtype, dialogfile){
if($(dialogtype).dialog('isOpen') == true){
$(dialogtype).dialog('moveToTop');
}else{
$('#dialog_holder').load(OC.filePath('news', 'ajax', dialogfile), function(jsondata){
if(jsondata.status != 'error'){
$(dialogtype).dialog({
dialogClass:'dialog',
minWidth: 600,
close: function(event, ui) {
$(this).dialog('destroy').remove();
}
}).css('overflow','visible');
} else {
alert(jsondata.data.message);
}
});
}
return false;
}
},
Folder: {
submit:function(button){
var displayname = $("#folder_add_name").val().trim();
if(displayname.length == 0) {
OC.dialogs.alert(t('news', 'Displayname cannot be empty.'), t('news', 'Error'));
return false;
}
$(button).attr("disabled", true);
//translation here!!!
$(button).prop('value', 'Adding...');
var folderid = $('#inputfolderid:input[name="folderid"]').val();
var url;
url = OC.filePath('news', 'ajax', 'createfolder.php');
$.post(url, { name: displayname, parentid: folderid },
function(jsondata){
if(jsondata.status == 'success'){
//$(button).closest('tr').prev().html(jsondata.page).show().next().remove();
OC.dialogs.alert(jsondata.data.message, t('news', 'Success!'));
} else {
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
$("#folder_add_name").val('');
$(button).attr("disabled", false);
//translation here!!!
$(button).prop('value', 'Add folder');
});
},
'delete':function(folderid) {
$('#feeds_delete').tipsy('hide');
OC.dialogs.confirm(t('news', 'Are you sure you want to delete this folder and all its feeds?'), t('news', 'Warning'), function(answer) {
if(answer == true) {
$.post(OC.filePath('news', 'ajax', 'deletefolder.php'),{'folderid':folderid},function(jsondata){
if(jsondata.status == 'success'){
alert('removed!');
}
else{
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
});
}
});
return false;
}
},
Feed: {
id:'',
submit:function(button){
var feedurl = $("#feed_add_url").val().trim();
if(feedurl.length == 0) {
OC.dialogs.alert(t('news', 'URL cannot be empty.'), t('news', 'Error'));
return false;
}
$(button).attr("disabled", true);
//translation here!!!
$(button).prop('value', 'Adding...');
var folderid = $('#inputfolderid:input[name="folderid"]').val();
var url;
url = OC.filePath('news', 'ajax', 'createfeed.php');
$.post(url, { feedurl: feedurl, folderid: folderid },
function(jsondata){
if(jsondata.status == 'success'){
OC.dialogs.alert(jsondata.data.message, t('news', 'Success!'));
} else {
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
$("#feed_add_url").val('');
$(button).attr("disabled", false);
//translation here!!!
$(button).prop('value', 'Add feed');
});
},
'delete':function(feedid) {
$('#feeds_delete').tipsy('hide');
OC.dialogs.confirm(t('news', 'Are you sure you want to delete this feed?'), t('news', 'Warning'), function(answer) {
if(answer == true) {
$.post(OC.filePath('news', 'ajax', 'deletefeed.php'),{'feedid':feedid},function(jsondata){
if(jsondata.status == 'success'){
$('#leftcontent [data-id="'+jsondata.data.feedid+'"]').remove();
//change the right view too (maybe a message to subscribe, like in Google Reader?)
}
else{
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
});
}
});
return false;
},
markItem:function(itemid) {
$.post(OC.filePath('news', 'ajax', 'markitem.php'),{'itemid':itemid},function(jsondata){
if(jsondata.status == 'success'){
var $currentitem = $('#rightcontent [data-id="'+jsondata.data.itemid+'"]');
$currentitem.removeClass('title_unread');
$currentitem.addClass('title_read');
//set a timeout for this
}
else{
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
});
}
}
}
$(document).ready(function(){
$('#addfeed').click(function() {
News.UI.overview('#addfeed_dialog','feeddialog.php');
$(this).parent().toggle();
});
$('#addfolder').click(function() {
News.UI.overview('#addfolder_dialog','folderdialog.php');
$(this).parent().toggle();
});
$('.collapsable').click(function(){
$(this).parent().children().toggle();
$(this).toggle();
});
$('.accordion .title_unread').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
$('.accordion .title_read').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
var list = $('.collapsable,.feeds_list').hover(function() {
var elem = $(this).find('#feeds_delete,#feeds_edit');
if(elem.css('display') == 'none')
elem.css('display', 'inline');
else
elem.css('display', 'none');
return false;
});
list.find('#feeds_delete').hide();
list.find('#feeds_edit').hide();
});

Просмотреть файл

@ -1,15 +0,0 @@
$(document).ready(function(){
$('#somesetting').blur(function(event){
event.preventDefault();
var post = $( "#somesetting" ).serialize();
$.post( OC.filePath('apptemplate','ajax','seturl.php') , post, function(data){ OC.msg.finishedSaving('#somesetting .msg', data); });
});
});

Просмотреть файл

@ -1,32 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
/**
* This class models a collection, which is either a feed or a folder.
*/
class OC_News_Collection {
private $id;
public function __construct($id){
$this->id = $id;
}
public function getId(){
return $this->id;
}
public function setId($id){
$this->id = $id;
}
}

Просмотреть файл

@ -1,46 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
/**
* This class models a feed.
*/
class OC_News_Feed extends OC_News_Collection {
private $url;
private $spfeed; //encapsulate a SimplePie_Core object
private $items; //array that contains all the items of the feed
public function __construct($url, $title, $items, $id = null){
$this->url = $url;
$this->title = $title;
$this->items = $items;
if ($id !== null){
parent::__construct($id);
}
}
public function getUrl(){
return $this->url;
}
public function getTitle(){
return $this->title;
}
public function setItems($items){
$this->items = $items;
}
public function getItems(){
return $this->items;
}
}

Просмотреть файл

@ -1,182 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
/**
* This class maps a feed to an entry in the feeds table of the database.
*/
class OC_News_FeedMapper {
const tableName = '*PREFIX*news_feeds';
/**
* @brief Retrieve a feed from the database
* @param id The id of the feed in the database table.
* @returns
*/
public function findById($id){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();
$url = $row['url'];
$title = $row['title'];
$feed = new OC_News_Feed($url, $title, null, $id);
return $feed;
}
/**
* @brief Retrieve a feed from the database
* @param id The id of the feed in the database table.
* @returns
*/
public function findByFolderId($folderid){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE folder_id = ?');
$result = $stmt->execute(array($folderid));
$feeds = array();
while ($row = $result->fetchRow()) {
$url = $row['url'];
$title = $row['title'];
$id = $row['id'];
$feed = new OC_News_Feed($url, $title, null, $id);
$feeds[] = $feed;
}
return $feeds;
}
/**
* @brief Retrieve a feed and all its items from the database
* @param id The id of the feed in the database table.
* @returns
*/
public function findWithItems($id){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();
$url = $row['url'];
$title = $row['title'];
$feed = new OC_News_Feed($url, $title, null,$id);
$itemMapper = new OC_News_ItemMapper();
$items = $itemMapper->findAll($id);
$feed->setItems($items);
return $feed;
}
/**
* @brief Find the id of a feed and all its items from the database
* @param url url of the feed
* @return id of the feed corresponding to the url passed as parameters
* null - if there is no such feed
*/
public function findIdFromUrl($url){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE url = ?');
$result = $stmt->execute(array($url));
$row = $result->fetchRow();
$id = null;
if ($row != null){
$id = $row['id'];
}
return $id;
}
/**
* @brief Save the feed and all its items into the database
* @param feed the feed to be saved
* @returns The id of the feed in the database table.
*/
//TODO: handle error case
public function save(OC_News_Feed $feed, $folderid){
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
$_ut = "strftime('%s','now')";
} elseif($CONFIG_DBTYPE == 'pgsql') {
$_ut = 'date_part(\'epoch\',now())::integer';
} else {
$_ut = "UNIX_TIMESTAMP()";
}
$title = $feed->getTitle();
$url = htmlspecialchars_decode($feed->getUrl());
if(empty($title)) {
$l = OC_L10N::get('news');
$title = $l->t('no title');
}
//FIXME: Detect when feed contains already a database id
$feedid = $this->findIdFromUrl($url);
if ($feedid == null){
$query = OCP\DB::prepare('
INSERT INTO ' . self::tableName .
'(url, title, folder_id, added, lastmodified)
VALUES (?, ?, ?, ?, ?)
');
$params=array(
$url,
htmlspecialchars_decode($title),
$folderid,
$_ut,
$_ut
);
$query->execute($params);
$feedid = OCP\DB::insertid(self::tableName);
}
$feed->setId($feedid);
$itemMapper = new OC_News_ItemMapper();
$items = $feed->getItems();
foreach($items as $item){
$itemMapper->save($item, $feedid);
}
return $feedid;
}
public function deleteById($id){
if ($id == null) {
return false;
}
$stmt = OCP\DB::prepare('DELETE FROM ' . self::tableName .' WHERE id = ?');
$result = $stmt->execute(array($id));
$itemMapper = new OC_News_ItemMapper();
//TODO: handle the value that the execute returns
$itemMapper->deleteAll($id);
return true;
}
public function delete(OC_News_Feed $feed){
$id = $feed->getId();
return deleteById($id);
}
//it's more complicated tan this...recursive delete, or delete with a join
public function deleteAll($folderdid){
if ($folderid == null) {
return false;
}
$stmt = OCP\DB::prepare('DELETE FROM ' . self::tableName .' WHERE folder_id = ?');
$result = $stmt->execute(array($folderid));
$itemMapper = new OC_News_ItemMapper();
//TODO: handle the value that the execute returns
$itemMapper->deleteAll($id);
return true;
}
}

Просмотреть файл

@ -1,56 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
/**
* This class models a folder that contains feeds.
*/
class OC_News_Folder extends OC_News_Collection {
private $name;
private $children;
private $parent;
public function __construct($name, $id = null, OC_News_Collection $parent = null){
$this->name = $name;
if ($id !== null){
parent::__construct($id);
}
$this->children = array();
if ($parent !== null){
$this->parent = $parent;
}
}
public function getName(){
return $this->name;
}
public function setName($name){
$this->name = $name;
}
public function getParentId(){
if ($this->parent === null){
return 0;
}
return $this->parent->getId();
}
public function addChild(OC_News_Collection $child){
$this->children[] = $child;
}
public function getChildren(){
return $this->children;
}
}

Просмотреть файл

@ -1,148 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
/**
* This class maps a feed to an entry in the feeds table of the database.
*/
class OC_News_FolderMapper {
const tableName = '*PREFIX*news_folders';
private $userid;
public function __construct($userid = null){
if ($userid !== null) {
$this->userid = $userid;
}
$userid = OCP\USER::getUser();
}
/**
* @brief Create a folder and populate with children from the database
* @param id The id of the folder.
* @param name The name of the folder.
* @returns an instance of OC_News_Folder
*/
public function populate($name, $id){
$root = new OC_News_Folder($name, $id);
$stmt = OCP\DB::prepare('SELECT *
FROM ' . self::tableName .
' WHERE user_id = ? AND parent_id = ?');
$result = $stmt->execute(array($this->userid, $id));
while( $row = $result->fetchRow()){
$child = OC_News_FolderMapper::populate($row['name'], $row['id']);
$root->addChild($child);
}
$feedmapper = new OC_News_FeedMapper();
$feeds = $feedmapper->findByFolderId($id);
foreach ($feeds as $feed){
$root->addChild($feed);
}
return $root;
}
/**
* @brief Retrieve a folder from the database
* @param id The id of the folder in the database table.
* @returns an instance of OC_News_Folder
*/
public function find($id){
$stmt = OCP\DB::prepare('SELECT *
FROM ' . self::tableName .
' WHERE user_id = ? AND id = ?');
$result = $stmt->execute(array($this->userid, $id));
$row = $result->fetchRow();
$folder = new OC_News_Folder($row['name'], $row['id']);
return $folder;
}
/**
* @brief Retrieve a feed and all its items from the database
* @param id The id of the feed in the database table.
* @returns
*/
public function findWithItems($id){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();
$url = $row['url'];
$title = $row['title'];
$feed = new OC_News_Feed($url, $title, null,$id);
$itemMapper = new OC_News_ItemMapper($feed);
$items = $itemMapper->findAll();
$feed->setItems($items);
return $feed;
}
/**
* @brief Store the folder and all its feeds into the database
* @param folder the folder to be saved
* @returns The id of the folder in the database table.
*/
public function save(OC_News_Folder $folder){
$query = OCP\DB::prepare('
INSERT INTO ' . self::tableName .
'(name, parent_id, user_id)
VALUES (?, ?, ?)
');
$name = $folder->getName();
if(empty($name)) {
$l = OC_L10N::get('news');
$name = $l->t('no name');
}
$parentid = $folder->getParentId();
$params=array(
htmlspecialchars_decode($name),
$parentid,
$this->userid
);
$query->execute($params);
$folderid = OCP\DB::insertid(self::tableName);
$folder->setId($folderid);
return $folderid;
}
public function delete(OC_News_Folder $folder){
$folderid = $folder->getId();
return deleteById(folderid);
}
//TODO: replace it with a DELETE INNER JOIN operation
public function deleteById($folderid){
if ($folderid == null){
return false;
}
$stmt = OCP\DB::prepare('DELETE FROM ' . self::tableName .' WHERE id = ?');
$result = $stmt->execute(array($folderid));
$feedMapper = new OC_News_FeedMapper();
//TODO: handle the value that the execute returns
$feedMapper->deleteAll($folderid);
return true;
}
}

Просмотреть файл

@ -1,122 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
class StatusFlag{
const Unread = 0x02;
const Important = 0x04;
const Deleted = 0x08;
const Updated = 0x16;
}
/**
* This class models an item.
*
* It encapsulate a SimplePie_Item object and adds a status flag to it
*/
class OC_News_Item {
private $url;
private $title;
private $guid;
private $body;
private $status; //a bit-field set with status flags
private $id; //id of the item in the database table
public function __construct($url, $title, $guid, $body, $id = null){
$this->title = $title;
$this->url = $url;
$this->guid = $guid;
$this->body = $body;
if ($id == null) {
$this->status |= StatusFlag::Unread;
}
else {
$this->id = $id;
}
}
public function getGuid(){
return $this->guid;
}
public function setGuid($guid){
$this->guid = $guid;
}
public function getId(){
return $this->id;
}
public function setId($id){
$this->id = $id;
}
public function setRead(){
$this->status &= ~StatusFlag::Unread;
}
public function setUnread(){
$this->status |= StatusFlag::Unread;
}
public function isRead(){
return !($this->status & StatusFlag::Unread);
}
public function setImportant(){
$this->status |= StatusFlag::Important;
}
public function setUnimportant(){
$this->status &= ~StatusFlag::Important;
}
public function isImportant(){
return ($this->status & StatusFlag::Important);
}
/**
* NOTE: this is needed to store items in the database, otherwise
* the status of an item should be retrieved with methods: isRead(), isImportant(), ...
*/
public function getStatus(){
return $this->status;
}
public function setStatus($status){
$this->status = $status;
}
public function getTitle(){
return $this->title;
}
public function setTitle($title){
$this->title = $title;
}
public function getUrl(){
return $this->url;
}
public function setUrl($url){
$this->url = $url;
}
public function getBody(){
return $this->body;
}
public function setBody($body){
$this->body = $body;
}
}

Просмотреть файл

@ -1,171 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
/**
* This class maps an item to a row of the items table in the database.
* It follows the Data Mapper pattern (see http://martinfowler.com/eaaCatalog/dataMapper.html).
*/
class OC_News_ItemMapper {
const tableName = '*PREFIX*news_items';
public function fromRow($row){
$url = $row['url'];
$title = $row['title'];
$guid = $row['guid'];
$status = $row['status'];
$body = $row['body'];
$id = $row['id'];
$item = new OC_News_Item($url, $title, $guid, $body, $id);
$item->setStatus($status);
return $item;
}
/**
* @brief Retrieve all the item corresponding to a feed from the database
* @param feedid The id of the feed in the database table.
*/
public function findAll($feedid){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE feed_id = ?');
$result = $stmt->execute(array($feedid));
$items = array();
while ($row = $result->fetchRow()) {
$item = $this->fromRow($row);
$items[] = $item;
}
return $items;
}
public function findIdFromGuid($guid, $feedid){
$stmt = OCP\DB::prepare('
SELECT * FROM ' . self::tableName . '
WHERE guid = ?
AND feed_id = ?
');
$result = $stmt->execute(array($guid, $feedid));
$row = $result->fetchRow();
$id = null;
if ($row != null){
$id = $row['id'];
}
return $id;
}
/**
* @brief Update the item after its status has changed
* @returns The item whose status has changed.
*/
public function update(OC_News_Item $item){
$itemid = $item->getId();
$status = $item->getStatus();
$stmt = OCP\DB::prepare('
UPDATE ' . self::tableName .
' SET status = ?
WHERE id = ?
');
$params=array(
$status,
$itemid
);
$stmt->execute($params);
return true;
}
/**
* @brief Save the feed and all its items into the database
* @returns The id of the feed in the database table.
*/
public function save(OC_News_Item $item, $feedid){
$guid = $item->getGuid();
$status = $item->getStatus();
$itemid = $this->findIdFromGuid($guid, $feedid);
if ($itemid == null){
$title = $item->getTitle();
$body = $item->getBody();
$stmt = OCP\DB::prepare('
INSERT INTO ' . self::tableName .
'(url, title, body, guid, feed_id, status)
VALUES (?, ?, ?, ?, ?, ?)
');
if(empty($title)) {
$l = OC_L10N::get('news');
$title = $l->t('no title');
}
if(empty($body)) {
$l = OC_L10N::get('news');
$body = $l->t('no body');
}
$params=array(
htmlspecialchars_decode($item->getUrl()),
htmlspecialchars_decode($title),
$body,
$guid,
$feedid,
$status
);
$stmt->execute($params);
$itemid = OCP\DB::insertid(self::tableName);
}
else {
$this->update($item);
}
$item->setId($itemid);
return $itemid;
}
/**
* @brief Retrieve an item from the database
* @param id The id of the feed in the database table.
*/
public function find($id){
$stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();
$item = $this->fromRow($row);
return $item;
}
/**
* @brief Permanently delete all items belonging to a feed from the database
* @param feedid The id of the feed that we wish to delete
* @return
*/
public function deleteAll($feedid){
if ($feedid == null) {
return false;
}
$stmt = OCP\DB::prepare('DELETE FROM ' . self::tableName .' WHERE feed_id = ?');
$result = $stmt->execute(array($feedid));
return $result;
}
}

Просмотреть файл

@ -1,46 +0,0 @@
<?php
/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// load SimplePie library
//TODO: is this file a suitable place for the following require?
require_once('news/3rdparty/SimplePie/SimplePieAutoloader.php');
class OC_News_Utils {
/**
* @brief Fetch a feed from remote
* @param url remote url of the feed
* @returns
*/
public static function fetch($url){
//TODO: handle the case where fetching of the feed fails
$spfeed = new SimplePie_Core();
$spfeed->set_feed_url( $url );
$spfeed->enable_cache( false );
$spfeed->init();
$spfeed->handle_content_type();
$title = $spfeed->get_title();
$spitems = $spfeed->get_items();
$items = array();
foreach($spitems as $spitem) { //FIXME: maybe we can avoid this loop
$itemUrl = $spitem->get_permalink();
$itemTitle = $spitem->get_title();
$itemGUID = $spitem->get_id();
$itemBody = $spitem->get_content();
$items[] = new OC_News_Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
}
$feed = new OC_News_Feed($url, $title, $items);
return $feed;
}
}

Просмотреть файл

@ -1,8 +0,0 @@
<?php
//OCP\Util::addscript( "news", "admin" );
$tmpl = new OCP\Template( 'news', 'settings');
return $tmpl->fetchPage();

Просмотреть файл

@ -1,36 +0,0 @@
<div id="leftcontent" class="leftcontent">
<ul id="feeds">
<?php echo $this->inc("part.feeds"); ?>
</ul>
</div>
<ul class="menu" id="feedfoldermenu">
<li class="menuItem" id="addfeed"><?php echo $l->t('Feed'); ?></li>
<li class="menuItem" id="addfolder"><?php echo $l->t('Folder'); ?></li>
</ul>
<div id="bottomcontrols">
<ul class="controls">
<li>
<button class="svg" id="addfeedfolder" title="<?php echo $l->t('Add Feed/Folder'); ?>" onclick="News.DropDownMenu.fade('ul#feedfoldermenu')"><img class="svg" src="<?php echo OCP\Util::linkTo('news', 'img/add.svg'); ?>" alt="<?php echo $l->t('Add Feed/Folder'); ?>" /></button>
</li>
<li><button class="svg" title="<?php echo $l->t('Change View'); ?>">Eye</button></li>
<li><button class="svg" title="<?php echo $l->t('Settings'); ?>">Settings</button></li>
<ul>
</div>
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['feedid']; ?>">
<?php
if ($_['feedid']){
echo $this->inc("part.items");
}
else {
echo $this->inc("part.nofeeds");
}
?>
</div>
<!-- Dialogs -->
<div id="dialog_holder"></div>
<!-- End of Dialogs -->

Просмотреть файл

@ -1,22 +0,0 @@
<div id="addfeed_dialog" title="<?php echo $l->t("Add Feed"); ?>">
<table width="100%" style="border: 0;">
<tr>
<td>Add new feed</td>
<td>
<div class="add_parentfolder">
<button id="dropdownBtn" onclick="News.DropDownMenu.dropdown(this)">
<?php echo $l->t('EVERYTHING'); ?>
</button>
<input id="inputfolderid" type="hidden" name="folderid" value="0" />
<ul class="menu" id="dropdownmenu">
<?php echo $this->inc("part.folderlist"); ?>
</ul>
</div>
</td>
</tr>
<tr>
<td><input type="text" id="feed_add_url" placeholder="<?php echo $l->t('URL'); ?>" class="news_input" /></td>
<td><input type="submit" value="<?php echo $l->t('Add feed'); ?>" onclick="News.Feed.submit(this)" id="feed_add_submit" /></td>
</tr>
</table>

Просмотреть файл

@ -1,22 +0,0 @@
<div id="addfolder_dialog" title="<?php echo $l->t("Add Folder"); ?>">
<table width="100%" style="border: 0;">
<tr>
<td>Add new folder</td>
<td>
<div class="add_parentfolder">
<button id="dropdownBtn" onclick="News.DropDownMenu.dropdown(this)">
<?php echo $l->t('EVERYTHING'); ?>
</button>
<input id="inputfolderid" type="hidden" name="folderid" value="0" />
<ul class="menu" id="dropdownmenu">
<?php echo $this->inc("part.folderlist"); ?>
</ul>
</div>
</td>
</tr>
<tr>
<td><input type="text" id="folder_add_name" placeholder="<?php echo $l->t('Folder name'); ?>" class="news_input" /></td>
<td><input type="submit" value="<?php echo $l->t('Add folder'); ?>" onclick="News.Folder.submit(this)" id="folder_add_submit" /></td>
</tr>
</table>

Просмотреть файл

@ -1,31 +0,0 @@
<?php
function print_folder(OC_News_Folder $folder, $depth){
$l = new OC_l10n('news');
echo '<ul style="margin-left:' . 10*$depth . 'px;"> <li class="folder_list" >' .
'<div class="collapsable" >' . strtoupper($folder->getName()) .
( ($depth != 0) ? '<button class="svg action" id="feeds_delete" onClick="(News.Folder.delete(' . $folder->getId(). '))" title="' . $l->t('Delete folder') . '"></button>' .
'<button class="svg action" id="feeds_edit" title="' . $l->t('Rename folder') . '"></button>': '' ) .
'</div>';
echo '<ul>';
$children = $folder->getChildren();
foreach($children as $child) {
if ($child instanceOf OC_News_Folder){
print_folder($child, $depth+1);
}
elseif ($child instanceOf OC_News_Feed) { //onhover $(element).attr('id', 'newID');
echo '<li class="feeds_list" data-id="' . $child->getId() . '"><a href="' . OCP\Util::linkTo('news', 'index.php'). '?feedid=' . $child->getId() . '">' . $child->getTitle() .'</a>';
echo '<button class="svg action" id="feeds_delete" onClick="(News.Feed.delete(' . $child->getId(). '))" title="' . $l->t('Delete feed') . '"></button>';
echo '<button class="svg action" id="feeds_edit" title="' . $l->t('Edit feed') . '"></button>';
echo '</li>';
}
else {
//TODO:handle error in this case
}
}
echo '</ul></li></ul>';
}
print_folder($_['allfeeds'], 0);
?>

Просмотреть файл

@ -1,12 +0,0 @@
<?php
function print_folder(OC_News_Folder $folder, $depth){
echo '<li class="menuItem" onclick="News.DropDownMenu.selectItem(this, ' . $folder->getId() . ')">' . strtoupper($folder->getName()) . '</li>';
$children = $folder->getChildren();
foreach($children as $child) {
if ($child instanceOf OC_News_Folder){
print_folder($child, $depth+1);
}
}
}
print_folder($_['allfeeds'], 0);
?>

Просмотреть файл

@ -1,23 +0,0 @@
<?php
$feedid = isset($_['feedid']) ? $_['feedid'] : '';
$itemmapper = new OC_News_ItemMapper();
$items = $itemmapper->findAll($feedid);
echo '<ul class="accordion">';
foreach($items as $item) {
$title = $item->getTitle();
echo '<li>';
echo '<div data-id="' . $item->getId() . '"';
if ($item->isRead()) {
echo ' class="title_read">';
}
else {
echo ' class="title_unread" onClick="News.Feed.markItem(' . $item->getId() . ')">';
}
echo $title . '</div><div class="body">' . $item->getBody() . '</div>';
echo '</li>';
}
echo '</ul>';

Просмотреть файл

@ -1,3 +0,0 @@
<div id="firstrun">
<?php echo $l->t('You have no feeds in your reader.') ?>
</div>

Просмотреть файл

@ -1,8 +0,0 @@
<form id="news">
<fieldset class="personalblock">
<strong>News</strong><br />
<input type="text" name="opml_file" id="opml_file" placeholder="<?php echo $l->t('.opml file');?>" />
<br />
</fieldset>
</form>

Просмотреть файл

@ -1,85 +0,0 @@
<?php
$feedmapper = new OC_News_FeedMapper();
$foldermapper = new OC_News_FolderMapper();
$itemmapper = new OC_News_ItemMapper();
$folder = new OC_News_Folder( 'Friends' );
$folderid = $foldermapper->save($folder);
$feed = OC_News_Utils::fetch( 'http://www.dabacon.org/newpontiff/?feed=rss2' );
$feedmapper->save($feed, $folder->getId());
$feed = $feedmapper->findWithItems($feed->getId());
echo '<br>' . $feed->getTitle() . '<br>';
$items = $feed->getItems();
foreach($items as $item) {
echo $item->getTitle() . ' - ';
if ($item->isRead()) {
echo $l->t('Read');
}
else {
echo $l->t('Unread');
}
echo ' - ';
if ($item->isImportant()) {
echo $l->t('Important');
}
else {
echo $l->t('Not important');
}
echo '<br>';
$item->setImportant();
}
echo '<br>...after changing status';
echo '<br>' . $feed->getTitle() . '<br>';
foreach($items as $item) {
echo $item->getTitle() . ' - ';
if ($item->isRead()) {
echo $l->t('Read');
}
else {
echo $l->t('Unread');
}
echo ' - ';
if ($item->isImportant()) {
echo $l->t('Important');
}
else {
echo $l->t('Not important');
}
echo '<br>';
$item->setUnimportant();
}
$feedmapper->save($feed, $folder->getId());
echo '<br>...after saving and reloading';
$feed = $feedmapper->findWithItems($feed->getId());
echo '<br>' . $feed->getTitle() . '<br>';
$items = $feed->getItems();
foreach($items as &$item) {
echo $item->getTitle() . ' - ';
if ($item->isRead()) {
echo $l->t('Read');
}
else {
echo $l->t('Unread');
}
echo ' - ';
if ($item->isImportant()) {
echo $l->t('Important');
}
else {
echo $l->t('Not important');
}
echo '<br>';
}