Changeset 873 for trunk/Modules/News/ImportObecHovezi.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/ImportObecHovezi.php
r827 r873 16 16 $doc = new DOMDocument(); 17 17 @$doc->load($SourceURL); 18 foreach ($doc->getElementsByTagName('item') as $node)18 foreach ($doc->getElementsByTagName('item') as $node) 19 19 { 20 20 $Title = $node->getElementsByTagName('title')->item(0)->nodeValue; … … 26 26 $Description = str_replace("\r", '', $Description); 27 27 $Description = str_replace("\n", '<br>', $Description); 28 //if (($CommaPos = strpos($Date, ',')) !== FALSE)28 //if (($CommaPos = strpos($Date, ',')) !== FALSE) 29 29 // $Date = substr($Date, $CommaPos + 1); 30 30 $Date = TimeToMysqlDateTime(strtotime($Date)); … … 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); 35 if ($DbResult->num_rows == 0)35 if ($DbResult->num_rows == 0) 36 36 { 37 37 $System->Database->insert('News', array('Title' => $Title, 'Date' => $Date, 'Author' => $Author, 'Category' => $Category, 'Content' => $Description, 'Link' => $Link)); … … 44 44 //$Content = addslashes($Encoding->ToUTF8(file_get_contents($SourceURL), 'win1250')); 45 45 $Content = file_get_contents($SourceURL); 46 while (strpos($Content, $StartText) !== false)46 while (strpos($Content, $StartText) !== false) 47 47 { 48 48 $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText)); … … 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); 76 if ($DbResult->num_rows == 0)76 if ($DbResult->num_rows == 0) 77 77 { 78 78 $System->Database->insert('News', array('Title' => $Title, 'Date' => 'NOW()', 'Author' => $Author, 'Category' => $Category, 'Content' => $Description, 'Link' => $Link));
Note:
See TracChangeset
for help on using the changeset viewer.