]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/rssaction.php
No more needed (for this fix) but maybe later. So I always only comment them out.
[quix0rs-gnu-social.git] / lib / rssaction.php
index f366db97293241a849784956f37ff3063cc12390..dfaad06358f3021f2e063389b85ea22ccc1a7d9c 100644 (file)
@@ -34,7 +34,7 @@ define('DEFAULT_RSS_LIMIT', 48);
 
 class Rss10Action extends Action
 {
-    # This will contain the details of each feed item's author and be used to generate SIOC data.
+    // This will contain the details of each feed item's author and be used to generate SIOC data.
 
     var $creators = array();
     var $limit = DEFAULT_RSS_LIMIT;
@@ -75,7 +75,7 @@ class Rss10Action extends Action
      * @return boolean success
      */
 
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -88,10 +88,10 @@ class Rss10Action extends Action
         if (common_config('site', 'private')) {
             if (!isset($_SERVER['PHP_AUTH_USER'])) {
 
-                # This header makes basic auth go
+                // This header makes basic auth go
                 header('WWW-Authenticate: Basic realm="StatusNet RSS"');
 
-                # If the user hits cancel -- bam!
+                // If the user hits cancel -- bam!
                 $this->show_basic_auth_error();
                 return;
             } else {
@@ -99,7 +99,7 @@ class Rss10Action extends Action
                 $password = $_SERVER['PHP_AUTH_PW'];
 
                 if (!common_check_user($nickname, $password)) {
-                    # basic authentication failed
+                    // basic authentication failed
                     list($proxy, $ip) = common_client_ip();
 
                     common_log(LOG_WARNING, "Failed RSS auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip.");
@@ -120,7 +120,7 @@ class Rss10Action extends Action
      * @return void
      */
 
-    function handle($args)
+    function handle(array $args=array())
     {
         // Parent handling, including cache check
         parent::handle($args);
@@ -278,8 +278,8 @@ class Rss10Action extends Action
         $attachments = $notice->attachments();
         if($attachments){
             foreach($attachments as $attachment){
-                $enclosure=$attachment->getEnclosure();
-                if ($enclosure) {
+                try {
+                    $enclosure = $attachment->getEnclosure();
                     $attribs = array('rdf:resource' => $enclosure->url);
                     if ($enclosure->title) {
                         $attribs['dc:title'] = $enclosure->title;
@@ -294,6 +294,8 @@ class Rss10Action extends Action
                         $attribs['enc:type'] = $enclosure->mimetype;
                     }
                     $this->element('enc:enclosure', $attribs);
+                } catch (ServerException $e) {
+                    // There was not enough metadata available
                 }
                 $this->element('sioc:links_to', array('rdf:resource'=>$attachment->url));
             }