1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-03 03:27:17 +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/' // '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(); if(function_exists('sql_close')) sql_close();
die(Element('page.html', Array( die(Element('page.html', Array(
'index'=>$config['root'], 'config'=>$config,
'title'=>'Error', 'title'=>'Error',
'subtitle'=>'An error has occured.', 'subtitle'=>'An error has occured.',
'body'=>"<center>" . 'body'=>"<center>" .
@ -82,7 +82,7 @@
'index'=>$config['root'], 'index'=>$config['root'],
'title'=>'Login', 'title'=>'Login',
'body'=>Element('login.html', Array( 'body'=>Element('login.html', Array(
'index'=>$config['root'], 'config'=>$config,
'error'=>$error, 'error'=>$error,
'username'=>$username, 'username'=>$username,
'redirect'=>$redirect 'redirect'=>$redirect

View File

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

30
mod.php
View File

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

View File

@ -1,20 +1,22 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <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> <title>{board[url]} - {board[name]}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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" /> <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> </head>
<body> <body>
{boardlist[top]} {boardlist[top]}
{pm?<div class="top_notice">{pm}</div><hr/>} {pm?<div class="top_notice">{pm}</div><hr/>}
{config[url_banner]?<img class="banner" src="{config[url_banner]}" />}
<h1>{board[url]} - {board[name]}</h1> <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="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} {hidden_inputs}
<input type="hidden" name="board" value="{board[uri]}" /> <input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />} {mod?<input type="hidden" name="mod" value="1" />}
@ -41,7 +43,7 @@
</th> </th>
<td> <td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="40" autocomplete="off" /> <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> </td>
</tr> </tr>
<tr> <tr>

View File

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

View File

@ -1,20 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <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> <title>{board[url]} - {board[name]}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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" /> <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> </head>
<body> <body>
{boardlist[top]} {boardlist[top]}
{pm?<div class="top_notice">{pm}</div><hr/>} {pm?<div class="top_notice">{pm}</div><hr/>}
{url_banner?<img class="banner" src="{url_banner}" />}
<h1>{board[url]} - {board[name]}</h1> <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="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> <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="thread" value="{id}" />
<input type="hidden" name="board" value="{board[uri]}" /> <input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />} {mod?<input type="hidden" name="mod" value="1" />}
@ -41,7 +42,7 @@
</th> </th>
<td> <td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="40" autocomplete="off" /> <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> </td>
</tr> </tr>
<tr> <tr>