[ Index ]

PHP Cross Reference of MyBB 1.6.5

title

Body

[close]

/ -> portal.php (source)

   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: portal.php 5297 2010-12-28 22:01:14Z Tomm $
  10   */
  11  
  12  define("IN_MYBB", 1);
  13  define("IN_PORTAL", 1);
  14  define('THIS_SCRIPT', 'portal.php');
  15  
  16  // set the path to your forums directory here (without trailing slash)
  17  $forumdir = "./";
  18  
  19  // end editing
  20  
  21  $change_dir = "./";
  22  
  23  if(!@chdir($forumdir) && !empty($forumdir))
  24  {
  25      if(@is_dir($forumdir))
  26      {
  27          $change_dir = $forumdir;
  28      }
  29      else
  30      {
  31          die("\$forumdir is invalid!");
  32      }
  33  }
  34  
  35  $templatelist = "portal_welcome,portal_welcome_membertext,portal_stats,portal_search,portal_whosonline_memberbit,portal_whosonline,portal_latestthreads_thread_lastpost,portal_latestthreads_thread,portal_latestthreads,portal_announcement_numcomments_no,portal_announcement,portal_announcement_numcomments,portal_pms,portal";
  36  
  37  require_once $change_dir."/global.php";
  38  require_once  MYBB_ROOT."inc/functions_post.php";
  39  require_once  MYBB_ROOT."inc/functions_user.php";
  40  require_once  MYBB_ROOT."inc/class_parser.php";
  41  $parser = new postParser;
  42  
  43  // Load global language phrases
  44  $lang->load("portal");
  45  
  46  // Fetch the current URL
  47  $portal_url = get_current_location();
  48  
  49  add_breadcrumb($lang->nav_portal, "portal.php");
  50  
  51  // This allows users to login if the portal is stored offsite or in a different directory
  52  if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")
  53  {
  54      $plugins->run_hooks("portal_do_login_start");
  55  
  56      // Checks to make sure the user can login; they haven't had too many tries at logging in.
  57      // Is a fatal call if user has had too many tries
  58      $logins = login_attempt_check();
  59      $login_text = '';
  60  
  61      if(!username_exists($mybb->input['username']))
  62      {
  63          error($lang->error_invalidpworusername.$login_text);
  64      }
  65      $user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
  66      if(!$user['uid'])
  67      {
  68          my_setcookie('loginattempts', $logins + 1);
  69          $db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);
  70          if($mybb->settings['failedlogintext'] == 1)
  71          {
  72              $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
  73          }
  74          error($lang->error_invalidpassword.$login_text);
  75      }
  76  
  77      my_setcookie('loginattempts', 1);
  78      $db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
  79      $newsession = array(
  80          "uid" => $user['uid'],
  81      );
  82      $db->update_query("sessions", $newsession, "sid='".$session->sid."'");
  83      
  84      $db->update_query("users", array("loginattempts" => 1), "uid='{$mybb->user['uid']}'");
  85  
  86      my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], ($mybb->input['remember'] == "yes" ? null : 0), true);
  87      my_setcookie("sid", $session->sid, -1, true);
  88  
  89      if(function_exists("loggedIn"))
  90      {
  91          loggedIn($user['uid']);
  92      }
  93  
  94      $plugins->run_hooks("portal_do_login_end");
  95  
  96      redirect("portal.php", $lang->redirect_loggedin);
  97  }
  98  
  99  $plugins->run_hooks("portal_start");
 100  
 101  
 102  // get forums user cannot view
 103  $unviewable = get_unviewable_forums(true);
 104  if($unviewable)
 105  {
 106      $unviewwhere = " AND fid NOT IN ($unviewable)";
 107  }
 108  // If user is known, welcome them
 109  if($mybb->settings['portal_showwelcome'] != 0)
 110  {
 111      if($mybb->user['uid'] != 0)
 112      {
 113          // Get number of new posts, threads, announcements
 114          $query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
 115          $newposts = $db->fetch_field($query, "newposts");
 116          if($newposts)
 117          { 
 118              // If there aren't any new posts, there is no point in wasting two more queries
 119              $query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
 120              $newthreads = $db->fetch_field($query, "newthreads");
 121  
 122              $announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
 123              if(is_array($announcementsfids))
 124              {
 125                  foreach($announcementsfids as $fid)
 126                  {
 127                      $fid_array[] = intval($fid);    
 128                  }
 129                  
 130                  $announcementsfids = implode(',', $fid_array);
 131                  $query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") $unviewwhere");
 132                  $newann = $db->fetch_field($query, "newann");
 133              }
 134  
 135              if(!$newthreads)
 136              {
 137                  $newthreads = 0;
 138              }
 139  
 140              if(!$newann)
 141              {
 142                  $newann = 0;
 143              }
 144          }
 145          else
 146          {
 147              $newposts = 0;
 148              $newthreads = 0;
 149              $newann = 0;
 150          }
 151  
 152          // Make the text
 153          if($newann == 1)
 154          {
 155              $lang->new_announcements = $lang->new_announcement;
 156          }
 157          else
 158          {
 159              $lang->new_announcements = $lang->sprintf($lang->new_announcements, $newann);
 160          }
 161          if($newthreads == 1)
 162          {
 163              $lang->new_threads = $lang->new_thread;
 164          }
 165          else
 166          {
 167              $lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
 168          }
 169          if($newposts == 1)
 170          {
 171              $lang->new_posts = $lang->new_post;
 172          }
 173          else
 174          {
 175              $lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
 176          }
 177          eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");
 178  
 179      }
 180      else
 181      {
 182          $lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');
 183          $mybb->user['username'] = $lang->guest;
 184          eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";");
 185      }
 186      $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
 187      eval("\$welcome = \"".$templates->get("portal_welcome")."\";");
 188      if($mybb->user['uid'] == 0)
 189      {
 190          $mybb->user['username'] = "";
 191      }
 192  }
 193  // Private messages box
 194  if($mybb->settings['portal_showpms'] != 0)
 195  {
 196      if($mybb->user['uid'] != 0 && $mybb->user['receivepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->settings['enablepms'] != 0)
 197      {
 198          switch($db->type)
 199          {
 200              case "sqlite":
 201              case "pgsql":
 202                  $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total", "uid='".$mybb->user['uid']."'");
 203                  $messages['pms_total'] = $db->fetch_field($query, "pms_total");
 204                  
 205                  $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='".$mybb->user['uid']."' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END");
 206                  $messages['pms_unread'] = $db->fetch_field($query, "pms_unread");
 207                  break;
 208              default:
 209                  $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='".$mybb->user['uid']."'");
 210                  $messages = $db->fetch_array($query);
 211          }
 212          
 213          // the SUM() thing returns "" instead of 0
 214          if($messages['pms_unread'] == "")
 215          {
 216              $messages['pms_unread'] = 0;
 217          }
 218          $lang->pms_received_new = $lang->sprintf($lang->pms_received_new, $mybb->user['username'], $messages['pms_unread']);
 219          eval("\$pms = \"".$templates->get("portal_pms")."\";");
 220      }
 221  }
 222  // Get Forum Statistics
 223  if($mybb->settings['portal_showstats'] != 0)
 224  {
 225      $stats = $cache->read("stats");
 226      $stats['numthreads'] = my_number_format($stats['numthreads']);
 227      $stats['numposts'] = my_number_format($stats['numposts']);
 228      $stats['numusers'] = my_number_format($stats['numusers']);
 229      if(!$stats['lastusername'])
 230      {
 231          $newestmember = "<strong>" . $lang->no_one . "</strong>";
 232      }
 233      else
 234      {
 235          $newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
 236      }
 237      eval("\$stats = \"".$templates->get("portal_stats")."\";");
 238  }
 239  
 240  // Search box
 241  if($mybb->settings['portal_showsearch'] != 0)
 242  {
 243      eval("\$search = \"".$templates->get("portal_search")."\";");
 244  }
 245  
 246  // Get the online users
 247  if($mybb->settings['portal_showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0)
 248  {
 249      $timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
 250      $comma = '';
 251      $guestcount = 0;
 252      $membercount = 0;
 253      $onlinemembers = '';
 254      $query = $db->query("
 255          SELECT s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup
 256          FROM ".TABLE_PREFIX."sessions s
 257          LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
 258          WHERE s.time>'$timesearch'
 259          ORDER BY u.username ASC, s.time DESC
 260      ");
 261      while($user = $db->fetch_array($query))
 262      {
 263      
 264          // Create a key to test if this user is a search bot.
 265          $botkey = my_strtolower(str_replace("bot=", '', $user['sid']));
 266          
 267          if($user['uid'] == "0")
 268          {
 269              ++$guestcount;
 270          }
 271          elseif(my_strpos($user['sid'], "bot=") !== false && $session->bots[$botkey])
 272          {
 273              // The user is a search bot.
 274              $onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup);
 275              $comma = $lang->comma;
 276              ++$botcount;
 277          }
 278          else
 279          {
 280              if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
 281              {
 282                  ++$membercount;
 283                  
 284                  $doneusers[$user['uid']] = $user['time'];
 285                  
 286                  // If the user is logged in anonymously, update the count for that.
 287                  if($user['invisible'] == 1)
 288                  {
 289                      ++$anoncount;
 290                  }
 291                  
 292                  if($user['invisible'] == 1)
 293                  {
 294                      $invisiblemark = "*";
 295                  }
 296                  else
 297                  {
 298                      $invisiblemark = '';
 299                  }
 300                  
 301                  if(($user['invisible'] == 1 && ($mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])) || $user['invisible'] != 1)
 302                  {
 303                      $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
 304                      $user['profilelink'] = get_profile_link($user['uid']);
 305                      eval("\$onlinemembers .= \"".$templates->get("portal_whosonline_memberbit", 1, 0)."\";");
 306                      $comma = $lang->comma;
 307                  }
 308              }
 309          }
 310      }
 311      
 312      $onlinecount = $membercount + $guestcount + $botcount;
 313      
 314      // If we can see invisible users add them to the count
 315      if($mybb->usergroup['canviewwolinvis'] == 1)
 316      {
 317          $onlinecount += $anoncount;
 318      }
 319      
 320      // If we can't see invisible users but the user is an invisible user incriment the count by one
 321      if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1)
 322      {
 323          ++$onlinecount;
 324      }
 325  
 326      // Most users online
 327      $mostonline = $cache->read("mostonline");
 328      if($onlinecount > $mostonline['numusers'])
 329      {
 330          $time = TIME_NOW;
 331          $mostonline['numusers'] = $onlinecount;
 332          $mostonline['time'] = $time;
 333          $cache->update("mostonline", $mostonline);
 334      }
 335      $recordcount = $mostonline['numusers'];
 336      $recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']);
 337      $recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
 338  
 339      if($onlinecount == 1)
 340      {
 341        $lang->online_users = $lang->online_user;
 342      }
 343      else
 344      {
 345        $lang->online_users = $lang->sprintf($lang->online_users, $onlinecount);
 346      }
 347      $lang->online_counts = $lang->sprintf($lang->online_counts, $membercount, $guestcount);
 348      eval("\$whosonline = \"".$templates->get("portal_whosonline")."\";");
 349  }
 350  
 351  // Latest forum discussions
 352  if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])
 353  {
 354      $altbg = alt_trow();
 355      $threadlist = '';
 356      $query = $db->query("
 357          SELECT t.*, u.username
 358          FROM ".TABLE_PREFIX."threads t
 359          LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
 360          WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
 361          ORDER BY t.lastpost DESC 
 362          LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
 363      );
 364      while($thread = $db->fetch_array($query))
 365      {
 366          $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
 367          $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
 368          // Don't link to guest's profiles (they have no profile).
 369          if($thread['lastposteruid'] == 0)
 370          {
 371              $lastposterlink = $thread['lastposter'];
 372          }
 373          else
 374          {
 375              $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
 376          }
 377          if(my_strlen($thread['subject']) > 25)
 378          {
 379              $thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
 380          }
 381          $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
 382          $thread['threadlink'] = get_thread_link($thread['tid']);
 383          $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
 384          eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
 385          $altbg = alt_trow();
 386      }
 387      if($threadlist)
 388      { 
 389          // Show the table only if there are threads
 390          eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
 391      }
 392  }
 393  
 394  // Get latest news announcements
 395  // First validate announcement fids:
 396  $announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
 397  if(is_array($announcementsfids))
 398  {
 399      foreach($announcementsfids as $fid)
 400      {
 401          $fid_array[] = intval($fid);
 402      }
 403      $announcementsfids = implode(',', $fid_array);
 404  }
 405  // And get them!
 406  $query = $db->simple_select("forums", "*", "fid IN (".$announcementsfids.")");
 407  while($forumrow = $db->fetch_array($query))
 408  {
 409      $forum[$forumrow['fid']] = $forumrow;
 410  }
 411  
 412  $numannouncements = intval($mybb->settings['portal_numannouncements']);
 413  if(!$numannouncements)
 414  {
 415      $numannouncements = 10; // Default back to 10
 416  }
 417  
 418  $pids = '';
 419  $tids = '';
 420  $comma = '';
 421  $query = $db->query("
 422      SELECT p.pid, p.message, p.tid, p.smilieoff
 423      FROM ".TABLE_PREFIX."posts p
 424      LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
 425      WHERE t.fid IN (".$announcementsfids.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
 426      ORDER BY t.dateline DESC 
 427      LIMIT 0, {$numannouncements}"
 428  );
 429  while($getid = $db->fetch_array($query))
 430  {
 431      $pids .= ",'{$getid['pid']}'";
 432      $tids .= ",'{$getid['tid']}'";
 433      $posts[$getid['tid']] = $getid;
 434  }
 435  $pids = "pid IN(0{$pids})";
 436  // Now lets fetch all of the attachments for these posts
 437  $query = $db->simple_select("attachments", "*", $pids);
 438  while($attachment = $db->fetch_array($query))
 439  {
 440      $attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
 441  }
 442  
 443  if(is_array($forum))
 444  {
 445      foreach($forum as $fid => $forumrow)
 446      {
 447          $forumpermissions[$fid] = forum_permissions($fid);
 448      }
 449  }
 450  
 451  $icon_cache = $cache->read("posticons");
 452  
 453  $announcements = '';
 454  $query = $db->query("
 455      SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
 456      FROM ".TABLE_PREFIX."threads t
 457      LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
 458      WHERE t.fid IN (".$announcementsfids.") AND t.tid IN (0{$tids}) AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
 459      ORDER BY t.dateline DESC
 460      LIMIT 0, {$numannouncements}"
 461  );
 462  while($announcement = $db->fetch_array($query))
 463  {
 464      // Make sure we can view this announcement
 465      if($forumpermissions[$announcement['fid']]['canview'] == 0 || $forumpermissions[$announcement['fid']]['canviewthreads'] == 0 || $forumpermissions[$announcement['fid']]['canonlyviewownthreads'] == 1 && $announcement['uid'] != $mybb->user['uid'])
 466      {
 467          continue;
 468      }
 469  
 470      $announcement['message'] = $posts[$announcement['tid']]['message'];
 471      $announcement['pid'] = $posts[$announcement['tid']]['pid'];
 472      $announcement['smilieoff'] = $posts[$announcement['tid']]['smilieoff'];
 473      $announcement['threadlink'] = get_thread_link($announcement['tid']);
 474      
 475      if($announcement['uid'] == 0)
 476      {
 477          $profilelink = htmlspecialchars_uni($announcement['threadusername']);
 478      }
 479      else
 480      {
 481          $profilelink = build_profile_link($announcement['username'], $announcement['uid']);
 482      }
 483      
 484      if(!$announcement['username'])
 485      {
 486          $announcement['username'] = $announcement['threadusername'];
 487      }
 488      $announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject']));
 489      if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
 490      {
 491          $icon = $icon_cache[$announcement['icon']];
 492          $icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
 493      }
 494      else
 495      {
 496          $icon = "&nbsp;";
 497      }
 498      if($announcement['avatar'] != '')
 499      {
 500          $avatar_dimensions = explode("|", $announcement['avatardimensions']);
 501          if($avatar_dimensions[0] && $avatar_dimensions[1])
 502          {
 503              $avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
 504          }
 505          if (!stristr($announcement['avatar'], 'http://'))
 506          {
 507              $announcement['avatar'] = $mybb->settings['bburl'] . '/' . $announcement['avatar'];
 508          }        
 509          $avatar = "<td class=\"trow1\" width=\"1\" align=\"center\" valign=\"top\"><img src=\"{$announcement['avatar']}\" alt=\"\" {$avatar_width_height} /></td>";
 510      }
 511      else
 512      {
 513          $avatar = '';
 514      }
 515      $anndate = my_date($mybb->settings['dateformat'], $announcement['dateline']);
 516      $anntime = my_date($mybb->settings['timeformat'], $announcement['dateline']);
 517  
 518      if($announcement['replies'])
 519      {
 520          eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments")."\";");
 521      }
 522      else
 523      {
 524          eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments_no")."\";");
 525          $lastcomment = '';
 526      }
 527      
 528      $plugins->run_hooks("portal_announcement");
 529  
 530      $parser_options = array(
 531          "allow_html" => $forum[$announcement['fid']]['allowhtml'],
 532          "allow_mycode" => $forum[$announcement['fid']]['allowmycode'],
 533          "allow_smilies" => $forum[$announcement['fid']]['allowsmilies'],
 534          "allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'],
 535          "allow_videocode" => $forum[$announcement['fid']]['allowvideocode'],
 536          "filter_badwords" => 1
 537      );
 538      if($announcement['smilieoff'] == 1)
 539      {
 540          $parser_options['allow_smilies'] = 0;
 541      }
 542  
 543      $message = $parser->parse_message($announcement['message'], $parser_options);
 544      
 545      if(is_array($attachcache[$announcement['pid']]))
 546      { // This post has 1 or more attachments
 547          $validationcount = 0;
 548          $id = $announcement['pid'];
 549          foreach($attachcache[$id] as $aid => $attachment)
 550          {
 551              if($attachment['visible'])
 552              { // There is an attachment thats visible!
 553                  $attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
 554                  $attachment['filesize'] = get_friendly_size($attachment['filesize']);
 555                  $ext = get_extension($attachment['filename']);
 556                  if($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg")
 557                  {
 558                      $isimage = true;
 559                  }
 560                  else
 561                  {
 562                      $isimage = false;
 563                  }
 564                  $attachment['icon'] = get_attachment_icon($ext);
 565                  // Support for [attachment=id] code
 566                  if(stripos($message, "[attachment=".$attachment['aid']."]") !== false)
 567                  {
 568                      if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
 569                      { // We have a thumbnail to show (and its not the "SMALL" enough image
 570                          eval("\$attbit = \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
 571                      }
 572                      elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
 573                      {
 574                          // Image is small enough to show - no thumbnail
 575                          eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
 576                      }
 577                      else
 578                      {
 579                          // Show standard link to attachment
 580                          eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
 581                      }
 582                      $message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $message);
 583                  }
 584                  else
 585                  {
 586                      if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
 587                      { // We have a thumbnail to show
 588                          eval("\$post['thumblist'] .= \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
 589                          if($tcount == 5)
 590                          {
 591                              $thumblist .= "<br />";
 592                              $tcount = 0;
 593                          }
 594                          ++$tcount;
 595                      }
 596                      elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
 597                      {
 598                          // Image is small enough to show - no thumbnail
 599                          eval("\$post['imagelist'] .= \"".$templates->get("postbit_attachments_images_image")."\";");
 600                      }
 601                      else
 602                      {
 603                          eval("\$post['attachmentlist'] .= \"".$templates->get("postbit_attachments_attachment")."\";");
 604                      }
 605                  }
 606              }
 607              else
 608              {
 609                  $validationcount++;
 610              }
 611          }
 612          if($post['thumblist'])
 613          {
 614              eval("\$post['attachedthumbs'] = \"".$templates->get("postbit_attachments_thumbnails")."\";");
 615          }
 616          if($post['imagelist'])
 617          {
 618              eval("\$post['attachedimages'] = \"".$templates->get("postbit_attachments_images")."\";");
 619          }
 620          if($post['attachmentlist'] || $post['thumblist'] || $post['imagelist'])
 621          {
 622              eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";");
 623          }
 624      }
 625  
 626      eval("\$announcements .= \"".$templates->get("portal_announcement")."\";");
 627      unset($post);
 628  }
 629  
 630  $plugins->run_hooks("portal_end");
 631  
 632  eval("\$portal = \"".$templates->get("portal")."\";");
 633  output_page($portal);
 634  
 635  ?>


Generated: Sun Dec 11 14:16:27 2011 Cross-referenced by PHPXref 0.7.1