Changeset 34 for trunk/index.php


Ignore:
Timestamp:
Jan 10, 2019, 10:51:57 PM (6 years ago)
Author:
chronos
Message:
  • Added: Generate robots.txt file and disallow all pages with ? symbol.
  • Added: Sitemap.xml file for robots.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r33 r34  
    237237      '<input value="'.$_SESSION['location'].'" onkeyup="if(event.keyCode!=9) upf(\'location\',$(this).val(),(event.keyCode==13?0:1)); '.
    238238      '" id="location" autocomplete="off" type="text"/>'.
    239       '</div> ';   
     239      '</div> ';
    240240    $Output .= '<div class="filter-num-box">'.
    241241      '<div class="label-box">Zpráva</div>'.
    242242      '<input value="'.$_SESSION['message'].'" onkeyup="if(event.keyCode!=9) upf(\'message\',$(this).val(),(event.keyCode==13?0:1)); '.
    243243      '" id="message" autocomplete="off" type="text"/>'.
    244       '</div> ';   
     244      '</div> ';
    245245    }
    246246
     
    263263    $PageList = GetPageList($DbRow[0]);
    264264
    265     $Gender = array('', 'Muž', 'Žena');   
     265    $Gender = array('', 'Muž', 'Žena');
    266266    $Output .= '<div id="list_content">';
    267267    $Output .= $PageList['Output'];
     
    304304    $Output .= '</div>';
    305305    if (array_key_exists('lvm', $_GET) and ($_GET['lvm'] == 'seznam'))
    306     {     
     306    {
    307307    }
    308308    else
     
    313313    return($Output);
    314314  }
    315  
     315
    316316  function ShowMeetItem()
    317317  {
    318318    $this->Title .= ' - Seznamka - Inzerát';
    319     $Output = '';   
     319    $Output = '';
    320320    if(count($this->PathItems) > 2)
    321321    {
     
    341341        '<tr><th>Email</th><td>'.$MeetItem['Email'].'</td></tr>'.
    342342        '<tr><th>Telefón</th><td>'.$MeetItem['Phone'].'</td></tr>'.
    343         '<tr><th>Zpráva</th><td>'.$MeetItem['Message'].'</td></tr>'.             
     343        '<tr><th>Zpráva</th><td>'.$MeetItem['Message'].'</td></tr>'.
    344344        '<tr><th>Původní web</th><td>'.$Link.'</td></tr>'.
    345345        '<tr><th>Zdroj importu</th><td><a href="'.$MeetItem['SourceURL'].'">'.$MeetItem['SourceName'].'</a></td></tr>';
     
    372372      if ($MeetItem['Age'] != '') $Description .= '<br/>Věk: '.$MeetItem['Age'].' let';
    373373      if ($MeetItem['Height'] != '') $Description .= '<br/>Výška: '.$MeetItem['Height'].' cm';
    374       if ($MeetItem['Weight'] != '') $Description .= '<br/>Váha: '.$MeetItem['Weight'].' kg';     
    375       $Description .= '<br/>Zdroj importu: <a href="'.$MeetItem['SourceURL'].'">'.$MeetItem['SourceName'].'</a>';     
     374      if ($MeetItem['Weight'] != '') $Description .= '<br/>Váha: '.$MeetItem['Weight'].' kg';
     375      $Description .= '<br/>Zdroj importu: <a href="'.$MeetItem['SourceURL'].'">'.$MeetItem['SourceName'].'</a>';
    376376      $Time = MysqlDateTimeToTime($MeetItem['Time']);
    377       $TimeImport = MysqlDateTimeToTime($MeetItem['TimeImport']);     
     377      $TimeImport = MysqlDateTimeToTime($MeetItem['TimeImport']);
    378378      // Append time part of TimeImport time to item time so new items will appear in correct time order even if item doesn't have time part specified
    379379      if (TimeToMysqlTime($Time) == '00:00:00')
     
    408408      '</head><body>';
    409409    $Output .= $Content;
    410     $Output .= '<div></div><div class="footer">Kontakt: <a href="mailto:'.$Config['Contact'].'">'.$Config['Contact'].'</a> '.
     410    $Output .= '<div class="footer">Kontakt: <a href="mailto:'.$Config['Contact'].'">'.$Config['Contact'].'</a> '.
    411411       '<a href="https://app.zdechov.net/tanec/">Zdrojový kód</a></div>';
    412412    $Output .= '</body></html>';
    413413    return($Output);
     414  }
     415
     416  function ShowRobots()
     417  {
     418    $this->NoFullPage = true;
     419    $Result = 'User-agent: *'."\n".
     420      'Disallow: /*?'."\n".
     421      'Sitemap: '.$this->AbsoluteLink('/sitemap.xml');
     422    return($Result);
     423  }
     424
     425  function ShowSiteMap()
     426  {
     427    $this->NoFullPage = true;
     428    $Urls = array(
     429      '/seznamka/',
     430      '/skoly/',
     431      '/tance/',
     432    );
     433    $Result = '<?xml version="1.0" encoding="UTF-8"?>'."\n".
     434      '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
     435    foreach ($Urls as $Url)
     436    {
     437      $Result .= '<url>'."\n".
     438        '  <loc>'.$this->AbsoluteLink($Url).'</loc>'."\n".
     439        //'<lastmod>'..'</lastmod>'."\n".
     440        '</url>'."\n";
     441    }
     442    // MeetItems
     443    $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem`');
     444    while ($DbRow = $DbResult->fetch_array())
     445    {
     446      $Url = '/seznamka/inzerat/'.$DbRow['Id'];
     447      $Time = MysqlDateTimeToTime($DbRow['Time']);
     448      $Result .= '<url>'."\n".
     449        '  <loc>'.$this->AbsoluteLink($Url).'</loc>'."\n".
     450        '  <lastmod>'.date('c', $Time).'</lastmod>'."\n".
     451        '</url>'."\n";
     452      $Result .= '<loc>'.$this->AbsoluteLink($Url).'</loc>'."\n";
     453    }
     454
     455    $Result .= '</urlset>';
     456    return($Result);
    414457  }
    415458
     
    429472
    430473    $this->Title = 'Tanec';
    431     $Output = '';   
     474    $Output = '';
    432475
    433476    if(count($this->PathItems) > 0)
    434477    {
    435       if($this->PathItems[0] == 'skoly') $Output .= $this->ShowSchoolList();
     478      if($this->PathItems[0] == 'robots.txt') $Output .= $this->ShowRobots();
     479      else if($this->PathItems[0] == 'sitemap.xml') $Output .= $this->ShowSiteMap();
     480      else if($this->PathItems[0] == 'skoly') $Output .= $this->ShowSchoolList();
    436481      else if($this->PathItems[0] == 'tance') $Output .= $this->ShowDanceList();
    437482      else if($this->PathItems[0] == 'seznamka') {
     
    442487          else if($this->PathItems[1] == 'inzerat') $Output .= $this->ShowMeetItem();
    443488        } else $Output .= $this->ShowMeetList();
    444       }     
     489      }
    445490      else $Output .= $this->ShowDanceList();
    446491    } else $Output .= $this->ShowDanceList();
Note: See TracChangeset for help on using the changeset viewer.