summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/af_pennyarcade/init.php54
-rw-r--r--plugins/af_unburn/init.php58
-rw-r--r--plugins/auth_internal/init.php8
-rw-r--r--plugins/auth_ldap/init.php143
-rw-r--r--plugins/auth_remote/init.php13
-rw-r--r--plugins/close_button/init.php2
-rw-r--r--plugins/digest/digest.js6
-rw-r--r--plugins/digest/digest_body.php28
-rw-r--r--plugins/digest/init.php8
-rw-r--r--plugins/embed_original/button.pngbin0 -> 1298 bytes
-rw-r--r--plugins/embed_original/init.css13
-rw-r--r--plugins/embed_original/init.js69
-rw-r--r--plugins/embed_original/init.php56
-rw-r--r--plugins/example/init.php2
-rw-r--r--plugins/flattr/init.php2
-rw-r--r--plugins/googleplus/init.php4
-rw-r--r--plugins/googlereaderkeys/init.php5
-rw-r--r--plugins/identica/init.php4
-rw-r--r--plugins/import_export/import_export.js2
-rw-r--r--plugins/import_export/init.php17
-rw-r--r--plugins/instances/init.php28
-rw-r--r--plugins/mail/init.php42
-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.php8
-rw-r--r--plugins/nsfw/init.php2
-rw-r--r--plugins/owncloud/init.php6
-rw-r--r--plugins/pinterest/init.php4
-rw-r--r--plugins/pocket/init.php4
-rw-r--r--plugins/share/init.php6
-rw-r--r--plugins/tweet/init.php4
-rw-r--r--plugins/updater/init.php74
33 files changed, 655 insertions, 142 deletions
diff --git a/plugins/af_pennyarcade/init.php b/plugins/af_pennyarcade/init.php
index 26d19bc01..06c1230a6 100644
--- a/plugins/af_pennyarcade/init.php
+++ b/plugins/af_pennyarcade/init.php
@@ -5,7 +5,7 @@ class Af_PennyArcade extends Plugin {
private $host;
function about() {
- return array(1.0,
+ return array(1.1,
"Strip unnecessary stuff from PA feeds",
"fox");
}
@@ -22,25 +22,22 @@ class Af_PennyArcade extends Plugin {
if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) {
if (strpos($article["plugin_data"], "pennyarcade,$owner_uid:") === FALSE) {
-
+
+ if ($debug_enabled) {
+ _debug("af_pennyarcade: Processing comic");
+ }
+
$doc = new DOMDocument();
- @$doc->loadHTML(fetch_file_contents($article["link"]));
+ $doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false;
if ($doc) {
$xpath = new DOMXPath($doc);
- $entries = $xpath->query('(//img[@src])'); // we might also check for img[@class='strip'] I guess...
-
- $matches = array();
+ $entries = $xpath->query('(//div[@class="post comic"])');
foreach ($entries as $entry) {
-
- if (preg_match("/(http:\/\/art.penny-arcade.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
-
- $basenode = $entry;
- break;
- }
+ $basenode = $entry;
}
if ($basenode) {
@@ -52,6 +49,39 @@ class Af_PennyArcade extends Plugin {
$article["content"] = $article["stored"]["content"];
}
}
+
+ if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) {
+ if (strpos($article["plugin_data"], "pennyarcade,$owner_uid:") === FALSE) {
+ if ($debug_enabled) {
+ _debug("af_pennyarcade: Processing news post");
+ }
+ $doc = new DOMDocument();
+ $doc->loadHTML(fetch_file_contents($article["link"]));
+
+ if ($doc) {
+ $xpath = new DOMXPath($doc);
+ $entries = $xpath->query('(//div[@class="post"])');
+
+ $basenode = false;
+
+ foreach ($entries as $entry) {
+ $basenode = $entry;
+ }
+
+ $uninteresting = $xpath->query('(//div[@class="heading"])');
+ foreach ($uninteresting as $i) {
+ $i->parentNode->removeChild($i);
+ }
+
+ if ($basenode){
+ $article["content"] = $doc->saveXML($basenode);
+ $article["plugin_data"] = "pennyarcade,$owner_uid:" . $article["plugin_data"];
+ }
+ }
+ } else if (isset($article["stored"]["content"])) {
+ $article["content"] = $article["stored"]["content"];
+ }
+ }
return $article;
}
diff --git a/plugins/af_unburn/init.php b/plugins/af_unburn/init.php
index b68796fb4..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($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,5 +79,54 @@ 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');
+
+ $curl = curl_init();
+ $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
+ $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
+ $header[] = "Cache-Control: max-age=0";
+ $header[] = "Connection: keep-alive";
+ $header[] = "Keep-Alive: 300";
+ $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
+ $header[] = "Accept-Language: en-us,en;q=0.5";
+ $header[] = "Pragma: ";
+
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Firefox/5.0');
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
+ curl_setopt($curl, CURLOPT_HEADER, true);
+ curl_setopt($curl, CURLOPT_REFERER, $url);
+ curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
+ curl_setopt($curl, CURLOPT_AUTOREFERER, true);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ //curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); //CURLOPT_FOLLOWLOCATION Disabled...
+ curl_setopt($curl, CURLOPT_TIMEOUT, 60);
+
+ $html = curl_exec($curl);
+
+ $status = curl_getinfo($curl);
+ curl_close($curl);
+
+ if($status['http_code']!=200){
+ if($status['http_code'] == 301 || $status['http_code'] == 302) {
+ list($header) = explode("\r\n\r\n", $html, 2);
+ $matches = array();
+ preg_match("/(Location:|URI:)[^(\n)]*/", $header, $matches);
+ $url = trim(str_replace($matches[1],"",$matches[0]));
+ $url_parsed = parse_url($url);
+ return (isset($url_parsed))? geturl($url, $referer):'';
+ }
+ $oline='';
+ foreach($status as $key=>$eline){$oline.='['.$key.']'.$eline.' ';}
+ $line =$oline." \r\n ".$url."\r\n-----------------\r\n";
+ $handle = @fopen('./curl.error.log', 'a');
+ fwrite($handle, $line);
+ return FALSE;
+ }
+ return $url;
+ }
}
?>
diff --git a/plugins/auth_internal/init.php b/plugins/auth_internal/init.php
index cf6c13780..e910e52aa 100644
--- a/plugins/auth_internal/init.php
+++ b/plugins/auth_internal/init.php
@@ -22,8 +22,8 @@ class Auth_Internal extends Plugin implements IAuthModule {
$pwd_hash1 = encrypt_password($password);
$pwd_hash2 = encrypt_password($password, $login);
- $login = db_escape_string($login);
- $otp = db_escape_string($_REQUEST["otp"]);
+ $login = db_escape_string($this->link, $login);
+ $otp = db_escape_string($this->link, $_REQUEST["otp"]);
if (get_schema_version($this->link) > 96) {
if (!defined('AUTH_DISABLE_OTP') || !AUTH_DISABLE_OTP) {
@@ -140,7 +140,7 @@ class Auth_Internal extends Plugin implements IAuthModule {
}
function check_password($owner_uid, $password) {
- $owner_uid = db_escape_string($owner_uid);
+ $owner_uid = db_escape_string($this->link, $owner_uid);
$result = db_query($this->link, "SELECT salt,login FROM ttrss_users WHERE
id = '$owner_uid'");
@@ -169,7 +169,7 @@ class Auth_Internal extends Plugin implements IAuthModule {
}
function change_password($owner_uid, $old_password, $new_password) {
- $owner_uid = db_escape_string($owner_uid);
+ $owner_uid = db_escape_string($this->link, $owner_uid);
if ($this->check_password($owner_uid, $old_password)) {
diff --git a/plugins/auth_ldap/init.php b/plugins/auth_ldap/init.php
new file mode 100644
index 000000000..8a7488e1c
--- /dev/null
+++ b/plugins/auth_ldap/init.php
@@ -0,0 +1,143 @@
+<?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');
+ * define('LDAP_AUTH_ANONYMOUSBEFOREBIND', FALSE);
+ * // ??? 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_WARNING);
+ }
+
+ 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['host'],
+ 'basedn'=>LDAP_AUTH_BASEDN,
+ 'options' => array('LDAP_OPT_REFERRALS' => 0)
+ );
+
+ if (!LDAP_AUTH_ANONYMOUSBEFOREBIND) {
+ $ldapConnParams['binddn']= LDAP_AUTH_BINDDN;
+ $ldapConnParams['bindpw']= LDAP_AUTH_BINDPW;
+ }
+ $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 if orignal connexion was anonymous
+ if (LDAP_AUTH_ANONYMOUSBEFOREBIND) {
+ $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/auth_remote/init.php b/plugins/auth_remote/init.php
index 65f188b8f..7e4638fb2 100644
--- a/plugins/auth_remote/init.php
+++ b/plugins/auth_remote/init.php
@@ -21,7 +21,7 @@ class Auth_Remote extends Plugin implements IAuthModule {
}
function get_login_by_ssl_certificate() {
- $cert_serial = db_escape_string(get_ssl_certificate_id());
+ $cert_serial = db_escape_string($this->link, get_ssl_certificate_id());
if ($cert_serial) {
$result = db_query($this->link, "SELECT login FROM ttrss_user_prefs, ttrss_users
@@ -29,7 +29,7 @@ class Auth_Remote extends Plugin implements IAuthModule {
owner_uid = ttrss_users.id");
if (db_num_rows($result) != 0) {
- return db_escape_string(db_fetch_result($result, 0, "login"));
+ return db_escape_string($this->link, db_fetch_result($result, 0, "login"));
}
}
@@ -38,7 +38,10 @@ class Auth_Remote extends Plugin implements IAuthModule {
function authenticate($login, $password) {
- $try_login = db_escape_string($_SERVER["REMOTE_USER"]);
+ $try_login = db_escape_string($this->link, $_SERVER["REMOTE_USER"]);
+
+ // php-cgi
+ if (!$try_login) $try_login = db_escape_string($this->link, $_SERVER["REDIRECT_REMOTE_USER"]);
if (!$try_login) $try_login = $this->get_login_by_ssl_certificate();
# if (!$try_login) $try_login = "test_qqq";
@@ -57,14 +60,14 @@ class Auth_Remote extends Plugin implements IAuthModule {
// update user name
$fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN'];
if ($fullname){
- $fullname = db_escape_string($fullname);
+ $fullname = db_escape_string($this->link, $fullname);
db_query($this->link, "UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " .
$user_id);
}
// update user mail
$email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL'];
if ($email){
- $email = db_escape_string($email);
+ $email = db_escape_string($this->link, $email);
db_query($this->link, "UPDATE ttrss_users SET email = '$email' WHERE id = " .
$user_id);
}
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..c8a08648c 100644
--- a/plugins/digest/digest.js
+++ b/plugins/digest/digest.js
@@ -68,7 +68,7 @@ function catchup_visible_articles(callback) {
var ids = get_visible_article_ids();
- if (confirm(__("Mark %d displayed articles as read?").replace("%d", ids.length))) {
+ if (confirm(ngettext("Mark %d displayed article as read?", "Mark %d displayed articles as read?", ids.length).replace("%d", ids.length))) {
var query = "?op=rpc&method=catchupSelected" +
"&cmode=0&ids=" + param_escape(ids);
@@ -515,7 +515,7 @@ function redraw_feedlist(feeds) {
$('feeds-content').innerHTML += "<li id='F-MORE-PROMPT'>" +
"<img src='images/blank_icon.gif'>" +
"<a href=\"#\" onclick=\"expand_feeds()\">" +
- __("%d more...").replace("%d", feeds.length-10) +
+ ngettext("%d more...", "%d more...", feeds.length-10).replace("%d", feeds.length-10) +
"</a>" + "</li>";
}
@@ -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..0dbe40b94 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,20 @@
<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",
+ "js/functions.js",
+ "plugins/digest/digest.js",
+ "errors.php?mode=js") as $jsfile) {
+
+ echo javascript_tag($jsfile);
+ } ?>
+
+ <script type="text/javascript">
+ <?php init_js_translations(); ?>
+ </script>
- <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,14 +37,12 @@
});
</script>
</head>
-<body id="ttrssDigest" class="claro">
+<body id="ttrssDigest">
<div id="overlay" style="display : block">
<div id="overlay_inner">
<noscript>
<p>
- <?php print_error(__("Your browser doesn't support Javascript, which is required
- for this application to function properly. Please check your
- browser settings.")) ?></p>
+ <?php print_error(__("Your browser doesn't support Javascript, which is required for this application to function properly. Please check your browser settings.")) ?></p>
</noscript>
<img src="images/indicator_white.gif"/>
diff --git a/plugins/digest/init.php b/plugins/digest/init.php
index 2feabe3b4..2fc98b0ec 100644
--- a/plugins/digest/init.php
+++ b/plugins/digest/init.php
@@ -47,7 +47,7 @@ class Digest extends Plugin implements IHandler {
}
function digestgetcontents() {
- $article_id = db_escape_string($_REQUEST['article_id']);
+ $article_id = db_escape_string($this->link, $_REQUEST['article_id']);
$result = db_query($this->link, "SELECT content,title,link,marked,published
FROM ttrss_entries, ttrss_user_entries
@@ -67,9 +67,9 @@ class Digest extends Plugin implements IHandler {
}
function digestupdate() {
- $feed_id = db_escape_string($_REQUEST['feed_id']);
- $offset = db_escape_string($_REQUEST['offset']);
- $seq = db_escape_string($_REQUEST['seq']);
+ $feed_id = db_escape_string($this->link, $_REQUEST['feed_id']);
+ $offset = db_escape_string($this->link, $_REQUEST['offset']);
+ $seq = db_escape_string($this->link, $_REQUEST['seq']);
if (!$feed_id) $feed_id = -4;
if (!$offset) $offset = 0;
diff --git a/plugins/embed_original/button.png b/plugins/embed_original/button.png
new file mode 100644
index 000000000..e861201d5
--- /dev/null
+++ b/plugins/embed_original/button.png
Binary files differ
diff --git a/plugins/embed_original/init.css b/plugins/embed_original/init.css
new file mode 100644
index 000000000..4ce482e1a
--- /dev/null
+++ b/plugins/embed_original/init.css
@@ -0,0 +1,13 @@
+div.cdmContentInner iframe.embeddedContent {
+ overflow : hidden;
+ width : 100%;
+ height : 600px;
+ border-width : 0px;
+}
+
+div.postContent iframe.embeddedContent {
+ overflow : hidden;
+ width : 100%;
+ height : 100%;
+ border-width : 0px;
+}
diff --git a/plugins/embed_original/init.js b/plugins/embed_original/init.js
new file mode 100644
index 000000000..517f2cd54
--- /dev/null
+++ b/plugins/embed_original/init.js
@@ -0,0 +1,69 @@
+function embedOriginalArticle(id) {
+ try {
+ var hasSandbox = "sandbox" in document.createElement("iframe");
+
+ if (!hasSandbox) {
+ alert(__("Sorry, your browser does not support sandboxed iframes."));
+ return;
+ }
+
+ var query = "op=pluginhandler&plugin=embed_original&method=getUrl&id=" +
+ param_escape(id);
+
+ var c = false;
+
+ if (isCdmMode()) {
+ c = $$("div#RROW-" + id + " div[class=cdmContentInner]")[0];
+ } else if (id == getActiveArticleId()) {
+ c = $$("div[class=postContent]")[0];
+ }
+
+ if (c) {
+ var iframe = c.getElementsByClassName("embeddedContent")[0];
+
+ if (iframe) {
+ Element.show(c.firstChild);
+ c.removeChild(iframe);
+
+ if (isCdmMode()) {
+ cdmScrollToArticleId(id, true);
+ }
+
+ return;
+ }
+ }
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ var ti = JSON.parse(transport.responseText);
+
+ if (ti) {
+
+ var iframe = new Element("iframe", {
+ class: "embeddedContent",
+ src: ti.url,
+ sandbox: 'allow-scripts',
+ });
+
+ if (c) {
+ Element.hide(c.firstChild);
+
+ if (c.firstChild.nextSibling)
+ c.insertBefore(iframe, c.firstChild.nextSibling);
+ else
+ c.appendChild(iframe);
+
+ if (isCdmMode()) {
+ cdmScrollToArticleId(id, true);
+ }
+ }
+ }
+
+ } });
+
+
+ } catch (e) {
+ exception_error("embedOriginalArticle", e);
+ }
+}
diff --git a/plugins/embed_original/init.php b/plugins/embed_original/init.php
new file mode 100644
index 000000000..0e0eb9603
--- /dev/null
+++ b/plugins/embed_original/init.php
@@ -0,0 +1,56 @@
+<?php
+class Embed_Original extends Plugin {
+ private $link;
+ private $host;
+
+ function init($host) {
+ $this->link = $host->get_link();
+ $this->host = $host;
+
+ $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
+ }
+
+ function about() {
+ return array(1.0,
+ "Try to display original article content inside tt-rss",
+ "fox");
+ }
+
+ function get_js() {
+ return file_get_contents(dirname(__FILE__) . "/init.js");
+ }
+
+ function get_css() {
+ return file_get_contents(dirname(__FILE__) . "/init.css");
+ }
+
+ function hook_article_button($line) {
+ $id = $line["id"];
+
+ $rv = "<img src=\"plugins/embed_original/button.png\"
+ class='tagsPic' style=\"cursor : pointer\"
+ onclick=\"embedOriginalArticle($id)\"
+ title='".__('Toggle embed original')."'>";
+
+ return $rv;
+ }
+
+ function getUrl() {
+ $id = db_escape_string($this->link, $_REQUEST['id']);
+
+ $result = db_query($this->link, "SELECT link
+ FROM ttrss_entries, ttrss_user_entries
+ WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
+
+ $url = "";
+
+ if (db_num_rows($result) != 0) {
+ $url = db_fetch_result($result, 0, "link");
+
+ }
+
+ print json_encode(array("url" => $url, "id" => $id));
+ }
+
+}
+?>
diff --git a/plugins/example/init.php b/plugins/example/init.php
index f3788ae8c..926a57da8 100644
--- a/plugins/example/init.php
+++ b/plugins/example/init.php
@@ -21,7 +21,7 @@ class Example extends Plugin {
}
function save() {
- $example_value = db_escape_string($_POST["example_value"]);
+ $example_value = db_escape_string($this->link, $_POST["example_value"]);
$this->host->set($this, "example", $example_value);
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..6045d2df6 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+')."'>";
@@ -32,7 +32,7 @@ class GooglePlus extends Plugin {
}
function getInfo() {
- $id = db_escape_string($_REQUEST['id']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link
FROM ttrss_entries, ttrss_user_entries
diff --git a/plugins/googlereaderkeys/init.php b/plugins/googlereaderkeys/init.php
index 97133d305..afdc58ec7 100644
--- a/plugins/googlereaderkeys/init.php
+++ b/plugins/googlereaderkeys/init.php
@@ -21,10 +21,11 @@ class GoogleReaderKeys extends Plugin {
$hotkeys["j"] = "next_article_noscroll";
$hotkeys["k"] = "prev_article_noscroll";
- $hotkeys["N"] = "next_feed";
- $hotkeys["P"] = "prev_feed";
+ $hotkeys["*n"] = "next_feed";
+ $hotkeys["*p"] = "prev_feed";
$hotkeys["v"] = "open_in_new_window";
$hotkeys["r"] = "feed_refresh";
+ $hotkeys["m"] = "toggle_unread";
$hotkeys["(32)|space"] = "next_article";
$hotkeys["(38)|up"] = "article_scroll_up";
$hotkeys["(40)|down"] = "article_scroll_down";
diff --git a/plugins/identica/init.php b/plugins/identica/init.php
index c260334af..8e0ad4b9a 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')."'>";
@@ -32,7 +32,7 @@ class Identica extends Plugin {
}
function getInfo() {
- $id = db_escape_string($_REQUEST['id']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link
FROM ttrss_entries, ttrss_user_entries
diff --git a/plugins/import_export/import_export.js b/plugins/import_export/import_export.js
index b3b760f15..86b0458be 100644
--- a/plugins/import_export/import_export.js
+++ b/plugins/import_export/import_export.js
@@ -37,7 +37,7 @@ function exportData() {
} else {
$("export_status_message").innerHTML =
- __("Finished, exported %d articles. You can download the data <a class='visibleLink' href='%u'>here</a>.")
+ ngettext("Finished, exported %d article. You can download the data <a class='visibleLink' href='%u'>here</a>.", "Finished, exported %d articles. You can download the data <a class='visibleLink' href='%u'>here</a>.", exported)
.replace("%d", exported)
.replace("%u", "backend.php?op=pluginhandler&plugin=import_export&subop=exportget");
diff --git a/plugins/import_export/init.php b/plugins/import_export/init.php
index de21dbf32..5a3051edb 100644
--- a/plugins/import_export/init.php
+++ b/plugins/import_export/init.php
@@ -49,7 +49,7 @@ class Import_Export extends Plugin implements IHandler {
}
function save() {
- $example_value = db_escape_string($_POST["example_value"]);
+ $example_value = db_escape_string($this->link, $_POST["example_value"]);
echo "Value set to $example_value (not really)";
}
@@ -122,7 +122,7 @@ class Import_Export extends Plugin implements IHandler {
}
function exportrun() {
- $offset = (int) db_escape_string($_REQUEST['offset']);
+ $offset = (int) db_escape_string($this->link, $_REQUEST['offset']);
$exported = 0;
$limit = 250;
@@ -238,7 +238,7 @@ class Import_Export extends Plugin implements IHandler {
foreach ($article_node->childNodes as $child) {
if ($child->nodeName != 'label_cache')
- $article[$child->nodeName] = db_escape_string($child->nodeValue);
+ $article[$child->nodeName] = db_escape_string($this->link, $child->nodeValue);
else
$article[$child->nodeName] = $child->nodeValue;
}
@@ -346,7 +346,7 @@ class Import_Export extends Plugin implements IHandler {
$score = (int) $article['score'];
$tag_cache = $article['tag_cache'];
- $label_cache = db_escape_string($article['label_cache']);
+ $label_cache = db_escape_string($this->link, $article['label_cache']);
$note = $article['note'];
//print "Importing " . $article['title'] . "<br/>";
@@ -382,8 +382,10 @@ class Import_Export extends Plugin implements IHandler {
}
print "<p>" .
- T_sprintf("Finished: %d articles processed, %d imported, %d feeds created.",
- $num_processed, $num_imported, $num_feeds_created) .
+ vsprintf(__("Finished: ")).
+ vsprintf(ngettext("%d article processed, ", "%d articles processed, ", $num_processed), $num_processed).
+ vsprintf(ngettext("%d imported, ", "%d imported, ", $num_imported), $num_imported).
+ vsprintf(ngettext("%d feed created.", "%d feeds created.", $num_feeds_created), $num_feeds_created).
"</p>";
} else {
@@ -421,8 +423,7 @@ class Import_Export extends Plugin implements IHandler {
$this->perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']);
} else {
- print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize
- in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
+ print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
}
diff --git a/plugins/instances/init.php b/plugins/instances/init.php
index 6c0f89e1c..6e8d43e9b 100644
--- a/plugins/instances/init.php
+++ b/plugins/instances/init.php
@@ -92,10 +92,10 @@ class Instances extends Plugin implements IHandler {
WHERE instance_id = '$id'");
foreach ($feeds['feeds'] as $feed) {
- $feed_url = db_escape_string($feed['feed_url']);
- $title = db_escape_string($feed['title']);
- $subscribers = db_escape_string($feed['subscribers']);
- $site_url = db_escape_string($feed['site_url']);
+ $feed_url = db_escape_string($this->link, $feed['feed_url']);
+ $title = db_escape_string($this->link, $feed['title']);
+ $subscribers = db_escape_string($this->link, $feed['subscribers']);
+ $site_url = db_escape_string($this->link, $feed['site_url']);
db_query($link, "INSERT INTO ttrss_linked_feeds
(feed_url, site_url, title, subscribers, instance_id, created, updated)
@@ -167,16 +167,16 @@ class Instances extends Plugin implements IHandler {
}
function remove() {
- $ids = db_escape_string($_REQUEST['ids']);
+ $ids = db_escape_string($this->link, $_REQUEST['ids']);
db_query($this->link, "DELETE FROM ttrss_linked_instances WHERE
id IN ($ids)");
}
function add() {
- $id = db_escape_string($_REQUEST["id"]);
- $access_url = db_escape_string($_REQUEST["access_url"]);
- $access_key = db_escape_string($_REQUEST["access_key"]);
+ $id = db_escape_string($this->link, $_REQUEST["id"]);
+ $access_url = db_escape_string($this->link, $_REQUEST["access_url"]);
+ $access_key = db_escape_string($this->link, $_REQUEST["access_key"]);
db_query($this->link, "BEGIN");
@@ -195,7 +195,7 @@ class Instances extends Plugin implements IHandler {
}
function edit() {
- $id = db_escape_string($_REQUEST["id"]);
+ $id = db_escape_string($this->link, $_REQUEST["id"]);
$result = db_query($this->link, "SELECT * FROM ttrss_linked_instances WHERE
id = '$id'");
@@ -253,9 +253,9 @@ class Instances extends Plugin implements IHandler {
}
function editSave() {
- $id = db_escape_string($_REQUEST["id"]);
- $access_url = db_escape_string($_REQUEST["access_url"]);
- $access_key = db_escape_string($_REQUEST["access_key"]);
+ $id = db_escape_string($this->link, $_REQUEST["id"]);
+ $access_url = db_escape_string($this->link, $_REQUEST["access_url"]);
+ $access_key = db_escape_string($this->link, $_REQUEST["access_key"]);
db_query($this->link, "UPDATE ttrss_linked_instances SET
access_key = '$access_key', access_url = '$access_url',
@@ -277,7 +277,7 @@ class Instances extends Plugin implements IHandler {
print "<div id=\"pref-instance-toolbar\" dojoType=\"dijit.Toolbar\">";
- $sort = db_escape_string($_REQUEST["sort"]);
+ $sort = db_escape_string($this->link, $_REQUEST["sort"]);
if (!$sort || $sort == "undefined") {
$sort = "access_url";
@@ -364,7 +364,7 @@ class Instances extends Plugin implements IHandler {
function fbexport() {
- $access_key = db_escape_string($_POST["key"]);
+ $access_key = db_escape_string($this->link, $_POST["key"]);
// TODO: rate limit checking using last_connected
$result = db_query($this->link, "SELECT id FROM ttrss_linked_instances
diff --git a/plugins/mail/init.php b/plugins/mail/init.php
index 2e972cf61..49de96afd 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')."'>";
@@ -30,7 +30,7 @@ class Mail extends Plugin {
function emailArticle() {
- $param = db_escape_string($_REQUEST['param']);
+ $param = db_escape_string($this->link, $_REQUEST['param']);
$secretkey = sha1(uniqid(rand(), true));
@@ -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
@@ -138,7 +137,7 @@ class Mail extends Plugin {
function sendEmail() {
$secretkey = $_REQUEST['secretkey'];
- require_once 'lib/phpmailer/class.phpmailer.php';
+ require_once 'classes/ttrssmailer.php';
$reply = array();
@@ -147,42 +146,25 @@ class Mail extends Plugin {
$_SESSION['email_secretkey'] = '';
- $destination = $_REQUEST['destination'];
- $subject = $_REQUEST['subject'];
- $content = $_REQUEST['content'];
-
$replyto = strip_tags($_SESSION['email_replyto']);
$fromname = strip_tags($_SESSION['email_fromname']);
- $mail = new PHPMailer();
-
- $mail->PluginDir = "lib/phpmailer/";
- $mail->SetLanguage("en", "lib/phpmailer/language/");
-
- $mail->CharSet = "UTF-8";
+ $mail = new ttrssMailer();
$mail->From = $replyto;
$mail->FromName = $fromname;
- $mail->AddAddress($destination);
-
- if (SMTP_HOST) {
- $mail->Host = SMTP_HOST;
- $mail->Mailer = "smtp";
- $mail->SMTPAuth = SMTP_LOGIN != '';
- $mail->Username = SMTP_LOGIN;
- $mail->Password = SMTP_PASSWORD;
- }
+ $mail->AddAddress($_REQUEST['destination']);
$mail->IsHTML(false);
- $mail->Subject = $subject;
- $mail->Body = $content;
+ $mail->Subject = $_REQUEST['subject'];
+ $mail->Body = $_REQUEST['content'];
$rc = $mail->Send();
if (!$rc) {
$reply['error'] = $mail->ErrorInfo;
} else {
- save_email_address($this->link, db_escape_string($destination));
+ save_email_address($this->link, db_escape_string($this->link, $destination));
$reply['message'] = "UPDATE_COUNTERS";
}
@@ -194,7 +176,7 @@ class Mail extends Plugin {
}
function completeEmails() {
- $search = db_escape_string($_REQUEST["search"]);
+ $search = db_escape_string($this->link, $_REQUEST["search"]);
print "<ul>";
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..e140bbea7
--- /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($this->link, $_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..7e8cfb57f 100644
--- a/plugins/note/init.php
+++ b/plugins/note/init.php
@@ -22,14 +22,14 @@ 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')."'>";
}
function edit() {
- $param = db_escape_string($_REQUEST['param']);
+ $param = db_escape_string($this->link, $_REQUEST['param']);
$result = db_query($this->link, "SELECT note FROM ttrss_user_entries WHERE
ref_id = '$param' AND owner_uid = " . $_SESSION['uid']);
@@ -58,8 +58,8 @@ class Note extends Plugin {
}
function setNote() {
- $id = db_escape_string($_REQUEST["id"]);
- $note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
+ $id = db_escape_string($this->link, $_REQUEST["id"]);
+ $note = trim(strip_tags(db_escape_string($this->link, $_REQUEST["note"])));
db_query($this->link, "UPDATE ttrss_user_entries SET note = '$note'
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php
index 9aadde4dd..247d56a1e 100644
--- a/plugins/nsfw/init.php
+++ b/plugins/nsfw/init.php
@@ -91,7 +91,7 @@ class NSFW extends Plugin {
}
function save() {
- $tags = explode(",", db_escape_string($_POST["tags"]));
+ $tags = explode(",", db_escape_string($this->link, $_POST["tags"]));
$tags = array_map("trim", $tags);
$tags = array_map("mb_strtolower", $tags);
$tags = join(", ", $tags);
diff --git a/plugins/owncloud/init.php b/plugins/owncloud/init.php
index b846241b8..5d215b386 100644
--- a/plugins/owncloud/init.php
+++ b/plugins/owncloud/init.php
@@ -20,7 +20,7 @@ class OwnCloud extends Plugin {
}
function save() {
- $owncloud_url = db_escape_string($_POST["owncloud_url"]);
+ $owncloud_url = db_escape_string($this->link, $_POST["owncloud_url"]);
$this->host->set($this, "owncloud", $owncloud_url);
echo "Value set to $owncloud_url";
}
@@ -68,14 +68,14 @@ 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 ')."'>";
}
function getOwnCloud() {
- $id = db_escape_string($_REQUEST['id']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link
FROM ttrss_entries, ttrss_user_entries
diff --git a/plugins/pinterest/init.php b/plugins/pinterest/init.php
index aef9d8511..11fe64eb5 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')."'>";
@@ -32,7 +32,7 @@ class Pinterest extends Plugin {
}
function getInfo() {
- $id = db_escape_string($_REQUEST['id']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link
FROM ttrss_entries, ttrss_user_entries
diff --git a/plugins/pocket/init.php b/plugins/pocket/init.php
index 3fc51dd91..e96d08001 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')."'>";
@@ -33,7 +33,7 @@ class Pocket extends Plugin {
}
function getInfo() {
- $id = db_escape_string($_REQUEST['id']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link
FROM ttrss_entries, ttrss_user_entries
diff --git a/plugins/share/init.php b/plugins/share/init.php
index e1151849b..a3dc35224 100644
--- a/plugins/share/init.php
+++ b/plugins/share/init.php
@@ -21,14 +21,14 @@ 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')."'>";
}
function shareArticle() {
- $param = db_escape_string($_REQUEST['param']);
+ $param = db_escape_string($this->link, $_REQUEST['param']);
$result = db_query($this->link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param'
AND owner_uid = " . $_SESSION['uid']);
@@ -41,7 +41,7 @@ class Share extends Plugin {
$ref_id = db_fetch_result($result, 0, "ref_id");
if (!$uuid) {
- $uuid = db_escape_string(sha1(uniqid(rand(), true)));
+ $uuid = db_escape_string($this->link, sha1(uniqid(rand(), true)));
db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param'
AND owner_uid = " . $_SESSION['uid']);
}
diff --git a/plugins/tweet/init.php b/plugins/tweet/init.php
index e7f8ce949..bbcf7836c 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')."'>";
@@ -32,7 +32,7 @@ class Tweet extends Plugin {
}
function getInfo() {
- $id = db_escape_string($_REQUEST['id']);
+ $id = db_escape_string($this->link, $_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link
FROM ttrss_entries, ttrss_user_entries
diff --git a/plugins/updater/init.php b/plugins/updater/init.php
index d940aefeb..8a7c8a9ca 100644
--- a/plugins/updater/init.php
+++ b/plugins/updater/init.php
@@ -79,7 +79,6 @@ class Updater extends Plugin {
$stop = true; break;
}
-
array_push($log, "Checking for latest version...");
$version_info = json_decode(fetch_file_contents("http://tt-rss.org/version.php"),
@@ -91,7 +90,7 @@ class Updater extends Plugin {
}
$target_version = $version_info["version"];
- $target_dir = "$parent_dir/tt-rss-$target_version";
+ $target_dir = "$parent_dir/Tiny-Tiny-RSS-$target_version";
array_push($log, "Target version: $target_version");
$params["target_version"] = $target_version;
@@ -110,7 +109,7 @@ class Updater extends Plugin {
case 1:
$target_version = $params["target_version"];
- array_push($log, "Downloading checksums...");
+/* array_push($log, "Downloading checksums...");
$md5sum_data = fetch_file_contents("http://tt-rss.org/download/md5sum.txt");
if (!$md5sum_data) {
@@ -134,16 +133,18 @@ class Updater extends Plugin {
$stop = true; break;
}
- $params["target_md5sum"] = $target_md5sum;
+ $params["target_md5sum"] = $target_md5sum; */
+
+ array_push($log, "Proceeding to download...");
break;
case 2:
$target_version = $params["target_version"];
- $target_md5sum = $params["target_md5sum"];
+ // $target_md5sum = $params["target_md5sum"];
array_push($log, "Downloading distribution tarball...");
- $tarball_url = "http://tt-rss.org/download/tt-rss-$target_version.tar.gz";
+ $tarball_url = "https://github.com/gothfox/Tiny-Tiny-RSS/archive/$target_version.tar.gz";
$data = fetch_file_contents($tarball_url);
if (!$data) {
@@ -151,14 +152,14 @@ class Updater extends Plugin {
$stop = true; break;
}
- array_push($log, "Verifying tarball checksum...");
+ /* array_push($log, "Verifying tarball checksum...");
$test_md5sum = md5($data);
if ($test_md5sum != $target_md5sum) {
array_push($log, "Downloaded checksum doesn't match (got $test_md5sum, expected $target_md5sum).");
$stop = true; break;
- }
+ } */
$tmp_file = tempnam(sys_get_temp_dir(), 'tt-rss');
array_push($log, "Saving download to $tmp_file");
@@ -180,14 +181,6 @@ class Updater extends Plugin {
$stop = true; break;
}
- $old_dir = tmpdirname($parent_dir, "tt-rss-old");
-
- array_push($log, "Renaming tt-rss directory to ".basename($old_dir));
- if (!rename($work_dir, $old_dir)) {
- array_push($log, "Unable to rename tt-rss directory.");
- $stop = true; break;
- }
-
array_push($log, "Extracting tarball...");
system("tar zxf $tmp_file", $system_rc);
@@ -196,7 +189,20 @@ class Updater extends Plugin {
$stop = true; break;
}
- $target_dir = "$parent_dir/tt-rss-$target_version";
+ $target_dir = "$parent_dir/Tiny-Tiny-RSS-$target_version";
+
+ if (!is_dir($target_dir)) {
+ array_push($log, "Target directory ($target_dir) not found.");
+ $stop = true; break;
+ }
+
+ $old_dir = tmpdirname($parent_dir, "tt-rss-old");
+
+ array_push($log, "Renaming tt-rss directory to ".basename($old_dir));
+ if (!rename($work_dir, $old_dir)) {
+ array_push($log, "Unable to rename tt-rss directory.");
+ $stop = true; break;
+ }
array_push($log, "Renaming target directory...");
if (!rename($target_dir, $work_dir)) {
@@ -224,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);
@@ -233,6 +240,26 @@ class Updater extends Plugin {
chmod($dir, 0777);
}
+ if (ICONS_DIR == "feed-icons") {
+ array_push($log, "Migrating feed icons...");
+
+ $icons = glob("$old_dir/feed-icons/*.ico");
+ $icons_copied = 0;
+
+ foreach ($icons as $icon) {
+ $icon = basename($icon);
+
+ if (copy("$old_dir/feed-icons/$icon", "$work_dir/feed-icons/$icon")) {
+ ++$icons_copied;
+ }
+ }
+
+ array_push($log, "Done; $icons_copied files copied");
+
+ } else {
+ array_push($log, "Not migrating feed icons, ICONS_DIR modified.");
+ }
+
array_push($log, "Upgrade completed.");
array_push($log, "Your old tt-rss directory is saved at $old_dir. ".
"Please migrate locally modified files (if any) and remove it.");
@@ -271,10 +298,12 @@ class Updater extends Plugin {
_debug("Please backup your tt-rss directory before continuing. Your database will not be modified.");
_debug("Type 'yes' to continue.");
- if (read_stdin() != 'yes')
+ $input = read_stdin();
+
+ if ($input != 'yes' && $input != 'force')
exit;
- $this->update_self_cli($link, in_array("-force", $args));
+ $this->update_self_cli($link, $input == 'force');
}
function get_prefs_js() {
@@ -294,9 +323,14 @@ class Updater extends Plugin {
if (is_array($_SESSION["version_data"])) {
$version = $_SESSION["version_data"]["version"];
+ $version_id = $_SESSION["version_data"]["version_id"];
print_notice(T_sprintf("New version of Tiny Tiny RSS is available (%s).", "<b>$version</b>"));
- print "<p><button dojoType=\"dijit.form.Button\" onclick=\"return updateSelf()\">".
+ $details = "http://tt-rss.org/redmine/versions/$version_id";
+
+ print "<p><button onclick=\"window.open('$details')\" dojoType=\"dijit.form.Button\">".__("See the release notes")."</button>";
+
+ print " <button dojoType=\"dijit.form.Button\" onclick=\"return updateSelf()\">".
__('Update Tiny Tiny RSS')."</button></p>";
} else {