1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-09-23 19:18:21 +02:00

Moved hardcoded html filepaths into config file for extensibility (#354)

Co-authored-by: chatfield <chatfield@creatuity.com>
Co-authored-by: Fred Brennan <copypaste@kittens.ph>
This commit is contained in:
C Hatfield 2022-08-29 09:50:45 -05:00 committed by GitHub
parent 0f94915fdf
commit ae2d91c534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 129 additions and 68 deletions

View File

@ -1205,7 +1205,7 @@
// enter the directory path here. Otherwise, keep it false.
$config['root_file'] = false;
// Location of files.
// Location of primary files.
$config['file_index'] = 'index.html';
$config['file_page'] = '%d.html'; // NB: page is both an index page and a thread
$config['file_catalog'] = 'catalog.html';
@ -1216,6 +1216,67 @@
$config['file_post'] = 'post.php';
$config['file_script'] = 'main.js';
$config['file_board_index'] = 'index.html';
$config['file_page_template'] = 'page.html';
$config['file_report'] = 'report.html';
$config['file_error'] = 'error.html';
$config['file_login'] = 'login.html';
$config['file_banned'] = 'banned.html';
$config['file_fileboard'] = 'fileboard.html';
$config['file_thread'] = 'thread.html';
$config['file_post_reply'] = 'post_reply.html';
$config['file_post_thread'] = 'post_thread.html';
$config['file_post_thread_fileboard'] = 'post_thread_fileboard.html';
// Mod page file settings
$config['file_mod_dashboard'] = 'mod/dashboard.html';
$config['file_mod_login'] = 'mod/login.html';
$config['file_mod_confim'] = 'mod/confirm.html';
$config['file_mod_board'] = 'mod/board.html';
$config['file_mod_news'] = 'mod/news.html';
$config['file_mod_log'] = 'mod/log.html';
$config['file_mod_view_ip'] = 'mod/view_ip.html';
$config['file_mod_ban_form'] = 'mod/ban_form.html';
$config['file_mod_ban_list'] = 'mod/ban_list.html';
$config['file_mod_ban_appeals'] = 'mod/ban_appeals.html';
$config['file_mod_noticeboard'] = 'mod/noticeboard.html';
$config['file_mod_search_results'] = 'mod/search_results.html';
$config['file_mod_move'] = 'mod/move.html';
$config['file_mod_move_reply'] = 'mod/move_reply.html';
$config['file_mod_edit_post_form'] = 'mod/edit_post_form.html';
$config['file_mod_user'] = 'mod/user.html';
$config['file_mod_users'] = 'mod/users.html';
$config['file_mod_pm'] = 'mod/pm.html';
$config['file_mod_new_pm'] = 'mod/new_pm.html';
$config['file_mod_inbox'] = 'mod/inbox.html';
$config['file_mod_rebuilt'] = 'mod/rebuilt.html';
$config['file_mod_rebuild'] = 'mod/rebuild.html';
$config['file_mod_report'] = 'mod/report.html';
$config['file_mod_reports'] = 'mod/reports.html';
$config['file_mod_recent_posts'] = 'mod/recent_posts.html';
$config['file_mod_config_editor'] = 'mod/config-editor.html';
$config['file_mod_config_editor_php'] = 'mod/config-editor-php.html';
$config['file_mod_themes'] = 'mod/themes.html';
$config['file_mod_theme_installed'] = 'mod/theme_installed.html';
$config['file_mod_theme_config'] = 'mod/theme_config.html';
$config['file_mod_theme_rebuilt'] = 'mod/theme_rebuilt.html';
$config['file_mod_pages'] = 'mod/pages.html';
$config['file_mod_edit_page'] = 'mod/edit_page.html';
$config['file_mod_debug_antispam'] = 'mod/debug/antispam.html';
$config['file_mod_debug_recent_posts'] = 'mod/debug/recent_posts.html';
$config['file_mod_debug_sql'] = 'mod/debug/sql.html';
$config['file_mod_debug_apc'] = 'mod/debug/apc.html';
// Board directory, followed by a forward-slash (/).
$config['board_path'] = '%s/';
// Misc directories.

View File

@ -116,11 +116,11 @@ function error($message, $priority = true, $debug_stuff = false) {
if ($debug_stuff)
$debug_stuff = array_filter($debug_stuff, $debug_callback);
die(Element('page.html', array(
die(Element($config['file_page_template'], array(
'config' => $config,
'title' => _('Error'),
'subtitle' => _('An error has occured.'),
'body' => Element('error.html', array(
'body' => Element($config['file_error'], array(
'config' => $config,
'message' => $message,
'mod' => $mod,
@ -133,11 +133,11 @@ function error($message, $priority = true, $debug_stuff = false) {
function loginForm($error=false, $username=false, $redirect=false) {
global $config;
die(Element('page.html', array(
die(Element($config['file_page_template'], array(
'index' => $config['root'],
'title' => _('Login'),
'config' => $config,
'body' => Element('login.html', array(
'body' => Element($config['file_login'], array(
'config'=>$config,
'error'=>$error,
'username'=>utf8tohtml($username),
@ -384,7 +384,7 @@ class Post {
public function build($index=false) {
global $board, $config;
return Element('post_reply.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'mod' => $this->mod));
return Element($config['file_post_reply'], array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'mod' => $this->mod));
}
};
@ -448,7 +448,7 @@ class Thread {
event('show-thread', $this);
$file = ($index && $config['file_board']) ? 'post_thread_fileboard.html' : 'post_thread.html';
$file = ($index && $config['file_board']) ? $config['file_post_thread_fileboard'] : $config['file_post_thread'];
$built = Element($file, array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'hasnoko50' => $hasnoko50, 'isnoko50' => $isnoko50, 'mod' => $this->mod));
return $built;

View File

@ -877,11 +877,11 @@ function displayBan($ban) {
// Show banned page and exit
die(
Element('page.html', array(
Element($config['file_page_template'], array(
'title' => _('Banned!'),
'config' => $config,
'boardlist' => createBoardlist(isset($mod) ? $mod : false),
'body' => Element('banned.html', array(
'body' => Element($config['file_banned'], array(
'config' => $config,
'ban' => $ban,
'board' => $board,
@ -1435,7 +1435,7 @@ function index($page, $mod=false, $brief = false) {
}
if ($config['file_board']) {
$body = Element('fileboard.html', array('body' => $body, 'mod' => $mod));
$body = Element($config['file_fileboard'], array('body' => $body, 'mod' => $mod));
}
return array(
@ -1795,7 +1795,7 @@ function buildIndex($global_api = "yes") {
$content['btn'] = getPageButtons($content['pages']);
$content['antibot'] = $antibot;
file_write($filename, Element('index.html', $content));
file_write($filename, Element($config['file_board_index'], $content));
}
elseif ($action == 'delete' || $catalog_api_action == 'delete') {
file_unlink($filename);
@ -2366,7 +2366,7 @@ function buildThread($id, $return = false, $mod = false) {
$hasnoko50 = $thread->postCount() >= $config['noko50_min'];
$antibot = $mod || $return ? false : create_antibot($board['uri'], $id);
$body = Element('thread.html', array(
$body = Element($config['file_thread'], array(
'board' => $board,
'thread' => $thread,
'body' => $thread->build(),
@ -2469,7 +2469,7 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
$hasnoko50 = $thread->postCount() >= $config['noko50_min'];
$body = Element('thread.html', array(
$body = Element($config['file_thread'], array(
'board' => $board,
'thread' => $thread,
'body' => $thread->build(false, true),

View File

@ -9,10 +9,10 @@ defined('TINYBOARD') or exit;
function mod_page($title, $template, $args, $subtitle = false) {
global $config, $mod;
echo Element('page.html', array(
echo Element($config['file_page_template'], array(
'config' => $config,
'mod' => $mod,
'hide_dashboard_link' => $template == 'mod/dashboard.html',
'hide_dashboard_link' => $template == $config['file_mod_dashboard'],
'title' => $title,
'subtitle' => $subtitle,
'boardlist' => createBoardlist($mod),
@ -57,11 +57,11 @@ function mod_login($redirect = false) {
if (isset($_POST['username']))
$args['username'] = $_POST['username'];
mod_page(_('Login'), 'mod/login.html', $args);
mod_page(_('Login'), $config['file_mod_login'], $args);
}
function mod_confirm($request) {
mod_page(_('Confirm action'), 'mod/confirm.html', array('request' => $request, 'token' => make_secure_link_token($request)));
mod_page(_('Confirm action'), $config['file_mod_confim'], array('request' => $request, 'token' => make_secure_link_token($request)));
}
function mod_logout() {
@ -159,7 +159,7 @@ function mod_dashboard() {
$args['logout_token'] = make_secure_link_token('logout');
mod_page(_('Dashboard'), 'mod/dashboard.html', $args);
mod_page(_('Dashboard'), $config['file_mod_dashboard'], $args);
}
function mod_search_redirect() {
@ -331,7 +331,7 @@ function mod_search($type, $search_query_escaped, $page_no = 1) {
// $results now contains the search results
mod_page(_('Search results'), 'mod/search_results.html', array(
mod_page(_('Search results'), $config['file_mod_search_results'], array(
'search_type' => $type,
'search_query' => $search_query,
'search_query_escaped' => $search_query_escaped,
@ -435,7 +435,7 @@ function mod_edit_board($boardName) {
header('Location: ?/', true, $config['redirect_http']);
} else {
mod_page(sprintf('%s: ' . $config['board_abbreviation'], _('Edit board'), $board['uri']), 'mod/board.html', array(
mod_page(sprintf('%s: ' . $config['board_abbreviation'], _('Edit board'), $board['uri']), $config['file_mod_board'], array(
'board' => $board,
'token' => make_secure_link_token('edit/' . $board['uri'])
));
@ -508,7 +508,7 @@ function mod_new_board() {
header('Location: ?/' . $board['uri'] . '/' . $config['file_index'], true, $config['redirect_http']);
}
mod_page(_('New board'), 'mod/board.html', array('new' => true, 'token' => make_secure_link_token('new-board')));
mod_page(_('New board'), $config['file_mod_board'], array('new' => true, 'token' => make_secure_link_token('new-board')));
}
function mod_noticeboard($page_no = 1) {
@ -559,7 +559,7 @@ function mod_noticeboard($page_no = 1) {
$query->execute() or error(db_error($query));
$count = $query->fetchColumn();
mod_page(_('Noticeboard'), 'mod/noticeboard.html', array(
mod_page(_('Noticeboard'), $config['file_mod_noticeboard'], array(
'noticeboard' => $noticeboard,
'count' => $count,
'token' => make_secure_link_token('noticeboard')
@ -628,7 +628,7 @@ function mod_news($page_no = 1) {
$query->execute() or error(db_error($query));
$count = $query->fetchColumn();
mod_page(_('News'), 'mod/news.html', array('news' => $news, 'count' => $count, 'token' => make_secure_link_token('edit_news')));
mod_page(_('News'), $config['file_mod_news'], array('news' => $news, 'count' => $count, 'token' => make_secure_link_token('edit_news')));
}
function mod_news_delete($id) {
@ -668,7 +668,7 @@ function mod_log($page_no = 1) {
$query->execute() or error(db_error($query));
$count = $query->fetchColumn();
mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count));
mod_page(_('Moderation log'), $config['file_mod_log'], array('logs' => $logs, 'count' => $count));
}
function mod_user_log($username, $page_no = 1) {
@ -695,7 +695,7 @@ function mod_user_log($username, $page_no = 1) {
$query->execute() or error(db_error($query));
$count = $query->fetchColumn();
mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'username' => $username));
mod_page(_('Moderation log'), $config['file_mod_log'], array('logs' => $logs, 'count' => $count, 'username' => $username));
}
function mod_board_log($board, $page_no = 1, $hide_names = false, $public = false) {
@ -731,7 +731,7 @@ function mod_board_log($board, $page_no = 1, $hide_names = false, $public = fals
$query->execute() or error(db_error($query));
$count = $query->fetchColumn();
mod_page(_('Board log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'board' => $board, 'hide_names' => $hide_names, 'public' => $public));
mod_page(_('Board log'), $config['file_mod_log'], array('logs' => $logs, 'count' => $count, 'board' => $board, 'hide_names' => $hide_names, 'public' => $public));
}
function mod_view_catalog($boardName) {
@ -762,7 +762,7 @@ function mod_view_board($boardName, $page_no = 1) {
$page['mod'] = true;
$page['config'] = $config;
echo Element('index.html', $page);
echo Element($config['file_board_index'], $page);
}
function mod_view_thread($boardName, $thread) {
@ -943,7 +943,7 @@ function mod_page_ip($cip) {
$args['security_token'] = make_secure_link_token('IP/' . $cip);
mod_page(sprintf('%s: %s', _('IP'), htmlspecialchars($cip)), 'mod/view_ip.html', $args, $args['hostname'] ?? null);
mod_page(sprintf('%s: %s', _('IP'), htmlspecialchars($cip)), $config['file_mod_view_ip'], $args, $args['hostname']);
}
function mod_ban() {
@ -953,7 +953,7 @@ function mod_ban() {
error($config['error']['noaccess']);
if (!isset($_POST['ip'], $_POST['reason'], $_POST['length'], $_POST['board'])) {
mod_page(_('New ban'), 'mod/ban_form.html', array('token' => make_secure_link_token('ban')));
mod_page(_('New ban'), $config['file_mod_ban_form'], array('token' => make_secure_link_token('ban')));
return;
}
@ -994,7 +994,7 @@ function mod_bans() {
return;
}
mod_page(_('Ban list'), 'mod/ban_list.html', array(
mod_page(_('Ban list'), $config['file_mod_ban_list'], array(
'mod' => $mod,
'boards' => json_encode($mod['boards']),
'token' => make_secure_link_token('bans'),
@ -1088,7 +1088,7 @@ function mod_ban_appeals() {
}
}
mod_page(_('Ban appeals'), 'mod/ban_appeals.html', array(
mod_page(_('Ban appeals'), $config['file_mod_ban_appeals'], array(
'ban_appeals' => $ban_appeals,
'token' => make_secure_link_token('ban-appeals')
));
@ -1290,7 +1290,7 @@ function mod_move_reply($originBoard, $postID) {
$security_token = make_secure_link_token($originBoard . '/move_reply/' . $postID);
mod_page(_('Move reply'), 'mod/move_reply.html', array('post' => $postID, 'board' => $originBoard, 'boards' => $boards, 'token' => $security_token));
mod_page(_('Move reply'), $config['file_mod_move_reply'], array('post' => $postID, 'board' => $originBoard, 'boards' => $boards, 'token' => $security_token));
}
@ -1503,7 +1503,7 @@ function mod_move($originBoard, $postID) {
$security_token = make_secure_link_token($originBoard . '/move/' . $postID);
mod_page(_('Move thread'), 'mod/move.html', array('post' => $postID, 'board' => $originBoard, 'boards' => $boards, 'token' => $security_token));
mod_page(_('Move thread'), $config['file_mod_move'], array('post' => $postID, 'board' => $originBoard, 'boards' => $boards, 'token' => $security_token));
}
function mod_ban_post($board, $delete, $post, $token = false) {
@ -1574,7 +1574,7 @@ function mod_ban_post($board, $delete, $post, $token = false) {
'token' => $security_token
);
mod_page(_('New ban'), 'mod/ban_form.html', $args);
mod_page(_('New ban'), $config['file_mod_ban_form'], $args);
}
function mod_edit_post($board, $edit_raw_html, $postID) {
@ -1650,7 +1650,7 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
$post['body'] = str_replace("\t", '&#09;', $post['body']);
}
mod_page(_('Edit post'), 'mod/edit_post_form.html', array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post));
mod_page(_('Edit post'), $config['file_mod_edit_post_form'], array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post));
}
}
@ -1936,7 +1936,7 @@ function mod_user($uid) {
$user['boards'] = explode(',', $user['boards']);
mod_page(_('Edit user'), 'mod/user.html', array(
mod_page(_('Edit user'), $config['file_mod_user'], array(
'user' => $user,
'logs' => $log,
'boards' => listBoards(),
@ -1993,7 +1993,7 @@ function mod_user_new() {
return;
}
mod_page(_('New user'), 'mod/user.html', array('new' => true, 'boards' => listBoards(), 'token' => make_secure_link_token('users/new')));
mod_page(_('New user'), $config['file_mod_user'], array('new' => true, 'boards' => listBoards(), 'token' => make_secure_link_token('users/new')));
}
@ -2015,7 +2015,7 @@ function mod_users() {
$user['demote_token'] = make_secure_link_token("users/{$user['id']}/demote");
}
mod_page(sprintf('%s (%d)', _('Manage users'), count($users)), 'mod/users.html', array('users' => $users));
mod_page(sprintf('%s (%d)', _('Manage users'), count($users)), $config['file_mod_users'], array('users' => $users));
}
function mod_user_promote($uid, $action) {
@ -2105,14 +2105,14 @@ function mod_pm($id, $reply = false) {
if (!$pm['to_username'])
error($config['error']['404']); // deleted?
mod_page(sprintf('%s %s', _('New PM for'), $pm['to_username']), 'mod/new_pm.html', array(
mod_page(sprintf('%s %s', _('New PM for'), $pm['to_username']), $config['file_mod_new_pm'], array(
'username' => $pm['username'],
'id' => $pm['sender'],
'message' => quote($pm['message']),
'token' => make_secure_link_token('new_PM/' . $pm['username'])
));
} else {
mod_page(sprintf('%s &ndash; #%d', _('Private message'), $id), 'mod/pm.html', $pm);
mod_page(sprintf('%s &ndash; #%d', _('Private message'), $id), $config['file_mod_pm'], $pm);
}
}
@ -2133,7 +2133,7 @@ function mod_inbox() {
$message['snippet'] = pm_snippet($message['message']);
}
mod_page(sprintf('%s (%s)', _('PM inbox'), count($messages) > 0 ? $unread . ' unread' : 'empty'), 'mod/inbox.html', array(
mod_page(sprintf('%s (%s)', _('PM inbox'), count($messages) > 0 ? $unread . ' unread' : 'empty'), $config['file_mod_inbox'], array(
'messages' => $messages,
'unread' => $unread
));
@ -2181,7 +2181,7 @@ function mod_new_pm($username) {
header('Location: ?/', true, $config['redirect_http']);
}
mod_page(sprintf('%s %s', _('New PM for'), $username), 'mod/new_pm.html', array(
mod_page(sprintf('%s %s', _('New PM for'), $username), $config['file_mod_new_pm'], array(
'username' => $username,
'id' => $id,
'token' => make_secure_link_token('new_PM/' . $username)
@ -2250,11 +2250,11 @@ function mod_rebuild() {
}
}
mod_page(_('Rebuild'), 'mod/rebuilt.html', array('logs' => $log));
mod_page(_('Rebuild'), $config['file_mod_rebuilt'], array('logs' => $log));
return;
}
mod_page(_('Rebuild'), 'mod/rebuild.html', array(
mod_page(_('Rebuild'), $config['file_mod_rebuild'], array(
'boards' => listBoards(),
'token' => make_secure_link_token('rebuild')
));
@ -2312,7 +2312,7 @@ function mod_reports() {
}
// a little messy and inefficient
$append_html = Element('mod/report.html', array(
$append_html = Element($config['file_mod_report'], array(
'report' => $report,
'config' => $config,
'mod' => $mod,
@ -2339,7 +2339,7 @@ function mod_reports() {
$count++;
}
mod_page(sprintf('%s (%d)', _('Report queue'), $count), 'mod/reports.html', array('reports' => $body, 'count' => $count));
mod_page(sprintf('%s (%d)', _('Report queue'), $count), $config['file_mod_reports'], array('reports' => $body, 'count' => $count));
}
function mod_report_dismiss($id, $all = false) {
@ -2426,7 +2426,7 @@ function mod_recent_posts($lim) {
$last_time = $post['time'];
}
echo mod_page(_('Recent posts'), 'mod/recent_posts.html', array(
echo mod_page(_('Recent posts'), $config['file_mod_recent_posts'], array(
'posts' => $posts,
'limit' => $limit,
'last_time' => $last_time
@ -2471,7 +2471,7 @@ function mod_config($board_config = false) {
}
$instance_config = str_replace("\n", '&#010;', utf8tohtml($instance_config));
mod_page(_('Config editor'), 'mod/config-editor-php.html', array(
mod_page(_('Config editor'), $config['file_mod_config_editor_php'], array(
'php' => $instance_config,
'readonly' => $readonly,
'boards' => listBoards(),
@ -2555,7 +2555,7 @@ function mod_config($board_config = false) {
<p style="text-align:center">You may proceed with these changes manually by copying and pasting the following code to the end of <strong>' . $config_file . '</strong>:</p>
<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" readonly>' . $config_append . '</textarea>
';
echo Element('page.html', $page);
echo Element($config['file_page_template'], $page);
exit;
}
}
@ -2566,7 +2566,7 @@ function mod_config($board_config = false) {
}
mod_page(_('Config editor') . ($board_config ? ': ' . sprintf($config['board_abbreviation'], $board_config) : ''),
'mod/config-editor.html', array(
$config['file_mod_config_editor'], array(
'boards' => listBoards(),
'board' => $board_config,
'conf' => $conf,
@ -2603,7 +2603,7 @@ function mod_themes_list() {
$theme['uninstall_token'] = make_secure_link_token('themes/' . $theme_name . '/uninstall');
}
mod_page(_('Manage themes'), 'mod/themes.html', array(
mod_page(_('Manage themes'), $config['file_mod_themes'], array(
'themes' => $themes,
'themes_in_use' => $themes_in_use,
));
@ -2672,7 +2672,7 @@ function mod_theme_configure($theme_name) {
// Build themes
rebuildThemes('all');
mod_page(sprintf(_($result ? 'Installed theme: %s' : 'Installation failed: %s'), $theme['name']), 'mod/theme_installed.html', array(
mod_page(sprintf(_($result ? 'Installed theme: %s' : 'Installation failed: %s'), $theme['name']), $config['file_mod_theme_installed'], array(
'theme_name' => $theme_name,
'theme' => $theme,
'result' => $result,
@ -2683,7 +2683,7 @@ function mod_theme_configure($theme_name) {
$settings = themeSettings($theme_name);
mod_page(sprintf(_('Configuring theme: %s'), $theme['name']), 'mod/theme_config.html', array(
mod_page(sprintf(_('Configuring theme: %s'), $theme['name']), $config['file_mod_theme_config'], array(
'theme_name' => $theme_name,
'theme' => $theme,
'settings' => $settings,
@ -2716,7 +2716,7 @@ function mod_theme_rebuild($theme_name) {
rebuildTheme($theme_name, 'all');
mod_page(sprintf(_('Rebuilt theme: %s'), $theme_name), 'mod/theme_rebuilt.html', array(
mod_page(sprintf(_('Rebuilt theme: %s'), $theme_name), $config['file_mod_theme_rebuilt'], array(
'theme_name' => $theme_name,
));
}
@ -2814,7 +2814,7 @@ function mod_edit_page($id) {
$fn = (isset($board['uri']) ? ($board['uri'] . '/') : '') . $page['name'] . '.html';
$body = "<div class='ban'>$write</div>";
$html = Element('page.html', array('config' => $config, 'boardlist' => createBoardlist(), 'body' => $body, 'title' => utf8tohtml($page['title'])));
$html = Element($config['file_page_template'], array('config' => $config, 'boardlist' => createBoardlist(), 'body' => $body, 'title' => utf8tohtml($page['title'])));
file_write($fn, $html);
}
@ -2825,7 +2825,7 @@ function mod_edit_page($id) {
$content = $query->fetchColumn();
}
mod_page(sprintf(_('Editing static page: %s'), $page['name']), 'mod/edit_page.html', array('page' => $page, 'token' => make_secure_link_token("edit_page/$id"), 'content' => prettify_textarea($content), 'board' => $board));
mod_page(sprintf(_('Editing static page: %s'), $page['name']), $config['file_mod_edit_page'], array('page' => $page, 'token' => make_secure_link_token("edit_page/$id"), 'content' => prettify_textarea($content), 'board' => $board));
}
function mod_pages($board = false) {
@ -2879,7 +2879,7 @@ function mod_pages($board = false) {
$p['delete_token'] = make_secure_link_token('edit_pages/delete/' . $p['name'] . ($board ? ('/' . $board) : ''));
}
mod_page(_('Pages'), 'mod/pages.html', array('pages' => $pages, 'token' => make_secure_link_token('edit_pages' . ($board ? ('/' . $board) : '')), 'board' => $board));
mod_page(_('Pages'), $config['file_mod_pages'], array('pages' => $pages, 'token' => make_secure_link_token('edit_pages' . ($board ? ('/' . $board) : '')), 'board' => $board));
}
function mod_debug_antispam() {
@ -2916,7 +2916,7 @@ function mod_debug_antispam() {
$query = query('SELECT * FROM ``antispam`` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `created` DESC LIMIT 20') or error(db_error());
$args['recent'] = $query->fetchAll(PDO::FETCH_ASSOC);
mod_page(_('Debug: Anti-spam'), 'mod/debug/antispam.html', $args);
mod_page(_('Debug: Anti-spam'), $config['file_mod_debug_antispam'], $args);
}
function mod_debug_recent_posts() {
@ -2950,7 +2950,7 @@ function mod_debug_recent_posts() {
}
}
mod_page(_('Debug: Recent posts'), 'mod/debug/recent_posts.html', array('posts' => $posts, 'flood_posts' => $flood_posts));
mod_page(_('Debug: Recent posts'), $config['file_mod_debug_recent_posts'], array('posts' => $posts, 'flood_posts' => $flood_posts));
}
function mod_debug_sql() {
@ -2974,7 +2974,7 @@ function mod_debug_sql() {
}
}
mod_page(_('Debug: SQL'), 'mod/debug/sql.html', $args);
mod_page(_('Debug: SQL'), $config['file_mod_debug_sql'], $args);
}
function mod_debug_apc() {
@ -2996,6 +2996,6 @@ function mod_debug_apc() {
$cached_vars[] = $var;
}
mod_page(_('Debug: APC'), 'mod/debug/apc.html', array('cached_vars' => $cached_vars));
mod_page(_('Debug: APC'), $config['file_mod_debug_apc'], array('cached_vars' => $cached_vars));
}

View File

@ -352,7 +352,7 @@ if (isset($_POST['delete'])) {
if (!isset($_POST['json_response'])) {
$index = $root . $board['dir'] . $config['file_index'];
echo Element('page.html', array('config' => $config, 'body' => '<div style="text-align:center"><a href="javascript:window.close()">[ ' . _('Close window') ." ]</a> <a href='$index'>[ " . _('Return') . ' ]</a></div>', 'title' => _('Report submitted!')));
echo Element($config['file_page_template'], array('config' => $config, 'body' => '<div style="text-align:center"><a href="javascript:window.close()">[ ' . _('Close window') ." ]</a> <a href='$index'>[ " . _('Return') . ' ]</a></div>', 'title' => _('Report submitted!')));
} else {
header('Content-Type: text/json');
echo json_encode(array('success' => true));

View File

@ -15,5 +15,5 @@ if ($config['report_captcha']) {
$captcha = null;
}
$body = Element('report.html', ['global' => $global, 'post' => $post, 'board' => $board, 'captcha' => $captcha, 'config' => $config]);
echo Element('page.html', ['config' => $config, 'body' => $body]);
$body = Element($config['file_report'], ['global' => $global, 'post' => $post, 'board' => $board, 'captcha' => $captcha, 'config' => $config]);
echo Element($config['file_page_template'], ['config' => $config, 'body' => $body]);

View File

@ -72,7 +72,7 @@
if(!preg_match('/[^*^\s]/', $phrase) && empty($filters)) {
_syslog(LOG_WARNING, 'Query too broad.');
$body .= '<p class="unimportant" style="text-align:center">(Query too broad.)</p>';
echo Element('page.html', Array(
echo Element($config['file_page_template'], Array(
'config'=>$config,
'title'=>'Search',
'body'=>$body,
@ -133,7 +133,7 @@
if($query->rowCount() == $search_limit) {
_syslog(LOG_WARNING, 'Query too broad.');
$body .= '<p class="unimportant" style="text-align:center">('._('Query too broad.').')</p>';
echo Element('page.html', Array(
echo Element($config['file_page_template'], Array(
'config'=>$config,
'title'=>'Search',
'body'=>$body,
@ -167,7 +167,7 @@
$body .= '<p style="text-align:center" class="unimportant">('._('No results.').')</p>';
}
echo Element('page.html', Array(
echo Element($config['file_page_template'], Array(
'config'=>$config,
'title'=>_('Search'),
'boardlist'=>createBoardlist(),