Пример #1
0
 function getForumHtml($type)
 {
     global $_G, $db_plist, $db_tlist, $groupid, $db_filterids;
     if (!s::inArray($type, array('thread', 'special'))) {
         return array('', '', '');
     }
     $forumadd = $forumcache = '';
     $notAllowedFids = $db_filterids ? explode(',', $db_filterids) : array();
     //* include pwCache::getPath ( D_P . "data/bbscache/forumcache.php" );
     extract(pwCache::getData(D_P . "data/bbscache/forumcache.php", false));
     $_forumsService = L::loadClass('forums', 'forum');
     /* @var $_forumsService PW_Forums */
     if ($forums = $_forumsService->getsNotCategory()) {
         foreach ($forums as $rt) {
             $allowvisit = !$rt['allowvisit'] || $rt['allowvisit'] != str_replace(",{$groupid},", '', $rt['allowvisit']) ? true : false;
             if ($rt['f_type'] == 'hidden' && $allowvisit) {
                 $forumadd .= "<option value=\"{$rt['fid']}\"> &nbsp;|- {$rt['name']}</option>";
             } elseif ($rt['password'] || !$allowvisit || S::inArray($rt['fid'], $notAllowedFids)) {
                 $forumcache = preg_replace("/\\<option value=\"{$rt['fid']}\"\\>(.+?)\\<\\/option\\>\\r?\\n/is", '', $forumcache);
             }
         }
     }
     if ($_G['allowsearch'] > 1) {
         $t_table = '';
         if ($db_plist && count($db_plist) > 1) {
             $p_table = "<select name=\"ptable\">";
             foreach ($db_plist as $key => $val) {
                 $name = $val ? $val : ($key != 0 ? getLangInfo('other', 'posttable') . $key : getLangInfo('other', 'posttable'));
                 $p_table .= "<option value=\"{$key}\">" . $name . "</option>";
             }
             $p_table .= '</select>';
         }
         if ($db_tlist) {
             $t_table = '<select name="ttable">';
             foreach ($db_tlist as $key => $value) {
                 $name = !empty($value['2']) ? $value['2'] : ($key == 0 ? 'tmsgs' : 'tmsgs' . $key);
                 $t_table .= "<option value=\"{$key}\">{$name}</option>";
             }
             $t_table .= '</select>';
         }
     }
     return array($forumcache, $p_table, $t_table, $forumadd);
 }