Advertisement
Guest User

Untitled

a guest
Dec 9th, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 19.34 KB | None | 0 0
  1. <?php
  2. /**
  3.  * MyBB 1.8
  4.  * Copyright 2014 MyBB Group, All Rights Reserved
  5.  *
  6.  * Website: http://www.mybb.com
  7.  * License: http://www.mybb.com/about/license
  8.  *
  9.  */
  10.  
  11. /**
  12. * Build a list of forum bits.
  13. *
  14. * @param int The parent forum to fetch the child forums for (0 assumes all)
  15. * @param int The depth to return forums with.
  16. * @return array Array of information regarding the child forums of this parent forum
  17. */
  18. function build_forumbits($pid=0, $depth=1)
  19. {
  20.     global $db, $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers;
  21.     static $private_forums;
  22.  
  23.     $forum_listing = '';
  24.  
  25.     // If no forums exist with this parent, do nothing
  26.     if(empty($fcache[$pid]) || !is_array($fcache[$pid]))
  27.     {
  28.         return;
  29.     }
  30.  
  31.     $parent_counters['threads'] = 0;
  32.     $parent_counters['posts'] = 0;
  33.     $parent_counters['unapprovedposts'] = 0;
  34.     $parent_counters['unapprovedthreads'] = 0;
  35.     $parent_counters['viewers'] = 0;
  36.     $forum_list = $comma = '';
  37.     $donecount = 0;
  38.  
  39.     // Foreach of the forums in this parent
  40.     foreach($fcache[$pid] as $parent)
  41.     {
  42.         foreach($parent as $forum)
  43.         {
  44.             $subforums = $sub_forums = '';
  45.             $lastpost_data = array(
  46.                 'lastpost' => 0
  47.             );
  48.             $forum_viewers_text = '';
  49.             $forum_viewers_text_plain = '';
  50.  
  51.             // Get the permissions for this forum
  52.             $permissions = $forumpermissions[$forum['fid']];
  53.  
  54.             // If this user doesnt have permission to view this forum and we're hiding private forums, skip this forum
  55.             if($permissions['canview'] != 1 && $mybb->settings['hideprivateforums'] == 1)
  56.             {
  57.                 continue;
  58.             }
  59.  
  60.             $forum = $plugins->run_hooks("build_forumbits_forum", $forum);
  61.  
  62.             // Build the link to this forum
  63.             $forum_url = get_forum_link($forum['fid']);
  64.  
  65.             // This forum has a password, and the user isn't authenticated with it - hide post information
  66.             $hideinfo = $hidecounters = false;
  67.             $hidelastpostinfo = false;
  68.             $showlockicon = 0;
  69.             if(isset($permissions['canviewthreads']) && $permissions['canviewthreads'] != 1)
  70.             {
  71.                 $hideinfo = true;
  72.             }
  73.  
  74.             if(isset($permissions['canonlyviewownthreads']) && $permissions['canonlyviewownthreads'] == 1)
  75.             {
  76.                 $hidecounters = true;
  77.  
  78.                 // If we only see our own threads, find out if there's a new post in one of them so the lightbulb shows
  79.                 if(!is_array($private_forums))
  80.                 {
  81.                     $private_forums = $fids = array();
  82.                     foreach($fcache as $fcache_p)
  83.                     {
  84.                         foreach($fcache_p as $parent_p)
  85.                         {
  86.                             foreach($parent_p as $forum_p)
  87.                             {
  88.                                 if($forumpermissions[$forum_p['fid']]['canonlyviewownthreads'])
  89.                                 {
  90.                                     $fids[] = $forum_p['fid'];
  91.                                 }
  92.                             }
  93.                         }
  94.                     }
  95.  
  96.                     if(!empty($fids))
  97.                     {
  98.                         $fids = implode(',', $fids);
  99.                         $query = $db->simple_select("threads", "tid, fid, subject, lastpost, lastposter, lastposteruid", "uid = '{$mybb->user['uid']}' AND fid IN ({$fids}) AND visible != '-2'", array("order_by" => "lastpost", "order_dir" => "desc"));
  100.  
  101.                         while($thread = $db->fetch_array($query))
  102.                         {
  103.                             if(!$private_forums[$thread['fid']])
  104.                             {
  105.                                 $private_forums[$thread['fid']] = $thread;
  106.                             }
  107.                         }
  108.                     }
  109.                 }
  110.  
  111.                 if($private_forums[$forum['fid']]['lastpost'])
  112.                 {
  113.                     $forum['lastpost'] = $private_forums[$forum['fid']]['lastpost'];
  114.  
  115.                     $lastpost_data = array(
  116.                         "lastpost" => $private_forums[$forum['fid']]['lastpost'],
  117.                         "lastpostsubject" => $private_forums[$forum['fid']]['subject'],
  118.                         "lastposter" => $private_forums[$forum['fid']]['lastposter'],
  119.                         "lastposttid" => $private_forums[$forum['fid']]['tid'],
  120.                         "lastposteruid" => $private_forums[$forum['fid']]['lastposteruid']
  121.                     );
  122.                 }
  123.             }
  124.             else
  125.             {
  126.                 $lastpost_data = array(
  127.                     "lastpost" => $forum['lastpost'],
  128.                     "lastpostsubject" => $forum['lastpostsubject'],
  129.                     "lastposter" => $forum['lastposter'],
  130.                     "lastposttid" => $forum['lastposttid'],
  131.                     "lastposteruid" => $forum['lastposteruid']
  132.                 );
  133.             }
  134.  
  135.             if($forum['password'] != '' && $mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
  136.             {
  137.                 $hideinfo = true;
  138.                 $showlockicon = 1;
  139.             }
  140.  
  141.             // Fetch subforums of this forum
  142.             if(isset($fcache[$forum['fid']]))
  143.             {
  144.                 $forum_info = build_forumbits($forum['fid'], $depth+1);
  145.  
  146.                 // Increment forum counters with counters from child forums
  147.                 $forum['threads'] += $forum_info['counters']['threads'];
  148.                 $forum['posts'] += $forum_info['counters']['posts'];
  149.                 $forum['unapprovedthreads'] += $forum_info['counters']['unapprovedthreads'];
  150.                 $forum['unapprovedposts'] += $forum_info['counters']['unapprovedposts'];
  151.  
  152.                 if(!empty($forum_info['counters']['viewing']))
  153.                 {
  154.                     $forum['viewers'] += $forum_info['counters']['viewing'];
  155.                 }
  156.  
  157.                 // If the child forums' lastpost is greater than the one for this forum, set it as the child forums greatest.
  158.                 if($forum_info['lastpost']['lastpost'] > $lastpost_data['lastpost'])
  159.                 {
  160.                     $lastpost_data = $forum_info['lastpost'];
  161.  
  162.                     /*
  163.                     // If our subforum is unread, then so must be our parents. Force our parents to unread as well
  164.                     if(strstr($forum_info['lightbulb']['folder'], "on") !== false)
  165.                     {
  166.                         $forum['lastread'] = 0;
  167.                     }
  168.                     // Otherwise, if we  have an explicit record in the db, we must make sure that it is explicitly set
  169.                     else
  170.                     {
  171.                         $lastpost_data['lastpost'] = $forum['lastpost'];
  172.                     }*/
  173.                 }
  174.  
  175.                 $sub_forums = $forum_info['forum_list'];
  176.             }
  177.  
  178.             // If we are hiding information (lastpost) because we aren't authenticated against the password for this forum, remove them
  179.             if($hidelastpostinfo == true)
  180.             {
  181.                 $lastpost_data = array(
  182.                     'lastpost' => 0,
  183.                     'lastposter' => ''
  184.                 );
  185.             }
  186.  
  187.             // If the current forums lastpost is greater than other child forums of the current parent, overwrite it
  188.             if(!isset($parent_lastpost) || $lastpost_data['lastpost'] > $parent_lastpost['lastpost'])
  189.             {
  190.                 $parent_lastpost = $lastpost_data;
  191.             }
  192.  
  193.             if(is_array($forum_viewers) && isset($forum_viewers[$forum['fid']]) && $forum_viewers[$forum['fid']] > 0)
  194.             {
  195.                 $forum['viewers'] = $forum_viewers[$forum['fid']];
  196.             }
  197.  
  198.             // Increment the counters for the parent forum (returned later)
  199.             if($hideinfo != true && $hidecounters != true)
  200.             {
  201.                 $parent_counters['threads'] += $forum['threads'];
  202.                 $parent_counters['posts'] += $forum['posts'];
  203.                 $parent_counters['unapprovedposts'] += $forum['unapprovedposts'];
  204.                 $parent_counters['unapprovedthreads'] += $forum['unapprovedthreads'];
  205.  
  206.                 if(!empty($forum['viewers']))
  207.                 {
  208.                     $parent_counters['viewers'] += $forum['viewers'];
  209.                 }
  210.             }
  211.  
  212.             // Done with our math, lets talk about displaying - only display forums which are under a certain depth
  213.             if($depth > $showdepth)
  214.             {
  215.                 continue;
  216.             }
  217.  
  218.             // Get the lightbulb status indicator for this forum based on the lastpost
  219.             $lightbulb = get_forum_lightbulb($forum, $lastpost_data, $showlockicon);
  220.  
  221.             // Fetch the number of unapproved threads and posts for this forum
  222.             $unapproved = get_forum_unapproved($forum);
  223.  
  224.             if($hideinfo == true)
  225.             {
  226.                 unset($unapproved);
  227.             }
  228.  
  229.             // Sanitize name and description of forum.
  230.             $forum['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['name']); // Fix & but allow unicode
  231.             $forum['description'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['description']); // Fix & but allow unicode
  232.             $forum['name'] = preg_replace("#&([^\#])(?![a-z1-4]{1,10};)#i", "&#038;$1", $forum['name']);
  233.             $forum['description'] = preg_replace("#&([^\#])(?![a-z1-4]{1,10};)#i", "&#038;$1", $forum['description']);
  234.  
  235.             // If this is a forum and we've got subforums of it, load the subforums list template
  236.             if($depth == 2 && $sub_forums)
  237.             {
  238.                 eval("\$subforums = \"".$templates->get("forumbit_subforums")."\";");
  239.             }
  240.             // A depth of three indicates a comma separated list of forums within a forum
  241.             else if($depth == 3)
  242.             {
  243.                 if($donecount < $mybb->settings['subforumsindex'])
  244.                 {
  245.                     $statusicon = '';
  246.  
  247.                     // Showing mini status icons for this forum
  248.                     if($mybb->settings['subforumsstatusicons'] == 1)
  249.                     {
  250.                         $lightbulb['folder'] = "mini".$lightbulb['folder'];
  251.                         eval("\$statusicon = \"".$templates->get("forumbit_depth3_statusicon", 1, 0)."\";");
  252.                     }
  253.  
  254.                     // Fetch the template and append it to the list
  255.                     eval("\$forum_list .= \"".$templates->get("forumbit_depth3", 1, 0)."\";");
  256.                     $comma = $lang->comma;
  257.                 }
  258.  
  259.                 // Have we reached our max visible subforums? put a nice message and break out of the loop
  260.                 ++$donecount;
  261.                 if($donecount == $mybb->settings['subforumsindex'])
  262.                 {
  263.                     if(subforums_count($fcache[$pid]) > $donecount)
  264.                     {
  265.                         $forum_list .= $comma.$lang->sprintf($lang->more_subforums, (subforums_count($fcache[$pid]) - $donecount));
  266.                     }
  267.                 }
  268.                 continue;
  269.             }
  270.  
  271.             // Forum is a category, set template type
  272.             if($forum['type'] == 'c')
  273.             {
  274.                 $forumcat = '_cat';
  275.             }
  276.             // Forum is a standard forum, set template type
  277.             else
  278.             {
  279.                 $forumcat = '_forum';
  280.             }
  281.  
  282.             if($forum['linkto'] == '')
  283.             {
  284.                 // No posts have been made in this forum - show never text
  285.                 if(($lastpost_data['lastpost'] == 0 || $lastpost_data['lastposter'] == '') && $hideinfo != true)
  286.                 {
  287.                     eval("\$lastpost = \"".$templates->get("forumbit_depth2_forum_lastpost_never")."\";");
  288.                 }
  289.                 elseif($hideinfo != true)
  290.                 {
  291.                     // Format lastpost date and time
  292.                     $lastpost_date = my_date('relative', $lastpost_data['lastpost']);
  293.  
  294.                     // Set up the last poster, last post thread id, last post subject and format appropriately
  295.                     $lastpost_profilelink = build_profile_link($lastpost_data['lastposter'], $lastpost_data['lastposteruid']);
  296.                     $lastpost_link = get_thread_link($lastpost_data['lastposttid'], 0, "lastpost");
  297.                     $lastpost_subject = $full_lastpost_subject = $parser->parse_badwords($lastpost_data['lastpostsubject']);
  298.                     if(my_strlen($lastpost_subject) > 25)
  299.                     {
  300.                         $lastpost_subject = my_substr($lastpost_subject, 0, 25)."...";
  301.                     }
  302.                     $lastpost_subject = htmlspecialchars_uni($lastpost_subject);
  303.                     $full_lastpost_subject = htmlspecialchars_uni($full_lastpost_subject);
  304.  
  305.                     // Call lastpost template
  306.                     if($depth != 1)
  307.                     {
  308.                         eval("\$lastpost = \"".$templates->get("forumbit_depth{$depth}_forum_lastpost")."\";");
  309.                     }
  310.                 }
  311.  
  312.                 if($mybb->settings['showforumviewing'] != 0 && $forum['viewers'] > 0)
  313.                 {
  314.                     if($forum['viewers'] == 1)
  315.                     {
  316.                         $forum_viewers_text = $lang->viewing_one;
  317.                     }
  318.                     else
  319.                     {
  320.                         $forum_viewers_text = $lang->sprintf($lang->viewing_multiple, $forum['viewers']);
  321.                     }
  322.                     $forum_viewers_text_plain = $forum_viewers_text;
  323.                     eval("\$forum_viewers_text = \"".$templates->get("forumbit_depth2_forum_viewers")."\";");
  324.                 }
  325.             }
  326.             // If this forum is a link or is password protected and the user isn't authenticated, set counters to "-"
  327.             if($forum['linkto'] != '' || $hideinfo == true || $hidecounters == true)
  328.             {
  329.                 $posts = "-";
  330.                 $threads = "-";
  331.             }
  332.             // Otherwise, format thread and post counts
  333.             else
  334.             {
  335.                 $posts = my_number_format($forum['posts']);
  336.                 $threads = my_number_format($forum['threads']);
  337.             }
  338.  
  339.             // If this forum is a link or is password protected and the user isn't authenticated, set lastpost to "-"
  340.             if($forum['linkto'] != '' || $hideinfo == true || $hidelastpostinfo == true)
  341.             {
  342.                 eval("\$lastpost = \"".$templates->get("forumbit_depth2_forum_lastpost_hidden")."\";");
  343.             }
  344.  
  345.             // Moderator column is not off
  346.             if($mybb->settings['modlist'] != 0)
  347.             {
  348.                 $done_moderators = array(
  349.                     "users" => array(),
  350.                     "groups" => array()
  351.                 );
  352.                 $moderators = '';
  353.                 // Fetch list of moderators from this forum and its parents
  354.                 $parentlistexploded = explode(',', $forum['parentlist']);
  355.                 foreach($parentlistexploded as $mfid)
  356.                 {
  357.                     // This forum has moderators
  358.                     if(isset($moderatorcache[$mfid]) && is_array($moderatorcache[$mfid]))
  359.                     {
  360.                         // Fetch each moderator from the cache and format it, appending it to the list
  361.                         foreach($moderatorcache[$mfid] as $modtype)
  362.                         {
  363.                             foreach($modtype as $moderator)
  364.                             {
  365.                                 if($moderator['isgroup'])
  366.                                 {
  367.                                     if(in_array($moderator['id'], $done_moderators['groups']))
  368.                                     {
  369.                                         continue;
  370.                                     }
  371.  
  372.                                     $moderator['title'] = htmlspecialchars_uni($moderator['title']);
  373.  
  374.                                     eval("\$moderators .= \"".$templates->get("forumbit_moderators_group", 1, 0)."\";");
  375.                                     $done_moderators['groups'][] = $moderator['id'];
  376.                                 }
  377.                                 else
  378.                                 {
  379.                                     if(in_array($moderator['id'], $done_moderators['users']))
  380.                                     {
  381.                                         continue;
  382.                                     }
  383.  
  384.                                     $moderator['profilelink'] = get_profile_link($moderator['id']);
  385.                                     $moderator['username'] = htmlspecialchars_uni($moderator['username']);
  386.  
  387.                                     eval("\$moderators .= \"".$templates->get("forumbit_moderators_user", 1, 0)."\";");
  388.                                     $done_moderators['users'][] = $moderator['id'];
  389.                                 }
  390.                                 $comma = $lang->comma;
  391.                             }
  392.                         }
  393.                     }
  394.                 }
  395.                 $comma = '';
  396.  
  397.                 // If we have a moderators list, load the template
  398.                 if($moderators)
  399.                 {
  400.                     eval("\$modlist = \"".$templates->get("forumbit_moderators")."\";");
  401.                 }
  402.                 else
  403.                 {
  404.                     $modlist = '';
  405.                 }
  406.             }
  407.  
  408.             // Descriptions aren't being shown - blank them
  409.             if($mybb->settings['showdescriptions'] == 0)
  410.             {
  411.                 $forum['description'] = '';
  412.             }
  413.  
  414.             // Check if this category is either expanded or collapsed and hide it as necessary.
  415.             $expdisplay = '';
  416.             $collapsed_name = "cat_{$forum['fid']}_c";
  417.             if(isset($collapsed[$collapsed_name]) && $collapsed[$collapsed_name] == "display: show;")
  418.             {
  419.                 $expcolimage = "collapse_collapsed.png";
  420.                 $expdisplay = "display: none;";
  421.                 $expthead = " thead_collapsed";
  422.                 $expaltext = "[+]";
  423.             }
  424.             else
  425.             {
  426.                 $expcolimage = "collapse.png";
  427.                 $expthead = "";
  428.                 $expaltext = "[-]";
  429.             }
  430.  
  431.             // Swap over the alternate backgrounds
  432.             $bgcolor = alt_trow();
  433.  
  434.             // Add the forum to the list
  435.             eval("\$forum_list .= \"".$templates->get("forumbit_depth$depth$forumcat")."\";");
  436.         }
  437.     }
  438.  
  439.     if(!isset($parent_lastpost))
  440.     {
  441.         $parent_lastpost = 0;
  442.     }
  443.  
  444.     if(!isset($lightbulb))
  445.     {
  446.         $lightbulb = '';
  447.     }
  448.  
  449.     // Return an array of information to the parent forum including child forums list, counters and lastpost information
  450.     return array(
  451.         "forum_list" => $forum_list,
  452.         "counters" => $parent_counters,
  453.         "lastpost" => $parent_lastpost,
  454.         "lightbulb" => $lightbulb,
  455.     );
  456. }
  457.  
  458. /**
  459.  * Fetch the status indicator for a forum based on its last post and the read date
  460.  *
  461.  * @param array Array of information about the forum
  462.  * @param array Array of information about the lastpost date
  463.  * @param int Whether or not this forum is locked or not
  464.  * @return array Array of the folder image to be shown and the alt text
  465.  */
  466. function get_forum_lightbulb($forum, $lastpost, $locked=0)
  467. {
  468.     global $mybb, $lang, $db, $unread_forums;
  469.  
  470.     // This forum is a redirect, so override the folder icon with the "offlink" icon.
  471.     if($forum['linkto'] != '')
  472.     {
  473.         $folder = "offlink";
  474.         $altonoff = $lang->forum_redirect;
  475.     }
  476.     // This forum is closed, so override the folder icon with the "offlock" icon.
  477.     elseif($forum['open'] == 0 || $locked)
  478.     {
  479.         switch ($forum['fid'])
  480.             {
  481.                 case 2:
  482.                 case 3:
  483.                 case 5:
  484.                 case 6:
  485.                 case 8:
  486.                 case 9:
  487.                 case 11:
  488.                 case 12:
  489.  
  490.                 $folder =  $forum['fid'];
  491.             break;
  492.             default;
  493.                 $folder = "offlock";
  494.                 $altonoff = $lang->forum_locked;
  495.             }
  496.        
  497.        
  498.     }
  499.     else
  500.     {
  501.         // Fetch the last read date for this forum
  502.         if(!empty($forum['lastread']))
  503.         {
  504.             $forum_read = $forum['lastread'];
  505.         }
  506.         elseif(!empty($mybb->cookies['mybb']['readallforums']))
  507.         {
  508.             // We've hit the read all forums as a guest, so use the lastvisit of the user
  509.             $forum_read = $mybb->cookies['mybb']['lastvisit'];
  510.         }
  511.         else
  512.         {
  513.             $forum_read = 0;
  514.             $threadcut = TIME_NOW - 60*60*24*$mybb->settings['threadreadcut'];
  515.  
  516.             // If the user is a guest, do they have a forumsread cookie?
  517.             if(!$mybb->user['uid'] && isset($mybb->cookies['mybb']['forumread']))
  518.             {
  519.                 // If they've visited us before, then they'll have this cookie - otherwise everything is unread...
  520.                 $forum_read = my_get_array_cookie("forumread", $forum['fid']);
  521.             }
  522.             else if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0 && $threadcut > $lastpost['lastpost'])
  523.             {
  524.                 // We have a user, the forum's unread and we're over our threadreadcut limit for the lastpost - we mark these as read
  525.                 $forum_read = $lastpost['lastpost'] + 1;
  526.             }
  527.         }
  528.  
  529.         //if(!$forum_read)
  530.         //{
  531.             //$forum_read = $mybb->user['lastvisit'];
  532.         //}
  533.  
  534.         // If the lastpost is greater than the last visit and is greater than the forum read date, we have a new post
  535.         if($lastpost['lastpost'] > $forum_read && $lastpost['lastpost'] != 0)
  536.         {
  537.             switch ($forum['fid'])
  538.             {
  539.                 case 2:
  540.                 case 3:
  541.                 case 5:
  542.                 case 6:
  543.                 case 8:
  544.                 case 9:
  545.                 case 11:
  546.                 case 12:
  547.  
  548.                 $unread_forums++;
  549.                 $folder = $forum['fid'];
  550.                 $altonoff = $lang->new_posts;
  551.             break;
  552.             default;
  553.                 $folder = 'on';
  554.                 $altonoff = $lang->new_posts;
  555.                 $unread_forums++;
  556.  
  557.             }
  558.            
  559.         }
  560.         // Otherwise, no new posts
  561.         else
  562.         {
  563.             switch ($forum['fid'])
  564.             {
  565.                 case 2:
  566.                 case 3:
  567.                 case 5:
  568.                 case 6:
  569.                 case 8:
  570.                 case 9:
  571.                 case 11:
  572.                 case 12:
  573.  
  574.                 $folder = $forum['fid'];
  575.             $altonoff = $lang->no_new_posts;
  576.             break;
  577.             default;
  578.                 $folder = 'off';
  579.                 $altonoff = $lang->no_new_posts;
  580.             }
  581.            
  582.  
  583.         }
  584.     }
  585.  
  586.     return array(
  587.         "folder" => $folder,
  588.         "altonoff" => $altonoff
  589.     );
  590. }
  591.  
  592. /**
  593.  * Fetch the number of unapproved posts, formatted, from a forum
  594.  *
  595.  * @param array Array of information about the forum
  596.  * @return array Array containing formatted string for posts and string for threads
  597.  */
  598. function get_forum_unapproved($forum)
  599. {
  600.     global $lang, $templates;
  601.  
  602.     $unapproved_threads = $unapproved_posts = '';
  603.  
  604.     // If the user is a moderator we need to fetch the count
  605.     if(is_moderator($forum['fid'], "canviewunapprove"))
  606.     {
  607.         // Forum has one or more unaproved posts, format language string accordingly
  608.         if($forum['unapprovedposts'])
  609.         {
  610.             if($forum['unapprovedposts'] > 1)
  611.             {
  612.                 $unapproved_posts_count = $lang->sprintf($lang->forum_unapproved_posts_count, $forum['unapprovedposts']);
  613.             }
  614.             else
  615.             {
  616.                 $unapproved_posts_count = $lang->sprintf($lang->forum_unapproved_post_count, 1);
  617.             }
  618.  
  619.             $forum['unapprovedposts'] = my_number_format($forum['unapprovedposts']);
  620.             eval("\$unapproved_posts = \"".$templates->get("forumbit_depth2_forum_unapproved_posts")."\";");
  621.         }
  622.         // Forum has one or more unapproved threads, format language string accordingly
  623.         if($forum['unapprovedthreads'])
  624.         {
  625.             if($forum['unapprovedthreads'] > 1)
  626.             {
  627.                 $unapproved_threads_count = $lang->sprintf($lang->forum_unapproved_threads_count, $forum['unapprovedthreads']);
  628.             }
  629.             else
  630.             {
  631.                 $unapproved_threads_count = $lang->sprintf($lang->forum_unapproved_thread_count, 1);
  632.             }
  633.  
  634.             $forum['unapprovedthreads'] = my_number_format($forum['unapprovedthreads']);
  635.             eval("\$unapproved_threads = \"".$templates->get("forumbit_depth2_forum_unapproved_threads")."\";");
  636.         }
  637.     }
  638.     return array(
  639.         "unapproved_posts" => $unapproved_posts,
  640.         "unapproved_threads" => $unapproved_threads
  641.     );
  642. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement