]> git.wh0rd.org - tt-rss.git/commitdiff
improve status reporting for linked feeds
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 31 Oct 2012 12:15:29 +0000 (16:15 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 31 Oct 2012 12:15:29 +0000 (16:15 +0400)
classes/pref/instances.php
include/functions.php

index c017ee9d2ea6d855f1e460aac8fc913cc424a290..0ce390805a15089cef0d043f61a9d31f49877734 100644 (file)
@@ -1,6 +1,12 @@
 <?php
 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) {
                $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='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_status_out')\">".__('Status')."</a></td>
                        <td width='10%'><a href=\"#\" onclick=\"updateUsersList('num_feeds')\">".__('Stored feeds')."</a></td>
                        </tr>";
 
@@ -193,6 +200,7 @@ class Pref_Instances extends Handler_Protected {
                        print "<td $onclick>" . htmlspecialchars($line['access_url']) . "</td>";
                        print "<td $onclick>" . htmlspecialchars($access_key) . "</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 "</tr>";
index a81a2c0cd65e52e0ccbdb9cbdd393914d7423d99..0e98b4a542d9cbd18a26e20de9a971fdf18f13bc 100644 (file)
                                if ($feeds) {
                                        if ($feeds['error']) {
                                                $status = $feeds['error']['code'] + 10;
+
+                                               // access denied
+                                               if ($status == 16) {
+                                                       db_query($link, "DELETE FROM ttrss_linked_feeds
+                                                               WHERE instance_id = '$id'");
+                                               }
                                        } else {
                                                $status = 1;