<?php
echo '<div class="menu2">Разделы форума</div>';
$query = DB :: $dbs -> query ("SELECT * FROM `forum_r` ORDER BY `id`");
        while ($r = $query -> fetch()) {
        
                echo '<div class="raz"><img src="/design/temas.png" alt="" align="middle"/> <a href="/forum/razd' . $r['id'] . '/" >' . $r['name'] . '</a><span class="c"> (' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_t` WHERE (`id_r`='" . $r['id'] . "') " . ($us['level'] > 0 ? '' : 'AND (`type`!=\'2\')')) . '/' . DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_p` WHERE (`id_r`='" . $r['id'] . "') " . ($us['level'] > 0 ? '' : 'AND (`del`=\'0\')')) . ')</span></div>';
                
               if (DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_pr` WHERE (`id_r`='" . $r['id'] . "')") != 0) {
                        
                       
                        $q = DB :: $dbs -> query ("SELECT * FROM `forum_pr` WHERE (`id_r`='" . $r['id'] . "') ORDER BY `id`");
                        while ($pr = $q -> fetch ()) {
                        
                                
                        }
                        
                        
                        
                    
                 
		}else {
                        echo '<div class="navg">Подразделов нет!</div>';
                }
                echo '</div>';
        }
       
		?>