Changeset 61


Ignore:
Timestamp:
Apr 28, 2021, 6:11:27 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Limit display of meet and event to defined time interval.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config/Config.sample.php

    r55 r61  
    99$Config['Encoding'] = 'utf-8';
    1010$Config['BaseURL'] = '';
     11$Config['HostName'] = 'https://localhost';
    1112$Config['ItemsPerPage'] = 30;
    1213$Config['VisiblePagingItems'] = 5;
     
    1516$Config['Web']['Title'] = 'Tanec';
    1617$Config['Web']['AdminPassword'] = rand(1, 10000000);
     18$Config['MeetInterval'] = 90 * 24 * 60 * 60;
     19$Config['EventInterval'] = 90 * 24 * 60 * 60;
  • trunk/Modules/Event/Event.php

    r55 r61  
    22
    33include_once(dirname(__FILE__).'/Import/JoeClub.php');
     4
     5function GetDefaultEventFilter($Table = '')
     6{
     7  global $Config;
     8
     9  if ($Table != '') $Table = $Table.'.';
     10
     11  return '('.$Table.'Hidden=0) AND ('.$Table.'TimeFrom > "'.TimeToMysqlDateTime(time() - $Config['EventInterval']).'")';
     12}
    413
    514function ReduceSpaces($Content)
  • trunk/Modules/Event/EventPage.php

    r56 r61  
    5757
    5858    $DbResult = $this->Database->query('SELECT COUNT(*) FROM (SELECT *, '.
    59       '(SELECT EventSource.Name FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceName FROM `Event`) AS T WHERE (T.Hidden=0) AND '.$Where);
     59      '(SELECT EventSource.Name FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceName FROM `Event`) AS T WHERE '.GetDefaultEventFilter('T').' AND '.$Where);
    6060    $DbRow = $DbResult->fetch_row();
    6161    $PageList = GetPageList($DbRow[0]);
     
    7777    $Output .= $Order['Output'];
    7878    $DbResult = $this->Database->query('SELECT * FROM (SELECT *, (SELECT EventSource.Name FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceName, '.
    79       '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL FROM Event) AS T WHERE (T.Hidden=0) AND '.
     79      '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL FROM Event) AS T WHERE '.GetDefaultEventFilter('T').' AND '.
    8080      $Where.$Order['SQL'].$PageList['SQLLimit']);
    8181    while ($Event = $DbResult->fetch_assoc())
     
    198198
    199199    $DbResult = $this->Database->select('Event', '*, (SELECT EventSource.Name FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceName, '.
    200       '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL', '`Hidden`=0 ORDER BY `TimeFrom` DESC LIMIT 30');
     200      '(SELECT EventSource.URL FROM EventSource WHERE EventSource.Id = Event.Source) AS SourceURL', GetDefaultEventFilter().' ORDER BY `TimeFrom` DESC LIMIT 30');
    201201    while ($Event = $DbResult->fetch_assoc())
    202202    {
  • trunk/Modules/Meet/Meet.php

    r59 r61  
    111111{
    112112  return ($Char == ' ') or ($Char == "\t");
     113}
     114
     115function GetDefaultMeetFilter($Table = '')
     116{
     117  global $Config;
     118
     119  if ($Table != '') $Table = $Table.'.';
     120
     121  return '('.$Table.'Hidden=0) AND ('.$Table.'Time > "'.TimeToMysqlDateTime(time() - $Config['MeetInterval']).'")';
    113122}
    114123
  • trunk/Modules/Meet/MeetPage.php

    r56 r61  
    3636  function Show()
    3737  {
     38    global $Config;
     39
    3840    $Filter = new Filter();
    3941    $Filter->Items = array(
     
    5961
    6062    $DbResult = $this->Database->query('SELECT COUNT(*) FROM (SELECT *, '.
    61       '(SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName FROM `MeetItem`) AS T WHERE (T.Hidden=0) AND '.$Where);
     63      '(SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName FROM `MeetItem`) AS T '.
     64      'WHERE '.GetDefaultMeetFilter('T').' AND '.$Where);
    6265    $DbRow = $DbResult->fetch_row();
    6366    $PageList = GetPageList($DbRow[0]);
     
    8285    $Output .= $Order['Output'];
    8386    $DbResult = $this->Database->query('SELECT * FROM (SELECT *, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '.
    84       '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE (T.Hidden=0) AND '.
     87      '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE '.GetDefaultMeetFilter('T').' AND '.
    8588      $Where.$Order['SQL'].$PageList['SQLLimit']);
    8689    while ($MeetItem = $DbResult->fetch_assoc())
     
    209212    $RSS->Link = $this->System->AbsoluteLink('/seznamka/');
    210213
    211     $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '.
    212       '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', '`Hidden`=0 ORDER BY `Time` DESC LIMIT 30');
     214    $DbResult = $this->Database->query('SELECT *, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '.
     215      '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem WHERE '.
     216      GetDefaultMeetFilter().' ORDER BY `Time` DESC LIMIT 30');
    213217    while ($MeetItem = $DbResult->fetch_assoc())
    214218    {
  • trunk/index.php

    r56 r61  
    235235
    236236    // Meets
    237     $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem` WHERE (`Hidden`=0)');
     237    $DbResult = $this->Database->query('SELECT `Id`,`Time` FROM `MeetItem` WHERE '.GetDefaultMeetFilter());
    238238    while ($DbRow = $DbResult->fetch_array())
    239239    {
     
    247247
    248248    // Events
    249     $DbResult = $this->Database->query('SELECT `Id`,`TimeFrom` FROM `Event` WHERE (`Hidden`=0)');
     249    $DbResult = $this->Database->query('SELECT `Id`,`TimeFrom` FROM `Event` WHERE '.GetDefaultEventFilter());
    250250    while ($DbRow = $DbResult->fetch_array())
    251251    {
Note: See TracChangeset for help on using the changeset viewer.