Skip to content

Commit

Permalink
remove some unused code reported by phpmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Dolgov committed Feb 19, 2014
1 parent 5ba1ddd commit 4a80c57
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 73 deletions.
1 change: 0 additions & 1 deletion classes/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function view() {
$id = $this->dbh->escape_string($_REQUEST["id"]);
$cids = explode(",", $this->dbh->escape_string($_REQUEST["cids"]));
$mode = $this->dbh->escape_string($_REQUEST["mode"]);
$omode = $this->dbh->escape_string($_REQUEST["omode"]);

// in prefetch mode we only output requested cids, main article
// just gets marked as read (it already exists in client cache)
Expand Down
1 change: 0 additions & 1 deletion classes/dlg.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function importOpml() {
print __("If you have imported labels and/or filters, you might need to reload preferences to see your new data.") . "</p>";

print "<div class=\"prefFeedOPMLHolder\">";
$owner_uid = $_SESSION["uid"];

$this->dbh->query("BEGIN");

Expand Down
22 changes: 5 additions & 17 deletions classes/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ private function format_headline_subtoolbar($feed_site_url, $feed_title,
$feed_id, $is_cat, $search,
$search_mode, $view_mode, $error, $feed_last_updated) {

$page_prev_link = "viewFeedGoPage(-1)";
$page_next_link = "viewFeedGoPage(1)";
$page_first_link = "viewFeedGoPage(0)";

$catchup_page_link = "catchupPage()";
$catchup_feed_link = "catchupCurrentFeed()";
$catchup_sel_link = "catchupSelection()";

$archive_sel_link = "archiveSelection()";
Expand Down Expand Up @@ -292,8 +286,6 @@ private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_
$num_unread = 0;
$cur_feed_title = '';

$fresh_intl = get_pref("FRESH_ARTICLE_MAX_AGE") * 60 * 60;

if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);

$expand_cdm = get_pref('CDM_EXPANDED');
Expand Down Expand Up @@ -557,7 +549,7 @@ class=\"hlTitle\"><span class='hlContent $hlc_suffix'>";
$reply['content'] .= "<div class=\"cdm $hlc_suffix $expanded_class $class\"
id=\"RROW-$id\" orig-feed-id='$feed_id' $mouseover_attrs>";

$reply['content'] .= "<div class=\"cdmHeader\" style=\"$row_background\">";
$reply['content'] .= "<div class=\"cdmHeader\">";
$reply['content'] .= "<div style=\"vertical-align : middle\">";

$reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
Expand Down Expand Up @@ -811,8 +803,6 @@ function view() {

if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info);

$omode = $this->dbh->escape_string($_REQUEST["omode"]);

$feed = $this->dbh->escape_string($_REQUEST["feed"]);
$method = $this->dbh->escape_string($_REQUEST["m"]);
$view_mode = $this->dbh->escape_string($_REQUEST["view_mode"]);
Expand Down Expand Up @@ -905,7 +895,7 @@ function view() {

//$topmost_article_ids = $ret[0];
$headlines_count = $ret[1];
$returned_feed = $ret[2];
/* $returned_feed = $ret[2]; */
$disable_cache = $ret[3];
$vgroup_last_feed = $ret[4];

Expand Down Expand Up @@ -1085,20 +1075,18 @@ function feedBrowser() {
print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">";

foreach (array(25, 50, 100, 200) as $l) {
$issel = ($l == $limit) ? "selected=\"1\"" : "";
print "<option $issel value=\"$l\">$l</option>";
//$issel = ($l == $limit) ? "selected=\"1\"" : "";
print "<option value=\"$l\">$l</option>";
}

print "</select> ";

print "</div>";

$owner_uid = $_SESSION["uid"];

require_once "feedbrowser.php";

print "<ul class='browseFeedList' id='browseFeedList'>";
print make_feed_browser($search, 25);
print make_feed_browser("", 25);
print "</ul>";

print "<div align='center'>
Expand Down
10 changes: 5 additions & 5 deletions classes/handler/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private function generate_syndicated_feed($owner_uid, $feed, $is_cat,
$result = $qfh_ret[0];
$feed_title = htmlspecialchars($qfh_ret[1]);
$feed_site_url = $qfh_ret[2];
$last_error = $qfh_ret[3];
/* $last_error = $qfh_ret[3]; */

$feed_self_url = get_self_url_prefix() .
"/public.php?op=rss&id=$feed&key=" .
Expand Down Expand Up @@ -404,17 +404,17 @@ function rss() {
}

function updateTask() {
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", false);
}

function housekeepingTask() {
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", $op);
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", false);
}

function globalUpdateFeeds() {
RPC::updaterandomfeed_real($this->dbh);

PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", false);
}

function sharepopup() {
Expand Down Expand Up @@ -692,7 +692,7 @@ function subscribe() {
function subscribe2() {
$feed_url = $this->dbh->escape_string(trim($_REQUEST["feed_url"]));
$cat_id = $this->dbh->escape_string($_REQUEST["cat_id"]);
$from = $this->dbh->escape_string($_REQUEST["from"]);
/* $from = $this->dbh->escape_string($_REQUEST["from"]); */
$feed_urls = array();

/* only read authentication information from POST */
Expand Down
8 changes: 2 additions & 6 deletions classes/pref/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ function savefeedorder() {
# print_r($data['items']);

if (is_array($data) && is_array($data['items'])) {
$cat_order_id = 0;
# $cat_order_id = 0;

$data_map = array();
$root_item = false;
Expand Down Expand Up @@ -962,7 +962,7 @@ function editsaveops($batch) {

if (!$batch) {

$result = $this->dbh->query("UPDATE ttrss_feeds SET
$this->dbh->query("UPDATE ttrss_feeds SET
$category_qpart
title = '$feed_title', feed_url = '$feed_link',
update_interval = '$upd_intl',
Expand Down Expand Up @@ -1573,8 +1573,6 @@ function inactiveFeeds() {
# class needed for selectTableRows()
print "<tr class=\"placeholder\" $this_row_id>";

$edit_title = htmlspecialchars($line["title"]);

# id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
Expand Down Expand Up @@ -1639,8 +1637,6 @@ function feedsWithErrors() {
# class needed for selectTableRows()
print "<tr class=\"placeholder\" $this_row_id>";

$edit_title = htmlspecialchars($line["title"]);

# id needed for selectTableRows()
print "<td width='5%' align='center'><input
onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
Expand Down
19 changes: 1 addition & 18 deletions classes/pref/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function testFilter() {

$result = $qfh_ret[0];

$articles = array();
$found = 0;

print __("Articles matching this filter:");
Expand All @@ -103,9 +102,6 @@ function testFilter() {
$line = $p->hook_query_headlines($line, 100);
}

$entry_timestamp = strtotime($line["updated"]);
$entry_tags = get_article_tags($line["id"], $_SESSION["uid"]);

$content_preview = $line["content_preview"];

if ($line["feed_title"])
Expand Down Expand Up @@ -174,24 +170,11 @@ function getfiltertree() {
owner_uid = ".$_SESSION["uid"]." ORDER BY order_id, title");


$action_id = -1;
$folder = array();
$folder['items'] = array();

while ($line = $this->dbh->fetch_assoc($result)) {

/* if ($action_id != $line["action_id"]) {
if (count($folder['items']) > 0) {
array_push($root['items'], $folder);
}
$folder = array();
$folder['id'] = $line["action_id"];
$folder['name'] = __($line["action_name"]);
$folder['items'] = array();
$action_id = $line["action_id"];
} */

$name = $this->getFilterName($line["id"]);

$match_ok = false;
Expand Down Expand Up @@ -471,7 +454,7 @@ function editSave() {
$inverse = checkbox_to_sql_bool($this->dbh->escape_string($_REQUEST["inverse"]));
$title = $this->dbh->escape_string($_REQUEST["title"]);

$result = $this->dbh->query("UPDATE ttrss_filters2 SET enabled = $enabled,
$this->dbh->query("UPDATE ttrss_filters2 SET enabled = $enabled,
match_any_rule = $match_any_rule,
inverse = $inverse,
title = '$title'
Expand Down
1 change: 0 additions & 1 deletion classes/pref/prefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,6 @@ function otpqrcode() {

if (!$otp_enabled) {
$secret = $base32->encode(sha1($this->dbh->fetch_result($result, 0, "salt")));
$topt = new \OTPHP\TOTP($secret);
print QRcode::png("otpauth://totp/".urlencode($login).
"?secret=$secret&issuer=".urlencode("Tiny Tiny RSS"));

Expand Down
13 changes: 6 additions & 7 deletions classes/rpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function remarchive() {
WHERE orig_feed_id = '$id') = 0 AND
id = '$id' AND owner_uid = ".$_SESSION["uid"]);

$rc = $this->dbh->affected_rows($result);
$this->dbh->affected_rows($result);
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@ function mark() {
$mark = "false";
}

$result = $this->dbh->query("UPDATE ttrss_user_entries SET marked = $mark,
$this->dbh->query("UPDATE ttrss_user_entries SET marked = $mark,
last_marked = NOW()
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);

Expand All @@ -148,8 +148,8 @@ function mark() {
function delete() {
$ids = $this->dbh->escape_string($_REQUEST["ids"]);

$result = $this->dbh->query("DELETE FROM ttrss_user_entries
WHERE ref_id IN ($ids) AND owner_uid = " . $_SESSION["uid"]);
$this->dbh->query("DELETE FROM ttrss_user_entries
WHERE ref_id IN ($ids) AND owner_uid = " . $_SESSION["uid"]);

purge_orphans();

Expand Down Expand Up @@ -258,15 +258,14 @@ private function archive_article($id, $owner_uid) {
function publ() {
$pub = $_REQUEST["pub"];
$id = $this->dbh->escape_string($_REQUEST["id"]);
$note = trim(strip_tags($this->dbh->escape_string($_REQUEST["note"])));

if ($pub == "1") {
$pub = "true";
} else {
$pub = "false";
}

$result = $this->dbh->query("UPDATE ttrss_user_entries SET
$this->dbh->query("UPDATE ttrss_user_entries SET
published = $pub, last_published = NOW()
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);

Expand Down Expand Up @@ -620,7 +619,7 @@ private function publishArticlesById($ids, $cmode) {

$p = new Publisher(PUBSUBHUBBUB_HUB);

$pubsub_result = $p->publish_update($rss_link);
/* $pubsub_result = */ $p->publish_update($rss_link);
}
}

Expand Down
2 changes: 0 additions & 2 deletions include/digest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ function prepare_headlines_digest($user_id, $days = 1, $limit = 1000) {
ORDER BY ttrss_feed_categories.title, ttrss_feeds.title, score DESC, date_updated DESC
LIMIT $limit");

$cur_feed_title = "";

$headlines_count = db_num_rows($result);

$headlines = array();
Expand Down
5 changes: 2 additions & 3 deletions include/feedbrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function make_feed_browser($search, $limit, $mode = 1) {
htmlspecialchars($line["title"])."</span></a>";

$feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"
href=\"$feed_url\"><img src='images/pub_set.svg'
href=\"$feed_url\"><img src='images/pub_set.png'
style='vertical-align : middle'></a>";

$rv .= "<li>$check_box $feed_url $site_url".
Expand All @@ -72,7 +72,6 @@ function make_feed_browser($search, $limit, $mode = 1) {
} else if ($mode == 2) {
$feed_url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
$title = htmlspecialchars($line["title"]);

$check_box = "<input onclick='toggleSelectListRow2(this)' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\">";
Expand All @@ -92,7 +91,7 @@ function make_feed_browser($search, $limit, $mode = 1) {
htmlspecialchars($line["title"])."</span></a>";

$feed_url = "<a target=\"_blank\" class=\"fb_feedUrl\"
href=\"$feed_url\"><img src='images/pub_set.svg'
href=\"$feed_url\"><img src='images/pub_set.png'
style='vertical-align : middle'></a>";


Expand Down
15 changes: 4 additions & 11 deletions include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,6 @@ function getFeedCounters($active_feed = false) {
AND ttrss_counters_cache.feed_id = id";

$result = db_query($query);
$fctrs_modified = false;

while ($line = db_fetch_assoc($result)) {

Expand Down Expand Up @@ -2922,7 +2921,6 @@ function sanitize($str, $force_remove_images = false, $owner = false, $site_url

$fragment = $doc->createDocumentFragment();
$text = $child->textContent;
$stubs = array();

while (($pos = mb_stripos($text, $word)) !== false) {
$fragment->appendChild(new DomText(mb_substr($text, 0, $pos)));
Expand Down Expand Up @@ -3104,19 +3102,16 @@ function render_login_form() {
}

function format_warning($msg, $id = "") {
global $link;
return "<div class=\"warning\" id=\"$id\">
<span><img src=\"images/alert.png\"></span><span>$msg</span></div>";
}

function format_notice($msg, $id = "") {
global $link;
return "<div class=\"notice\" id=\"$id\">
<span><img src=\"images/information.png\"></span><span>$msg</span></div>";
}

function format_error($msg, $id = "") {
global $link;
return "<div class=\"error\" id=\"$id\">
<span><img src=\"images/alert.png\"></span><span>$msg</span></div>";
}
Expand Down Expand Up @@ -3225,8 +3220,6 @@ function format_article($id, $mark_as_read = true, $zoom_mode = false, $owner_ui

$line = db_fetch_assoc($result);

$tag_cache = $line["tag_cache"];

$line["tags"] = get_article_tags($id, $owner_uid, $line["tag_cache"]);
unset($line["tag_cache"]);

Expand Down Expand Up @@ -3382,7 +3375,7 @@ class='tagsPic' alt='Tags' title='Tags'>&nbsp;";
$rv['content'] .= "&nbsp;";

$rv['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";
$rv['content'] .= "<img title='".__('Feed URL')."'class='tinyFeedIcon' src='images/pub_set.svg'></a>";
$rv['content'] .= "<img title='".__('Feed URL')."' class='tinyFeedIcon' src='images/pub_set.png'></a>";

$rv['content'] .= "</div>";
}
Expand Down Expand Up @@ -4268,9 +4261,9 @@ function geturl($url, $depth = 0){
$fetch_last_error = curl_errno($curl) . " " . curl_error($curl);
curl_close($curl);

$oline='';
foreach($status as $key=>$eline){$oline.='['.$key.']'.$eline.' ';}
$line =$oline." \r\n ".$url."\r\n-----------------\r\n";
# $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;
Expand Down
2 changes: 1 addition & 1 deletion include/labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function label_remove_article($id, $label, $owner_uid) {

if (!$label_id) return;

$result = db_query(
db_query(
"DELETE FROM ttrss_user_labels2
WHERE
label_id = '$label_id' AND
Expand Down

0 comments on commit 4a80c57

Please sign in to comment.