MyBB PHP Cross Reference Discussion Forums

Source: /forumdisplay.php - 1353 lines - 35441 bytes - Summary - Text - Print

Description: MyBB 1.6 Copyright 2010 MyBB Group, All Rights Reserved

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://mybb.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id$
  10   */
  11  
  12  define("IN_MYBB", 1);
  13  define('THIS_SCRIPT', 'forumdisplay.php');
  14  
  15  $templatelist = "forumdisplay,forumdisplay_thread,forumbit_depth1_cat,forumbit_depth2_cat,forumbit_depth2_forum,forumdisplay_subforums,forumdisplay_threadlist,forumdisplay_moderatedby,forumdisplay_newthread,forumdisplay_searchforum,forumdisplay_orderarrow,forumdisplay_thread_rating,forumdisplay_threadlist_rating,forumdisplay_threadlist_sortrating,forumbit_moderators,forumbit_subforums,forumbit_depth2_forum_lastpost";
  16  $templatelist .= ",forumbit_depth1_forum_lastpost,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,forumdisplay_thread_multipage_more";
  17  $templatelist .= ",multipage_prevpage,multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage";
  18  $templatelist .= ",forumjump_advanced,forumjump_special,forumjump_bit,forumdisplay_password_wrongpass,forumdisplay_password";
  19  $templatelist .= ",forumdisplay_usersbrowsing_user,forumdisplay_usersbrowsing,forumdisplay_inlinemoderation,forumdisplay_thread_modbit,forumdisplay_inlinemoderation_col,forumdisplay_inlinemoderation_selectall,forumdisplay_threadlist_clearpass";
  20  $templatelist .= ",forumdisplay_announcements_announcement,forumdisplay_announcements,forumdisplay_threads_sep,forumbit_depth3_statusicon,forumbit_depth3,forumdisplay_sticky_sep,forumdisplay_thread_attachment_count,forumdisplay_threadlist_inlineedit_js,forumdisplay_rssdiscovery,forumdisplay_announcement_rating,forumdisplay_announcements_announcement_modbit,forumdisplay_rules,forumdisplay_rules_link,forumdisplay_thread_gotounread,forumdisplay_nothreads,forumdisplay_inlinemoderation_custom_tool,forumdisplay_inlinemoderation_custom";
  21  require_once  "./global.php";
  22  require_once  MYBB_ROOT."inc/functions_post.php";
  23  require_once  MYBB_ROOT."inc/functions_forumlist.php";
  24  require_once  MYBB_ROOT."inc/class_parser.php";
  25  $parser = new postParser;
  26  
  27  $orderarrow = $sortsel = array('rating' => '', 'subject' => '', 'starter' => '', 'started' => '', 'replies' => '', 'views' => '');
  28  $ordersel = array('asc' => '', 'desc' => '');
  29  $datecutsel = array(1 => '', 5 => '', 10 => '', 20 => '', 50 => '', 75 => '', 100 => '', 365 => '', 9999 => '');
  30  $rules = '';
  31  
  32  // Load global language phrases
  33  $lang->load("forumdisplay");
  34  
  35  $plugins->run_hooks("forumdisplay_start");
  36  
  37  $fid = intval($mybb->input['fid']);
  38  if($fid < 0)
  39  {
  40      switch($fid)
  41      {
  42          case "-1":
  43              $location = "index.php";
  44              break;
  45          case "-2":
  46              $location = "search.php";
  47              break;
  48          case "-3":
  49              $location = "usercp.php";
  50              break;
  51          case "-4":
  52              $location = "private.php";
  53              break;
  54          case "-5":
  55              $location = "online.php";
  56              break;
  57      }
  58      if($location)
  59      {
  60          header("Location: ".$location);
  61          exit;
  62      }
  63  }
  64  
  65  // Get forum info
  66  $foruminfo = get_forum($fid);
  67  if(!$foruminfo)
  68  {
  69      error($lang->error_invalidforum);
  70  }
  71  
  72  $archive_url = build_archive_link("forum", $fid);
  73  
  74  $currentitem = $fid;
  75  build_forum_breadcrumb($fid);
  76  $parentlist = $foruminfo['parentlist'];
  77  
  78  // To validate, turn & to &amp; but support unicode
  79  $foruminfo['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $foruminfo['name']);
  80  
  81  $forumpermissions = forum_permissions();
  82  $fpermissions = $forumpermissions[$fid];
  83  
  84  if($fpermissions['canview'] != 1)
  85  {
  86      error_no_permission();
  87  }
  88  
  89  if($mybb->user['uid'] == 0)
  90  {
  91      // Cookie'd forum read time
  92      $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
  93  
  94       if(is_array($forumsread) && empty($forumsread))
  95       {
  96           if($mybb->cookies['mybb']['readallforums'])
  97          {
  98              $forumsread[$fid] = $mybb->cookies['mybb']['lastvisit'];
  99          }
 100          else
 101          {
 102               $forumsread = array();
 103          }
 104       }
 105  
 106      $query = $db->simple_select("forums", "*", "active != 0", array("order_by" => "pid, disporder"));
 107  }
 108  else
 109  {
 110      // Build a forum cache from the database
 111      $query = $db->query("
 112          SELECT f.*, fr.dateline AS lastread
 113          FROM ".TABLE_PREFIX."forums f
 114          LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')
 115          WHERE f.active != 0
 116          ORDER BY pid, disporder
 117      ");
 118  }
 119  
 120  while($forum = $db->fetch_array($query))
 121  {
 122      if($mybb->user['uid'] == 0 && $forumsread[$forum['fid']])
 123      {
 124          $forum['lastread'] = $forumsread[$forum['fid']];
 125      }
 126  
 127      $fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
 128  }
 129  
 130  // Get the forum moderators if the setting is enabled.
 131  if($mybb->settings['modlist'] != 0)
 132  {
 133      $moderatorcache = $cache->read("moderators");
 134  }
 135  
 136  $bgcolor = "trow1";
 137  if($mybb->settings['subforumsindex'] != 0)
 138  {
 139      $showdepth = 3;
 140  }
 141  else
 142  {
 143      $showdepth = 2;
 144  }
 145  
 146  $subforums = '';
 147  $child_forums = build_forumbits($fid, 2);
 148  $forums = $child_forums['forum_list'];
 149  
 150  if($forums)
 151  {
 152      $lang->sub_forums_in = $lang->sprintf($lang->sub_forums_in, $foruminfo['name']);
 153      eval("\$subforums = \"".$templates->get("forumdisplay_subforums")."\";");
 154  }
 155  
 156  $excols = "forumdisplay";
 157  
 158  // Password protected forums
 159  check_forum_password($foruminfo['fid']);
 160  
 161  if($foruminfo['linkto'])
 162  {
 163      header("Location: {$foruminfo['linkto']}");
 164      exit;
 165  }
 166  
 167  // Make forum jump...
 168  if($mybb->settings['enableforumjump'] != 0)
 169  {
 170      $forumjump = build_forum_jump("", $fid, 1);
 171  }
 172  
 173  if($foruminfo['type'] == "f" && $foruminfo['open'] != 0)
 174  {
 175      eval("\$newthread = \"".$templates->get("forumdisplay_newthread")."\";");
 176  }
 177  
 178  if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f")
 179  {
 180      eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";");
 181  }
 182  
 183  // Gather forum stats
 184  $has_announcements = $has_modtools = false;
 185  $forum_stats = $cache->read("forumsdisplay");
 186  
 187  if(is_array($forum_stats))
 188  {
 189      if(!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$fid]['modtools']))
 190      {
 191          // Mod tools are specific to forums, not parents
 192          $has_modtools = true;
 193      }
 194  
 195      if(!empty($forum_stats[-1]['announcements']) || !empty($forum_stats[$fid]['announcements']))
 196      {
 197          // Global or forum-specific announcements
 198          $has_announcements = true;
 199      }
 200  }
 201  
 202  $done_moderators = array(
 203      "users" => array(),
 204      "groups" => array()
 205  );
 206  
 207  $moderators = '';
 208  $parentlistexploded = explode(",", $parentlist);
 209  
 210  foreach($parentlistexploded as $mfid)
 211  {
 212      // This forum has moderators
 213      if(is_array($moderatorcache[$mfid]))
 214      {
 215          // Fetch each moderator from the cache and format it, appending it to the list
 216          foreach($moderatorcache[$mfid] as $modtype)
 217          {
 218              foreach($modtype as $moderator)
 219              {
 220                  if($moderator['isgroup'])
 221                  {
 222                      if(in_array($moderator['id'], $done_moderators['groups']))
 223                      {
 224                          continue;
 225                      }
 226                      $moderators .= $comma.htmlspecialchars_uni($moderator['title']);
 227                      $done_moderators['groups'][] = $moderator['id'];
 228                  }
 229                  else
 230                  {
 231                      if(in_array($moderator['id'], $done_moderators['users']))
 232                      {
 233                          continue;
 234                      }
 235                      $moderators .= "{$comma}<a href=\"".get_profile_link($moderator['id'])."\">".format_name(htmlspecialchars_uni($moderator['username']), $moderator['usergroup'], $moderator['displaygroup'])."</a>";
 236                      $done_moderators['users'][] = $moderator['id'];
 237                  }
 238                  $comma = $lang->comma;
 239              }
 240          }
 241      }
 242  
 243      if(!empty($forum_stats[$mfid]['announcements']))
 244      {
 245          $has_announcements = true;
 246      }
 247  }
 248  $comma = '';
 249  
 250  // If we have a moderators list, load the template
 251  if($moderators)
 252  {
 253      eval("\$moderatedby = \"".$templates->get("forumdisplay_moderatedby")."\";");
 254  }
 255  else
 256  {
 257      $moderatedby = '';
 258  }
 259  
 260  // Get the users browsing this forum.
 261  if($mybb->settings['browsingthisforum'] != 0)
 262  {
 263      $timecut = TIME_NOW - $mybb->settings['wolcutoff'];
 264  
 265      $comma = '';
 266      $guestcount = 0;
 267      $membercount = 0;
 268      $inviscount = 0;
 269      $onlinemembers = '';
 270      $doneusers = array();
 271  
 272      $query = $db->query("
 273          SELECT s.ip, s.uid, u.username, s.time, u.invisible, u.usergroup, u.usergroup, u.displaygroup
 274          FROM ".TABLE_PREFIX."sessions s
 275          LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
 276          WHERE s.time > '$timecut' AND location1='$fid' AND nopermission != 1
 277          ORDER BY u.username ASC, s.time DESC
 278      ");
 279  
 280      while($user = $db->fetch_array($query))
 281      {
 282          if($user['uid'] == 0)
 283          {
 284              ++$guestcount;
 285          }
 286          else
 287          {
 288              if(empty($doneusers[$user['uid']]) || $doneusers[$user['uid']] < $user['time'])
 289              {
 290                  $doneusers[$user['uid']] = $user['time'];
 291                  ++$membercount;
 292                  if($user['invisible'] == 1)
 293                  {
 294                      $invisiblemark = "*";
 295                      ++$inviscount;
 296                  }
 297                  else
 298                  {
 299                      $invisiblemark = '';
 300                  }
 301  
 302                  if($user['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])
 303                  {
 304                      $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
 305                      $user['profilelink'] = build_profile_link($user['username'], $user['uid']);
 306                      eval("\$onlinemembers .= \"".$templates->get("forumdisplay_usersbrowsing_user", 1, 0)."\";");
 307                      $comma = $lang->comma;
 308                  }
 309              }
 310          }
 311      }
 312  
 313      $guestsonline = '';
 314      if($guestcount)
 315      {
 316          $guestsonline = $lang->sprintf($lang->users_browsing_forum_guests, $guestcount);
 317      }
 318  
 319      $onlinesep = '';
 320      if($guestcount && $onlinemembers)
 321      {
 322          $onlinesep = $lang->comma;
 323      }
 324  
 325      $invisonline = '';
 326      if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1))
 327      {
 328          $invisonline = $lang->sprintf($lang->users_browsing_forum_invis, $inviscount);
 329      }
 330  
 331      $onlinesep2 = '';
 332      if($invisonline != '' && $guestcount)
 333      {
 334          $onlinesep2 = $lang->comma;
 335      }
 336      eval("\$usersbrowsing = \"".$templates->get("forumdisplay_usersbrowsing")."\";");
 337  }
 338  
 339  // Do we have any forum rules to show for this forum?
 340  $forumrules = '';
 341  if($foruminfo['rulestype'] != 0 && $foruminfo['rules'])
 342  {
 343      if(!$foruminfo['rulestitle'])
 344      {
 345          $foruminfo['rulestitle'] = $lang->sprintf($lang->forum_rules, $foruminfo['name']);
 346      }
 347  
 348      $rules_parser = array(
 349          "allow_html" => 1,
 350          "allow_mycode" => 1,
 351          "allow_smilies" => 1,
 352          "allow_imgcode" => 1
 353      );
 354  
 355      $foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser);
 356      if($foruminfo['rulestype'] == 1 || $foruminfo['rulestype'] == 3)
 357      {
 358          eval("\$rules = \"".$templates->get("forumdisplay_rules")."\";");
 359      }
 360      else if($foruminfo['rulestype'] == 2)
 361      {
 362          eval("\$rules = \"".$templates->get("forumdisplay_rules_link")."\";");
 363      }
 364  }
 365  
 366  $bgcolor = "trow1";
 367  
 368  // Set here to fetch only approved topics (and then below for a moderator we change this).
 369  $visibleonly = "AND visible='1'";
 370  $tvisibleonly = "AND t.visible='1'";
 371  
 372  // Check if the active user is a moderator and get the inline moderation tools.
 373  if(is_moderator($fid))
 374  {
 375      eval("\$inlinemodcol = \"".$templates->get("forumdisplay_inlinemoderation_col")."\";");
 376      $ismod = true;
 377      $inlinecount = "0";
 378      $inlinecookie = "inlinemod_forum".$fid;
 379      $visibleonly = " AND (visible='1' OR visible='0')";
 380      $tvisibleonly = " AND (t.visible='1' OR t.visible='0')";
 381  }
 382  else
 383  {
 384      $inlinemod = '';
 385      $ismod = false;
 386  }
 387  
 388  if(is_moderator($fid, "caneditposts") || $fpermissions['caneditposts'] == 1)
 389  {
 390      $can_edit_titles = 1;
 391  }
 392  else
 393  {
 394      $can_edit_titles = 0;
 395  }
 396  
 397  unset($rating);
 398  
 399  // Pick out some sorting options.
 400  // First, the date cut for the threads.
 401  $datecut = 0;
 402  if(empty($mybb->input['datecut']))
 403  {
 404      // If the user manually set a date cut, use it.
 405      if($mybb->user['daysprune'])
 406      {
 407          $datecut = $mybb->user['daysprune'];
 408      }
 409      else
 410      {
 411          // If the forum has a non-default date cut, use it.
 412          if(!empty($foruminfo['defaultdatecut']))
 413          {
 414              $datecut = $foruminfo['defaultdatecut'];
 415          }
 416      }
 417  }
 418  // If there was a manual date cut override, use it.
 419  else
 420  {
 421      $datecut = intval($mybb->input['datecut']);
 422  }
 423  
 424  $datecut = intval($datecut);
 425  $datecutsel[$datecut] = "selected=\"selected\"";
 426  if($datecut > 0 && $datecut != 9999)
 427  {
 428      $checkdate = TIME_NOW - ($datecut * 86400);
 429      $datecutsql = "AND (lastpost >= '$checkdate' OR sticky = '1')";
 430      $datecutsql2 = "AND (t.lastpost >= '$checkdate' OR t.sticky = '1')";
 431  }
 432  else
 433  {
 434      $datecutsql = '';
 435      $datecutsql2 = '';
 436  }
 437  
 438  // Pick the sort order.
 439  if(!isset($mybb->input['order']) && !empty($foruminfo['defaultsortorder']))
 440  {
 441      $mybb->input['order'] = $foruminfo['defaultsortorder'];
 442  }
 443  
 444  if(!empty($mybb->input['order']))
 445  {
 446      $mybb->input['order'] = htmlspecialchars_uni($mybb->input['order']);
 447  }
 448  else
 449  {
 450      $mybb->input['order'] = '';
 451  }
 452  
 453  switch(my_strtolower($mybb->input['order']))
 454  {
 455      case "asc":
 456          $sortordernow = "asc";
 457          $ordersel['asc'] = "selected=\"selected\"";
 458          $oppsort = $lang->desc;
 459          $oppsortnext = "desc";
 460          break;
 461      default:
 462          $sortordernow = "desc";
 463          $ordersel['desc'] = "selected=\"selected\"";
 464          $oppsort = $lang->asc;
 465          $oppsortnext = "asc";
 466          break;
 467  }
 468  
 469  // Sort by which field?
 470  if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby']))
 471  {
 472      $mybb->input['sortby'] = $foruminfo['defaultsortby'];
 473  }
 474  
 475  $t = "t.";
 476  $sortfield2 = '';
 477  
 478  if(!empty($mybb->input['sortby']))
 479  {
 480      $sortby = htmlspecialchars_uni($mybb->input['sortby']);
 481  }
 482  else
 483  {
 484      $mybb->input['sortby'] = '';
 485  }
 486  
 487  switch($mybb->input['sortby'])
 488  {
 489      case "subject":
 490          $sortfield = "subject";
 491          break;
 492      case "replies":
 493          $sortfield = "replies";
 494          break;
 495      case "views":
 496          $sortfield = "views";
 497          break;
 498      case "starter":
 499          $sortfield = "username";
 500          break;
 501      case "rating":
 502          $t = "";
 503          $sortfield = "averagerating";
 504          $sortfield2 = ", t.totalratings DESC";
 505          break;
 506      case "started":
 507          $sortfield = "dateline";
 508          break;
 509      default:
 510          $sortby = "lastpost";
 511          $sortfield = "lastpost";
 512          $mybb->input['sortby'] = "lastpost";
 513          break;
 514  }
 515  
 516  $sortsel['rating'] = ''; // Needs to be initialized in order to speed-up things. Fixes #2031
 517  $sortsel[$mybb->input['sortby']] = "selected=\"selected\"";
 518  
 519  // Pick the right string to join the sort URL
 520  if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1))
 521  {
 522      $string = "?";
 523  }
 524  else
 525  {
 526      $string = "&amp;";
 527  }
 528  
 529  // Are we viewing a specific page?
 530  if(isset($mybb->input['page']) && is_numeric($mybb->input['page']))
 531  {
 532      $sorturl = get_forum_link($fid, $mybb->input['page']).$string."datecut=$datecut";
 533  }
 534  else
 535  {
 536      $sorturl = get_forum_link($fid).$string."datecut=$datecut";
 537  }
 538  
 539  // Needs to be initialized in order to speed-up things. Fixes #2031
 540  $orderarrow = array('rating'=>'', 'subject'=>'', 'starter'=>'', 'replies'=>'', 'views'=>'');
 541  eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");
 542  
 543  $threadcount = 0;
 544  $useronly = $tuseronly = "";
 545  if(isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1)
 546  {
 547      $useronly = "AND uid={$mybb->user['uid']}";
 548      $tuseronly = "AND t.uid={$mybb->user['uid']}";
 549  }
 550  
 551  if($fpermissions['canviewthreads'] != 0)
 552  {
 553  
 554      // How many posts are there?
 555      if($datecut > 0 || isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1)
 556      {
 557          $query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $useronly $visibleonly $datecutsql");
 558          $threadcount = $db->fetch_field($query, "threads");
 559      }
 560      else
 561      {
 562          $query = $db->simple_select("forums", "threads, unapprovedthreads", "fid = '{$fid}'", array('limit' => 1));
 563          $forum_threads = $db->fetch_array($query);
 564          $threadcount = $forum_threads['threads'];
 565          if($ismod == true)
 566          {
 567              $threadcount += $forum_threads['unapprovedthreads'];
 568          }
 569  
 570          // If we have 0 threads double check there aren't any "moved" threads
 571          if($threadcount == 0)
 572          {
 573              $query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $useronly $visibleonly", array('limit' => 1));
 574              $threadcount = $db->fetch_field($query, "threads");
 575          }
 576      }
 577  }
 578  
 579  // How many pages are there?
 580  if(!$mybb->settings['threadsperpage'])
 581  {
 582      $mybb->settings['threadsperpage'] = 20;
 583  }
 584  
 585  $perpage = $mybb->settings['threadsperpage'];
 586  
 587  if(isset($mybb->input['page']) && intval($mybb->input['page']) > 0)
 588  {
 589      $page = intval($mybb->input['page']);
 590      $start = ($page-1) * $perpage;
 591      $pages = $threadcount / $perpage;
 592      $pages = ceil($pages);
 593      if($page > $pages || $page <= 0)
 594      {
 595          $start = 0;
 596          $page = 1;
 597      }
 598  }
 599  else
 600  {
 601      $start = 0;
 602      $page = 1;
 603  }
 604  
 605  $end = $start + $perpage;
 606  $lower = $start + 1;
 607  $upper = $end;
 608  
 609  if($upper > $threadcount)
 610  {
 611      $upper = $threadcount;
 612  }
 613  
 614  // Assemble page URL
 615  if($mybb->input['sortby'] || $mybb->input['order'] || $mybb->input['datecut']) // Ugly URL
 616  {
 617      $page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED);
 618  
 619      if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && isset($_SERVER['SEO_SUPPORT']) && $_SERVER['SEO_SUPPORT'] == 1))
 620      {
 621          $q = "?";
 622          $and = '';
 623      }
 624      else
 625      {
 626          $q = '';
 627          $and = "&";
 628      }
 629  
 630      if((!empty($foruminfo['defaultsortby']) && $sortby != $foruminfo['defaultsortby']) || (empty($foruminfo['defaultsortby']) && $sortby != "lastpost"))
 631      {
 632          $page_url .= "{$q}{$and}sortby={$sortby}";
 633          $q = '';
 634          $and = "&";
 635      }
 636  
 637      if($sortordernow != "desc")
 638      {
 639          $page_url .= "{$q}{$and}order={$sortordernow}";
 640          $q = '';
 641          $and = "&";
 642      }
 643  
 644      if($datecut > 0)
 645      {
 646          $page_url .= "{$q}{$and}datecut={$datecut}";
 647      }
 648  }
 649  else
 650  {
 651      $page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED);
 652  }
 653  $multipage = multipage($threadcount, $perpage, $page, $page_url);
 654  
 655  if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
 656  {
 657      $lang->load("ratethread");
 658  
 659      switch($db->type)
 660      {
 661          case "pgsql":
 662              $ratingadd = "CASE WHEN t.numratings=0 THEN 0 ELSE t.totalratings/t.numratings::numeric END AS averagerating, ";
 663              break;
 664          default:
 665              $ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";
 666      }
 667  
 668      $lpbackground = "trow2";
 669      eval("\$ratingcol = \"".$templates->get("forumdisplay_threadlist_rating")."\";");
 670      eval("\$ratingsort = \"".$templates->get("forumdisplay_threadlist_sortrating")."\";");
 671      $colspan = "7";
 672  }
 673  else
 674  {
 675      if($sortfield == "averagerating")
 676      {
 677          $t = "t.";
 678          $sortfield = "lastpost";
 679      }
 680      $ratingadd = '';
 681      $lpbackground = "trow1";
 682      $colspan = "6";
 683  }
 684  
 685  if($ismod)
 686  {
 687      ++$colspan;
 688  }
 689  
 690  // Get Announcements
 691  if($has_announcements == true)
 692  {
 693      $limit = '';
 694      $announcements = '';
 695      if($mybb->settings['announcementlimit'])
 696      {
 697          $limit = "LIMIT 0, ".$mybb->settings['announcementlimit'];
 698      }
 699  
 700      $sql = build_parent_list($fid, "fid", "OR", $parentlist);
 701      $time = TIME_NOW;
 702      $query = $db->query("
 703          SELECT a.*, u.username
 704          FROM ".TABLE_PREFIX."announcements a
 705          LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
 706          WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1')
 707          ORDER BY a.startdate DESC $limit
 708      ");
 709  
 710      // See if this announcement has been read in our announcement array
 711      $cookie = array();
 712      if(isset($mybb->cookies['mybb']['announcements']))
 713      {
 714          $cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
 715      }
 716  
 717      $announcementlist = '';
 718      $bgcolor = alt_trow(true); // Reset the trow colors
 719      while($announcement = $db->fetch_array($query))
 720      {
 721          if($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']])
 722          {
 723              $new_class = ' class="subject_new"';
 724              $folder = "newfolder";
 725          }
 726          else
 727          {
 728              $new_class = ' class="subject_old"';
 729              $folder = "folder";
 730          }
 731  
 732          // Mmm, eat those announcement cookies if they're older than our last visit
 733          if($cookie[$announcement['aid']] < $mybb->user['lastvisit'])
 734          {
 735              unset($cookie[$announcement['aid']]);
 736          }
 737  
 738          $announcement['announcementlink'] = get_announcement_link($announcement['aid']);
 739          $announcement['subject'] = $parser->parse_badwords($announcement['subject']);
 740          $announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
 741          $postdate = my_date($mybb->settings['dateformat'], $announcement['startdate']);
 742          $posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']);
 743          $announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
 744  
 745          if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
 746          {
 747              eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";");
 748              $lpbackground = "trow2";
 749          }
 750          else
 751          {
 752              $rating = '';
 753              $lpbackground = "trow1";
 754          }
 755  
 756          if($ismod)
 757          {
 758              eval("\$modann = \"".$templates->get("forumdisplay_announcements_announcement_modbit")."\";");
 759          }
 760          else
 761          {
 762              $modann = '';
 763          }
 764  
 765          $plugins->run_hooks("forumdisplay_announcement");
 766          eval("\$announcements .= \"".$templates->get("forumdisplay_announcements_announcement")."\";");
 767          $bgcolor = alt_trow();
 768      }
 769  
 770      if($announcements)
 771      {
 772          eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";");
 773          $shownormalsep = true;
 774      }
 775  
 776      if(empty($cookie))
 777      {
 778          // Clean up cookie crumbs
 779          my_setcookie('mybb[announcements]', 0, (TIME_NOW - (60*60*24*365)));
 780      }
 781      else if(!empty($cookie))
 782      {
 783          my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);
 784      }
 785  }
 786  else
 787  {
 788      $announcementlist = '';
 789  }
 790  
 791  $tids = $threadcache = array();
 792  $icon_cache = $cache->read("posticons");
 793  
 794  if($fpermissions['canviewthreads'] != 0)
 795  {
 796      // Start Getting Threads
 797      $query = $db->query("
 798          SELECT t.*, {$ratingadd}t.username AS threadusername, u.username
 799          FROM ".TABLE_PREFIX."threads t
 800          LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
 801          WHERE t.fid='$fid' $tuseronly $tvisibleonly $datecutsql2
 802          ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2
 803          LIMIT $start, $perpage
 804      ");
 805  
 806      $ratings = false;
 807      $moved_threads = array();
 808      while($thread = $db->fetch_array($query))
 809      {
 810          $threadcache[$thread['tid']] = $thread;
 811  
 812          if($thread['numratings'] > 0 && $ratings == false)
 813          {
 814              $ratings = true; // Looks for ratings in the forum
 815          }
 816  
 817          // If this is a moved thread - set the tid for participation marking and thread read marking to that of the moved thread
 818          if(substr($thread['closed'], 0, 5) == "moved")
 819          {
 820              $tid = substr($thread['closed'], 6);
 821              if(!$tids[$tid])
 822              {
 823                  $moved_threads[$tid] = $thread['tid'];
 824                  $tids[$thread['tid']] = $tid;
 825              }
 826          }
 827          // Otherwise - set it to the plain thread ID
 828          else
 829          {
 830              $tids[$thread['tid']] = $thread['tid'];
 831              if(isset($moved_threads[$thread['tid']]))
 832              {
 833                  unset($moved_threads[$thread['tid']]);
 834              }
 835          }
 836      }
 837  
 838      if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $mybb->user['uid'] && !empty($threadcache) && $ratings == true)
 839      {
 840          // Check if we've rated threads on this page
 841          // Guests get the pleasure of not being ID'd, but will be checked when they try and rate
 842          $imp = implode(",", array_keys($threadcache));
 843          $query = $db->simple_select("threadratings", "tid, uid", "tid IN ({$imp}) AND uid = '{$mybb->user['uid']}'");
 844  
 845          while($rating = $db->fetch_array($query))
 846          {
 847              $threadcache[$rating['tid']]['rated'] = 1;
 848          }
 849      }
 850  }
 851  
 852  // If user has moderation tools available, prepare the Select All feature
 853  $num_results = $db->num_rows($query);
 854  if(is_moderator($fid) && $num_results > 0)
 855  {
 856      $lang->page_selected = $lang->sprintf($lang->page_selected, intval($num_results));
 857      $lang->select_all = $lang->sprintf($lang->select_all, intval($threadcount));
 858      $lang->all_selected = $lang->sprintf($lang->all_selected, intval($threadcount));
 859      eval("\$selectall = \"".$templates->get("forumdisplay_inlinemoderation_selectall")."\";");
 860  }
 861  
 862  if(!empty($tids))
 863  {
 864      $tids = implode(",", $tids);
 865  }
 866  
 867  // Check participation by the current user in any of these threads - for 'dot' folder icons
 868  if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && !empty($threadcache))
 869  {
 870      $query = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN ({$tids}) {$visibleonly}");
 871      while($post = $db->fetch_array($query))
 872      {
 873          if(!empty($moved_threads[$post['tid']]))
 874          {
 875              $post['tid'] = $moved_threads[$post['tid']];
 876          }
 877          if($threadcache[$post['tid']])
 878          {
 879              $threadcache[$post['tid']]['doticon'] = 1;
 880          }
 881      }
 882  }
 883  
 884  // Read threads
 885  if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0 && !empty($threadcache))
 886  {
 887      $query = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");
 888      while($readthread = $db->fetch_array($query))
 889      {
 890          if(!empty($moved_threads[$readthread['tid']]))
 891          {
 892               $readthread['tid'] = $moved_threads[$readthread['tid']];
 893           }
 894          if($threadcache[$readthread['tid']])
 895          {
 896               $threadcache[$readthread['tid']]['lastread'] = $readthread['dateline'];
 897          }
 898      }
 899  }
 900  
 901  if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])
 902  {
 903      $query = $db->simple_select("forumsread", "dateline", "fid='{$fid}' AND uid='{$mybb->user['uid']}'");
 904      $forum_read = $db->fetch_field($query, "dateline");
 905  
 906      $read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
 907      if($forum_read == 0 || $forum_read < $read_cutoff)
 908      {
 909          $forum_read = $read_cutoff;
 910      }
 911  }
 912  else
 913  {
 914      $forum_read = my_get_array_cookie("forumread", $fid);
 915  
 916      if($mybb->cookies['mybb']['readallforums'] && !$forum_read)
 917      {
 918          $forum_read = $mybb->cookies['mybb']['lastvisit'];
 919      }
 920  }
 921  
 922  $unreadpost = 0;
 923  $threads = '';
 924  $load_inline_edit_js = 0;
 925  if(!empty($threadcache))
 926  {
 927      if(!$mybb->settings['maxmultipagelinks'])
 928      {
 929          $mybb->settings['maxmultipagelinks'] = 5;
 930      }
 931  
 932      if(!$mybb->settings['postsperpage'])
 933      {
 934          $mybb->settings['postperpage'] = 20;
 935      }
 936  
 937      foreach($threadcache as $thread)
 938      {
 939          $plugins->run_hooks("forumdisplay_thread");
 940  
 941          $moved = explode("|", $thread['closed']);
 942  
 943          if($thread['visible'] == 0)
 944          {
 945              $bgcolor = "trow_shaded";
 946          }
 947          else
 948          {
 949              $bgcolor = alt_trow();
 950          }
 951  
 952          if($thread['sticky'] == 1)
 953          {
 954              $thread_type_class = " forumdisplay_sticky";
 955          }
 956          else
 957          {
 958              $thread_type_class = " forumdisplay_regular";
 959          }
 960  
 961          $folder = '';
 962          $prefix = '';
 963  
 964          $thread['author'] = $thread['uid'];
 965          if(!$thread['username'])
 966          {
 967              $thread['username'] = $thread['threadusername'];
 968              $thread['profilelink'] = $thread['threadusername'];
 969          }
 970          else
 971          {
 972              $thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
 973          }
 974  
 975          // If this thread has a prefix, insert a space between prefix and subject
 976          $thread['threadprefix'] = $threadprefix = '';
 977          if($thread['prefix'] != 0)
 978          {
 979              $threadprefix = build_prefixes($thread['prefix']);
 980              $thread['threadprefix'] = $threadprefix['displaystyle'].'&nbsp;';
 981          }
 982  
 983          $thread['subject'] = $parser->parse_badwords($thread['subject']);
 984          $thread['subject'] = htmlspecialchars_uni($thread['subject']);
 985  
 986          if($thread['icon'] > 0 && $icon_cache[$thread['icon']])
 987          {
 988              $icon = $icon_cache[$thread['icon']];
 989              $icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
 990          }
 991          else
 992          {
 993              $icon = "&nbsp;";
 994          }
 995  
 996          $prefix = '';
 997          if($thread['poll'])
 998          {
 999              $prefix = $lang->poll_prefix;
1000          }
1001  
1002          if($thread['sticky'] == "1" && !$donestickysep)
1003          {
1004              eval("\$threads .= \"".$templates->get("forumdisplay_sticky_sep")."\";");
1005              $shownormalsep = true;
1006              $donestickysep = true;
1007          }
1008          else if($thread['sticky'] == 0 && !empty($shownormalsep))
1009          {
1010              eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";");
1011              $shownormalsep = false;
1012          }
1013  
1014          $rating = '';
1015          if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0)
1016          {
1017              if($moved[0] == "moved")
1018              {
1019                  $rating = "<td class=\"{$bgcolor}\" style=\"text-align: center;\">-</td>";
1020              }
1021              else
1022              {
1023                  $thread['averagerating'] = floatval(round($thread['averagerating'], 2));
1024                  $thread['width'] = intval(round($thread['averagerating']))*20;
1025                  $thread['numratings'] = intval($thread['numratings']);
1026  
1027                  $not_rated = '';
1028                  if(!isset($thread['rated']) || empty($thread['rated']))
1029                  {
1030                      $not_rated = ' star_rating_notrated';
1031                  }
1032  
1033                  $ratingvotesav = $lang->sprintf($lang->rating_votes_average, $thread['numratings'], $thread['averagerating']);
1034                  eval("\$rating = \"".$templates->get("forumdisplay_thread_rating")."\";");
1035              }
1036          }
1037  
1038          $thread['pages'] = 0;
1039          $thread['multipage'] = '';
1040          $threadpages = '';
1041          $morelink = '';
1042          $thread['posts'] = $thread['replies'] + 1;
1043  
1044          if($thread['unapprovedposts'] > 0 && $ismod)
1045          {
1046              $thread['posts'] += $thread['unapprovedposts'];
1047          }
1048  
1049          if($thread['posts'] > $mybb->settings['postsperpage'])
1050          {
1051              $thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
1052              $thread['pages'] = ceil($thread['pages']);
1053  
1054              if($thread['pages'] > $mybb->settings['maxmultipagelinks'])
1055              {
1056                  $pagesstop = $mybb->settings['maxmultipagelinks'] - 1;
1057                  $page_link = get_thread_link($thread['tid'], $thread['pages']);
1058                  eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
1059              }
1060              else
1061              {
1062                  $pagesstop = $thread['pages'];
1063              }
1064  
1065              for($i = 1; $i <= $pagesstop; ++$i)
1066              {
1067                  $page_link = get_thread_link($thread['tid'], $i);
1068                  eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");
1069              }
1070  
1071              eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
1072          }
1073          else
1074          {
1075              $threadpages = '';
1076              $morelink = '';
1077              $thread['multipage'] = '';
1078          }
1079  
1080          if($ismod)
1081          {
1082              if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|"))
1083              {
1084                  $inlinecheck = "checked=\"checked\"";
1085                  ++$inlinecount;
1086              }
1087              else
1088              {
1089                  $inlinecheck = '';
1090              }
1091  
1092              $multitid = $thread['tid'];
1093              eval("\$modbit = \"".$templates->get("forumdisplay_thread_modbit")."\";");
1094          }
1095          else
1096          {
1097              $modbit = '';
1098          }
1099  
1100          if($moved[0] == "moved")
1101          {
1102              $prefix = $lang->moved_prefix;
1103              $thread['tid'] = $moved[1];
1104              $thread['replies'] = "-";
1105              $thread['views'] = "-";
1106          }
1107  
1108          $thread['threadlink'] = get_thread_link($thread['tid']);
1109          $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
1110  
1111          // Determine the folder
1112          $folder = '';
1113          $folder_label = '';
1114  
1115          if($thread['doticon'])
1116          {
1117              $folder = "dot_";
1118              $folder_label .= $lang->icon_dot;
1119          }
1120  
1121          $gotounread = '';
1122          $isnew = 0;
1123          $donenew = 0;
1124  
1125          if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read)
1126          {
1127              if($thread['lastread'])
1128              {
1129                  $last_read = $thread['lastread'];
1130              }
1131              else
1132              {
1133                  $last_read = $read_cutoff;
1134              }
1135          }
1136          else
1137          {
1138              $last_read = my_get_array_cookie("threadread", $thread['tid']);
1139          }
1140  
1141          if($forum_read > $last_read)
1142          {
1143              $last_read = $forum_read;
1144          }
1145  
1146          if($thread['lastpost'] > $last_read && $moved[0] != "moved")
1147          {
1148              $folder .= "new";
1149              $folder_label .= $lang->icon_new;
1150              $new_class = "subject_new";
1151              $thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
1152              eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
1153              $unreadpost = 1;
1154          }
1155          else
1156          {
1157              $folder_label .= $lang->icon_no_new;
1158              $new_class = "subject_old";
1159          }
1160  
1161          if($thread['replies'] >= $mybb->settings['hottopic'] || $thread['views'] >= $mybb->settings['hottopicviews'])
1162          {
1163              $folder .= "hot";
1164              $folder_label .= $lang->icon_hot;
1165          }
1166  
1167          if($thread['closed'] == 1)
1168          {
1169              $folder .= "lock";
1170              $folder_label .= $lang->icon_lock;
1171          }
1172  
1173          if($moved[0] == "moved")
1174          {
1175              $folder = "move";
1176              $gotounread = '';
1177          }
1178  
1179          $folder .= "folder";
1180  
1181          $inline_edit_tid = $thread['tid'];
1182  
1183          // If this user is the author of the thread and it is not closed or they are a moderator, they can edit
1184          if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $can_edit_titles == 1) || $ismod == true)
1185          {
1186              $inline_edit_class = "subject_editable";
1187          }
1188          else
1189          {
1190              $inline_edit_class = "";
1191          }
1192          $load_inline_edit_js = 1;
1193  
1194          $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
1195          $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
1196          $lastposter = $thread['lastposter'];
1197          $lastposteruid = $thread['lastposteruid'];
1198  
1199          // Don't link to guest's profiles (they have no profile).
1200          if($lastposteruid == 0)
1201          {
1202              $lastposterlink = $lastposter;
1203          }
1204          else
1205          {
1206              $lastposterlink = build_profile_link($lastposter, $lastposteruid);
1207          }
1208  
1209          $thread['replies'] = my_number_format($thread['replies']);
1210          $thread['views'] = my_number_format($thread['views']);
1211  
1212          // Threads and posts requiring moderation
1213          if($thread['unapprovedposts'] > 0 && $ismod)
1214          {
1215              if($thread['unapprovedposts'] > 1)
1216              {
1217                  $unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_posts_count, $thread['unapprovedposts']);
1218              }
1219              else
1220              {
1221                  $unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_post_count, 1);
1222              }
1223  
1224              $unapproved_posts = " <span title=\"{$unapproved_posts_count}\">(".my_number_format($thread['unapprovedposts']).")</span>";
1225          }
1226          else
1227          {
1228              $unapproved_posts = '';
1229          }
1230  
1231          // If this thread has 1 or more attachments show the papperclip
1232          if($thread['attachmentcount'] > 0)
1233          {
1234              if($thread['attachmentcount'] > 1)
1235              {
1236                  $attachment_count = $lang->sprintf($lang->attachment_count_multiple, $thread['attachmentcount']);
1237              }
1238              else
1239              {
1240                  $attachment_count = $lang->attachment_count;
1241              }
1242  
1243              eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");
1244          }
1245          else
1246          {
1247              $attachment_count = '';
1248          }
1249  
1250          eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");
1251      }
1252  
1253      $customthreadtools = '';
1254      if($ismod)
1255      {
1256          if(is_moderator($fid, "canusecustomtools") && $has_modtools == true)
1257          {
1258              switch($db->type)
1259              {
1260                  case "pgsql":
1261                  case "sqlite":
1262                      $query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");
1263                      break;
1264                  default:
1265                      $query = $db->simple_select("modtools", 'tid, name', "(CONCAT(',',forums,',') LIKE '%,$fid,%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='') AND type = 't'");
1266              }
1267  
1268              while($tool = $db->fetch_array($query))
1269              {
1270                  eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");
1271              }
1272  
1273              if($customthreadtools)
1274              {
1275                  eval("\$customthreadtools = \"".$templates->get("forumdisplay_inlinemoderation_custom")."\";");
1276              }
1277          }
1278  
1279          eval("\$inlinemod = \"".$templates->get("forumdisplay_inlinemoderation")."\";");
1280      }
1281  }
1282  
1283  // If there are no unread threads in this forum and no unread child forums - mark it as read
1284  require_once  MYBB_ROOT."inc/functions_indicators.php";
1285  
1286  $unread_threads = fetch_unread_count($fid);
1287  if($unread_threads !== false && $unread_threads == 0 && empty($unread_forums))
1288  {
1289      mark_forum_read($fid);
1290  }
1291  
1292  // Subscription status
1293  $add_remove_subscription = 'add';
1294  $add_remove_subscription_text = $lang->subscribe_forum;
1295  
1296  if($mybb->user['uid'])
1297  {
1298      $query = $db->simple_select("forumsubscriptions", "fid", "fid='".$fid."' AND uid='{$mybb->user['uid']}'", array('limit' => 1));
1299  
1300      if($db->fetch_field($query, 'fid'))
1301      {
1302          $add_remove_subscription = 'remove';
1303          $add_remove_subscription_text = $lang->unsubscribe_forum;
1304      }
1305  }
1306  
1307  // Is this a real forum with threads?
1308  if($foruminfo['type'] != "c")
1309  {
1310      if(!$threadcount)
1311      {
1312          eval("\$threads = \"".$templates->get("forumdisplay_nothreads")."\";");
1313      }
1314  
1315      $clearstoredpass = '';
1316      if($foruminfo['password'] != '')
1317      {
1318          eval("\$clearstoredpass = \"".$templates->get("forumdisplay_threadlist_clearpass")."\";");
1319      }
1320  
1321      if($load_inline_edit_js == 1)
1322      {
1323          eval("\$inline_edit_js = \"".$templates->get("forumdisplay_threadlist_inlineedit_js")."\";");
1324      }
1325  
1326      $post_code_string = '';
1327      if($mybb->user['uid'])
1328      {
1329          $post_code_string = "&amp;my_post_key=".$mybb->post_code;
1330      }
1331  
1332      $lang->rss_discovery_forum = $lang->sprintf($lang->rss_discovery_forum, htmlspecialchars_uni(strip_tags($foruminfo['name'])));
1333      eval("\$rssdiscovery = \"".$templates->get("forumdisplay_rssdiscovery")."\";");
1334      eval("\$threadslist = \"".$templates->get("forumdisplay_threadlist")."\";");
1335  }
1336  else
1337  {
1338      $rssdiscovery = '';
1339      $threadslist = '';
1340  
1341      if(empty($forums))
1342      {
1343          error($lang->error_containsnoforums);
1344      }
1345  }
1346  
1347  $plugins->run_hooks("forumdisplay_end");
1348  
1349  $foruminfo['name'] = strip_tags($foruminfo['name']);
1350  
1351  eval("\$forums = \"".$templates->get("forumdisplay")."\";");
1352  output_page($forums);
1353  ?>

title

Description

title

Description

title

Description

title

title

Body