Browse Source

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

Co-authored-by: chatfield <[email protected]>
Co-authored-by: Fred Brennan <[email protected]>
main
C Hatfield 2 years ago
committed by -
parent
commit
4026e4c448
  1. 63
      inc/config.php
  2. 12
      inc/display.php
  3. 14
      inc/functions.php
  4. 96
      inc/mod/pages.php
  5. 2
      post.php
  6. 4
      report.php
  7. 6
      search.php

63
inc/config.php

@ -1349,7 +1349,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_catalog'] = 'catalog.html'; // Catalog page (used in preg_match for post referer)
$config['file_page'] = '%d.html'; // NB: page is both an index page and a thread
@ -1361,6 +1361,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.

12
inc/display.php

@ -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));
}
};
@ -473,7 +473,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;

14
inc/functions.php

@ -954,11 +954,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,
@ -1493,7 +1493,7 @@ function deletePostPermanent($id, $error_if_doesnt_exist=true, $rebuild_after=tr
// Delete posts and maybe replies
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
event('delete', $post);
$thread_id = $post['thread'];
if (!$post['thread']) {
// Delete thread HTML page
@ -1732,7 +1732,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(
@ -2092,7 +2092,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);
@ -2743,7 +2743,7 @@ function buildThread($id, $return = false, $mod = false, $shadow = 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(),
@ -2846,7 +2846,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),

96
inc/mod/pages.php

@ -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() {
@ -163,7 +163,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() {
@ -335,7 +335,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,
@ -445,7 +445,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'])
));
@ -529,7 +529,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) {
@ -580,7 +580,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')
@ -649,7 +649,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) {
@ -689,7 +689,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) {
@ -716,7 +716,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) {
@ -754,7 +754,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) {
@ -810,7 +810,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) {
@ -995,7 +995,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_announcements() {
@ -1040,7 +1040,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;
}
@ -1081,7 +1081,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'),
@ -1175,7 +1175,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')
));
@ -1394,7 +1394,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));
}
@ -1634,7 +1634,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_merge($originBoard, $postID) {
@ -1970,7 +1970,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_warning_post($board, $delete, $post, $token = false) {
@ -2128,7 +2128,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));
}
}
@ -2729,7 +2729,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(),
@ -2786,7 +2786,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')));
}
@ -2808,7 +2808,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) {
@ -2898,14 +2898,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);
}
}
@ -2926,7 +2926,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
));
@ -2974,7 +2974,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)
@ -3044,11 +3044,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')
));
@ -3106,7 +3106,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,
@ -3133,7 +3133,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) {
@ -3258,7 +3258,7 @@ function mod_report_dismiss($id, $all = false) {
echo $jsondata;
}
else {
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
@ -3352,7 +3352,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(),
@ -3436,7 +3436,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;
}
}
@ -3447,7 +3447,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,
@ -3484,7 +3484,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,
));
@ -3553,7 +3553,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,
@ -3564,7 +3564,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,
@ -3597,7 +3597,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,
));
}
@ -3695,7 +3695,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);
}
@ -3706,7 +3706,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) {
@ -3760,7 +3760,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() {
@ -3797,7 +3797,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() {
@ -3831,7 +3831,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() {
@ -3855,7 +3855,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() {
@ -3877,7 +3877,7 @@ 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));
}

2
post.php

@ -395,7 +395,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));

4
report.php

@ -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]);

6
search.php

@ -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(),

Loading…
Cancel
Save