Ignore:
Timestamp:
Feb 6, 2011, 7:07:14 PM (14 years ago)
Author:
george
Message:
  • Opraveno: V importech aktualit opraveno lomítkování.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/aktuality/import_kino_vatra.php

    r306 r310  
    2020  $Date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue;
    2121 
    22   $Title = $Database->real_escape_string($Title);
    2322  $Description = strip_tags($Description);
    2423  $Description = str_replace("\r", '', $Description);
    2524  $Description = str_replace("\n", '<br>', $Description);
    26   $Description = $Database->real_escape_string($Description);
    27   $Link = $Database->real_escape_string($Link);
    2825  //if(($CommaPos = strpos($Date, ',')) !== FALSE)
    2926  //  $Date = substr($Date, $CommaPos + 1);
    3027  $Date = TimeToMysqlDateTime(strtotime($Date));
    3128 
    32  
    33   $DbResult = $Database->select('News', 'Id', '(`Title`="'.$Title.'") AND (`Category`='.$Category.') AND (`Content` = "'.$Description.'") AND (`Link` = "'.$Link.'")');
    34   //echo($Database->LastQuery);
     29  $Query = 'SELECT Id FROM News WHERE (`Title`="'.$Database->real_escape_string($Title).'") AND (`Category`='.$Category.') AND (`Content` = "'.$Database->real_escape_string($Description).'") AND (`Link` = "'.$Database->real_escape_string($Link).'")';
     30  $DbResult = $Database->query($Query);
    3531  if($DbResult->num_rows == 0)
    3632  {
     
    4036}
    4137
    42 /*
    43 //$Content = addslashes(ToUTF8(file_get_contents($SourceURL), 'win1250'));
    44 $Content = file_get_contents($SourceURL);
    45 while(strpos($Content, $StartText) !== false)
    46 {
    47   $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText));
    48   $Title = substr($Content, strpos($Content, $TitleSeparator) + strlen($TitleSeparator));
    49   $Title = substr($Title, 0, strpos($Title, '<'));
    50 
    51   $Description = substr($Content, strpos($Content, $DescriptionSeparator) + strlen($DescriptionSeparator));
    52   $Description = trim(substr($Description, 0, strpos($Description, '</')));
    53  
    54   $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink));
    55   $Link = substr($Content, 0, strpos($Content, '<'));
    56 //  $Link = substr($Link, 0, strpos($Link, '?')); // Remove URL parameters
    57 //  $Link = substr($Link, 0, strrpos($Link, '/')).substr($Link, strrpos($Link, '/')); // Insert month between folder and filename
    58 //  $Description .= '<br><a href="'.$Link.'">Video</a>';
    59 
    60   //echo('Title: '.$Title.'<br>');
    61   //echo('Description: '.$Description.'<br>');
    62   //echo('Link: '.$Link.'<br><hr>');
    63  
    64   $Link = $Database->real_escape_string($Link);
    65   $Title = $Database->real_escape_string($Title);
    66   $Description = strip_cdata($Description);
    67   $Description = strip_tags($Description);
    68  
    69   $Description = str_replace("\n", '<br>', $Description);
    70   $Description = str_replace("\r", '', $Description);
    71   $Description = $Database->real_escape_string($Description);
    72  
    73   $DbResult = $Database->select('News', 'Id', '(`Title`="'.$Title.'") AND (`Category`='.$Category.') AND (`Content` = "'.$Description.'") AND (`Link` = "'.$Link.'")');
    74   //echo($Database->LastQuery);
    75   if($DbResult->num_rows == 0)
    76   {
    77     $Database->insert('News', array('Title' => $Title, 'Date' => 'NOW()', 'Author' => $Author, 'Category' => $Category, 'Content' => $Description, 'Link' => $Link));
    78     echo($Database->insert_id.',');
    79   }
    80 }
    81 */
    82 
    8338?>
Note: See TracChangeset for help on using the changeset viewer.