Файл: wboard/source/system/controller/mainpage.php
Строк: 33
<?php
/**
 * Wboard
 * Mainpage
 * @author Screamer
 * @copyright 2013
 */
class Module_Mainpage extends Module
{
    /**
     * Index of Mainpage
     * @return (void)
     */
    public function index()
    {
        // List of boards
        $boards = $this->model->get_boards();
        $list = '';
        foreach ($boards as $item) {
            if ($item['hidden'] == 1) {
                continue;
            }
            $list .= $this->tpl->load('mainpage_board_item', array(
                'name' => $item['name'],
                'description' => htmlspecialchars($item['description'], ENT_QUOTES, 'UTF-8'),
            ));
        }
        // Static pages
        $pages = '';
        $pages_dir = $this->path . 'files' . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR;
        $pages_conf = $pages_dir . 'pages.json';
        if (is_file($pages_conf)) {
            $pages_conf = json_decode(file_get_contents($pages_conf), TRUE);
            if (isset($pages_conf['show_main'])) {
                foreach ($pages_conf['show_main'] as $page) {
                    if (is_file($pages_dir . $page . '.html')) {
                        $pages .= file_get_contents($pages_dir . $page . '.html');
                    }
                }
            }
        }
        // Set data for output
        $this->tpl->set_output($this->tpl->load('mainpage', array(
            'pages' => $pages,
            'boards' => $list,
            'last_threads' => $this->helper->display_threads($this->model->get_threads('', 5, FALSE)),
        )));
    }
}