]> git.wh0rd.org Git - tt-rss.git/commitdiff
atom author field parsing fixes
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 25 Dec 2006 08:18:34 +0000 (09:18 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 25 Dec 2006 08:18:34 +0000 (09:18 +0100)
functions.php

index 201e290bb6c6fde8bdc5a5cbfab862a062662219..afe3e4cd2ff418a32a5b7deaac4ad4744c46bca3 100644 (file)
 
                                $entry_author = db_escape_string(strip_tags($item['dc']['creator']));
 
-                               if (!$entry_author) {
-                                       $entry_author = db_escape_string(strip_tags($item['author']));
+                               if ($item['author']) {
+                                       if (!$entry_author) {
+                                               $entry_author = db_escape_string(strip_tags($item['author']['name']));
+                                       }
+
+                                       if (!$entry_author) {
+                                               $entry_author = db_escape_string(strip_tags($item['author']['email']));
+                                       }
+
+                                       if (!$entry_author) {
+                                               $entry_author = db_escape_string(strip_tags($item['author']));
+                                       }
                                }
 
+                               if (preg_match('/^[\t\n\r ]*$/', $entry_author)) $entry_author = '';
+
                                $entry_guid = db_escape_string(strip_tags($entry_guid));
 
                                $result = db_query($link, "SELECT id FROM       ttrss_entries