Changeset 321


Ignore:
Timestamp:
Nov 27, 2011, 6:47:46 PM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Načítání úřední desky zděchova.
Location:
trunk/aktuality
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/aktuality/import_zdechov_cz_aktuality.php

    r320 r321  
    2828 
    2929
     30  /*
    3031  echo('Title: '.$Title.'<br>');
    3132  echo('Description: '.$Description.'<br>');
    3233  echo('Date: '.$Date.'<br>');
    3334  echo('Link: '.$Link.'<br><hr>');
    34 
     35  */
    3536
    3637  $DbResult = $Database->select('News', 'Id', '`Title`="'.$Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
  • trunk/aktuality/import_zdechov_cz_zapisy.php

    r310 r321  
    33include('../global.php');
    44
    5 $SourceURL = 'http://www.zdechov.cz/pages/main.php?pg=ou-usneseni-zapisy&ax=arx';
    6 $StartText = '<b>Dokument:</b>&nbsp;&nbsp;';
    7 $TitleSeparator = '<br>&nbsp;';
    8 $StartLink = '<a href=..';
     5$SourceURL = 'http://www.zdechov.cz/?page=uredni_deska';
     6$StartText = '<tr class="even">';
     7$StartLink = 'href="';
     8$StartTitle = '>';
     9$TitleSeparator = '"';
     10$StartDescription = '';
     11$StartDate = '<td align="right">';
    912$Category = 11;
    1013$Author = 'Automat';
    11 
    12 $Content = addslashes(ToUTF8(file_get_contents($SourceURL), 'win1250'));
     14$Content = file_get_contents($SourceURL);
    1315while(strpos($Content, $StartText) !== false)
    1416{
    1517  $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText));
    16   $Title = substr($Content, 0, strpos($Content, $TitleSeparator));
    17   $Date = substr($Title, strrpos($Title, ' ') + 1);
    18   $DateParts = explode('-', $Date);
     18  $Content = substr($Content, strpos($Content, $StartDate) + strlen($StartDate));
     19  $Date = substr($Content, 0, strpos($Content, '<'));
     20  $DateParts = explode('.', $Date);
    1921  $Date = $DateParts[2].'-'.$DateParts[1].'-'.$DateParts[0];
    2022  $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink));
    21   $Link = 'http://www.zdechov.cz'.substr($Content, 0, strpos($Content, ' '));
    22   $Link = substr($Link, 0, strpos($Link, '?')); // Remove URL parameters
    23   $Link = substr($Link, 0, strrpos($Link, '/')).$DateParts[1].substr($Link, strrpos($Link, '/')); // Insert month between folder and filename
     23  $Link = substr($Content, 0, strpos($Content, '"'));
     24  if(substr($Link, 0, 7) != 'http://') $Link = 'http://'.$Link;
     25  $Content = substr($Content, strpos($Content, $StartTitle) + strlen($StartTitle));
     26  $Title = substr($Content, 0, strpos($Content, '<'));
    2427  $Description = '';
     28 
    2529
    26 /*
     30  /*
    2731  echo('Title: '.$Title.'<br>');
    2832  echo('Description: '.$Description.'<br>');
    2933  echo('Date: '.$Date.'<br>');
    3034  echo('Link: '.$Link.'<br><hr>');
    31 */
     35  */
    3236
    3337  $DbResult = $Database->select('News', 'Id', '`Title`="'.$Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
Note: See TracChangeset for help on using the changeset viewer.