improve status reporting for linked feeds

This commit is contained in:
Andrew Dolgov 2012-10-31 16:15:29 +04:00
parent 29064218d0
commit 32532f1c0f
2 changed files with 14 additions and 0 deletions

View File

@ -1,6 +1,12 @@
<?php <?php
class Pref_Instances extends Handler_Protected { class Pref_Instances extends Handler_Protected {
private $status_codes = array(
0 => "Connection failed",
1 => "Success",
2 => "Invalid object received",
16 => "Access denied" );
function csrf_ignore($method) { function csrf_ignore($method) {
$csrf_ignored = array("index", "edit"); $csrf_ignored = array("index", "edit");
@ -167,6 +173,7 @@ class Pref_Instances extends Handler_Protected {
<td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">".__('Instance URL')."</a></td> <td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">".__('Instance URL')."</a></td>
<td width='20%'><a href=\"#\" onclick=\"updateInstanceList('access_key')\">".__('Access key')."</a></td> <td width='20%'><a href=\"#\" onclick=\"updateInstanceList('access_key')\">".__('Access key')."</a></td>
<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">".__('Last connected')."</a></td> <td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">".__('Last connected')."</a></td>
<td width='10%'><a href=\"#\" onclick=\"updateUsersList('last_status_out')\">".__('Status')."</a></td>
<td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">".__('Stored feeds')."</a></td> <td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">".__('Stored feeds')."</a></td>
</tr>"; </tr>";
@ -193,6 +200,7 @@ class Pref_Instances extends Handler_Protected {
print "<td $onclick>" . htmlspecialchars($line['access_url']) . "</td>"; print "<td $onclick>" . htmlspecialchars($line['access_url']) . "</td>";
print "<td $onclick>" . htmlspecialchars($access_key) . "</td>"; print "<td $onclick>" . htmlspecialchars($access_key) . "</td>";
print "<td $onclick>" . htmlspecialchars($line['last_connected']) . "</td>"; print "<td $onclick>" . htmlspecialchars($line['last_connected']) . "</td>";
print "<td $onclick>" . $this->status_codes[$line['last_status_out']] . "</td>";
print "<td $onclick>" . htmlspecialchars($line['num_feeds']) . "</td>"; print "<td $onclick>" . htmlspecialchars($line['num_feeds']) . "</td>";
print "</tr>"; print "</tr>";

View File

@ -5124,6 +5124,12 @@
if ($feeds) { if ($feeds) {
if ($feeds['error']) { if ($feeds['error']) {
$status = $feeds['error']['code'] + 10; $status = $feeds['error']['code'] + 10;
// access denied
if ($status == 16) {
db_query($link, "DELETE FROM ttrss_linked_feeds
WHERE instance_id = '$id'");
}
} else { } else {
$status = 1; $status = 1;