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

Legend:

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

    r827 r873  
    1616$doc = new DOMDocument();
    1717@$doc->load($SourceURL);
    18 foreach($doc->getElementsByTagName('item') as $node)
     18foreach ($doc->getElementsByTagName('item') as $node)
    1919{
    2020  $Title = $node->getElementsByTagName('title')->item(0)->nodeValue;
     
    2626  $Description = str_replace("\r", '', $Description);
    2727  $Description = str_replace("\n", '<br>', $Description);
    28   //if(($CommaPos = strpos($Date, ',')) !== FALSE)
     28  //if (($CommaPos = strpos($Date, ',')) !== FALSE)
    2929  //  $Date = substr($Date, $CommaPos + 1);
    3030  $Date = TimeToMysqlDateTime(strtotime($Date));
     
    3333  $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).'")');
    3434  //echo($System->Database->LastQuery);
    35   if($DbResult->num_rows == 0)
     35  if ($DbResult->num_rows == 0)
    3636  {
    3737    $System->Database->insert('News', array('Title' => $Title, 'Date' => $Date, 'Author' => $Author, 'Category' => $Category, 'Content' => $Description, 'Link' => $Link));
     
    4444//$Content = addslashes($Encoding->ToUTF8(file_get_contents($SourceURL), 'win1250'));
    4545$Content = file_get_contents($SourceURL);
    46 while(strpos($Content, $StartText) !== false)
     46while (strpos($Content, $StartText) !== false)
    4747{
    4848  $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText));
     
    7474  $DbResult = $System->Database->select('News', 'Id', '(`Title`="'.$Title.'") AND (`Category`='.$Category.') AND (`Content` = "'.$Description.'") AND (`Link` = "'.$Link.'")');
    7575  //echo($System->Database->LastQuery);
    76   if($DbResult->num_rows == 0)
     76  if ($DbResult->num_rows == 0)
    7777  {
    7878    $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.