renamed $IS_PRESS to $ID_HACK_FOR_MRREADER

Renamed $IS_PRESS to $ID_HACK_FOR_MRREADER to make code more readable. This helps others understand the code.
This commit is contained in:
Torsten Stelling
2014-01-15 22:48:49 +01:00
parent cfdb4e92f8
commit 30e3d5cd93

View File

@@ -15,7 +15,7 @@ class FeverAPI extends Handler {
const DEBUG_FILE = './debug_fever.txt'; // the file for debugging output const DEBUG_FILE = './debug_fever.txt'; // the file for debugging output
const ADD_ATTACHED_FILES = 1; //add link in bottom for attached files const ADD_ATTACHED_FILES = 1; //add link in bottom for attached files
private $IS_PRESS = 0; private $ID_HACK_FOR_MRREADER = 0;
private $xml; private $xml;
@@ -532,10 +532,10 @@ class FeverAPI extends Handler {
if ($since_id) if ($since_id)
{ {
if (!empty($where)) $where .= " AND "; if (!empty($where)) $where .= " AND ";
if ($this->IS_PRESS) { if ($this->ID_HACK_FOR_MRREADER) {
$where .= "id > " . db_escape_string($since_id) . " ";
} else {
$where .= "id > " . db_escape_string($since_id*1000) . " "; // NASTY hack for Mr. Reader 2.0 on iOS and TinyTiny RSS Fever $where .= "id > " . db_escape_string($since_id*1000) . " "; // NASTY hack for Mr. Reader 2.0 on iOS and TinyTiny RSS Fever
} else {
$where .= "id > " . db_escape_string($since_id) . " ";
} }
} }
else if (empty($where)) else if (empty($where))
@@ -873,13 +873,13 @@ class FeverAPI extends Handler {
// validate the api_key, user preferences // validate the api_key, user preferences
function before($method) { function before($method) {
if ( strpos($_SERVER['HTTP_USER_AGENT'],"Dalvik") !== false || // Check for all client in Android except ReadKit in Mac, Mr. Reader and Dalvik
if (strpos($_SERVER['HTTP_USER_AGENT'],"Dalvik") !== false ||
strpos($_SERVER['HTTP_USER_AGENT'],"ReadKit") !== false || strpos($_SERVER['HTTP_USER_AGENT'],"ReadKit") !== false ||
strpos($_SERVER['HTTP_USER_AGENT'],"Mr. Reader") !== false strpos($_SERVER['HTTP_USER_AGENT'],"Mr. Reader") !== false) {
) { //Check for Press client in Android, ReadKit in Mac, Mr. Reader $this->ID_HACK_FOR_MRREADER = 0;
$this->IS_PRESS = 1;
} else { } else {
$this->IS_PRESS = 0; $this->ID_HACK_FOR_MRREADER = 1; // and readkit and dalvik...
} }
if (parent::before($method)) { if (parent::before($method)) {
if (self::DEBUG) { if (self::DEBUG) {