function GetMenu($savetofile = false, $option = false) { global $tc_db, $dwoo, $dwoo_data, $kusabaxorg; require_once KU_ROOTDIR . 'lib/dwoo.php'; $dwoo_data->assign('boardpath', getCLBoardPath()); if (KU_MENUTYPE == 'normal') { $dwoo_data->assign('styles', explode(':', KU_MENUSTYLES)); } if ($savetofile) { $files = array('menu.html', 'menu_dirs.html'); } else { $files = array('menu.php', 'menu.php'); } $dwoo_data->assign('files', $files); $sections = array(); $results_boardsexist = $tc_db->GetAll("SELECT `id` FROM `" . KU_DBPREFIX . "boards` LIMIT 1"); if (count($results_boardsexist) > 0) { $sections = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "sections` ORDER BY `order` ASC"); foreach ($sections as $key => $section) { $results = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $section['id'] . "' ORDER BY `order` ASC, `name` ASC /* MENU.CLASS.PHP */"); foreach ($results as $line) { $sections[$key]['boards'][] = $line; } } } $dwoo_data->assign('boards', $sections); $tpl_irc = ''; $dwoo_data->assign('irc', $tpl_irc); for ($i = 0; $i < 2; $i++) { if ($i == 0) { $dwoo_data->assign('showdirs', 0); } else { $dwoo_data->assign('showdirs', 1); } if ($savetofile) { if ($i == 0) { file_put_contents(KU_ROOTDIR . $files[0], $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data)); } else { file_put_contents(KU_ROOTDIR . $files[1], $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data)); } } else { if ($i == 0) { $menu_nodirs = $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data); if ($option == 'nodirs') { return $menu_nodirs; } } else { if ($option == 'dirs') { $menu_dirs = $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data); return $menu_dirs; } } } } if (isset($menu_nodirs) && isset($menu_dirs)) { return array($menu_nodirs, $menu_dirs); } }
/** * Initialize the instance of smary which will be used for generating pages */ function InitializeDwoo() { require_once KU_ROOTDIR . 'lib/dwoo.php'; $this->dwoo = new Dwoo(); $this->dwoo_data = new Dwoo_Data(); $this->dwoo_data->assign('cwebpath', getCWebpath()); $this->dwoo_data->assign('boardpath', getCLBoardPath()); }
$postidquery .= "`id` = " . intval($postids[0]); } } $board_class->InitializeDwoo(); $board_class->dwoo_data->assign('board', $board_class->board); $board_class->dwoo_data->assign('isread', true); $board_class->dwoo_data->assign('file_path', getCLBoardPath($board_class->board['name'], $board_class->board['loadbalanceurl_formatted'], '')); $page = ''; if (!$singlepost) { $page .= $board_class->PageHeader($thread, 0, -1, -1); $board_class->dwoo_data->assign('replythrad', $thread); $page .= $board_class->dwoo->get(KU_TEMPLATEDIR . '/' . $board_class->board['text_readable'] . '_reply_header.tpl', $board_class->dwoo_data); } else { $tpl['title'] = ''; $tpl['head'] = ''; $page .= '<link rel="stylesheet" href="' . getCLBoardPath() . 'css/img_global.css" />'; } if ($board_class->board['type'] == 1) { $relative_id = 0; $ids_found = 0; if ($posts != '0') { $postrange = array(); foreach ($postids as $key => $postid) { if ((!$key || $key != "BETWEEN") && (ctype_digit($postid) || is_integer($postid))) { $postrange[] = $postid; } } if (isset($postids['BETWEEN'])) { foreach ($postids['BETWEEN'] as $between) { $postrange = array_merge($postrange, range($between[0], $between[1])); }
} require KU_ROOTDIR . 'inc/functions.php'; require KU_ROOTDIR . 'inc/classes/board-post.class.php'; $board_name = $tc_db->GetOne("SELECT `name` FROM `" . KU_DBPREFIX . "boards` WHERE `name` = " . $tc_db->qstr($_GET['board']) . ""); if ($board_name != '') { $board_class = new Board($board_name); if ($board_class->board['locale'] != '') { changeLocale($board_class->board['locale']); } } else { die('<font color="red">Invalid board.</font>'); } $board_class->InitializeDwoo(); $board_class->dwoo_data->assign('isexpand', true); $board_class->dwoo_data->assign('board', $board_class->board); $board_class->dwoo_data->assign('file_path', getCLBoardPath($board_class->board['name'], $board_class->board['loadbalanceurl_formatted'], '')); if (isset($_GET['preview'])) { require KU_ROOTDIR . 'inc/classes/parse.class.php'; $parse_class = new Parse(); if (isset($_GET['board']) && isset($_GET['parentid']) && isset($_GET['message'])) { die('<strong>' . _gettext('Post preview') . ':</strong><br /><div style="border: 1px dotted;padding: 8px;background-color: white;">' . $parse_class->ParsePost($_GET['message'], $board_class->board['name'], $board_class->board['type'], $_GET['parentid'], $board_class->board['id']) . '</div>'); } die('Error'); } $posts = $tc_db->GetAll('SELECT * FROM `' . KU_DBPREFIX . 'posts` WHERE `boardid` = ' . $board_class->board['id'] . ' AND `IS_DELETED` = 0 AND `parentid` = ' . $tc_db->qstr($_GET['threadid']) . ' ORDER BY `id` ASC'); global $expandjavascript; $output = ''; $expandjavascript = ''; $numimages = 0; if ($board_class->board['type'] != 1) { $embeds = $tc_db->GetAll("SELECT filetype FROM `" . KU_DBPREFIX . "embeds`");