diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-03-26 18:23:15 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-03-26 18:23:15 +1100 |
| commit | 92310f445ca443bb6c83a372ba59761b15361c3b (patch) | |
| tree | 38c0ef6adc3ecb0811a1c811a060a2ad005ad9b8 | |
| parent | ab5bece9d54306a12ac9fa8af9d99ffc04584353 (diff) | |
Allow custom URLs for stylesheet/javascript/banner
| -rw-r--r-- | inc/config.php | 5 | ||||
| -rw-r--r-- | inc/display.php | 4 | ||||
| -rw-r--r-- | inc/functions.php | 15 | ||||
| -rw-r--r-- | mod.php | 30 | ||||
| -rw-r--r-- | templates/index.html | 10 | ||||
| -rw-r--r-- | templates/page.html | 2 | ||||
| -rw-r--r-- | templates/thread.html | 9 |
7 files changed, 42 insertions, 33 deletions
diff --git a/inc/config.php b/inc/config.php index 640999ac..38468f57 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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'; ?>
\ No newline at end of file diff --git a/inc/display.php b/inc/display.php index c6570002..966ddab6 100644 --- a/inc/display.php +++ b/inc/display.php @@ -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 diff --git a/inc/functions.php b/inc/functions.php index daa2d6d8..d930712f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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), @@ -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, diff --git a/templates/index.html b/templates/index.html index b14e2e4e..30cb3259 100644 --- a/templates/index.html +++ b/templates/index.html @@ -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>
diff --git a/templates/page.html b/templates/page.html index ad1ef982..f83f0191 100644 --- a/templates/page.html +++ b/templates/page.html @@ -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" />
diff --git a/templates/thread.html b/templates/thread.html index b60e5f7a..e8df7647 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -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>
|
