Fix some layout problems, and caching issues.

This commit is contained in:
tim
2015-11-22 01:43:29 +02:00
parent 925a8572d0
commit 3b8f5e6599
13 changed files with 58 additions and 54 deletions
+1 -2
View File
@@ -12,8 +12,7 @@
<script type="text/javascript" src="utilities.js"></script> <script type="text/javascript" src="utilities.js"></script>
</head> </head>
<? flush(); ?> <? flush(); ?>
<body> <body>
<div id="container"> <div id="container">
<? include_once("./sidebar.inc.php"); ?> <? include_once("./sidebar.inc.php"); ?>
<div id="main"> <div id="main">
+1 -2
View File
@@ -19,8 +19,7 @@
open_db('open'); open_db('open');
require_once("./navigation.lib.php"); require_once("./navigation.lib.php");
?> ?>
<body> <body>
<div id="container"> <div id="container">
<? include_once("./sidebar.inc.php"); ?> <? include_once("./sidebar.inc.php"); ?>
<div id="main"> <div id="main">
+1 -2
View File
@@ -19,8 +19,7 @@
open_db('open'); open_db('open');
require_once("./navigation.lib.php"); require_once("./navigation.lib.php");
?> ?>
<body> <body>
<div id="container"> <div id="container">
<? include_once("./sidebar.inc.php"); ?> <? include_once("./sidebar.inc.php"); ?>
<div id="main"> <div id="main">
+6 -6
View File
@@ -41,7 +41,6 @@ if (!isset($_SESSION['editor'])) {
</head> </head>
<? flush(); ?> <? flush(); ?>
<body> <body>
<div id="container"> <div id="container">
<? include_once("../sidebar.inc.php"); ?> <? include_once("../sidebar.inc.php"); ?>
<div id="main"> <div id="main">
@@ -54,15 +53,18 @@ if (!isset($_SESSION['editor'])) {
<? } else { ?> <? } else { ?>
<form action="https://xxx.org.za<?= $_SERVER['REQUEST_URI'] ?>" method="post"> <form action="https://xxx.org.za<?= $_SERVER['REQUEST_URI'] ?>" method="post">
<div>
<label for="username">Username: </label> <label for="username">Username: </label>
<input type="text" id="username" name="username" /> <input type="text" id="username" name="username" />
<br class="clear" /> </div>
<div>
<label for="password">Password: </label> <label for="password">Password: </label>
<input type="password" id="password" name="password" /> <input type="password" id="password" name="password" />
<br class="clear" /> </div>
<div>
<label for="email">Email: </label> <label for="email">Email: </label>
<input type="text" id="email" name="email" /> <input type="text" id="email" name="email" />
<br class="clear" /> </div>
<div class="submission"> <div class="submission">
<button type="submit" id="adduser" name="adduser" value="1">Add editor</button> <button type="submit" id="adduser" name="adduser" value="1">Add editor</button>
</div> </div>
@@ -74,8 +76,6 @@ if (!isset($_SESSION['editor'])) {
<? include_once("../bottombar.inc.php"); ?> <? include_once("../bottombar.inc.php"); ?>
</div> <!-- container --> </div> <!-- container -->
<? include('../bottombar.inc.php'); ?>
</body> </body>
</html> </html>
-1
View File
@@ -34,7 +34,6 @@ if (!isset($_SESSION['editor'])) {
$id = get_id(); $id = get_id();
?> ?>
<body> <body>
<div id='container'> <div id='container'>
<? include_once("../sidebar.inc.php"); ?> <? include_once("../sidebar.inc.php"); ?>
<div id='main'> <div id='main'>
-1
View File
@@ -25,7 +25,6 @@
$editable = TRUE; $editable = TRUE;
?> ?>
<body> <body>
<div id='container'> <div id='container'>
<? include_once("../sidebar.inc.php"); ?> <? include_once("../sidebar.inc.php"); ?>
<div id='main'> <div id='main'>
+6 -4
View File
@@ -67,7 +67,6 @@ if (isset($_SESSION['editor'])) {
</head> </head>
<? flush(); ?> <? flush(); ?>
<body> <body>
<div id="container"> <div id="container">
<? include_once("../sidebar.inc.php"); ?> <? include_once("../sidebar.inc.php"); ?>
<div id="main"> <div id="main">
@@ -81,15 +80,18 @@ if ($denied)
?> ?>
<form action="<? echo "https://xxx.org.za".$_SERVER['REQUEST_URI']; ?>" method="post"> <form action="<? echo "https://xxx.org.za".$_SERVER['REQUEST_URI']; ?>" method="post">
<div>
<label for="username">Username: </label> <label for="username">Username: </label>
<input type="text" id="username" name="username" /> <input type="text" id="username" name="username" />
<br class="clear" /> </div>
<div>
<label for="password">Password: </label> <label for="password">Password: </label>
<input type="password" id="password" name="password" /> <input type="password" id="password" name="password" />
<br class="clear" /> </div>
<div>
<label for="remember">Remember me:</label> <label for="remember">Remember me:</label>
<input type="checkbox" id="remember" name="remember" checked /> <input type="checkbox" id="remember" name="remember" checked />
<br class="clear" /> </div>
<div class="submission"> <div class="submission">
<button type="submit" id="login" name="login" value="1">Login</button> <button type="submit" id="login" name="login" value="1">Login</button>
</div> </div>
+7 -3
View File
@@ -1,11 +1,15 @@
<? <?
//include_once('../session.lib.php');
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
include_once('../session.lib.php');
if ( ! isset($_SERVER['HTTPS'])) { if ( ! isset($_SERVER['HTTPS'])) {
header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']); header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
} }
require_once("../session.lib.php");
if (isset($_SESSION['editor'])) { if (isset($_SESSION['editor'])) {
if (isset($_COOKIE[session_name()])) { if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/'); setcookie(session_name(), '', strtotime('-1 day'), '/');
} }
session_destroy(); session_destroy();
} }
@@ -21,7 +25,7 @@ if (isset($_SESSION['referrer'])) {
header("Location: $url"); header("Location: $url");
return; return;
} else { } else {
header("Location: http://xxx.org.za/"); header("Location: https://xxx.org.za/");
return; return;
} }
?> ?>
+20 -10
View File
@@ -1,4 +1,4 @@
#title, #author, #email, #comments, #story, #username, #password, #remember, #recaptcha_response_field { #main form #title, #main form #author, #main form #email, #main form #comments, #main form #story, #main form #username, #main form #password, #main form #remember {
border: 1px dashed #006633; border: 1px dashed #006633;
display: block; display: block;
width: 250px; width: 250px;
@@ -7,41 +7,41 @@
margin-top: 5px; margin-top: 5px;
padding-left: 2px; padding-left: 2px;
} }
input#remember { #main form input#remember {
margin-left: -2px; margin-left: -2px;
margin-top: 7px; margin-top: 7px;
width: inherit; width: initial;
} }
#story { #main form #story {
width: 450px; width: 450px;
height: 200px; height: 200px;
} }
#htmloptions { #main form #htmloptions {
display: block; display: block;
float: left; float: left;
width: auto; width: auto;
border: 1px solid #006633; border: 1px solid #006633;
} }
.submission { #main form .submission {
margin-top: 10px; margin-top: 10px;
margin-left: 120px; margin-left: 120px;
} }
#preview, #submit, #delete, #login, #adduser { #main form #preview, #submit, #delete, #login, #adduser {
border: 1px dashed #006633; border: 1px dashed #006633;
background-color: #FFFFFF; background-color: #FFFFFF;
font-weight: bold; font-weight: bold;
margin-right: 5px; margin-right: 5px;
} }
#hidden { #main form #hidden {
display: block; display: block;
float: left; float: left;
margin: 5px 0; margin: 5px 0;
} }
label { #main form label {
display: block; display: block;
float: left; float: left;
margin-bottom: 5px; margin-bottom: 5px;
@@ -51,6 +51,16 @@ label {
padding-right: 20px; padding-right: 20px;
} }
#main form>div {
overflow: auto;
width: 100%
}
#main form>div.textarea {
width: inherit;
}
#main form>div.g-recaptcha {
overflow: inherit;
}
br.clear { br.clear {
clear: both; clear: both;
} }
@@ -102,9 +112,9 @@ div.textarea {
} }
#uploadparent { #uploadparent {
width: 455px;
height: 200px; height: 200px;
border: 1px dashed #006633; border: 1px dashed #006633;
margin-bottom: 10px;
} }
#uploadparent>div { #uploadparent>div {
padding: 10px; padding: 10px;
+5 -16
View File
@@ -20,33 +20,29 @@ if (count($validate) !== 0) {
?> ?>
<form method="post" enctype="multipart/form-data" onsubmit="return review()" action=""> <form id="write" method="post" enctype="multipart/form-data" onsubmit="return review()" action="">
<div> <div>
<label<?= isset($validate['title']) ? ' class="red"' : '' ?> for="title">Title:</label> <label<?= isset($validate['title']) ? ' class="red"' : '' ?> for="title">Title:</label>
<input type="text" id="title" name="title" maxlength="150" value="<?= isset($title) ? $title : '' ?>" /> <input type="text" id="title" name="title" maxlength="150" value="<?= isset($title) ? $title : '' ?>" />
<span class="required">&nbsp;*</span> <span class="required">&nbsp;*</span>
<br class="clear" />
</div> </div>
<div> <div>
<label<?= isset($validate['author']) ? ' class="red"' : '' ?> for="author">Author:</label> <label<?= isset($validate['author']) ? ' class="red"' : '' ?> for="author">Author:</label>
<input type="text" name="author" id="author" value="<?= isset($author) ? $author : '' ?>" maxlength="150" /> <input type="text" name="author" id="author" value="<?= isset($author) ? $author : '' ?>" maxlength="150" />
<span class="required">&nbsp;*</span> <span class="required">&nbsp;*</span>
<br class="clear" />
</div> </div>
<div> <div>
<label<?= isset($validate['email']) ? ' class="red"' : '' ?> for="email">Email address:</label> <label<?= isset($validate['email']) ? ' class="red"' : '' ?> for="email">Email address:</label>
<input type="text" name="email" id="email" maxlength="150" value="<?= isset($email) ? $email : ''?>" /> <input type="text" name="email" id="email" maxlength="150" value="<?= isset($email) ? $email : ''?>" />
<br class="clear" /> <br />
<div class="note">(An email address where editors can reach the author.)</div> <div class="note">(An email address where editors can reach the author.)</div>
<br class="clear" />
</div> </div>
<div class="tab<?= isset($validate['story']) ? ' red' : '' ?>" onclick="showHide('text');">Text:</div> <span class="tab<?= isset($validate['story']) ? ' red' : '' ?>" onclick="showHide('text');">Text:</span>
<div class="tab<?= isset($validate['upload']) ? ' red' : '' ?>" onclick="showHide('upload');">Image:</div> <span class="tab<?= isset($validate['upload']) ? ' red' : '' ?>" onclick="showHide('upload');">Image:</span>
<div id="wordcounter" class="counter" style="display: none;">0 words</div> <span id="wordcounter" class="counter" style="display: none;">0 words</span>
<div class="textarea"> <div class="textarea">
<div id="textparent"> <div id="textparent">
@@ -55,7 +51,6 @@ if (count($validate) !== 0) {
echo (isset($story) ? $story : '') echo (isset($story) ? $story : '')
?> ?>
</textarea> </textarea>
<br class="clear" />
<div class="note">(To get line-breaks&mdash;as in poetry&mdash;instead of paragraph breaks, hit shift-enter instead of enter.)</div> <div class="note">(To get line-breaks&mdash;as in poetry&mdash;instead of paragraph breaks, hit shift-enter instead of enter.)</div>
</div> </div>
<div class="upload" id="uploadparent" style="display: none;"><div> <div class="upload" id="uploadparent" style="display: none;"><div>
@@ -71,9 +66,7 @@ if (isset($file_src) || isset($img)) {
echo ' <div class="in-note">You may upload an image of 100,000 pixels instead of text:</div>'; echo ' <div class="in-note">You may upload an image of 100,000 pixels instead of text:</div>';
} }
?> ?>
<br class="clear" />
<input type="file" name="upload" id="upload" /> <input type="file" name="upload" id="upload" />
<br class="clear" />
<? <?
if (isset($file_src) || isset($img)) { if (isset($file_src) || isset($img)) {
echo ' <div>'; echo ' <div>';
@@ -88,14 +81,12 @@ if (isset($file_src) || isset($img)) {
} }
?> ?>
</div></div> </div></div>
<br class="clear" />
</div> </div>
<? if ($is_admin) { ?> <? if ($is_admin) { ?>
<div> <div>
<label<? isset($validate['comments']) ? ' class="red"' : '' ?> for="comments">Comments:</label> <label<? isset($validate['comments']) ? ' class="red"' : '' ?> for="comments">Comments:</label>
<input type="text" name="comments" id="comments" maxlength="150" value="<?= isset($comments) ? $comments : '' ?>" /> <input type="text" name="comments" id="comments" maxlength="150" value="<?= isset($comments) ? $comments : '' ?>" />
<br class="clear" />
</div> </div>
<input type="hidden" id="editor" name="editor" value="<?= $username ?>" /> <input type="hidden" id="editor" name="editor" value="<?= $username ?>" />
<? } else { ?> <? } else { ?>
@@ -109,7 +100,6 @@ if (isset($file_src) || isset($img)) {
<? <?
if (!$is_admin && (($action == "") || isset($validate['captcha']))) { if (!$is_admin && (($action == "") || isset($validate['captcha']))) {
echo '<div><br class="clear" /></div>';
echo '<div class="g-recaptcha" data-sitekey="'.htmlspecialchars(config('RECAPTCHA_SITE_KEY')).'"></div>'; echo '<div class="g-recaptcha" data-sitekey="'.htmlspecialchars(config('RECAPTCHA_SITE_KEY')).'"></div>';
} }
@@ -118,7 +108,6 @@ if (isset($file_src) || isset($img)) {
echo '<div>'; echo '<div>';
echo '<label'.(isset($validate['hidden']) ? ' class="red"' : '').' for="hidden">Hidden:</label>'; echo '<label'.(isset($validate['hidden']) ? ' class="red"' : '').' for="hidden">Hidden:</label>';
echo '<input type="checkbox" name="hidden" id="hidden"'.$checked.' />'; echo '<input type="checkbox" name="hidden" id="hidden"'.$checked.' />';
echo '<br class="clear" />';
echo '</div>'; echo '</div>';
} }
?> ?>
+7 -1
View File
@@ -1,6 +1,8 @@
<? <?
require_once(realpath(dirname(__FILE__) . '/open_db.lib.php')); require_once(realpath(dirname(__FILE__) . '/open_db.lib.php'));
$is_admin = FALSE;
if (isset($_SERVER['HTTPS'])) { if (isset($_SERVER['HTTPS'])) {
session_cache_limiter('private'); session_cache_limiter('private');
session_set_cookie_params(strtotime('+1 year'), '/', '.xxx.org.za', TRUE, TRUE); session_set_cookie_params(strtotime('+1 year'), '/', '.xxx.org.za', TRUE, TRUE);
@@ -10,12 +12,16 @@ if (isset($_SERVER['HTTPS'])) {
$is_admin = TRUE; $is_admin = TRUE;
$username = $_SESSION['editor']; $username = $_SESSION['editor'];
} elseif (check_persistent_login()) { } elseif (check_persistent_login()) {
// check_persistent_login() sets $_SESSION['editor'] // Note that check_persistent_login() sets $_SESSION['editor']
$is_admin = TRUE; $is_admin = TRUE;
$username = $_SESSION['editor']; $username = $_SESSION['editor'];
} else { } else {
$is_admin = FALSE; $is_admin = FALSE;
} }
// Don't cache if $is_admin is set
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );
} }
function check_persistent_login() { function check_persistent_login() {
+1 -5
View File
@@ -1,7 +1,3 @@
<?
if (!isset($is_admin))
$is_admin=FALSE
?>
<aside id="sidebar"> <aside id="sidebar">
<div class="logo"> <div class="logo">
@@ -22,7 +18,7 @@ if (preg_match("#^(/$|/index)#", $_SERVER['REQUEST_URI'])) {
<li><a href="/about">About <span class="xxx">x&middot;x&middot;x</span></a></li> <li><a href="/about">About <span class="xxx">x&middot;x&middot;x</span></a></li>
<li><a href="/article?start=5">Archive</a></li> <li><a href="/article?start=5">Archive</a></li>
<li><a href="/publish">Add</a>/<a href="/publish/edit" class="sidelink">Edit</a></li> <li><a href="/publish">Add</a>/<a href="/publish/edit" class="sidelink">Edit</a></li>
<? if ($is_admin) { <? if (isset($is_admin) && $is_admin) {
echo '<li><a href="/publish/addeditor">Add editor</a></li>'; echo '<li><a href="/publish/addeditor">Add editor</a></li>';
echo '<li><a href="/publish/logout">Logout</a></li>'; echo '<li><a href="/publish/logout">Logout</a></li>';
} }
+3 -1
View File
@@ -54,7 +54,6 @@ footer#bottom p {
} }
#sidebar { #sidebar {
color: #FFFFFF;
} }
#sidebar .logo { #sidebar .logo {
font-family: monospace; font-family: monospace;
@@ -63,6 +62,9 @@ footer#bottom p {
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
} }
#sidebar .logo a {
color: #FFFFFF;
}
#sidebar .links { #sidebar .links {
font-size: 9pt; font-size: 9pt;
color: #006633; color: #006633;