Changeset 310 for trunk


Ignore:
Timestamp:
Feb 6, 2011, 7:07:14 PM (14 years ago)
Author:
george
Message:
  • Opraveno: V importech aktualit opraveno lomítkování.
Location:
trunk/aktuality
Files:
5 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?>
  • trunk/aktuality/import_obec_hovezi.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);
     
    3128 
    3229 
    33   $DbResult = $Database->select('News', 'Id', '(`Title`="'.$Title.'") AND (`Category`='.$Category.') AND (`Content` = "'.$Description.'") AND (`Link` = "'.$Link.'")');
     30  $DbResult = $Database->select('News', 'Id', '(`Title`="'.$Database->real_escape_string($Title).'") AND (`Category`='.$Category.') AND (`Content` = "'.$Database->real_escape_string($Description).'") AND (`Link` = "'.$Database->real_escape_string($Link).'")');
    3431  //echo($Database->LastQuery);
    3532  if($DbResult->num_rows == 0)
  • trunk/aktuality/import_tv_beskyd.php

    r306 r310  
    3131  //echo('Link: '.$Link.'<br><hr>');
    3232 
    33   $DbResult = $Database->select('News', 'Id', '`Title`="'.$Title.'" AND `Category`='.$Category);
     33  $DbResult = $Database->select('News', 'Id', '`Title`="'.$Database->real_escape_string($Title).'" AND `Category`='.$Category);
    3434  //echo($Database->LastQuery);
    3535  if($DbResult->num_rows == 0)
  • trunk/aktuality/import_zdechov_cz_aktuality.php

    r306 r310  
    3232*/
    3333
    34   $DbResult = $Database->select('News', 'Id', '`Title`="'.$Title.'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
     34  $DbResult = $Database->select('News', 'Id', '`Title`="'.$Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
    3535  //echo($Database->LastQuery);
    3636  if($DbResult->num_rows == 0)
    3737  {
    38     $Database->insert('News', array('Title' => $Title, 'Date' => $Date, 'Author' => $Author, 'Category' => $Category, 'Content' => addslashes($Description), 'Link' => $Link));
     38    $Database->insert('News', array('Title' => $Title, 'Date' => $Date, 'Author' => $Author, 'Category' => $Category, 'Content' => $Description, 'Link' => $Link));
    3939    echo($Database->insert_id.',');
    4040  }
  • trunk/aktuality/import_zdechov_cz_zapisy.php

    r307 r310  
    3131*/
    3232
    33   $DbResult = $Database->select('News', 'Id', '`Title`="'.$Title.'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
     33  $DbResult = $Database->select('News', 'Id', '`Title`="'.$Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
    3434  //echo($Database->LastQuery);
    3535  if($DbResult->num_rows == 0)
Note: See TracChangeset for help on using the changeset viewer.