summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/af_unburn/init.php11
-rw-r--r--plugins/auth_ldap/init.php135
-rw-r--r--plugins/close_button/init.php2
-rw-r--r--plugins/digest/digest.js2
-rw-r--r--plugins/digest/digest_body.php22
-rw-r--r--plugins/flattr/init.php2
-rw-r--r--plugins/googleplus/init.php2
-rw-r--r--plugins/identica/init.php2
-rw-r--r--plugins/mail/init.php9
-rw-r--r--plugins/mailto/init.js32
-rw-r--r--plugins/mailto/init.php93
-rw-r--r--plugins/mailto/mail.pngbin0 -> 254 bytes
-rw-r--r--plugins/note/init.php2
-rw-r--r--plugins/owncloud/init.php2
-rw-r--r--plugins/pinterest/init.php2
-rw-r--r--plugins/pocket/init.php2
-rw-r--r--plugins/share/init.php2
-rw-r--r--plugins/tweet/init.php2
-rw-r--r--plugins/updater/init.php1
19 files changed, 296 insertions, 29 deletions
diff --git a/plugins/af_unburn/init.php b/plugins/af_unburn/init.php
index a0c51c97e..9f0b6cb0d 100644
--- a/plugins/af_unburn/init.php
+++ b/plugins/af_unburn/init.php
@@ -29,11 +29,16 @@ class Af_Unburn extends Plugin {
if (strpos($article["plugin_data"], "unburn,$owner_uid:") === FALSE) {
- $ch = curl_init(geturl($article["link"]));
+ if (ini_get("safe_mode")) {
+ $ch = curl_init(geturl($article["link"]));
+ } else {
+ $ch = curl_init($article["link"]);
+ }
+
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
- //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("safe_mode"));
curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT);
$contents = @curl_exec($ch);
@@ -74,7 +79,7 @@ class Af_Unburn extends Plugin {
return $article;
}
-
+
function geturl($url){
(function_exists('curl_init')) ? '' : die('cURL Must be installed for geturl function to work. Ask your host to enable it or uncomment extension=php_curl.dll in php.ini');
diff --git a/plugins/auth_ldap/init.php b/plugins/auth_ldap/init.php
new file mode 100644
index 000000000..e1a4c49f1
--- /dev/null
+++ b/plugins/auth_ldap/init.php
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Tiny Tiny RSS plugin for LDAP authentication
+ * @author hydrian ([email protected])
+ * @copyright GPL2
+ * Requires php-ldap and PEAR Net::LDAP2
+ */
+
+/**
+ * Configuration
+ * Put the following options in config.php and customize them for your environment
+ *
+ * define('LDAP_AUTH_SERVER_URI, 'ldaps://LDAPServerHostname:port/');
+ * define('LDAP_AUTH_USETLS, FALSE); // Enable TLS Support for ldaps://
+ * define('LDAP_AUTH_ALLOW_UNTRUSTED_CERT', TRUE); // Allows untrusted certificate
+ * define('LDAP_AUTH_BINDDN', 'cn=serviceaccount,dc=example,dc=com');
+ * define('LDAP_AUTH_BINDPW', 'ServiceAccountsPassword');
+ * define('LDAP_AUTH_BASEDN', 'dc=example,dc=com');
+ * // ??? will be replaced with the entered username(escaped) at login
+ * define('LDAP_AUTH_SEARCHFILTER', '(&(objectClass=person)(uid=???))');
+ */
+
+/**
+ * Notes -
+ * LDAP search does not support follow ldap referals. Referals are disabled to
+ * allow proper login. This is particular to Active Directory.
+ *
+ * Also group membership can be supported if the user object contains the
+ * the group membership via attributes. The following LDAP servers can
+ * support this.
+ * * Active Directory
+ * * OpenLDAP support with MemberOf Overlay
+ *
+ */
+class Auth_Ldap extends Plugin implements IAuthModule {
+
+ private $link;
+ private $host;
+ private $base;
+
+ function about() {
+ return array(0.01,
+ "Authenticates against an LDAP server (configured in config.php)",
+ "hydrian",
+ true);
+ }
+
+ function init($host) {
+ $this->link = $host->get_link();
+ $this->host = $host;
+ $this->base = new Auth_Base($this->link);
+
+ $host->add_hook($host::HOOK_AUTH_USER, $this);
+ }
+
+ private function _log($msg) {
+ trigger_error($msg, E_USER_WARN);
+ }
+
+ function authenticate($login, $password) {
+ if ($login && $password) {
+ if (!function_exists('ldap_connect')) {
+ trigger_error('auth_ldap requires PHP\'s PECL LDAP package installed.');
+ return FALSE;
+ }
+ if (!require_once('Net/LDAP2.php')) {
+ trigger_error('auth_ldap requires the PEAR package Net::LDAP2');
+ return FALSE;
+ }
+ $parsedURI=parse_url(LDAP_AUTH_SERVER_URI);
+ if ($parsedURI === FALSE) {
+ $this->_log('Could not parse LDAP_AUTH_SERVER_URI in config.php');
+ return FALSE;
+ }
+ $ldapConnParams=array(
+ 'host'=>$parsedURI['scheme'].'://'.$parsedURI['host'],
+ 'basedn'=>LDAP_AUTH_BASEDN,
+ 'options' => array('LDAP_OPT_REFERRALS' => 0)
+ );
+ $ldapConnParams['starttls']= defined('LDAP_AUTH_USETLS') ?
+ LDAP_AUTH_USETLS : FALSE;
+
+ if (is_int($parsedURI['port'])) {
+ $ldapConnParams['port']=$parsedURI['port'];
+ }
+ // Making connection to LDAP server
+ if (LDAP_AUTH_ALLOW_UNTRUSTED_CERT === TRUE) {
+ putenv('LDAPTLS_REQCERT=never');
+ }
+ $ldapConn = Net_LDAP2::connect($ldapConnParams);
+ if (Net_LDAP2::isError($ldapConn)) {
+ $this->_log('Could not connect to LDAP Server: '.$ldapConn->getMessage());
+ return FALSE;
+ }
+ // Bind with service account
+ $binding=$ldapConn->bind(LDAP_AUTH_BINDDN, LDAP_AUTH_BINDPW);
+ if (Net_LDAP2::isError($binding)) {
+ $this->_log('Cound not bind service account: '.$binding->getMessage());
+ return FALSE;
+ }
+ //Searching for user
+ $completedSearchFiler=str_replace('???',$login,LDAP_AUTH_SEARCHFILTER);
+ $filterObj=Net_LDAP2_Filter::parse($completedSearchFiler);
+ $searchResults=$ldapConn->search(LDAP_AUTH_BASEDN, $filterObj);
+ if (Net_LDAP2::isError($searchResults)) {
+ $this->_log('LDAP Search Failed: '.$searchResults->getMessage());
+ return FALSE;
+ } elseif ($searchResults->count() === 0) {
+ return FALSE;
+ } elseif ($searchResults->count() > 1 ) {
+ $this->_log('Multiple DNs found for username '.$login);
+ return FALSE;
+ }
+ //Getting user's DN from search
+ $userEntry=$searchResults->shiftEntry();
+ $userDN=$userEntry->dn();
+ //Binding with user's DN.
+ $loginAttempt=$ldapConn->bind($userDN, $password);
+ $ldapConn->disconnect();
+ if ($loginAttempt === TRUE) {
+ return $this->base->auto_create_user($login);
+ } elseif ($loginAttempt->getCode() == 49) {
+ return FALSE;
+ } else {
+ $this->_log('Unknown Error: Code: '.$loginAttempt->getCode().
+ ' Message: '.$loginAttempt->getMessage());
+ return FALSE;
+ }
+ }
+ return false;
+ }
+
+}
+
+?>
diff --git a/plugins/close_button/init.php b/plugins/close_button/init.php
index bf4183320..ff2027bc7 100644
--- a/plugins/close_button/init.php
+++ b/plugins/close_button/init.php
@@ -18,7 +18,7 @@ class Close_Button extends Plugin {
function hook_article_button($line) {
if (!get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
- $rv = "<img src=\"".theme_image($this->link, 'plugins/close_button/button.png')."\"
+ $rv = "<img src=\"plugins/close_button/button.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"closeArticlePanel()\"
title='".__('Close article')."'>";
diff --git a/plugins/digest/digest.js b/plugins/digest/digest.js
index 88410d9ed..197847411 100644
--- a/plugins/digest/digest.js
+++ b/plugins/digest/digest.js
@@ -670,8 +670,6 @@ function init_second_stage() {
function init() {
try {
- dojo.require("dijit.Dialog");
-
new Ajax.Request("backend.php", {
parameters: {op: "rpc", method: "sanityCheck"},
onComplete: function(transport) {
diff --git a/plugins/digest/digest_body.php b/plugins/digest/digest_body.php
index c4f51d376..5ffcfd812 100644
--- a/plugins/digest/digest_body.php
+++ b/plugins/digest/digest_body.php
@@ -7,8 +7,7 @@
<head>
<title>Tiny Tiny RSS</title>
- <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
- <link rel="stylesheet" type="text/css" href="plugins/digest/digest.css?<?php echo $dt_add ?>"/>
+ <?php echo stylesheet_tag("plugins/digest/digest.css") ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@@ -16,13 +15,18 @@
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
- <script type="text/javascript" src="lib/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
- <script type="text/javascript" src="lib/prototype.js"></script>
- <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
+ <?php
+ foreach (array("lib/prototype.js",
+ "lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls",
+ "localized_js.php",
+ "js/functions.js",
+ "plugins/digest/digest.js",
+ "errors.php?mode=js") as $jsfile) {
+
+ echo javascript_tag($jsfile);
+
+ } ?>
- <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
- <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
- <script type="text/javascript" charset="utf-8" src="js/functions.js?<?php echo $dt_add ?>"></script>
<script type="text/javascript" src="plugins/digest/digest.js"></script>
<script type="text/javascript">
@@ -31,7 +35,7 @@
});
</script>
</head>
-<body id="ttrssDigest" class="claro">
+<body id="ttrssDigest">
<div id="overlay" style="display : block">
<div id="overlay_inner">
<noscript>
diff --git a/plugins/flattr/init.php b/plugins/flattr/init.php
index d5e4ad025..b91019880 100644
--- a/plugins/flattr/init.php
+++ b/plugins/flattr/init.php
@@ -25,7 +25,7 @@ class Flattr extends Plugin {
$encoded = urlencode($article_link);
$r = file_get_contents("https://api.flattr.com/rest/v2/things/lookup/?url=$encoded");
$response = json_decode($r, true);
- $image = "<img src=\"".theme_image($this->link, 'plugins/flattr/flattr.png')."\"
+ $image = "<img src=\"plugins/flattr/flattr.png\"
class='tagsPic' style=\"cursor : pointer\"
title='".__('Flattr this article.')."'>";
// if Flattr has it in the catalogue, we display the button
diff --git a/plugins/googleplus/init.php b/plugins/googleplus/init.php
index 3d6c60887..7ae6d1456 100644
--- a/plugins/googleplus/init.php
+++ b/plugins/googleplus/init.php
@@ -23,7 +23,7 @@ class GooglePlus extends Plugin {
function hook_article_button($line) {
$article_id = $line["id"];
- $rv = "<img src=\"".theme_image($this->link, 'plugins/googleplus/googleplus.png')."\"
+ $rv = "<img src=\"plugins/googleplus/googleplus.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"shareArticleToGooglePlus($article_id)\"
title='".__('Share on Google+')."'>";
diff --git a/plugins/identica/init.php b/plugins/identica/init.php
index c260334af..c9aa4118e 100644
--- a/plugins/identica/init.php
+++ b/plugins/identica/init.php
@@ -23,7 +23,7 @@ class Identica extends Plugin {
function hook_article_button($line) {
$article_id = $line["id"];
- $rv = "<img src=\"".theme_image($this->link, 'plugins/identica/identica.png')."\"
+ $rv = "<img src=\"plugins/identica/identica.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"shareArticleToIdentica($article_id)\"
title='".__('Share on identi.ca')."'>";
diff --git a/plugins/mail/init.php b/plugins/mail/init.php
index 2e972cf61..30a417a1b 100644
--- a/plugins/mail/init.php
+++ b/plugins/mail/init.php
@@ -22,7 +22,7 @@ class Mail extends Plugin {
}
function hook_article_button($line) {
- return "<img src=\"".theme_image($link, 'plugins/mail/mail.png')."\"
+ return "<img src=\"plugins/mail/mail.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"emailArticle(".$line["id"].")\"
alt='Zoom' title='".__('Forward by email')."'>";
@@ -59,10 +59,9 @@ class Mail extends Plugin {
$tpl->readTemplateFromFile("templates/email_article_template.txt");
- $tpl->setVariable('USER_NAME', $_SESSION["name"]);
- $tpl->setVariable('USER_EMAIL', $user_email);
- $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]);
-
+ $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
+ $tpl->setVariable('USER_EMAIL', $user_email, true);
+ $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
$result = db_query($this->link, "SELECT link, content, title
FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js
new file mode 100644
index 000000000..8f7656a07
--- /dev/null
+++ b/plugins/mailto/init.js
@@ -0,0 +1,32 @@
+function mailtoArticle(id) {
+ try {
+ if (!id) {
+ var ids = getSelectedArticleIds2();
+
+ if (ids.length == 0) {
+ alert(__("No articles are selected."));
+ return;
+ }
+
+ id = ids.toString();
+ }
+
+ if (dijit.byId("emailArticleDlg"))
+ dijit.byId("emailArticleDlg").destroyRecursive();
+
+ var query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle&param=" + param_escape(id);
+
+ dialog = new dijit.Dialog({
+ id: "emailArticleDlg",
+ title: __("Forward article by email"),
+ style: "width: 600px",
+ href: query});
+
+ dialog.show();
+
+ } catch (e) {
+ exception_error("emailArticle", e);
+ }
+}
+
+
diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php
new file mode 100644
index 000000000..8d175ae1c
--- /dev/null
+++ b/plugins/mailto/init.php
@@ -0,0 +1,93 @@
+<?php
+class MailTo extends Plugin {
+
+ private $link;
+ private $host;
+
+ function about() {
+ return array(1.0,
+ "Share article via email (using mailto: links, invoking your mail client)",
+ "fox");
+ }
+
+ function init($host) {
+ $this->link = $host->get_link();
+ $this->host = $host;
+
+ $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
+ }
+
+ function get_js() {
+ return file_get_contents(dirname(__FILE__) . "/init.js");
+ }
+
+ function hook_article_button($line) {
+ return "<img src=\"plugins/mailto/mail.png\"
+ class='tagsPic' style=\"cursor : pointer\"
+ onclick=\"mailtoArticle(".$line["id"].")\"
+ alt='Zoom' title='".__('Forward by email')."'>";
+ }
+
+ function emailArticle() {
+
+ $param = db_escape_string($_REQUEST['param']);
+
+ require_once "lib/MiniTemplator.class.php";
+
+ $tpl = new MiniTemplator;
+ $tpl_t = new MiniTemplator;
+
+ $tpl->readTemplateFromFile("templates/email_article_template.txt");
+
+ $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
+ $tpl->setVariable('USER_EMAIL', $user_email, true);
+ $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
+
+
+ $result = db_query($this->link, "SELECT link, content, title
+ FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
+ id IN ($param) AND owner_uid = " . $_SESSION["uid"]);
+
+ if (db_num_rows($result) > 1) {
+ $subject = __("[Forwarded]") . " " . __("Multiple articles");
+ }
+
+ while ($line = db_fetch_assoc($result)) {
+
+ if (!$subject)
+ $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]);
+
+ $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
+ $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
+
+ $tpl->addBlock('article');
+ }
+
+ $tpl->addBlock('email');
+
+ $content = "";
+ $tpl->generateOutputToString($content);
+
+ $mailto_link = htmlspecialchars("mailto: ?subject=".urlencode($subject).
+ "&body=".urlencode($content));
+
+ print __("Clicking the following link to invoke your mail client:");
+
+ print "<div class=\"tagCloudContainer\">";
+ print "<a target=\"_blank\" href=\"$mailto_link\">".
+ __("Forward selected article(s) by email.")."</a>";
+ print "</div>";
+
+ print __("You should be able to edit the message before sending in your mail client.");
+
+ print "<p>";
+
+ print "<div style='text-align : center'>";
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Close this dialog')."</button>";
+ print "</div>";
+
+ //return;
+ }
+
+}
+?>
diff --git a/plugins/mailto/mail.png b/plugins/mailto/mail.png
new file mode 100644
index 000000000..fcdcbd604
--- /dev/null
+++ b/plugins/mailto/mail.png
Binary files differ
diff --git a/plugins/note/init.php b/plugins/note/init.php
index 560796a69..83db94248 100644
--- a/plugins/note/init.php
+++ b/plugins/note/init.php
@@ -22,7 +22,7 @@ class Note extends Plugin {
function hook_article_button($line) {
- return "<img src=\"".theme_image($this->link, "plugins/note/note.png")."\"
+ return "<img src=\"plugins/note/note.png\"
style=\"cursor : pointer\" style=\"cursor : pointer\"
onclick=\"editArticleNote(".$line["id"].")\"
class='tagsPic' title='".__('Edit article note')."'>";
diff --git a/plugins/owncloud/init.php b/plugins/owncloud/init.php
index b846241b8..48377e9d9 100644
--- a/plugins/owncloud/init.php
+++ b/plugins/owncloud/init.php
@@ -68,7 +68,7 @@ class OwnCloud extends Plugin {
}
function hook_article_button($line) {
- return "<img src=\"".theme_image($this->link, "plugins/owncloud/owncloud.png")."\"
+ return "<img src=\"plugins/owncloud/owncloud.png\"
style=\"cursor : pointer\" style=\"cursor : pointer\"
onclick=\"ownArticle(".$line["id"].")\"
class='tagsPic' title='".__('Bookmark on OwnCloud ')."'>";
diff --git a/plugins/pinterest/init.php b/plugins/pinterest/init.php
index aef9d8511..96c730e84 100644
--- a/plugins/pinterest/init.php
+++ b/plugins/pinterest/init.php
@@ -23,7 +23,7 @@ class Pinterest extends Plugin {
function hook_article_button($line) {
$article_id = $line["id"];
- $rv = "<img src=\"".theme_image($this->link, 'plugins/pinterest/pinterest.png')."\"
+ $rv = "<img src=\"plugins/pinterest/pinterest.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"pinterest($article_id)\"
title='".__('Pinterest')."'>";
diff --git a/plugins/pocket/init.php b/plugins/pocket/init.php
index 3fc51dd91..688a6258d 100644
--- a/plugins/pocket/init.php
+++ b/plugins/pocket/init.php
@@ -24,7 +24,7 @@ class Pocket extends Plugin {
function hook_article_button($line) {
$article_id = $line["id"];
- $rv = "<img src=\"".theme_image($this->link, 'plugins/pocket/pocket.png')."\"
+ $rv = "<img src=\"plugins/pocket/pocket.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"shareArticleToPocket($article_id)\"
title='".__('Pocket')."'>";
diff --git a/plugins/share/init.php b/plugins/share/init.php
index e1151849b..f52d2a4fa 100644
--- a/plugins/share/init.php
+++ b/plugins/share/init.php
@@ -21,7 +21,7 @@ class Share extends Plugin {
}
function hook_article_button($line) {
- return "<img src=\"".theme_image($this->link, 'plugins/share/share.png')."\"
+ return "<img src=\"plugins/share/share.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"shareArticle(".$line['int_id'].")\"
title='".__('Share by URL')."'>";
diff --git a/plugins/tweet/init.php b/plugins/tweet/init.php
index e7f8ce949..2d20c7187 100644
--- a/plugins/tweet/init.php
+++ b/plugins/tweet/init.php
@@ -23,7 +23,7 @@ class Tweet extends Plugin {
function hook_article_button($line) {
$article_id = $line["id"];
- $rv = "<img src=\"".theme_image($this->link, 'plugins/tweet/tweet.png')."\"
+ $rv = "<img src=\"plugins/tweet/tweet.png\"
class='tagsPic' style=\"cursor : pointer\"
onclick=\"tweetArticle($article_id)\"
title='".__('Share on Twitter')."'>";
diff --git a/plugins/updater/init.php b/plugins/updater/init.php
index 4f9ee86bd..6c31501ed 100644
--- a/plugins/updater/init.php
+++ b/plugins/updater/init.php
@@ -230,6 +230,7 @@ class Updater extends Plugin {
CACHE_DIR,
CACHE_DIR . "/export",
CACHE_DIR . "/images",
+ CACHE_DIR . "/js",
CACHE_DIR . "/simplepie",
ICONS_DIR,
LOCK_DIRECTORY);