mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-29 10:31:28 +00:00
remove $link
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Af_Buttersafe extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +10,6 @@ class Af_Buttersafe extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Af_Explosm extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +10,6 @@ class Af_Explosm extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Af_GoComics extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +9,6 @@ class Af_GoComics extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Af_PennyArcade extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +10,6 @@ class Af_PennyArcade extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
@@ -22,11 +20,11 @@ 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"]));
|
||||
|
||||
@@ -49,7 +47,7 @@ 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) {
|
||||
@@ -57,22 +55,22 @@ class Af_PennyArcade extends Plugin {
|
||||
}
|
||||
$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"];
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Af_RedditImgur extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +9,6 @@ class Af_RedditImgur extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Af_Unburn extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +9,6 @@ class Af_Unburn extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Auth_Internal extends Plugin implements IAuthModule {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -12,7 +10,6 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_AUTH_USER, $this);
|
||||
@@ -22,12 +19,12 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
|
||||
$pwd_hash1 = encrypt_password($password);
|
||||
$pwd_hash2 = encrypt_password($password, $login);
|
||||
$login = db_escape_string($this->link, $login);
|
||||
$otp = db_escape_string($this->link, $_REQUEST["otp"]);
|
||||
$login = db_escape_string( $login);
|
||||
$otp = db_escape_string( $_REQUEST["otp"]);
|
||||
|
||||
if (get_schema_version($this->link) > 96) {
|
||||
if (get_schema_version() > 96) {
|
||||
if (!defined('AUTH_DISABLE_OTP') || !AUTH_DISABLE_OTP) {
|
||||
$result = db_query($this->link, "SELECT otp_enabled,salt FROM ttrss_users WHERE
|
||||
$result = db_query( "SELECT otp_enabled,salt FROM ttrss_users WHERE
|
||||
login = '$login'");
|
||||
|
||||
if (db_num_rows($result) > 0) {
|
||||
@@ -75,9 +72,9 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
}
|
||||
}
|
||||
|
||||
if (get_schema_version($this->link) > 87) {
|
||||
if (get_schema_version() > 87) {
|
||||
|
||||
$result = db_query($this->link, "SELECT salt FROM ttrss_users WHERE
|
||||
$result = db_query( "SELECT salt FROM ttrss_users WHERE
|
||||
login = '$login'");
|
||||
|
||||
if (db_num_rows($result) != 1) {
|
||||
@@ -95,7 +92,7 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
|
||||
// verify and upgrade password to new salt base
|
||||
|
||||
$result = db_query($this->link, $query);
|
||||
$result = db_query( $query);
|
||||
|
||||
if (db_num_rows($result) == 1) {
|
||||
// upgrade password to MODE2
|
||||
@@ -103,7 +100,7 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
$salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
|
||||
$pwd_hash = encrypt_password($password, $salt, true);
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_users SET
|
||||
db_query( "UPDATE ttrss_users SET
|
||||
pwd_hash = '$pwd_hash', salt = '$salt' WHERE login = '$login'");
|
||||
|
||||
$query = "SELECT id
|
||||
@@ -131,7 +128,7 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
pwd_hash = '$pwd_hash2')";
|
||||
}
|
||||
|
||||
$result = db_query($this->link, $query);
|
||||
$result = db_query( $query);
|
||||
|
||||
if (db_num_rows($result) == 1) {
|
||||
return db_fetch_result($result, 0, "id");
|
||||
@@ -141,9 +138,9 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
}
|
||||
|
||||
function check_password($owner_uid, $password) {
|
||||
$owner_uid = db_escape_string($this->link, $owner_uid);
|
||||
$owner_uid = db_escape_string( $owner_uid);
|
||||
|
||||
$result = db_query($this->link, "SELECT salt,login FROM ttrss_users WHERE
|
||||
$result = db_query( "SELECT salt,login FROM ttrss_users WHERE
|
||||
id = '$owner_uid'");
|
||||
|
||||
$salt = db_fetch_result($result, 0, "salt");
|
||||
@@ -164,20 +161,20 @@ class Auth_Internal extends Plugin implements IAuthModule {
|
||||
id = '$owner_uid' AND pwd_hash = '$password_hash'";
|
||||
}
|
||||
|
||||
$result = db_query($this->link, $query);
|
||||
$result = db_query( $query);
|
||||
|
||||
return db_num_rows($result) != 0;
|
||||
}
|
||||
|
||||
function change_password($owner_uid, $old_password, $new_password) {
|
||||
$owner_uid = db_escape_string($this->link, $owner_uid);
|
||||
$owner_uid = db_escape_string( $owner_uid);
|
||||
|
||||
if ($this->check_password($owner_uid, $old_password)) {
|
||||
|
||||
$new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
|
||||
$new_password_hash = encrypt_password($new_password, $new_salt, true);
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_users SET
|
||||
db_query( "UPDATE ttrss_users SET
|
||||
pwd_hash = '$new_password_hash', salt = '$new_salt', otp_enabled = false
|
||||
WHERE id = '$owner_uid'");
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Auth_Remote extends Plugin implements IAuthModule {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
private $base;
|
||||
|
||||
@@ -13,23 +12,22 @@ class Auth_Remote extends Plugin implements IAuthModule {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
$this->base = new Auth_Base($this->link);
|
||||
$this->base = new Auth_Base();
|
||||
|
||||
$host->add_hook($host::HOOK_AUTH_USER, $this);
|
||||
}
|
||||
|
||||
function get_login_by_ssl_certificate() {
|
||||
$cert_serial = db_escape_string($this->link, get_ssl_certificate_id());
|
||||
$cert_serial = db_escape_string( get_ssl_certificate_id());
|
||||
|
||||
if ($cert_serial) {
|
||||
$result = db_query($this->link, "SELECT login FROM ttrss_user_prefs, ttrss_users
|
||||
$result = db_query( "SELECT login FROM ttrss_user_prefs, ttrss_users
|
||||
WHERE pref_name = 'SSL_CERT_SERIAL' AND value = '$cert_serial' AND
|
||||
owner_uid = ttrss_users.id");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
return db_escape_string($this->link, db_fetch_result($result, 0, "login"));
|
||||
return db_escape_string( db_fetch_result($result, 0, "login"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +36,10 @@ class Auth_Remote extends Plugin implements IAuthModule {
|
||||
|
||||
|
||||
function authenticate($login, $password) {
|
||||
$try_login = db_escape_string($this->link, $_SERVER["REMOTE_USER"]);
|
||||
$try_login = db_escape_string( $_SERVER["REMOTE_USER"]);
|
||||
|
||||
// php-cgi
|
||||
if (!$try_login) $try_login = db_escape_string($this->link, $_SERVER["REDIRECT_REMOTE_USER"]);
|
||||
if (!$try_login) $try_login = db_escape_string( $_SERVER["REDIRECT_REMOTE_USER"]);
|
||||
|
||||
if (!$try_login) $try_login = $this->get_login_by_ssl_certificate();
|
||||
# if (!$try_login) $try_login = "test_qqq";
|
||||
@@ -60,15 +58,15 @@ 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($this->link, $fullname);
|
||||
db_query($this->link, "UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " .
|
||||
$fullname = db_escape_string( $fullname);
|
||||
db_query( "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($this->link, $email);
|
||||
db_query($this->link, "UPDATE ttrss_users SET email = '$email' WHERE id = " .
|
||||
$email = db_escape_string( $email);
|
||||
db_query( "UPDATE ttrss_users SET email = '$email' WHERE id = " .
|
||||
$user_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
class Bookmarklets extends Plugin {
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -10,7 +9,6 @@ class Bookmarklets extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
class Close_Button 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);
|
||||
@@ -17,7 +15,7 @@ class Close_Button extends Plugin {
|
||||
}
|
||||
|
||||
function hook_article_button($line) {
|
||||
if (!get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
|
||||
if (!get_pref( "COMBINED_DISPLAY_MODE")) {
|
||||
$rv = "<img src=\"plugins/close_button/button.png\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"closeArticlePanel()\"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<?php global $link; ?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -25,7 +23,7 @@
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
|
||||
<?php print_user_stylesheet($link) ?>
|
||||
<?php print_user_stylesheet(); ?>
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
// TODO: digest should register digest specific hotkey actions within tt-rss
|
||||
class Digest extends Plugin implements IHandler {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -13,7 +11,6 @@ class Digest extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_handler("digest", "*", $this);
|
||||
@@ -22,10 +19,7 @@ class Digest extends Plugin implements IHandler {
|
||||
function index() {
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
login_sequence($this->link);
|
||||
|
||||
global $link;
|
||||
$link = $this->link;
|
||||
login_sequence();
|
||||
|
||||
require_once dirname(__FILE__) . "/digest_body.php";
|
||||
}
|
||||
@@ -47,13 +41,13 @@ class Digest extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function digestgetcontents() {
|
||||
$article_id = db_escape_string($this->link, $_REQUEST['article_id']);
|
||||
$article_id = db_escape_string( $_REQUEST['article_id']);
|
||||
|
||||
$result = db_query($this->link, "SELECT content,title,link,marked,published
|
||||
$result = db_query( "SELECT content,title,link,marked,published
|
||||
FROM ttrss_entries, ttrss_user_entries
|
||||
WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']);
|
||||
|
||||
$content = sanitize($this->link, db_fetch_result($result, 0, "content"));
|
||||
$content = sanitize( db_fetch_result($result, 0, "content"));
|
||||
$title = strip_tags(db_fetch_result($result, 0, "title"));
|
||||
$article_url = htmlspecialchars(db_fetch_result($result, 0, "link"));
|
||||
$marked = sql_bool_to_bool(db_fetch_result($result, 0, "marked"));
|
||||
@@ -61,15 +55,15 @@ class Digest extends Plugin implements IHandler {
|
||||
|
||||
print json_encode(array("article" =>
|
||||
array("id" => $article_id, "url" => $article_url,
|
||||
"tags" => get_article_tags($this->link, $article_id),
|
||||
"tags" => get_article_tags( $article_id),
|
||||
"marked" => $marked, "published" => $published,
|
||||
"title" => $title, "content" => $content)));
|
||||
}
|
||||
|
||||
function digestupdate() {
|
||||
$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']);
|
||||
$feed_id = db_escape_string( $_REQUEST['feed_id']);
|
||||
$offset = db_escape_string( $_REQUEST['offset']);
|
||||
$seq = db_escape_string( $_REQUEST['seq']);
|
||||
|
||||
if (!$feed_id) $feed_id = -4;
|
||||
if (!$offset) $offset = 0;
|
||||
@@ -78,18 +72,18 @@ class Digest extends Plugin implements IHandler {
|
||||
|
||||
$reply['seq'] = $seq;
|
||||
|
||||
$headlines = API::api_get_headlines($this->link, $feed_id, 30, $offset,
|
||||
$headlines = API::api_get_headlines( $feed_id, 30, $offset,
|
||||
'', ($feed_id == -4), true, false, "unread", "updated DESC", 0, 0);
|
||||
|
||||
$reply['headlines'] = array();
|
||||
$reply['headlines']['title'] = getFeedTitle($this->link, $feed_id);
|
||||
$reply['headlines']['title'] = getFeedTitle( $feed_id);
|
||||
$reply['headlines']['content'] = $headlines;
|
||||
|
||||
print json_encode($reply);
|
||||
}
|
||||
|
||||
function digestinit() {
|
||||
$tmp_feeds = API::api_get_feeds($this->link, -4, true, false, 0);
|
||||
$tmp_feeds = API::api_get_feeds( -4, true, false, 0);
|
||||
|
||||
$params = array();
|
||||
$feeds = array();
|
||||
@@ -99,7 +93,7 @@ class Digest extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
if ($_REQUEST["init"] == 1) {
|
||||
$params["hotkeys"] = get_hotkeys_map($this->link);
|
||||
$params["hotkeys"] = get_hotkeys_map();
|
||||
}
|
||||
$params["feeds"] = $feeds;
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?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);
|
||||
@@ -36,9 +34,9 @@ class Embed_Original extends Plugin {
|
||||
}
|
||||
|
||||
function getUrl() {
|
||||
$id = db_escape_string($this->link, $_REQUEST['id']);
|
||||
$id = db_escape_string( $_REQUEST['id']);
|
||||
|
||||
$result = db_query($this->link, "SELECT link
|
||||
$result = db_query( "SELECT link
|
||||
FROM ttrss_entries, ttrss_user_entries
|
||||
WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
class Example extends Plugin {
|
||||
|
||||
// Demonstrates how to add a separate panel to the preferences screen and inject Javascript/save data using Dojo forms.
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -15,14 +13,13 @@ class Example extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
||||
}
|
||||
|
||||
function save() {
|
||||
$example_value = db_escape_string($this->link, $_POST["example_value"]);
|
||||
$example_value = db_escape_string( $_POST["example_value"]);
|
||||
|
||||
$this->host->set($this, "example", $example_value);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ class Example_Api extends Plugin {
|
||||
// 1. status (STATUS_OK or STATUS_ERR)
|
||||
// 2. arbitrary payload
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -18,7 +17,6 @@ class Example_Api extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_api_method("example_testmethod", $this);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Example_Article extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -12,7 +11,6 @@ class Example_Article extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
|
||||
|
||||
@@ -4,7 +4,6 @@ class Example_Feed extends Plugin {
|
||||
// Demonstrates how to query data from the parsed feed object (SimplePie)
|
||||
// don't enable unless debugging feed through f D hotkey or manually.
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -15,7 +14,6 @@ class Example_Feed extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_FEED_PARSED, $this);
|
||||
|
||||
@@ -12,7 +12,6 @@ class Example_Routing extends Plugin implements IHandler {
|
||||
// Any system method may be masked by plugins. You can mask
|
||||
// entire handler by supplying "*" instead of a method name.
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -23,7 +22,6 @@ class Example_Routing extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_handler("test", "example", $this);
|
||||
|
||||
@@ -6,7 +6,6 @@ class Example_VFeed extends Plugin {
|
||||
|
||||
// Not implemented yet: stuff for 3 panel mode
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
private $dummy_id;
|
||||
|
||||
@@ -18,7 +17,6 @@ class Example_VFeed extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$this->dummy_id = $host->add_feed(-1, 'Dummy feed', 'images/pub_set.svg', $this);
|
||||
@@ -29,7 +27,7 @@ class Example_VFeed extends Plugin {
|
||||
}
|
||||
|
||||
function get_headlines($feed_id, $options) {
|
||||
$qfh_ret = queryFeedHeadlines($this->link, -4,
|
||||
$qfh_ret = queryFeedHeadlines( -4,
|
||||
$options['limit'],
|
||||
$options['view_mode'], $options['cat_view'],
|
||||
$options['search'],
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?php
|
||||
class GoogleReaderImport extends Plugin {
|
||||
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -14,7 +11,6 @@ class GoogleReaderImport extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_command("greader-import",
|
||||
@@ -34,11 +30,11 @@ class GoogleReaderImport extends Plugin {
|
||||
|
||||
_debug("please enter your username:");
|
||||
|
||||
$username = db_escape_string($this->link, trim(read_stdin()));
|
||||
$username = db_escape_string( trim(read_stdin()));
|
||||
|
||||
_debug("looking up user: $username...");
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_users
|
||||
$result = db_query( "SELECT id FROM ttrss_users
|
||||
WHERE login = '$username'");
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
@@ -59,7 +55,7 @@ class GoogleReaderImport extends Plugin {
|
||||
|
||||
function import($file = false, $owner_uid = 0) {
|
||||
|
||||
purge_orphans($this->link);
|
||||
purge_orphans();
|
||||
|
||||
if (!$file) {
|
||||
header("Content-Type: text/html");
|
||||
@@ -115,30 +111,30 @@ class GoogleReaderImport extends Plugin {
|
||||
foreach ($doc['items'] as $item) {
|
||||
// print_r($item);
|
||||
|
||||
$guid = db_escape_string($this->link, mb_substr($item['id'], 0, 250));
|
||||
$title = db_escape_string($this->link, $item['title']);
|
||||
$guid = db_escape_string( mb_substr($item['id'], 0, 250));
|
||||
$title = db_escape_string( $item['title']);
|
||||
$updated = date('Y-m-d h:i:s', $item['updated']);
|
||||
$link = '';
|
||||
$content = '';
|
||||
$author = db_escape_string($this->link, $item['author']);
|
||||
$author = db_escape_string( $item['author']);
|
||||
$tags = array();
|
||||
$orig_feed_data = array();
|
||||
|
||||
if (is_array($item['alternate'])) {
|
||||
foreach ($item['alternate'] as $alt) {
|
||||
if (isset($alt['type']) && $alt['type'] == 'text/html') {
|
||||
$link = db_escape_string($this->link, $alt['href']);
|
||||
$link = db_escape_string( $alt['href']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($item['summary'])) {
|
||||
$content = db_escape_string($this->link,
|
||||
$content = db_escape_string(
|
||||
$item['summary']['content'], false);
|
||||
}
|
||||
|
||||
if (is_array($item['content'])) {
|
||||
$content = db_escape_string($this->link,
|
||||
$content = db_escape_string(
|
||||
$item['content']['content'], false);
|
||||
}
|
||||
|
||||
@@ -153,14 +149,14 @@ class GoogleReaderImport extends Plugin {
|
||||
if (is_array($item['origin'])) {
|
||||
if (strpos($item['origin']['streamId'], 'feed/') === 0) {
|
||||
|
||||
$orig_feed_data['feed_url'] = db_escape_string($this->link,
|
||||
$orig_feed_data['feed_url'] = db_escape_string(
|
||||
mb_substr(preg_replace("/^feed\//",
|
||||
"", $item['origin']['streamId']), 0, 200));
|
||||
|
||||
$orig_feed_data['title'] = db_escape_string($this->link,
|
||||
$orig_feed_data['title'] = db_escape_string(
|
||||
mb_substr($item['origin']['title'], 0, 200));
|
||||
|
||||
$orig_feed_data['site_url'] = db_escape_string($this->link,
|
||||
$orig_feed_data['site_url'] = db_escape_string(
|
||||
mb_substr($item['origin']['htmlUrl'], 0, 200));
|
||||
}
|
||||
}
|
||||
@@ -168,7 +164,7 @@ class GoogleReaderImport extends Plugin {
|
||||
$processed++;
|
||||
|
||||
$imported += (int) $this->create_article($owner_uid, $guid, $title,
|
||||
$updated, $link, $content, $author, $sql_set_marked, $tags,
|
||||
$updated, $content, $author, $sql_set_marked, $tags,
|
||||
$orig_feed_data);
|
||||
|
||||
if ($file && $processed % 25 == 0) {
|
||||
@@ -200,7 +196,7 @@ class GoogleReaderImport extends Plugin {
|
||||
}
|
||||
|
||||
// expects ESCAPED data
|
||||
private function create_article($owner_uid, $guid, $title, $updated, $link, $content, $author, $marked, $tags, $orig_feed_data) {
|
||||
private function create_article($owner_uid, $guid, $title, $updated, $content, $author, $marked, $tags, $orig_feed_data) {
|
||||
|
||||
if (!$guid) $guid = sha1($link);
|
||||
|
||||
@@ -210,9 +206,9 @@ class GoogleReaderImport extends Plugin {
|
||||
|
||||
$content_hash = sha1($content);
|
||||
|
||||
if (filter_var($link, FILTER_VALIDATE_URL) === FALSE) return false;
|
||||
if (filter_var( FILTER_VALIDATE_URL) === FALSE) return false;
|
||||
|
||||
db_query($this->link, "BEGIN");
|
||||
db_query( "BEGIN");
|
||||
|
||||
$feed_id = 'NULL';
|
||||
|
||||
@@ -223,7 +219,7 @@ class GoogleReaderImport extends Plugin {
|
||||
// before dealing with archived feeds we must check ttrss_feeds to maintain id consistency
|
||||
|
||||
if ($orig_feed_data['feed_url'] && $create_archived_feeds) {
|
||||
$result = db_query($this->link,
|
||||
$result = db_query(
|
||||
"SELECT id FROM ttrss_feeds WHERE feed_url = '".$orig_feed_data['feed_url']."'
|
||||
AND owner_uid = $owner_uid");
|
||||
|
||||
@@ -234,7 +230,7 @@ class GoogleReaderImport extends Plugin {
|
||||
|
||||
if (!$orig_feed_data['title']) $orig_feed_data['title'] = '[Unknown]';
|
||||
|
||||
$result = db_query($this->link,
|
||||
$result = db_query(
|
||||
"INSERT INTO ttrss_feeds
|
||||
(owner_uid,feed_url,site_url,title,cat_id,auth_login,auth_pass,update_method)
|
||||
VALUES ($owner_uid,
|
||||
@@ -243,7 +239,7 @@ class GoogleReaderImport extends Plugin {
|
||||
'".$orig_feed_data['title']."',
|
||||
NULL, '', '', 0)");
|
||||
|
||||
$result = db_query($this->link,
|
||||
$result = db_query(
|
||||
"SELECT id FROM ttrss_feeds WHERE feed_url = '".$orig_feed_data['feed_url']."'
|
||||
AND owner_uid = $owner_uid");
|
||||
|
||||
@@ -258,18 +254,18 @@ class GoogleReaderImport extends Plugin {
|
||||
// locate archived entry to file entries in, we don't want to file them in actual feeds because of purging
|
||||
// maybe file marked in real feeds because eh
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_archived_feeds WHERE
|
||||
$result = db_query( "SELECT id FROM ttrss_archived_feeds WHERE
|
||||
feed_url = '".$orig_feed_data['feed_url']."' AND owner_uid = $owner_uid");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
$orig_feed_id = db_fetch_result($result, 0, "id");
|
||||
} else {
|
||||
db_query($this->link, "INSERT INTO ttrss_archived_feeds
|
||||
db_query( "INSERT INTO ttrss_archived_feeds
|
||||
(id, owner_uid, title, feed_url, site_url)
|
||||
SELECT id, owner_uid, title, feed_url, site_url from ttrss_feeds
|
||||
WHERE id = '$feed_id'");
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_archived_feeds WHERE
|
||||
$result = db_query( "SELECT id FROM ttrss_archived_feeds WHERE
|
||||
feed_url = '".$orig_feed_data['feed_url']."' AND owner_uid = $owner_uid");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
@@ -280,32 +276,32 @@ class GoogleReaderImport extends Plugin {
|
||||
|
||||
// delete temporarily inserted feed
|
||||
if ($feed_id && $feed_inserted) {
|
||||
db_query($this->link, "DELETE FROM ttrss_feeds WHERE id = $feed_id");
|
||||
db_query( "DELETE FROM ttrss_feeds WHERE id = $feed_id");
|
||||
}
|
||||
|
||||
if (!$orig_feed_id) $orig_feed_id = 'NULL';
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_entries, ttrss_user_entries WHERE
|
||||
$result = db_query( "SELECT id FROM ttrss_entries, ttrss_user_entries WHERE
|
||||
guid = '$guid' AND ref_id = id AND owner_uid = '$owner_uid' LIMIT 1");
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
$result = db_query($this->link, "INSERT INTO ttrss_entries
|
||||
$result = db_query( "INSERT INTO ttrss_entries
|
||||
(title, guid, link, updated, content, content_hash, date_entered, date_updated, author)
|
||||
VALUES
|
||||
('$title', '$guid', '$link', '$updated', '$content', '$content_hash', NOW(), NOW(), '$author')");
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_entries WHERE guid = '$guid'");
|
||||
$result = db_query( "SELECT id FROM ttrss_entries WHERE guid = '$guid'");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
$ref_id = db_fetch_result($result, 0, "id");
|
||||
|
||||
db_query($this->link, "INSERT INTO ttrss_user_entries
|
||||
db_query( "INSERT INTO ttrss_user_entries
|
||||
(ref_id, uuid, feed_id, orig_feed_id, owner_uid, marked, tag_cache, label_cache,
|
||||
last_read, note, unread, last_marked)
|
||||
VALUES
|
||||
('$ref_id', '', NULL, $orig_feed_id, $owner_uid, $marked, '', '', NOW(), '', false, NOW())");
|
||||
|
||||
$result = db_query($this->link, "SELECT int_id FROM ttrss_user_entries, ttrss_entries
|
||||
$result = db_query( "SELECT int_id FROM ttrss_user_entries, ttrss_entries
|
||||
WHERE owner_uid = $owner_uid AND ref_id = id AND ref_id = $ref_id");
|
||||
|
||||
if (db_num_rows($result) != 0 && is_array($tags)) {
|
||||
@@ -315,16 +311,16 @@ class GoogleReaderImport extends Plugin {
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
|
||||
$tag = db_escape_string($this->link, sanitize_tag($tag));
|
||||
$tag = db_escape_string( sanitize_tag($tag));
|
||||
|
||||
if (!tag_is_valid($tag)) continue;
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_tags
|
||||
$result = db_query( "SELECT id FROM ttrss_tags
|
||||
WHERE tag_name = '$tag' AND post_int_id = '$entry_int_id' AND
|
||||
owner_uid = '$owner_uid' LIMIT 1");
|
||||
|
||||
if ($result && db_num_rows($result) == 0) {
|
||||
db_query($this->link, "INSERT INTO ttrss_tags
|
||||
db_query( "INSERT INTO ttrss_tags
|
||||
(owner_uid,tag_name,post_int_id)
|
||||
VALUES ('$owner_uid','$tag', '$entry_int_id')");
|
||||
}
|
||||
@@ -335,9 +331,9 @@ class GoogleReaderImport extends Plugin {
|
||||
/* update the cache */
|
||||
|
||||
$tags_to_cache = array_unique($tags_to_cache);
|
||||
$tags_str = db_escape_string($this->link, join(",", $tags_to_cache));
|
||||
$tags_str = db_escape_string( join(",", $tags_to_cache));
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_user_entries
|
||||
db_query( "UPDATE ttrss_user_entries
|
||||
SET tag_cache = '$tags_str' WHERE ref_id = '$ref_id'
|
||||
AND owner_uid = $owner_uid");
|
||||
}
|
||||
@@ -346,7 +342,7 @@ class GoogleReaderImport extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
db_query($this->link, "COMMIT");
|
||||
db_query( "COMMIT");
|
||||
|
||||
return $rc;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class GoogleReaderKeys extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +9,6 @@ class GoogleReaderKeys extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_HOTKEY_MAP, $this);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
<?php
|
||||
class Import_Export extends Plugin implements IHandler {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
||||
@@ -29,11 +26,11 @@ class Import_Export extends Plugin implements IHandler {
|
||||
|
||||
_debug("please enter your username:");
|
||||
|
||||
$username = db_escape_string($this->link, trim(read_stdin()));
|
||||
$username = db_escape_string( trim(read_stdin()));
|
||||
|
||||
_debug("importing $filename for user $username...\n");
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_users WHERE login = '$username'");
|
||||
$result = db_query( "SELECT id FROM ttrss_users WHERE login = '$username'");
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
print "error: could not find user $username.\n";
|
||||
@@ -42,11 +39,11 @@ class Import_Export extends Plugin implements IHandler {
|
||||
|
||||
$owner_uid = db_fetch_result($result, 0, "id");
|
||||
|
||||
$this->perform_data_import($this->link, $filename, $owner_uid);
|
||||
$this->perform_data_import( $filename, $owner_uid);
|
||||
}
|
||||
|
||||
function save() {
|
||||
$example_value = db_escape_string($this->link, $_POST["example_value"]);
|
||||
$example_value = db_escape_string( $_POST["example_value"]);
|
||||
|
||||
echo "Value set to $example_value (not really)";
|
||||
}
|
||||
@@ -120,12 +117,12 @@ class Import_Export extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function exportrun() {
|
||||
$offset = (int) db_escape_string($this->link, $_REQUEST['offset']);
|
||||
$offset = (int) db_escape_string( $_REQUEST['offset']);
|
||||
$exported = 0;
|
||||
$limit = 250;
|
||||
|
||||
if ($offset < 10000 && is_writable(CACHE_DIR . "/export")) {
|
||||
$result = db_query($this->link, "SELECT
|
||||
$result = db_query( "SELECT
|
||||
ttrss_entries.guid,
|
||||
ttrss_entries.title,
|
||||
content,
|
||||
@@ -184,7 +181,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||
print json_encode(array("exported" => $exported));
|
||||
}
|
||||
|
||||
function perform_data_import($link, $filename, $owner_uid) {
|
||||
function perform_data_import( $filename, $owner_uid) {
|
||||
|
||||
$num_imported = 0;
|
||||
$num_processed = 0;
|
||||
@@ -237,7 +234,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($this->link, $child->nodeValue);
|
||||
$article[$child->nodeName] = db_escape_string( $child->nodeValue);
|
||||
else
|
||||
$article[$child->nodeName] = $child->nodeValue;
|
||||
}
|
||||
@@ -248,16 +245,16 @@ class Import_Export extends Plugin implements IHandler {
|
||||
|
||||
++$num_processed;
|
||||
|
||||
//db_query($link, "BEGIN");
|
||||
//db_query( "BEGIN");
|
||||
|
||||
//print 'GUID:' . $article['guid'] . "\n";
|
||||
|
||||
$result = db_query($link, "SELECT id FROM ttrss_entries
|
||||
$result = db_query( "SELECT id FROM ttrss_entries
|
||||
WHERE guid = '".$article['guid']."'");
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
|
||||
$result = db_query($link,
|
||||
$result = db_query(
|
||||
"INSERT INTO ttrss_entries
|
||||
(title,
|
||||
guid,
|
||||
@@ -285,7 +282,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||
'0',
|
||||
'')");
|
||||
|
||||
$result = db_query($link, "SELECT id FROM ttrss_entries
|
||||
$result = db_query( "SELECT id FROM ttrss_entries
|
||||
WHERE guid = '".$article['guid']."'");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
@@ -306,7 +303,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||
$feed = 'NULL';
|
||||
|
||||
if ($feed_url && $feed_title) {
|
||||
$result = db_query($link, "SELECT id FROM ttrss_feeds
|
||||
$result = db_query( "SELECT id FROM ttrss_feeds
|
||||
WHERE feed_url = '$feed_url' AND owner_uid = '$owner_uid'");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
@@ -314,10 +311,10 @@ class Import_Export extends Plugin implements IHandler {
|
||||
} else {
|
||||
// try autocreating feed in Uncategorized...
|
||||
|
||||
$result = db_query($link, "INSERT INTO ttrss_feeds (owner_uid,
|
||||
$result = db_query( "INSERT INTO ttrss_feeds (owner_uid,
|
||||
feed_url, title) VALUES ($owner_uid, '$feed_url', '$feed_title')");
|
||||
|
||||
$result = db_query($link, "SELECT id FROM ttrss_feeds
|
||||
$result = db_query( "SELECT id FROM ttrss_feeds
|
||||
WHERE feed_url = '$feed_url' AND owner_uid = '$owner_uid'");
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
@@ -335,7 +332,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||
|
||||
//print "$ref_id / $feed / " . $article['title'] . "\n";
|
||||
|
||||
$result = db_query($link, "SELECT int_id FROM ttrss_user_entries
|
||||
$result = db_query( "SELECT int_id FROM ttrss_user_entries
|
||||
WHERE ref_id = '$ref_id' AND owner_uid = '$owner_uid' AND $feed_qpart");
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
@@ -345,14 +342,14 @@ class Import_Export extends Plugin implements IHandler {
|
||||
$score = (int) $article['score'];
|
||||
|
||||
$tag_cache = $article['tag_cache'];
|
||||
$label_cache = db_escape_string($this->link, $article['label_cache']);
|
||||
$label_cache = db_escape_string( $article['label_cache']);
|
||||
$note = $article['note'];
|
||||
|
||||
//print "Importing " . $article['title'] . "<br/>";
|
||||
|
||||
++$num_imported;
|
||||
|
||||
$result = db_query($link,
|
||||
$result = db_query(
|
||||
"INSERT INTO ttrss_user_entries
|
||||
(ref_id, owner_uid, feed_id, unread, last_read, marked,
|
||||
published, score, tag_cache, label_cache, uuid, note)
|
||||
@@ -365,15 +362,15 @@ class Import_Export extends Plugin implements IHandler {
|
||||
if (is_array($label_cache) && $label_cache["no-labels"] != 1) {
|
||||
foreach ($label_cache as $label) {
|
||||
|
||||
label_create($link, $label[1],
|
||||
label_create( $label[1],
|
||||
$label[2], $label[3], $owner_uid);
|
||||
|
||||
label_add_article($link, $ref_id, $label[1], $owner_uid);
|
||||
label_add_article( $ref_id, $label[1], $owner_uid);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//db_query($link, "COMMIT");
|
||||
//db_query( "COMMIT");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -441,7 +438,7 @@ class Import_Export extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
if (is_file($tmp_file)) {
|
||||
$this->perform_data_import($this->link, $tmp_file, $_SESSION['uid']);
|
||||
$this->perform_data_import( $tmp_file, $_SESSION['uid']);
|
||||
unlink($tmp_file);
|
||||
} else {
|
||||
print_error(__('No file uploaded.'));
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Instances extends Plugin implements IHandler {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
private $status_codes = array(
|
||||
@@ -18,7 +16,6 @@ class Instances extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_PREFS_TABS, $this);
|
||||
@@ -30,7 +27,7 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
function hook_update_task($args) {
|
||||
_debug("Get linked feeds...");
|
||||
$this->get_linked_feeds($this->link);
|
||||
$this->get_linked_feeds();
|
||||
}
|
||||
|
||||
// Status codes:
|
||||
@@ -40,7 +37,7 @@ class Instances extends Plugin implements IHandler {
|
||||
// 2 - did not receive valid data
|
||||
// >10 - server error, code + 10 (e.g. 16 means server error 6)
|
||||
|
||||
function get_linked_feeds($link, $instance_id = false) {
|
||||
function get_linked_feeds( $instance_id = false) {
|
||||
if ($instance_id)
|
||||
$instance_qpart = "id = '$instance_id' AND ";
|
||||
else
|
||||
@@ -52,7 +49,7 @@ class Instances extends Plugin implements IHandler {
|
||||
$date_qpart = "last_connected < DATE_SUB(NOW(), INTERVAL 6 HOUR)";
|
||||
}
|
||||
|
||||
$result = db_query($link, "SELECT id, access_key, access_url FROM ttrss_linked_instances
|
||||
$result = db_query( "SELECT id, access_key, access_url FROM ttrss_linked_instances
|
||||
WHERE $instance_qpart $date_qpart ORDER BY last_connected");
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
@@ -80,7 +77,7 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
// access denied
|
||||
if ($status == 16) {
|
||||
db_query($link, "DELETE FROM ttrss_linked_feeds
|
||||
db_query( "DELETE FROM ttrss_linked_feeds
|
||||
WHERE instance_id = '$id'");
|
||||
}
|
||||
} else {
|
||||
@@ -88,16 +85,16 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
if (count($feeds['feeds']) > 0) {
|
||||
|
||||
db_query($link, "DELETE FROM ttrss_linked_feeds
|
||||
db_query( "DELETE FROM ttrss_linked_feeds
|
||||
WHERE instance_id = '$id'");
|
||||
|
||||
foreach ($feeds['feeds'] as $feed) {
|
||||
$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']);
|
||||
$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']);
|
||||
|
||||
db_query($link, "INSERT INTO ttrss_linked_feeds
|
||||
db_query( "INSERT INTO ttrss_linked_feeds
|
||||
(feed_url, site_url, title, subscribers, instance_id, created, updated)
|
||||
VALUES
|
||||
('$feed_url', '$site_url', '$title', '$subscribers', '$id', NOW(), NOW())");
|
||||
@@ -122,7 +119,7 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
_debug("Status: $status");
|
||||
|
||||
db_query($link, "UPDATE ttrss_linked_instances SET
|
||||
db_query( "UPDATE ttrss_linked_instances SET
|
||||
last_status_out = '$status', last_connected = NOW() WHERE id = '$id'");
|
||||
|
||||
}
|
||||
@@ -130,7 +127,7 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
|
||||
function get_feeds() {
|
||||
$this->get_linked_feeds($this->link, false);
|
||||
$this->get_linked_feeds( false);
|
||||
}
|
||||
|
||||
function get_prefs_js() {
|
||||
@@ -167,37 +164,37 @@ class Instances extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function remove() {
|
||||
$ids = db_escape_string($this->link, $_REQUEST['ids']);
|
||||
$ids = db_escape_string( $_REQUEST['ids']);
|
||||
|
||||
db_query($this->link, "DELETE FROM ttrss_linked_instances WHERE
|
||||
db_query( "DELETE FROM ttrss_linked_instances WHERE
|
||||
id IN ($ids)");
|
||||
}
|
||||
|
||||
function add() {
|
||||
$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"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
$access_url = db_escape_string( $_REQUEST["access_url"]);
|
||||
$access_key = db_escape_string( $_REQUEST["access_key"]);
|
||||
|
||||
db_query($this->link, "BEGIN");
|
||||
db_query( "BEGIN");
|
||||
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_linked_instances
|
||||
$result = db_query( "SELECT id FROM ttrss_linked_instances
|
||||
WHERE access_url = '$access_url'");
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
db_query($this->link, "INSERT INTO ttrss_linked_instances
|
||||
db_query( "INSERT INTO ttrss_linked_instances
|
||||
(access_url, access_key, last_connected, last_status_in, last_status_out)
|
||||
VALUES
|
||||
('$access_url', '$access_key', '1970-01-01', -1, -1)");
|
||||
|
||||
}
|
||||
|
||||
db_query($this->link, "COMMIT");
|
||||
db_query( "COMMIT");
|
||||
}
|
||||
|
||||
function edit() {
|
||||
$id = db_escape_string($this->link, $_REQUEST["id"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
|
||||
$result = db_query($this->link, "SELECT * FROM ttrss_linked_instances WHERE
|
||||
$result = db_query( "SELECT * FROM ttrss_linked_instances WHERE
|
||||
id = '$id'");
|
||||
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$id\">";
|
||||
@@ -253,11 +250,11 @@ class Instances extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function editSave() {
|
||||
$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"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
$access_url = db_escape_string( $_REQUEST["access_url"]);
|
||||
$access_key = db_escape_string( $_REQUEST["access_key"]);
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_linked_instances SET
|
||||
db_query( "UPDATE ttrss_linked_instances SET
|
||||
access_key = '$access_key', access_url = '$access_url',
|
||||
last_connected = '1970-01-01'
|
||||
WHERE id = '$id'");
|
||||
@@ -277,7 +274,7 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
print "<div id=\"pref-instance-toolbar\" dojoType=\"dijit.Toolbar\">";
|
||||
|
||||
$sort = db_escape_string($this->link, $_REQUEST["sort"]);
|
||||
$sort = db_escape_string( $_REQUEST["sort"]);
|
||||
|
||||
if (!$sort || $sort == "undefined") {
|
||||
$sort = "access_url";
|
||||
@@ -298,7 +295,7 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
print "</div>"; #toolbar
|
||||
|
||||
$result = db_query($this->link, "SELECT *,
|
||||
$result = db_query( "SELECT *,
|
||||
(SELECT COUNT(*) FROM ttrss_linked_feeds
|
||||
WHERE instance_id = ttrss_linked_instances.id) AS num_feeds
|
||||
FROM ttrss_linked_instances
|
||||
@@ -327,7 +324,7 @@ class Instances extends Plugin implements IHandler {
|
||||
$id = $line['id'];
|
||||
$this_row_id = "id=\"LIRR-$id\"";
|
||||
|
||||
$line["last_connected"] = make_local_datetime($this->link, $line["last_connected"], false);
|
||||
$line["last_connected"] = make_local_datetime( $line["last_connected"], false);
|
||||
|
||||
print "<tr class=\"$class\" $this_row_id>";
|
||||
|
||||
@@ -364,17 +361,17 @@ class Instances extends Plugin implements IHandler {
|
||||
|
||||
function fbexport() {
|
||||
|
||||
$access_key = db_escape_string($this->link, $_POST["key"]);
|
||||
$access_key = db_escape_string( $_POST["key"]);
|
||||
|
||||
// TODO: rate limit checking using last_connected
|
||||
$result = db_query($this->link, "SELECT id FROM ttrss_linked_instances
|
||||
$result = db_query( "SELECT id FROM ttrss_linked_instances
|
||||
WHERE access_key = '$access_key'");
|
||||
|
||||
if (db_num_rows($result) == 1) {
|
||||
|
||||
$instance_id = db_fetch_result($result, 0, "id");
|
||||
|
||||
$result = db_query($this->link, "SELECT feed_url, site_url, title, subscribers
|
||||
$result = db_query( "SELECT feed_url, site_url, title, subscribers
|
||||
FROM ttrss_feedbrowser_cache ORDER BY subscribers DESC LIMIT 100");
|
||||
|
||||
$feeds = array();
|
||||
@@ -383,7 +380,7 @@ class Instances extends Plugin implements IHandler {
|
||||
array_push($feeds, $line);
|
||||
}
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_linked_instances SET
|
||||
db_query( "UPDATE ttrss_linked_instances SET
|
||||
last_status_in = 1 WHERE id = '$instance_id'");
|
||||
|
||||
print json_encode(array("feeds" => $feeds));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Mail extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +10,6 @@ class Mail extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
|
||||
@@ -30,13 +28,13 @@ class Mail extends Plugin {
|
||||
|
||||
function emailArticle() {
|
||||
|
||||
$param = db_escape_string($this->link, $_REQUEST['param']);
|
||||
$param = db_escape_string( $_REQUEST['param']);
|
||||
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"mail\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"sendEmail\">";
|
||||
|
||||
$result = db_query($this->link, "SELECT email, full_name FROM ttrss_users WHERE
|
||||
$result = db_query( "SELECT email, full_name FROM ttrss_users WHERE
|
||||
id = " . $_SESSION["uid"]);
|
||||
|
||||
$user_email = htmlspecialchars(db_fetch_result($result, 0, "email"));
|
||||
@@ -58,7 +56,7 @@ class Mail extends Plugin {
|
||||
$tpl->setVariable('USER_EMAIL', $user_email, true);
|
||||
$tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
|
||||
|
||||
$result = db_query($this->link, "SELECT link, content, title
|
||||
$result = db_query( "SELECT link, content, title
|
||||
FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
|
||||
id IN ($param) AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
@@ -149,7 +147,7 @@ class Mail extends Plugin {
|
||||
if (!$rc) {
|
||||
$reply['error'] = $mail->ErrorInfo;
|
||||
} else {
|
||||
save_email_address($this->link, db_escape_string($this->link, $destination));
|
||||
save_email_address( db_escape_string($destination));
|
||||
$reply['message'] = "UPDATE_COUNTERS";
|
||||
}
|
||||
|
||||
@@ -157,7 +155,7 @@ class Mail extends Plugin {
|
||||
}
|
||||
|
||||
function completeEmails() {
|
||||
$search = db_escape_string($this->link, $_REQUEST["search"]);
|
||||
$search = db_escape_string( $_REQUEST["search"]);
|
||||
|
||||
print "<ul>";
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class MailTo extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +9,6 @@ class MailTo extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
|
||||
@@ -30,7 +27,7 @@ class MailTo extends Plugin {
|
||||
|
||||
function emailArticle() {
|
||||
|
||||
$param = db_escape_string($this->link, $_REQUEST['param']);
|
||||
$param = db_escape_string( $_REQUEST['param']);
|
||||
|
||||
require_once "lib/MiniTemplator.class.php";
|
||||
|
||||
@@ -44,7 +41,7 @@ class MailTo extends Plugin {
|
||||
$tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
|
||||
|
||||
|
||||
$result = db_query($this->link, "SELECT link, content, title
|
||||
$result = db_query( "SELECT link, content, title
|
||||
FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
|
||||
id IN ($param) AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
class Mark_Button 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);
|
||||
@@ -20,7 +18,7 @@ class Mark_Button extends Plugin {
|
||||
$marked_pic = "";
|
||||
$id = $line["id"];
|
||||
|
||||
if (get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
|
||||
if (get_pref( "COMBINED_DISPLAY_MODE")) {
|
||||
if (sql_bool_to_bool($line["marked"])) {
|
||||
$marked_pic = "<img
|
||||
src=\"images/mark_set.svg\"
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
init_plugins($link);
|
||||
|
||||
login_sequence($link, true);
|
||||
login_sequence( true);
|
||||
|
||||
$id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$feed_id = db_escape_string($link, $_REQUEST["feed"]);
|
||||
$cat_id = db_escape_string($link, $_REQUEST["cat"]);
|
||||
$is_cat = db_escape_string($link, $_REQUEST["is_cat"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
$feed_id = db_escape_string( $_REQUEST["feed"]);
|
||||
$cat_id = db_escape_string( $_REQUEST["cat"]);
|
||||
$is_cat = db_escape_string( $_REQUEST["is_cat"]);
|
||||
|
||||
render_article($link, $id, $feed_id, $cat_id, $is_cat);
|
||||
render_article( $id, $feed_id, $cat_id, $is_cat);
|
||||
?>
|
||||
|
||||
|
||||
@@ -31,28 +31,28 @@
|
||||
|
||||
switch ($op) {
|
||||
case "toggleMarked":
|
||||
$cmode = db_escape_string($link, $_REQUEST["mark"]);
|
||||
$id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$cmode = db_escape_string( $_REQUEST["mark"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
|
||||
markArticlesById($link, array($id), $cmode);
|
||||
markArticlesById( array($id), $cmode);
|
||||
break;
|
||||
case "togglePublished":
|
||||
$cmode = db_escape_string($link, $_REQUEST["pub"]);
|
||||
$id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$cmode = db_escape_string( $_REQUEST["pub"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
|
||||
publishArticlesById($link, array($id), $cmode);
|
||||
publishArticlesById( array($id), $cmode);
|
||||
break;
|
||||
case "toggleUnread":
|
||||
$cmode = db_escape_string($link, $_REQUEST["unread"]);
|
||||
$id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$cmode = db_escape_string( $_REQUEST["unread"]);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
|
||||
catchupArticlesById($link, array($id), $cmode);
|
||||
catchupArticlesById( array($id), $cmode);
|
||||
break;
|
||||
|
||||
case "setPref":
|
||||
$id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$value = db_escape_string($link, $_REQUEST["to"]);
|
||||
mobile_set_pref($link, $id, $value);
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
$value = db_escape_string( $_REQUEST["to"]);
|
||||
mobile_set_pref( $id, $value);
|
||||
print_r($_SESSION);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
init_plugins($link);
|
||||
|
||||
login_sequence($link, true);
|
||||
login_sequence( true);
|
||||
|
||||
$cat_id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$cat_id = db_escape_string( $_REQUEST["id"]);
|
||||
|
||||
render_category($link, $cat_id);
|
||||
render_category( $cat_id);
|
||||
?>
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
init_plugins($link);
|
||||
|
||||
login_sequence($link, true);
|
||||
login_sequence( true);
|
||||
|
||||
$feed_id = db_escape_string($link, $_REQUEST["id"]);
|
||||
$cat_id = db_escape_string($link, $_REQUEST["cat"]);
|
||||
$offset = (int) db_escape_string($link, $_REQUEST["skip"]);
|
||||
$search = db_escape_string($link, $_REQUEST["search"]);
|
||||
$is_cat = (bool) db_escape_string($link, $_REQUEST["is_cat"]);
|
||||
$feed_id = db_escape_string( $_REQUEST["id"]);
|
||||
$cat_id = db_escape_string( $_REQUEST["cat"]);
|
||||
$offset = (int) db_escape_string( $_REQUEST["skip"]);
|
||||
$search = db_escape_string( $_REQUEST["search"]);
|
||||
$is_cat = (bool) db_escape_string( $_REQUEST["is_cat"]);
|
||||
|
||||
render_headlines_list($link, $feed_id, $cat_id, $offset, $search, $is_cat);
|
||||
render_headlines_list( $feed_id, $cat_id, $offset, $search, $is_cat);
|
||||
?>
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
init_plugins($link);
|
||||
|
||||
login_sequence($link, true);
|
||||
login_sequence( true);
|
||||
|
||||
$use_cats = mobile_get_pref($link, 'ENABLE_CATS');
|
||||
$offset = (int) db_escape_string($link, $_REQUEST["skip"]);
|
||||
$use_cats = mobile_get_pref( 'ENABLE_CATS');
|
||||
$offset = (int) db_escape_string( $_REQUEST["skip"]);
|
||||
|
||||
if ($use_cats) {
|
||||
render_categories_list($link);
|
||||
} else {
|
||||
render_flat_feed_list($link, $offset);
|
||||
render_flat_feed_list( $offset);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
init_plugins($link);
|
||||
|
||||
login_sequence($link, true);
|
||||
login_sequence( true);
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
@@ -76,13 +76,13 @@
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$use_cats = mobile_get_pref($link, 'ENABLE_CATS');
|
||||
$offset = (int) db_escape_string($link, $_REQUEST["skip"]);
|
||||
$use_cats = mobile_get_pref( 'ENABLE_CATS');
|
||||
$offset = (int) db_escape_string( $_REQUEST["skip"]);
|
||||
|
||||
if ($use_cats) {
|
||||
render_categories_list($link);
|
||||
} else {
|
||||
render_flat_feed_list($link, $offset);
|
||||
render_flat_feed_list( $offset);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Mobile extends Plugin implements IHandler {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -12,7 +10,6 @@ class Mobile extends Plugin implements IHandler {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_handler("mobile", "index", $this);
|
||||
|
||||
@@ -8,34 +8,34 @@
|
||||
|
||||
/* TODO replace with interface to db-prefs */
|
||||
|
||||
function mobile_pref_toggled($link, $id) {
|
||||
if (get_pref($link, "_MOBILE_$id"))
|
||||
function mobile_pref_toggled( $id) {
|
||||
if (get_pref( "_MOBILE_$id"))
|
||||
return "true";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function mobile_get_pref($link, $id) {
|
||||
function mobile_get_pref( $id) {
|
||||
//return $_SESSION["mobile-prefs"][$id];
|
||||
return get_pref($link, "_MOBILE_$id");
|
||||
return get_pref( "_MOBILE_$id");
|
||||
}
|
||||
|
||||
function mobile_set_pref($link, $id, $value) {
|
||||
function mobile_set_pref( $id, $value) {
|
||||
//$_SESSION["mobile-prefs"][$id] = $value;
|
||||
return set_pref($link, "_MOBILE_$id", $value);
|
||||
return set_pref( "_MOBILE_$id", $value);
|
||||
}
|
||||
|
||||
function mobile_feed_has_icon($id) {
|
||||
return file_exists("../../".ICONS_DIR."/$id.ico");
|
||||
}
|
||||
|
||||
function render_flat_feed_list($link, $offset) {
|
||||
function render_flat_feed_list( $offset) {
|
||||
$owner_uid = $_SESSION["uid"];
|
||||
$limit = 0;
|
||||
|
||||
if (!$offset) $offset = 0;
|
||||
|
||||
if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) {
|
||||
if (mobile_get_pref( "SORT_FEEDS_UNREAD")) {
|
||||
$order_by = "unread DESC, title";
|
||||
} else {
|
||||
$order_by = "title";
|
||||
@@ -47,7 +47,7 @@
|
||||
$limit_qpart = "";
|
||||
}
|
||||
|
||||
$result = db_query($link, "SELECT id,
|
||||
$result = db_query( "SELECT id,
|
||||
title,
|
||||
(SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
|
||||
WHERE feed_id = ttrss_feeds.id AND unread = true
|
||||
@@ -85,7 +85,7 @@
|
||||
$icon_url = "../../images/blank_icon.gif";
|
||||
}
|
||||
|
||||
if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
|
||||
if ($unread > 0 || !mobile_get_pref( "HIDE_READ")) {
|
||||
print "<li class='$class'><a href='feed.php?id=$id'>" .
|
||||
"<img class='tinyIcon' src='$icon_url'/>".
|
||||
$line["title"] . "</a></li>";
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
}
|
||||
|
||||
function render_category($link, $cat_id, $offset) {
|
||||
function render_category( $cat_id, $offset) {
|
||||
$owner_uid = $_SESSION["uid"];
|
||||
|
||||
if ($cat_id >= 0) {
|
||||
@@ -114,13 +114,13 @@
|
||||
$cat_query = "cat_id IS NULL";
|
||||
}
|
||||
|
||||
if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) {
|
||||
if (mobile_get_pref( "SORT_FEEDS_UNREAD")) {
|
||||
$order_by = "unread DESC, title";
|
||||
} else {
|
||||
$order_by = "title";
|
||||
}
|
||||
|
||||
$result = db_query($link, "SELECT id,
|
||||
$result = db_query( "SELECT id,
|
||||
title,
|
||||
(SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
|
||||
WHERE feed_id = ttrss_feeds.id AND unread = true
|
||||
@@ -132,7 +132,7 @@
|
||||
$cat_query
|
||||
ORDER BY $order_by");
|
||||
|
||||
$title = getCategoryTitle($link, $cat_id);
|
||||
$title = getCategoryTitle( $cat_id);
|
||||
|
||||
print "<ul id='cat-$cat_id' title='$title' myBackLabel='".__("Home")."'
|
||||
myBackHref='home.php'>";
|
||||
@@ -158,7 +158,7 @@
|
||||
$icon_url = "../../images/blank_icon.gif";
|
||||
}
|
||||
|
||||
if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
|
||||
if ($unread > 0 || !mobile_get_pref( "HIDE_READ")) {
|
||||
print "<li class='$class'><a href='feed.php?id=$id&cat=$cat_id'>" .
|
||||
"<img class='tinyIcon' src='$icon_url'/>".
|
||||
$line["title"] . "</a></li>";
|
||||
@@ -174,8 +174,8 @@
|
||||
myBackHref='home.php'>";
|
||||
|
||||
foreach (array(-4, -3, -1, -2, 0) as $id) {
|
||||
$title = getFeedTitle($link, $id);
|
||||
$unread = getFeedUnread($link, $id, false);
|
||||
$title = getFeedTitle( $id);
|
||||
$unread = getFeedUnread( $id, false);
|
||||
$icon = getFeedIcon($id);
|
||||
|
||||
if ($unread > 0) {
|
||||
@@ -185,7 +185,7 @@
|
||||
$class = 'oldItem';
|
||||
}
|
||||
|
||||
if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
|
||||
if ($unread > 0 || !mobile_get_pref( "HIDE_READ")) {
|
||||
print "<li class='$class'>
|
||||
<a href='feed.php?id=$id&cat=-1'>
|
||||
<img class='tinyIcon' src='../$icon'/>$title</a></li>";
|
||||
@@ -200,7 +200,7 @@
|
||||
print "<ul id='cat--2' title='$title' myBackLabel='".__("Home")."'
|
||||
myBackHref='home.php'>";
|
||||
|
||||
$result = db_query($link, "SELECT id, caption FROM ttrss_labels2
|
||||
$result = db_query( "SELECT id, caption FROM ttrss_labels2
|
||||
WHERE owner_uid = '$owner_uid'");
|
||||
|
||||
$label_data = array();
|
||||
@@ -209,7 +209,7 @@
|
||||
|
||||
$id = label_to_feed_id($line["id"]);
|
||||
|
||||
$unread = getFeedUnread($link, $id);
|
||||
$unread = getFeedUnread( $id);
|
||||
$title = $line["caption"];
|
||||
|
||||
if ($unread > 0) {
|
||||
@@ -219,7 +219,7 @@
|
||||
$class = 'oldItem';
|
||||
}
|
||||
|
||||
if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
|
||||
if ($unread > 0 || !mobile_get_pref( "HIDE_READ")) {
|
||||
print "<li class='$class'>
|
||||
<a href='feed.php?id=$id&cat=-2'>$title</a></li>";
|
||||
}
|
||||
@@ -231,7 +231,7 @@
|
||||
function render_categories_list($link) {
|
||||
$owner_uid = $_SESSION["uid"];
|
||||
|
||||
$cat_browse = mobile_get_pref($link, "BROWSE_CATS");
|
||||
$cat_browse = mobile_get_pref( "BROWSE_CATS");
|
||||
|
||||
print '<ul id="home" title="'.__('Home').'" selected="true"
|
||||
myBackLabel="'.__('Logout').'" myBackHref="logout.php" myBackTarget="_self">';
|
||||
@@ -239,8 +239,8 @@
|
||||
// print "<li><a href='#searchForm'>Search...</a></li>";
|
||||
|
||||
foreach (array(-1, -2) as $id) {
|
||||
$title = getCategoryTitle($link, $id);
|
||||
$unread = getFeedUnread($link, $id, true);
|
||||
$title = getCategoryTitle( $id);
|
||||
$unread = getFeedUnread( $id, true);
|
||||
if ($unread > 0) {
|
||||
$title = $title . " ($unread)";
|
||||
$class = '';
|
||||
@@ -254,7 +254,7 @@
|
||||
print "<li class='$class'><a href='feed.php?id=$id&is_cat=true'>$title</a></li>";
|
||||
}
|
||||
|
||||
$result = db_query($link, "SELECT
|
||||
$result = db_query( "SELECT
|
||||
ttrss_feed_categories.id,
|
||||
ttrss_feed_categories.title,
|
||||
COUNT(ttrss_feeds.id) AS num_feeds
|
||||
@@ -269,7 +269,7 @@
|
||||
|
||||
if ($line["num_feeds"] > 0) {
|
||||
|
||||
$unread = getFeedUnread($link, $line["id"], true);
|
||||
$unread = getFeedUnread( $line["id"], true);
|
||||
$id = $line["id"];
|
||||
|
||||
if ($unread > 0) {
|
||||
@@ -279,7 +279,7 @@
|
||||
$class = 'oldItem';
|
||||
}
|
||||
|
||||
if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
|
||||
if ($unread > 0 || !mobile_get_pref( "HIDE_READ")) {
|
||||
|
||||
if ($cat_browse)
|
||||
print "<li class='$class'><a href='cat.php?id=$id'>" .
|
||||
@@ -292,13 +292,13 @@
|
||||
}
|
||||
|
||||
|
||||
$result = db_query($link, "SELECT COUNT(*) AS nf FROM ttrss_feeds WHERE
|
||||
$result = db_query( "SELECT COUNT(*) AS nf FROM ttrss_feeds WHERE
|
||||
cat_id IS NULL and owner_uid = '$owner_uid'");
|
||||
|
||||
$num_feeds = db_fetch_result($result, 0, "nf");
|
||||
|
||||
if ($num_feeds > 0) {
|
||||
$unread = getFeedUnread($link, 0, true);
|
||||
$unread = getFeedUnread( 0, true);
|
||||
$title = "Uncategorized";
|
||||
|
||||
if ($unread > 0) {
|
||||
@@ -308,7 +308,7 @@
|
||||
$class = 'oldItem';
|
||||
}
|
||||
|
||||
if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
|
||||
if ($unread > 0 || !mobile_get_pref( "HIDE_READ")) {
|
||||
if ($cat_browse)
|
||||
print "<li class='$class'><a href='cat.php?id=0'>$title</a></li>";
|
||||
else
|
||||
@@ -320,14 +320,14 @@
|
||||
print "</ul>";
|
||||
}
|
||||
|
||||
function render_headlines_list($link, $feed_id, $cat_id, $offset, $search,
|
||||
function render_headlines_list( $feed_id, $cat_id, $offset, $search,
|
||||
$is_cat = false) {
|
||||
|
||||
$feed_id = $feed_id;
|
||||
$limit = 15;
|
||||
$filter = '';
|
||||
|
||||
if (!mobile_get_pref($link, "HIDE_READ"))
|
||||
if (!mobile_get_pref( "HIDE_READ"))
|
||||
$view_mode = "all_articles";
|
||||
else
|
||||
$view_mode = 'adaptive';
|
||||
@@ -338,9 +338,9 @@
|
||||
$search_mode = '';
|
||||
}
|
||||
|
||||
$qfh_ret = queryFeedHeadlines($link, $feed_id, $limit,
|
||||
$qfh_ret = queryFeedHeadlines( $feed_id, $limit,
|
||||
$view_mode, $is_cat, $search, $search_mode,
|
||||
"score DESC, date_entered ".(mobile_get_pref($link, 'REVERSE_HEADLINES') ? 'ASC' : 'DESC'), $offset);
|
||||
"score DESC, date_entered ".(mobile_get_pref( 'REVERSE_HEADLINES') ? 'ASC' : 'DESC'), $offset);
|
||||
|
||||
$result = $qfh_ret[0];
|
||||
$feed_title = $qfh_ret[1];
|
||||
@@ -364,7 +364,7 @@
|
||||
</form>";
|
||||
|
||||
if ($cat_id) {
|
||||
$cat_title = getCategoryTitle($link, $cat_id);
|
||||
$cat_title = getCategoryTitle( $cat_id);
|
||||
|
||||
print "<ul id=\"feed-$feed_id\" title=\"$feed_title\" selected=\"true\"
|
||||
myBackLabel='$cat_title' myBackHref='cat.php?id=$cat_id'>";
|
||||
@@ -413,7 +413,7 @@
|
||||
// print "<a target='_replace' href='feed.php?id=$feed_id&cat=$cat_id&skip=0'>Next $limit articles...</a>";
|
||||
|
||||
$next_offset = $offset + $num_headlines;
|
||||
$num_unread = getFeedUnread($link, $feed_id, $is_cat);
|
||||
$num_unread = getFeedUnread( $feed_id, $is_cat);
|
||||
|
||||
/* FIXME needs normal implementation */
|
||||
|
||||
@@ -435,7 +435,7 @@
|
||||
|
||||
}
|
||||
|
||||
function render_article($link, $id, $feed_id, $cat_id, $is_cat) {
|
||||
function render_article( $id, $feed_id, $cat_id, $is_cat) {
|
||||
|
||||
$query = "SELECT title,link,content,feed_id,comments,int_id,
|
||||
marked,unread,published,
|
||||
@@ -445,33 +445,33 @@
|
||||
WHERE id = '$id' AND ref_id = id AND owner_uid = " .
|
||||
$_SESSION["uid"] ;
|
||||
|
||||
$result = db_query($link, $query);
|
||||
$result = db_query( $query);
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
|
||||
$line = db_fetch_assoc($result);
|
||||
|
||||
$tmp_result = db_query($link, "UPDATE ttrss_user_entries
|
||||
$tmp_result = db_query( "UPDATE ttrss_user_entries
|
||||
SET unread = false,last_read = NOW()
|
||||
WHERE ref_id = '$id'
|
||||
AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
$updated_fmt = make_local_datetime($link, $line['updated'], false);
|
||||
$updated_fmt = make_local_datetime( $line['updated'], false);
|
||||
|
||||
$title = $line["title"];
|
||||
$article_link = $line["link"];
|
||||
|
||||
if (!$is_cat)
|
||||
$feed_title = getFeedTitle($link, $feed_id);
|
||||
$feed_title = getFeedTitle( $feed_id);
|
||||
else
|
||||
$feed_title = getCategoryTitle($link, $feed_id);
|
||||
$feed_title = getCategoryTitle( $feed_id);
|
||||
|
||||
print "<div class=\"panel\" id=\"article-$id\" title=\"$title\"
|
||||
selected=\"true\"
|
||||
myBackLabel='$feed_title' myBackHref='feed.php?id=$feed_id&cat=$cat_id&is_cat=$is_cat'>";
|
||||
|
||||
if ($line['feed_id'] != $feed_id) {
|
||||
$real_feed_title = getFeedTitle($link, $line['feed_id']);
|
||||
$real_feed_title = getFeedTitle( $line['feed_id']);
|
||||
$real_feed_id = $line['feed_id'];
|
||||
$feed_link = "(<a href=\"feed.php?id=$real_feed_id\">$real_feed_title</a>)";
|
||||
}
|
||||
@@ -497,10 +497,10 @@
|
||||
|
||||
// print "</fieldset>";
|
||||
|
||||
$content = sanitize($link, $line["content"]);
|
||||
$content = sanitize( $line["content"]);
|
||||
$content = preg_replace("/href=/i", "target=\"_blank\" href=", $content);
|
||||
|
||||
if (!mobile_get_pref($link, "SHOW_IMAGES")) {
|
||||
if (!mobile_get_pref( "SHOW_IMAGES")) {
|
||||
$content = preg_replace('/<img[^>]+>/is', '', $content);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
init_plugins($link);
|
||||
|
||||
login_sequence($link, true);
|
||||
login_sequence( true);
|
||||
?>
|
||||
|
||||
<div class="panel" id="prefs" selected="yes" title="Preferences"
|
||||
@@ -32,33 +32,33 @@
|
||||
|
||||
<div class="row">
|
||||
<label><?php echo __('Enable categories') ?></label>
|
||||
<div class="toggle" id="ENABLE_CATS" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "ENABLE_CATS") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
<div class="toggle" id="ENABLE_CATS" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled( "ENABLE_CATS") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label><?php echo __('Browse categories like folders') ?></label>
|
||||
<div class="toggle" id="BROWSE_CATS" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "BROWSE_CATS") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
<div class="toggle" id="BROWSE_CATS" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled( "BROWSE_CATS") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<label><?php echo __('Show images in posts') ?></label>
|
||||
<div class="toggle" id="SHOW_IMAGES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SHOW_IMAGES") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
<div class="toggle" id="SHOW_IMAGES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled( "SHOW_IMAGES") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label><?php echo __('Hide read articles and feeds') ?></label>
|
||||
<div class="toggle" id="HIDE_READ" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "HIDE_READ") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
<div class="toggle" id="HIDE_READ" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled( "HIDE_READ") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label><?php echo __('Sort feeds by unread count') ?></label>
|
||||
<div class="toggle" id="SORT_FEEDS_UNREAD" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SORT_FEEDS_UNREAD") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
<div class="toggle" id="SORT_FEEDS_UNREAD" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled( "SORT_FEEDS_UNREAD") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label><?php echo __('Reverse headline order (oldest first)') ?></label>
|
||||
<div class="toggle" id="REVERSE_HEADLINES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "REVERSE_HEADLINES") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
<div class="toggle" id="REVERSE_HEADLINES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled( "REVERSE_HEADLINES") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
class Note extends Plugin {
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -10,7 +9,6 @@ class Note extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
|
||||
@@ -29,9 +27,9 @@ class Note extends Plugin {
|
||||
}
|
||||
|
||||
function edit() {
|
||||
$param = db_escape_string($this->link, $_REQUEST['param']);
|
||||
$param = db_escape_string( $_REQUEST['param']);
|
||||
|
||||
$result = db_query($this->link, "SELECT note FROM ttrss_user_entries WHERE
|
||||
$result = db_query( "SELECT note FROM ttrss_user_entries WHERE
|
||||
ref_id = '$param' AND owner_uid = " . $_SESSION['uid']);
|
||||
|
||||
$note = db_fetch_result($result, 0, "note");
|
||||
@@ -58,10 +56,10 @@ class Note extends Plugin {
|
||||
}
|
||||
|
||||
function setNote() {
|
||||
$id = db_escape_string($this->link, $_REQUEST["id"]);
|
||||
$note = trim(strip_tags(db_escape_string($this->link, $_REQUEST["note"])));
|
||||
$id = db_escape_string( $_REQUEST["id"]);
|
||||
$note = trim(strip_tags(db_escape_string( $_REQUEST["note"])));
|
||||
|
||||
db_query($this->link, "UPDATE ttrss_user_entries SET note = '$note'
|
||||
db_query( "UPDATE ttrss_user_entries SET note = '$note'
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
$formatted_note = format_article_note($id, $note);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class NSFW extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -12,7 +10,6 @@ class NSFW extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
|
||||
@@ -91,7 +88,7 @@ class NSFW extends Plugin {
|
||||
}
|
||||
|
||||
function save() {
|
||||
$tags = explode(",", db_escape_string($this->link, $_POST["tags"]));
|
||||
$tags = explode(",", db_escape_string( $_POST["tags"]));
|
||||
$tags = array_map("trim", $tags);
|
||||
$tags = array_map("mb_strtolower", $tags);
|
||||
$tags = join(", ", $tags);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
class Share extends Plugin {
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -10,7 +9,6 @@ class Share extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
|
||||
@@ -28,9 +26,9 @@ class Share extends Plugin {
|
||||
}
|
||||
|
||||
function shareArticle() {
|
||||
$param = db_escape_string($this->link, $_REQUEST['param']);
|
||||
$param = db_escape_string( $_REQUEST['param']);
|
||||
|
||||
$result = db_query($this->link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param'
|
||||
$result = db_query( "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param'
|
||||
AND owner_uid = " . $_SESSION['uid']);
|
||||
|
||||
if (db_num_rows($result) == 0) {
|
||||
@@ -41,8 +39,8 @@ class Share extends Plugin {
|
||||
$ref_id = db_fetch_result($result, 0, "ref_id");
|
||||
|
||||
if (!$uuid) {
|
||||
$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'
|
||||
$uuid = db_escape_string( sha1(uniqid(rand(), true)));
|
||||
db_query( "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param'
|
||||
AND owner_uid = " . $_SESSION['uid']);
|
||||
}
|
||||
|
||||
@@ -55,10 +53,10 @@ class Share extends Plugin {
|
||||
print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>";
|
||||
print "</div>";
|
||||
|
||||
/* if (!label_find_id($this->link, __('Shared'), $_SESSION["uid"]))
|
||||
label_create($this->link, __('Shared'), $_SESSION["uid"]);
|
||||
/* if (!label_find_id( __('Shared'), $_SESSION["uid"]))
|
||||
label_create( __('Shared'), $_SESSION["uid"]);
|
||||
|
||||
label_add_article($this->link, $ref_id, __('Shared'), $_SESSION['uid']); */
|
||||
label_add_article( $ref_id, __('Shared'), $_SESSION['uid']); */
|
||||
}
|
||||
|
||||
print "<div align='center'>";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Swap_JK extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -11,7 +10,6 @@ class Swap_JK extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_HOTKEY_MAP, $this);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Updater extends Plugin {
|
||||
|
||||
private $link;
|
||||
private $host;
|
||||
|
||||
function about() {
|
||||
@@ -12,7 +11,6 @@ class Updater extends Plugin {
|
||||
}
|
||||
|
||||
function init($host) {
|
||||
$this->link = $host->get_link();
|
||||
$this->host = $host;
|
||||
|
||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
||||
@@ -22,7 +20,7 @@ class Updater extends Plugin {
|
||||
$this);
|
||||
}
|
||||
|
||||
function update_self_step($link, $step, $params, $force = false) {
|
||||
function update_self_step( $step, $params, $force = false) {
|
||||
// __FILE__ is in plugins/updater so we need to go one level up
|
||||
$work_dir = dirname(dirname(dirname(__FILE__)));
|
||||
$parent_dir = dirname($work_dir);
|
||||
@@ -279,13 +277,13 @@ class Updater extends Plugin {
|
||||
return array("step" => $step, "stop" => $stop, "params" => $params, "log" => $log);
|
||||
}
|
||||
|
||||
function update_self_cli($link, $force = false) {
|
||||
function update_self_cli( $force = false) {
|
||||
$step = 0;
|
||||
$stop = false;
|
||||
$params = array();
|
||||
|
||||
while (!$stop) {
|
||||
$rc = $this->update_self_step($link, $step, $params, $force);
|
||||
$rc = $this->update_self_step( $step, $params, $force);
|
||||
|
||||
$params = $rc['params'];
|
||||
$stop = $rc['stop'];
|
||||
@@ -309,7 +307,7 @@ class Updater extends Plugin {
|
||||
if ($input != 'yes' && $input != 'force')
|
||||
exit;
|
||||
|
||||
$this->update_self_cli($link, $input == 'force');
|
||||
$this->update_self_cli( $input == 'force');
|
||||
}
|
||||
|
||||
function get_prefs_js() {
|
||||
@@ -323,7 +321,7 @@ class Updater extends Plugin {
|
||||
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Update Tiny Tiny RSS')."\">";
|
||||
|
||||
if ($_SESSION["pref_last_version_check"] + 86400 + rand(-1000, 1000) < time()) {
|
||||
$_SESSION["version_data"] = @check_for_update($this->link);
|
||||
$_SESSION["version_data"] = @check_for_update();
|
||||
$_SESSION["pref_last_version_check"] = time();
|
||||
}
|
||||
|
||||
@@ -378,7 +376,7 @@ class Updater extends Plugin {
|
||||
$force = (bool) $_REQUEST["force"];
|
||||
|
||||
if (($_SESSION["access_level"] >= 10 || SINGLE_USER_MODE) && CHECK_FOR_NEW_VERSION) {
|
||||
print json_encode($this->update_self_step($this->link, $step, $params, $force));
|
||||
print json_encode($this->update_self_step( $step, $params, $force));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user