Changeset 873 for trunk/Modules/News/ImportZdechovCzRecords.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/ImportZdechovCzRecords.php
r827 r873 16 16 $Author = 'Automat'; 17 17 $Content = @file_get_contents($SourceURL); 18 while (strpos($Content, $StartText) !== false)18 while (strpos($Content, $StartText) !== false) 19 19 { 20 20 $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText)); … … 22 22 $Date = substr($Content, 0, strpos($Content, '<')); 23 23 $DateParts = explode('.', $Date); 24 if (count($DateParts) >= 3)24 if (count($DateParts) >= 3) 25 25 $Date = $DateParts[2].'-'.$DateParts[1].'-'.$DateParts[0]; 26 26 else break; 27 27 $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink)); 28 28 $Link = substr($Content, 0, strpos($Content, '"')); 29 if (substr($Link, 0, 7) != 'http://') $Link = 'http://www.zdechov.cz/'.$Link;29 if (substr($Link, 0, 7) != 'http://') $Link = 'http://www.zdechov.cz/'.$Link; 30 30 $Content = substr($Content, strpos($Content, $StartTitle) + strlen($StartTitle)); 31 31 $Title = substr($Content, 0, strpos($Content, '<')); … … 42 42 $DbResult = $System->Database->select('News', 'Id', '`Title`="'.$System->Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category); 43 43 //echo($System->Database->LastQuery); 44 if ($DbResult->num_rows == 0)44 if ($DbResult->num_rows == 0) 45 45 { 46 46 $System->Database->insert('News', array('Title' => $Title, 'Date' => $Date, 'Author' => $Author, 'Category' => $Category, 'Content' => $Description, 'Link' => $Link));
Note:
See TracChangeset
for help on using the changeset viewer.