Changeset 689 for trunk/Modules/News/ImportObecHovezi.php
- Timestamp:
- Sep 7, 2014, 6:15:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/ImportObecHovezi.php
r635 r689 15 15 16 16 $doc = new DOMDocument(); 17 $doc->load($SourceURL);18 foreach($doc->getElementsByTagName('item') as $node) 17 @$doc->load($SourceURL); 18 foreach($doc->getElementsByTagName('item') as $node) 19 19 { 20 20 $Title = $node->getElementsByTagName('title')->item(0)->nodeValue; 21 21 $Description = $node->getElementsByTagName('description')->item(0)->nodeValue; 22 $Link = $node->getElementsByTagName('link')->item(0)->nodeValue; 22 $Link = $node->getElementsByTagName('link')->item(0)->nodeValue; 23 23 $Date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue; 24 24 25 25 $Description = strip_tags($Description); 26 26 $Description = str_replace("\r", '', $Description); … … 29 29 // $Date = substr($Date, $CommaPos + 1); 30 30 $Date = TimeToMysqlDateTime(strtotime($Date)); 31 32 31 32 33 33 $DbResult = $System->Database->select('News', 'Id', '(`Title`="'.$System->Database->real_escape_string($Title).'") AND (`Category`='.$Category.') AND (`Content` = "'.$System->Database->real_escape_string($Description).'") AND (`Link` = "'.$System->Database->real_escape_string($Link).'")'); 34 34 //echo($System->Database->LastQuery); … … 52 52 $Description = substr($Content, strpos($Content, $DescriptionSeparator) + strlen($DescriptionSeparator)); 53 53 $Description = trim(substr($Description, 0, strpos($Description, '</'))); 54 54 55 55 $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink)); 56 56 $Link = substr($Content, 0, strpos($Content, '<')); … … 62 62 //echo('Description: '.$Description.'<br>'); 63 63 //echo('Link: '.$Link.'<br><hr>'); 64 64 65 65 $Link = $System->Database->real_escape_string($Link); 66 66 $Title = $System->Database->real_escape_string($Title); 67 67 $Description = strip_cdata($Description); 68 68 $Description = strip_tags($Description); 69 69 70 70 $Description = str_replace("\n", '<br>', $Description); 71 71 $Description = str_replace("\r", '', $Description); 72 72 $Description = $System->Database->real_escape_string($Description); 73 73 74 74 $DbResult = $System->Database->select('News', 'Id', '(`Title`="'.$Title.'") AND (`Category`='.$Category.') AND (`Content` = "'.$Description.'") AND (`Link` = "'.$Link.'")'); 75 75 //echo($System->Database->LastQuery); … … 79 79 echo($System->Database->insert_id.','); 80 80 } 81 } 81 } 82 82 */
Note:
See TracChangeset
for help on using the changeset viewer.