Commit dcc58e5b1a46b5c141e4e6165c40f322ea70c2fd

Authored by Jonathan Byrne
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
plugins/rssplugin/loadFeed.inc.php
1 1 <?php
2 2 /*
3   - * $Id:$
  3 + * $Id$
4 4 *
5 5 * KnowledgeTree Open Source Edition
6 6 * Document Management Made Simple
... ... @@ -49,13 +49,19 @@
49 49 // If it is a url, it is an external feed
50 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 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 61 "<div class='outerContainer' id='outerContainer'>" .
56 62 "<table width='90%'>";
57 63 for($i=0;$i<count($aRSSArray[items]);$i++){
58   - $reposonse .= "<tr>
  64 + $response .= "<tr>
59 65 <td colspan='2'><strong><a href='".$aRSSArray[items][$i][link]."' target='_blank'>".$aRSSArray[items][$i][title]."</a><strong></td>
60 66 </tr>
61 67 <tr>
... ... @@ -63,7 +69,7 @@
63 69 </tr>
64 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 1 <?php
2 2  
3 3 /*
4   - * $Id:$
  4 + * $Id$
5 5 *
6 6 * KnowledgeTree Open Source Edition
7 7 * Document Management Made Simple
... ... @@ -80,8 +80,8 @@
80 80 #
81 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 87 # make the request
... ... @@ -169,7 +169,6 @@
169 169 #
170 170  
171 171 else {
172   -
173 172 $rss2array_globals[errors][] = "Can't connect to $host";
174 173  
175 174 }
... ...