[Top level directory]     [Classes]     [Functions]     [Constants]     [Variables]

XMB Open Source Forum Software - PHP Cross Reference

title

Body

[close]

/ -> today.php (source)

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


Generated: Tue Jan 26 20:11:23 2010 Home | Forum | Download | SVN | Bug Tracker | Documentation Cross-referenced by PHPXref 0.7