- Timestamp:
- Feb 6, 2011, 7:07:14 PM (14 years ago)
- Location:
- trunk/aktuality
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/aktuality/import_kino_vatra.php
r306 r310 20 20 $Date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue; 21 21 22 $Title = $Database->real_escape_string($Title);23 22 $Description = strip_tags($Description); 24 23 $Description = str_replace("\r", '', $Description); 25 24 $Description = str_replace("\n", '<br>', $Description); 26 $Description = $Database->real_escape_string($Description);27 $Link = $Database->real_escape_string($Link);28 25 //if(($CommaPos = strpos($Date, ',')) !== FALSE) 29 26 // $Date = substr($Date, $CommaPos + 1); 30 27 $Date = TimeToMysqlDateTime(strtotime($Date)); 31 28 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); 35 31 if($DbResult->num_rows == 0) 36 32 { … … 40 36 } 41 37 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 parameters57 // $Link = substr($Link, 0, strrpos($Link, '/')).substr($Link, strrpos($Link, '/')); // Insert month between folder and filename58 // $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 83 38 ?> -
trunk/aktuality/import_obec_hovezi.php
r306 r310 20 20 $Date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue; 21 21 22 $Title = $Database->real_escape_string($Title);23 22 $Description = strip_tags($Description); 24 23 $Description = str_replace("\r", '', $Description); 25 24 $Description = str_replace("\n", '<br>', $Description); 26 $Description = $Database->real_escape_string($Description);27 $Link = $Database->real_escape_string($Link);28 25 //if(($CommaPos = strpos($Date, ',')) !== FALSE) 29 26 // $Date = substr($Date, $CommaPos + 1); … … 31 28 32 29 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).'")'); 34 31 //echo($Database->LastQuery); 35 32 if($DbResult->num_rows == 0) -
trunk/aktuality/import_tv_beskyd.php
r306 r310 31 31 //echo('Link: '.$Link.'<br><hr>'); 32 32 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); 34 34 //echo($Database->LastQuery); 35 35 if($DbResult->num_rows == 0) -
trunk/aktuality/import_zdechov_cz_aktuality.php
r306 r310 32 32 */ 33 33 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); 35 35 //echo($Database->LastQuery); 36 36 if($DbResult->num_rows == 0) 37 37 { 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)); 39 39 echo($Database->insert_id.','); 40 40 } -
trunk/aktuality/import_zdechov_cz_zapisy.php
r307 r310 31 31 */ 32 32 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); 34 34 //echo($Database->LastQuery); 35 35 if($DbResult->num_rows == 0)
Note:
See TracChangeset
for help on using the changeset viewer.