1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-29 01:34:31 +01:00

Allow custom URLs for stylesheet/javascript/banner

This commit is contained in:
Savetheinternet 2011-03-26 18:23:15 +11:00
parent 258620300b
commit d1a74bd49d
7 changed files with 42 additions and 33 deletions

View File

@ -419,4 +419,9 @@
// 'status' => 'http://status.example.org/'
//);
// Set custom locations for stylesheets, scripts and maybe a banner.
// This can be good for load balancing across multiple servers or hostnames.
// $config['url_stylesheet'] = 'http://static.example.org/style.css';
// $config['url_javascript'] = 'http://static.example.org/script.js';
// $config['url_banner'] = '/banner.php';
?>

View File

@ -61,7 +61,7 @@
if(function_exists('sql_close')) sql_close();
die(Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Error',
'subtitle'=>'An error has occured.',
'body'=>"<center>" .
@ -82,7 +82,7 @@
'index'=>$config['root'],
'title'=>'Login',
'body'=>Element('login.html', Array(
'index'=>$config['root'],
'config'=>$config,
'error'=>$error,
'username'=>$username,
'redirect'=>$redirect

View File

@ -12,6 +12,11 @@
require $board['dir'] . '/config.php';
}
if(!isset($config['url_stylesheet']))
$config['url_stylesheet'] = $config['root'] . 'style.css';
if(!isset($config['url_javascript']))
$config['url_javascript'] = $config['root'] . 'script.js';
if(!isset($config['post_url']))
$config['post_url'] = $config['root'] . $config['file_post'];
@ -56,7 +61,6 @@
else
$config['uri_img'] = sprintf($config['uri_img'], $board['dir']);
if($config['root_file']) {
chdir($config['root_file']);
}
@ -256,7 +260,7 @@
// Show banned page and exit
die(Element('page.html', Array(
'index' => $config['root'],
'config' => $config,
'title' => 'Banned',
'subtitle' => 'You are banned!',
'body' => $body
@ -503,11 +507,10 @@
}
return Array(
'button'=>$config['button_newtopic'],
'board'=>$board,
'body'=>$body,
'post_url' => $config['post_url'],
'index' => $config['root'],
'config' => $config,
'boardlist' => createBoardlist($mod)
);
}
@ -1008,11 +1011,9 @@
if(!isset($thread)) error($config['error']['nonexistant']);
$body = Element('thread.html', Array(
'button'=>$config['button_reply'],
'board'=>$board,
'body'=>$thread->build(),
'post_url' => $config['post_url'],
'index' => $config['root'],
'config' => $config,
'id' => $id,
'mod' => $mod,
'boardlist' => createBoardlist($mod),

30
mod.php
View File

@ -109,7 +109,7 @@
}
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Dashboard',
'body'=>$body
//,'mod'=>true /* All 'mod' does, at this point, is put the "Return to dashboard" link in. */
@ -140,7 +140,7 @@
$body .= '</table>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Moderation log',
'body'=>$body,
'mod'=>true
@ -187,7 +187,7 @@
'</form>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Private message',
'body'=>$body,
'mod'=>true
@ -225,7 +225,7 @@
$query->execute() or error(db_error($query));
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'PM sent',
'body'=>'<p style="text-align:center">Message sent successfully to ' . htmlentities($to['username']) . '.</p>',
'mod'=>true
@ -252,7 +252,7 @@
'</form>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'New PM for ' . htmlentities($to['username']),
'body'=>$body
,'mod'=>true
@ -314,7 +314,7 @@
$body .= '</form>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Manage users',
'body'=>$body
,'mod'=>true
@ -372,7 +372,7 @@
'</form></fieldset>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'New user',
'body'=>$body
,'mod'=>true
@ -461,7 +461,7 @@
'</fieldset>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Edit user',
'body'=>$body
,'mod'=>true
@ -522,7 +522,7 @@
($reports == $count['count'] ? 'all ' . $reports . ' reports' : $reports . ' of ' . $count['count'] . ' reports') . '.</p>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Report queue',
'body'=>$body,
'mod'=>true
@ -637,7 +637,7 @@
'</fieldset>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Manage ' . sprintf($config['board_abbreviation'], $board['uri']),
'body'=>$body,
'mod'=>true
@ -721,7 +721,7 @@
}
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Ban list',
'body'=>$body,
'mod'=>true
@ -792,7 +792,7 @@
$body = '<fieldset><legend>Configuration</legend><table>' . $data . '</table></fieldset>';
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'Configuration',
'body'=>$body,
'mod'=>true
@ -873,7 +873,7 @@
// TODO: Statistics, etc, in the dashboard.
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'New board',
'body'=>$body,
'mod'=>true
@ -1186,7 +1186,7 @@
$body = form_newBan($post['ip'], null, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false, $delete ? $post['id'] : false, $delete ? $boardName : false);
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'New ban',
'body'=>$body,
'mod'=>true
@ -1295,7 +1295,7 @@
$body .= form_newBan($ip, null, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false);
echo Element('page.html', Array(
'index'=>$config['root'],
'config'=>$config,
'title'=>'IP: ' . $ip,
'subtitle' => $host,
'body'=>$body,

View File

@ -1,20 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="screen" href="{index}style.css"/>
<link rel="stylesheet" media="screen" href="{config[url_stylesheet]}"/>
<title>{board[url]} - {board[name]}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<script type="text/javascript" src="{index}main.js"></script>
<script type="text/javascript" src="{config[url_javascript]}"></script>
{config[meta_keywords]?<meta name="keywords" content="{config[meta_keywords]}" />}
</head>
<body>
{boardlist[top]}
{pm?<div class="top_notice">{pm}</div><hr/>}
{config[url_banner]?<img class="banner" src="{config[url_banner]}" />}
<h1>{board[url]} - {board[name]}</h1>
<div class="title">{board[title]?{board[title]}}<p>{mod?<a href="?/">Return to dashboard</a>}</p></div>
<form onsubmit="return dopost(this);" enctype="multipart/form-data" action="{post_url}" method="post">
<form onsubmit="return dopost(this);" enctype="multipart/form-data" action="{config[post_url]}" method="post">
{hidden_inputs}
<input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />}
@ -41,7 +43,7 @@
</th>
<td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="40" autocomplete="off" />
<input accesskey="s" style="float:right;" type="submit" name="post" value="{button=New Topic}" />
<input accesskey="s" style="float:right;" type="submit" name="post" value="{config[button_newtopic]=New Topic}" />
</td>
</tr>
<tr>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="screen" href="{index}style.css"/>
<link rel="stylesheet" media="screen" href="{config[url_stylesheet]}"/>
<title>{title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />

View File

@ -1,20 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="screen" href="{index}style.css"/>
<link rel="stylesheet" media="screen" href="{config[url_stylesheet]}"/>
<title>{board[url]} - {board[name]}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<script type="text/javascript" src="{index}main.js"></script>
<script type="text/javascript" src="{config[url_javascript]}"></script>
</head>
<body>
{boardlist[top]}
{pm?<div class="top_notice">{pm}</div><hr/>}
{url_banner?<img class="banner" src="{url_banner}" />}
<h1>{board[url]} - {board[name]}</h1>
<div class="title">{board[title]?{board[title]}}<p>{mod?<a href="?/">Return to dashboard</a>}</p></div>
<div class="banner">Posting mode: Reply <a class="unimportant" href="{return}">[Return.]</a></div>
<form onsubmit="return dopost(this);" enctype="multipart/form-data" action="{post_url}" method="post">{hidden_inputs}
<form onsubmit="return dopost(this);" enctype="multipart/form-data" action="{config[post_url]}" method="post">{hidden_inputs}
<input type="hidden" name="thread" value="{id}" />
<input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />}
@ -41,7 +42,7 @@
</th>
<td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="40" autocomplete="off" />
<input accesskey="s" style="float:right;" type="submit" name="post" value="{button=New Topic}" />
<input accesskey="s" style="float:right;" type="submit" name="post" value="{config[button_reply]=New Reply}" />
</td>
</tr>
<tr>