]>
git.wh0rd.org - tt-rss.git/blob - plugins/owncloud/owncloud.php
2 // This plugin creates ReadLater bookmarks in your owncloud.
4 // define('OWNCLOUD_URL','http(s)://your.serv.er/owncloud');
5 // in your config.php. The parameter is actually global. user_pref
6 // with editable parameter in future versions.
8 require_once "config.php";
10 class OwnCloud
extends Plugin
{
16 "Adds support for OwnCloud ReadLater",
20 function init($host) {
21 $this->link
= $host->get_link();
24 $host->add_hook($host::HOOK_ARTICLE_BUTTON
, $this);
28 return file_get_contents(dirname(__FILE__
) . "/owncloud.js");
31 function hook_article_button($line) {
32 return "<img src=\"".theme_image($this->link
, "plugins/owncloud/owncloud.png")."\"
33 style=\"cursor : pointer\" style=\"cursor : pointer\"
34 onclick=\"ownArticle(".$line["id"].")\"
35 class='tagsPic' title='".__('Bookmark on OwnCloud ')."'>";
38 function getOwnCloud() {
39 $id = db_escape_string($_REQUEST['id']);
41 $result = db_query($this->link
, "SELECT title, link
42 FROM ttrss_entries, ttrss_user_entries
43 WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
45 if (db_num_rows($result) != 0) {
46 $title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')),
48 $article_link = db_fetch_result($result, 0, 'link');
52 if (defined('OWNCLOUD_URL')) {
53 $own_url = OWNCLOUD_URL
;
56 print json_encode(array("title" => $title, "link" => $article_link,
57 "id" => $id, "ownurl" => $own_url));