Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/News/ImportZdechovCzRecords.php

    r827 r873  
    1616$Author = 'Automat';
    1717$Content = @file_get_contents($SourceURL);
    18 while(strpos($Content, $StartText) !== false)
     18while (strpos($Content, $StartText) !== false)
    1919{
    2020  $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText));
     
    2222  $Date = substr($Content, 0, strpos($Content, '<'));
    2323  $DateParts = explode('.', $Date);
    24   if(count($DateParts) >= 3)
     24  if (count($DateParts) >= 3)
    2525    $Date = $DateParts[2].'-'.$DateParts[1].'-'.$DateParts[0];
    2626      else break;
    2727  $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink));
    2828  $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;
    3030  $Content = substr($Content, strpos($Content, $StartTitle) + strlen($StartTitle));
    3131  $Title = substr($Content, 0, strpos($Content, '<'));
     
    4242  $DbResult = $System->Database->select('News', 'Id', '`Title`="'.$System->Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
    4343  //echo($System->Database->LastQuery);
    44   if($DbResult->num_rows == 0)
     44  if ($DbResult->num_rows == 0)
    4545  {
    4646    $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.