XMB PHP Cross Reference Discussion Forums

Source: /today.php - 200 lines - 7035 bytes - Summary - Text - Print

Description: eXtreme Message Board XMB 1.9.11

   1  <?php
   2  /**
   3   * eXtreme Message Board
   4   * XMB 1.9.11
   5   *
   6   * Developed And Maintained By The XMB Group
   7   * Copyright (c) 2001-2012, The XMB Group
   8   * http://www.xmbforum2.com/
   9   *
  10   * This program is free software; you can redistribute it and/or
  11   * modify it under the terms of the GNU General Public License
  12   * as published by the Free Software Foundation; either version 2
  13   * of the License, or (at your option) any later version.
  14   *
  15   * This program is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  22   *
  23   **/
  24  
  25  define('X_SCRIPT', 'today.php');
  26  
  27  require  'header.php';
  28  
  29  loadtemplates(
  30  'forumdisplay_thread_lastpost',
  31  'today',
  32  'today_noposts',
  33  'today_row',
  34  'today_multipage'
  35  );
  36  
  37  smcwcache();
  38  
  39  nav($lang['navtodaysposts']);
  40  
  41  if ($SETTINGS['todaysposts'] == 'off') {
  42      header('HTTP/1.0 403 Forbidden');
  43      error($lang['fnasorry3'], TRUE);
  44  }
  45  
  46  $daysold = getInt('daysold', 'r');
  47  if ($daysold < 1) {
  48      $daysold = 1;
  49  }
  50  $srchfrom = $onlinetime - (86400 * $daysold);
  51  
  52  $tids = array();
  53  $fids = permittedForums(forumCache(), 'thread', 'csv');
  54  
  55  if (strlen($fids) == 0) {
  56      $threadcount = 0;
  57  } else {
  58      $threadcount = $db->result($db->query("SELECT COUNT(*) FROM ".X_PREFIX."threads WHERE lastpost >= $srchfrom AND fid IN ($fids)"), 0);
  59  }
  60  
  61  eval('$css = "'.template('css').'";');
  62  
  63  if ($threadcount == 0) {
  64      eval('$header = "'.template('header').'";');
  65      $noPostsMessage = ($daysold == 1) ? $lang['nopoststoday'] : $lang['noPostsTimePeriod'];
  66      $multipage = '';
  67      eval('$rows = "'.template('today_noposts').'";');
  68  } else {
  69      validateTpp();
  70      validatePpp();
  71  
  72      if ($daysold == 1) {
  73          $mpage = multipage($threadcount, $tpp, 'today.php');
  74      } else {
  75          $mpage = multipage($threadcount, $tpp, 'today.php?daysold='.$daysold);
  76      }
  77      $multipage =& $mpage['html'];
  78      if (strlen($mpage['html']) != 0) {
  79          eval('$multipage = "'.template('today_multipage').'";');
  80      }
  81  
  82      eval('$header = "'.template('header').'";');
  83  
  84      $t_extension = get_extension($lang['toppedprefix']);
  85      switch($t_extension) {
  86          case 'gif':
  87          case 'jpg':
  88          case 'jpeg':
  89          case 'png':
  90              $lang['toppedprefix'] = '<img src="'.$imgdir.'/'.$lang['toppedprefix'].'" alt="'.$lang['toppedpost'].'" border="0" />';
  91              break;
  92      }
  93  
  94      $p_extension = get_extension($lang['pollprefix']);
  95      switch($p_extension) {
  96          case 'gif':
  97          case 'jpg':
  98          case 'jpeg':
  99          case 'png':
 100              $lang['pollprefix'] = '<img src="'.$imgdir.'/'.$lang['pollprefix'].'" alt="'.$lang['postpoll'].'" border="0" />';
 101              break;
 102      }
 103  
 104      $query = $db->query(
 105          "SELECT t.*, t.replies+1 as posts, m.uid, r.uid AS lastauthor
 106           FROM ".X_PREFIX."threads t
 107           LEFT JOIN ".X_PREFIX."members AS m ON t.author = m.username
 108           LEFT JOIN ".X_PREFIX."members AS r ON SUBSTRING_INDEX(SUBSTRING_INDEX(t.lastpost, '|', 2), '|', -1) = r.username
 109           WHERE t.lastpost >= $srchfrom AND t.fid IN ($fids)
 110           ORDER BY t.lastpost DESC
 111           LIMIT {$mpage['start']}, $tpp"
 112      );
 113      $today_row = array();
 114      $tmOffset = ($timeoffset * 3600) + ($SETTINGS['addtime'] * 3600);
 115      while($thread = $db->fetch_array($query)) {
 116          $thread['subject'] = shortenString(rawHTMLsubject(stripslashes($thread['subject'])), 125, X_SHORTEN_SOFT|X_SHORTEN_HARD, '...');
 117          $forum = getForum($thread['fid']);
 118          $thread['name'] = fnameOut($forum['name']);
 119  
 120          if ($thread['author'] == 'Anonymous') {
 121              $authorlink = $lang['textanonymous'];
 122          } elseif (is_null($thread['uid'])) {
 123              $authorlink = $thread['author'];
 124          } else {
 125              $authorlink = '<a href="member.php?action=viewpro&amp;member='.recodeOut($thread['author']).'">'.$thread['author'].'</a>';
 126          }
 127  
 128          $lastpost = explode('|', $thread['lastpost']);
 129          $dalast = $lastpost[0];
 130          $lastPid = $lastpost[2];
 131  
 132          if ($lastpost[1] == 'Anonymous') {
 133              $lastpost[1] = $lang['textanonymous'];
 134          } elseif (!is_null($thread['lastauthor'])) {
 135              $lastpost[1] = '<a href="member.php?action=viewpro&amp;member='.recodeOut($lastpost[1]).'">'.$lastpost[1].'</a>';
 136          } // else leave value unchanged
 137  
 138          $lastreplydate = gmdate($dateformat, $lastpost[0] + $tmOffset);
 139          $lastreplytime = gmdate($timecode, $lastpost[0] + $tmOffset);
 140          $lastpost = $lastreplydate.' '.$lang['textat'].' '.$lastreplytime.'<br />'.$lang['textby'].' '.$lastpost[1];
 141  
 142          if ($thread['icon'] != '' && file_exists($smdir.'/'.$thread['icon'])) {
 143              $thread['icon'] = '<img src="'.$smdir.'/'.$thread['icon'].'" alt="'.$thread['icon'].'" border="0" />';
 144          } else {
 145              $thread['icon'] = '';
 146          }
 147  
 148          if ($thread['replies'] >= $SETTINGS['hottopic']) {
 149              $folder = '<img src="'.$imgdir.'/hot_folder.gif" alt="'.$lang['althotfolder'].'" border="0" />';
 150          } else {
 151              $folder = '<img src="'.$imgdir.'/folder.gif" alt="'.$lang['altfolder'].'" border="0" />';
 152          }
 153  
 154          $oldtopics = isset($oldtopics) ? $oldtopics : '';
 155          if (($oT = strpos($oldtopics, '|'.$lastPid.'|')) === false && $thread['replies'] >= $SETTINGS['hottopic'] && $lastvisit < $dalast) {
 156              $folder = '<img src="'.$imgdir.'/hot_red_folder.gif" alt="'.$lang['althotredfolder'].'" border="0" />';
 157          } else if ($lastvisit < $dalast && $oT === false) {
 158              $folder = '<img src="'.$imgdir.'/red_folder.gif" alt="'.$lang['altredfolder'].'" border="0" />';
 159          }
 160  
 161          if ($thread['closed'] == 'yes') {
 162              $folder = '<img src="'.$imgdir.'/lock_folder.gif" alt="'.$lang['altclosedtopic'].'" border="0" />';
 163              $prefix = '';
 164          } else {
 165              $moved = explode('|', $thread['closed']);
 166              if ($moved[0] == 'moved') {
 167                  continue;
 168              }
 169          }
 170  
 171          eval('$lastpostrow = "'.template('forumdisplay_thread_lastpost').'";');
 172  
 173          $prefix = '';
 174          if ($thread['pollopts'] == 1) {
 175              $prefix = $lang['pollprefix'].' ';
 176          }
 177  
 178          if ($thread['topped'] == 1) {
 179              $prefix = $lang['toppedprefix'].' '.$prefix;
 180          }
 181  
 182          $mpurl = 'viewthread.php?tid='.$thread['tid'];
 183          $multipage2 = multi(1, quickpage($thread['replies']+1, $ppp), $mpurl, FALSE);
 184          if (strlen($multipage2) != 0) {
 185              $multipage2 = "(<small>$multipage2</small>)";
 186          }
 187          unset($mpurl);
 188  
 189          eval('$today_row[] = "'.template('today_row').'";');
 190      }
 191      $rows = implode("\n", $today_row);
 192      $db->free_result($query);
 193  }
 194  
 195  eval('$todaypage = "'.template('today').'";');
 196  
 197  end_time();
 198  eval('$footer = "'.template('footer').'";');
 199  echo $header, $todaypage, $footer;
 200  ?>

title

Description

title

Description

title

Description

title

title

Body