Commit dcc58e5b1a46b5c141e4e6165c40f322ea70c2fd
1 parent
56c18173
KTC-232
"Error when trying to view RSS Feed" Fixed Added an error check to pick up a failed network connection. Committed By: Jonathan Byrne Reviewed By: Jalaloedien Abrahams git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7696 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
15 additions
and
10 deletions
plugins/rssplugin/loadFeed.inc.php
| 1 | <?php | 1 | <?php |
| 2 | /* | 2 | /* |
| 3 | - * $Id:$ | 3 | + * $Id$ |
| 4 | * | 4 | * |
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| @@ -49,13 +49,19 @@ | @@ -49,13 +49,19 @@ | ||
| 49 | // If it is a url, it is an external feed | 49 | // If it is a url, it is an external feed |
| 50 | $aRSSArray = rss2array($feed); | 50 | $aRSSArray = rss2array($feed); |
| 51 | } | 51 | } |
| 52 | - | 52 | + if(count($aRSSArray[errors]) > 0){ |
| 53 | + for($i=0;$i<count($aRSSArray[errors]);$i++){ | ||
| 54 | + $response .= $aRSSArray[errors][$i].'<br>'; | ||
| 55 | + echo '<br>'.$response.'<br>'; | ||
| 56 | + return; | ||
| 57 | + } | ||
| 58 | + } | ||
| 53 | // Prepare response data to be passed back to page | 59 | // Prepare response data to be passed back to page |
| 54 | - $reposonse = "<h3>".$aRSSArray[channel][title]."</h3>" . | 60 | + $response = "<h3>".$aRSSArray[channel][title]."</h3>" . |
| 55 | "<div class='outerContainer' id='outerContainer'>" . | 61 | "<div class='outerContainer' id='outerContainer'>" . |
| 56 | "<table width='90%'>"; | 62 | "<table width='90%'>"; |
| 57 | for($i=0;$i<count($aRSSArray[items]);$i++){ | 63 | for($i=0;$i<count($aRSSArray[items]);$i++){ |
| 58 | - $reposonse .= "<tr> | 64 | + $response .= "<tr> |
| 59 | <td colspan='2'><strong><a href='".$aRSSArray[items][$i][link]."' target='_blank'>".$aRSSArray[items][$i][title]."</a><strong></td> | 65 | <td colspan='2'><strong><a href='".$aRSSArray[items][$i][link]."' target='_blank'>".$aRSSArray[items][$i][title]."</a><strong></td> |
| 60 | </tr> | 66 | </tr> |
| 61 | <tr> | 67 | <tr> |
| @@ -63,7 +69,7 @@ | @@ -63,7 +69,7 @@ | ||
| 63 | </tr> | 69 | </tr> |
| 64 | <tr><td colspan='2'><br></td></tr>"; | 70 | <tr><td colspan='2'><br></td></tr>"; |
| 65 | } | 71 | } |
| 66 | - $reposonse .= "</table></div><br>"; | 72 | + $response .= "</table></div><br>"; |
| 67 | 73 | ||
| 68 | - echo $reposonse; | 74 | + echo $response; |
| 69 | ?> | 75 | ?> |
plugins/rssplugin/rss2array.inc.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | - * $Id:$ | 4 | + * $Id$ |
| 5 | * | 5 | * |
| 6 | * KnowledgeTree Open Source Edition | 6 | * KnowledgeTree Open Source Edition |
| 7 | * Document Management Made Simple | 7 | * Document Management Made Simple |
| @@ -80,8 +80,8 @@ | @@ -80,8 +80,8 @@ | ||
| 80 | # | 80 | # |
| 81 | # open the connection | 81 | # open the connection |
| 82 | # | 82 | # |
| 83 | - | ||
| 84 | - if($http = fsockopen($host, $port, $errno, $errstr, 5)){ | 83 | + $http = @fsockopen($host, $port, $errno, $errstr, 5); |
| 84 | + if($http){ | ||
| 85 | 85 | ||
| 86 | # | 86 | # |
| 87 | # make the request | 87 | # make the request |
| @@ -169,7 +169,6 @@ | @@ -169,7 +169,6 @@ | ||
| 169 | # | 169 | # |
| 170 | 170 | ||
| 171 | else { | 171 | else { |
| 172 | - | ||
| 173 | $rss2array_globals[errors][] = "Can't connect to $host"; | 172 | $rss2array_globals[errors][] = "Can't connect to $host"; |
| 174 | 173 | ||
| 175 | } | 174 | } |