Fix some layout problems, and caching issues.
This commit is contained in:
@@ -12,8 +12,7 @@
|
||||
<script type="text/javascript" src="utilities.js"></script>
|
||||
</head>
|
||||
<? flush(); ?>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<div id="container">
|
||||
<? include_once("./sidebar.inc.php"); ?>
|
||||
<div id="main">
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@
|
||||
open_db('open');
|
||||
require_once("./navigation.lib.php");
|
||||
?>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<div id="container">
|
||||
<? include_once("./sidebar.inc.php"); ?>
|
||||
<div id="main">
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
open_db('open');
|
||||
require_once("./navigation.lib.php");
|
||||
?>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<div id="container">
|
||||
<? include_once("./sidebar.inc.php"); ?>
|
||||
<div id="main">
|
||||
|
||||
@@ -41,7 +41,6 @@ if (!isset($_SESSION['editor'])) {
|
||||
</head>
|
||||
<? flush(); ?>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
<? include_once("../sidebar.inc.php"); ?>
|
||||
<div id="main">
|
||||
@@ -54,15 +53,18 @@ if (!isset($_SESSION['editor'])) {
|
||||
<? } else { ?>
|
||||
|
||||
<form action="https://xxx.org.za<?= $_SERVER['REQUEST_URI'] ?>" method="post">
|
||||
<div>
|
||||
<label for="username">Username: </label>
|
||||
<input type="text" id="username" name="username" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="password">Password: </label>
|
||||
<input type="password" id="password" name="password" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="email">Email: </label>
|
||||
<input type="text" id="email" name="email" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<div class="submission">
|
||||
<button type="submit" id="adduser" name="adduser" value="1">Add editor</button>
|
||||
</div>
|
||||
@@ -74,8 +76,6 @@ if (!isset($_SESSION['editor'])) {
|
||||
<? include_once("../bottombar.inc.php"); ?>
|
||||
</div> <!-- container -->
|
||||
|
||||
<? include('../bottombar.inc.php'); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ if (!isset($_SESSION['editor'])) {
|
||||
$id = get_id();
|
||||
?>
|
||||
<body>
|
||||
|
||||
<div id='container'>
|
||||
<? include_once("../sidebar.inc.php"); ?>
|
||||
<div id='main'>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
$editable = TRUE;
|
||||
?>
|
||||
<body>
|
||||
|
||||
<div id='container'>
|
||||
<? include_once("../sidebar.inc.php"); ?>
|
||||
<div id='main'>
|
||||
|
||||
+6
-4
@@ -67,7 +67,6 @@ if (isset($_SESSION['editor'])) {
|
||||
</head>
|
||||
<? flush(); ?>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
<? include_once("../sidebar.inc.php"); ?>
|
||||
<div id="main">
|
||||
@@ -81,15 +80,18 @@ if ($denied)
|
||||
?>
|
||||
|
||||
<form action="<? echo "https://xxx.org.za".$_SERVER['REQUEST_URI']; ?>" method="post">
|
||||
<div>
|
||||
<label for="username">Username: </label>
|
||||
<input type="text" id="username" name="username" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="password">Password: </label>
|
||||
<input type="password" id="password" name="password" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="remember">Remember me:</label>
|
||||
<input type="checkbox" id="remember" name="remember" checked />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<div class="submission">
|
||||
<button type="submit" id="login" name="login" value="1">Login</button>
|
||||
</div>
|
||||
|
||||
+7
-3
@@ -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'])) {
|
||||
header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
|
||||
}
|
||||
require_once("../session.lib.php");
|
||||
if (isset($_SESSION['editor'])) {
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(), '', time()-42000, '/');
|
||||
setcookie(session_name(), '', strtotime('-1 day'), '/');
|
||||
}
|
||||
session_destroy();
|
||||
}
|
||||
@@ -21,7 +25,7 @@ if (isset($_SESSION['referrer'])) {
|
||||
header("Location: $url");
|
||||
return;
|
||||
} else {
|
||||
header("Location: http://xxx.org.za/");
|
||||
header("Location: https://xxx.org.za/");
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
+20
-10
@@ -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;
|
||||
display: block;
|
||||
width: 250px;
|
||||
@@ -7,41 +7,41 @@
|
||||
margin-top: 5px;
|
||||
padding-left: 2px;
|
||||
}
|
||||
input#remember {
|
||||
#main form input#remember {
|
||||
margin-left: -2px;
|
||||
margin-top: 7px;
|
||||
width: inherit;
|
||||
width: initial;
|
||||
}
|
||||
|
||||
#story {
|
||||
#main form #story {
|
||||
width: 450px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
#htmloptions {
|
||||
#main form #htmloptions {
|
||||
display: block;
|
||||
float: left;
|
||||
width: auto;
|
||||
border: 1px solid #006633;
|
||||
}
|
||||
|
||||
.submission {
|
||||
#main form .submission {
|
||||
margin-top: 10px;
|
||||
margin-left: 120px;
|
||||
}
|
||||
#preview, #submit, #delete, #login, #adduser {
|
||||
#main form #preview, #submit, #delete, #login, #adduser {
|
||||
border: 1px dashed #006633;
|
||||
background-color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
margin-right: 5px;
|
||||
}
|
||||
#hidden {
|
||||
#main form #hidden {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
label {
|
||||
#main form label {
|
||||
display: block;
|
||||
float: left;
|
||||
margin-bottom: 5px;
|
||||
@@ -51,6 +51,16 @@ label {
|
||||
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 {
|
||||
clear: both;
|
||||
}
|
||||
@@ -102,9 +112,9 @@ div.textarea {
|
||||
}
|
||||
|
||||
#uploadparent {
|
||||
width: 455px;
|
||||
height: 200px;
|
||||
border: 1px dashed #006633;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
#uploadparent>div {
|
||||
padding: 10px;
|
||||
|
||||
+5
-16
@@ -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>
|
||||
<label<?= isset($validate['title']) ? ' class="red"' : '' ?> for="title">Title:</label>
|
||||
<input type="text" id="title" name="title" maxlength="150" value="<?= isset($title) ? $title : '' ?>" />
|
||||
<span class="required"> *</span>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label<?= isset($validate['author']) ? ' class="red"' : '' ?> for="author">Author:</label>
|
||||
<input type="text" name="author" id="author" value="<?= isset($author) ? $author : '' ?>" maxlength="150" />
|
||||
<span class="required"> *</span>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label<?= isset($validate['email']) ? ' class="red"' : '' ?> for="email">Email address:</label>
|
||||
<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>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
<div class="tab<?= isset($validate['story']) ? ' red' : '' ?>" onclick="showHide('text');">Text:</div>
|
||||
<div class="tab<?= isset($validate['upload']) ? ' red' : '' ?>" onclick="showHide('upload');">Image:</div>
|
||||
<div id="wordcounter" class="counter" style="display: none;">0 words</div>
|
||||
<span class="tab<?= isset($validate['story']) ? ' red' : '' ?>" onclick="showHide('text');">Text:</span>
|
||||
<span class="tab<?= isset($validate['upload']) ? ' red' : '' ?>" onclick="showHide('upload');">Image:</span>
|
||||
<span id="wordcounter" class="counter" style="display: none;">0 words</span>
|
||||
|
||||
<div class="textarea">
|
||||
<div id="textparent">
|
||||
@@ -55,7 +51,6 @@ if (count($validate) !== 0) {
|
||||
echo (isset($story) ? $story : '')
|
||||
?>
|
||||
</textarea>
|
||||
<br class="clear" />
|
||||
<div class="note">(To get line-breaks—as in poetry—instead of paragraph breaks, hit shift-enter instead of enter.)</div>
|
||||
</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>';
|
||||
}
|
||||
?>
|
||||
<br class="clear" />
|
||||
<input type="file" name="upload" id="upload" />
|
||||
<br class="clear" />
|
||||
<?
|
||||
if (isset($file_src) || isset($img)) {
|
||||
echo ' <div>';
|
||||
@@ -88,14 +81,12 @@ if (isset($file_src) || isset($img)) {
|
||||
}
|
||||
?>
|
||||
</div></div>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
<? if ($is_admin) { ?>
|
||||
<div>
|
||||
<label<? isset($validate['comments']) ? ' class="red"' : '' ?> for="comments">Comments:</label>
|
||||
<input type="text" name="comments" id="comments" maxlength="150" value="<?= isset($comments) ? $comments : '' ?>" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<input type="hidden" id="editor" name="editor" value="<?= $username ?>" />
|
||||
<? } else { ?>
|
||||
@@ -109,7 +100,6 @@ if (isset($file_src) || isset($img)) {
|
||||
|
||||
<?
|
||||
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>';
|
||||
}
|
||||
|
||||
@@ -118,7 +108,6 @@ if (isset($file_src) || isset($img)) {
|
||||
echo '<div>';
|
||||
echo '<label'.(isset($validate['hidden']) ? ' class="red"' : '').' for="hidden">Hidden:</label>';
|
||||
echo '<input type="checkbox" name="hidden" id="hidden"'.$checked.' />';
|
||||
echo '<br class="clear" />';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
+7
-1
@@ -1,6 +1,8 @@
|
||||
<?
|
||||
require_once(realpath(dirname(__FILE__) . '/open_db.lib.php'));
|
||||
|
||||
$is_admin = FALSE;
|
||||
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
session_cache_limiter('private');
|
||||
session_set_cookie_params(strtotime('+1 year'), '/', '.xxx.org.za', TRUE, TRUE);
|
||||
@@ -10,12 +12,16 @@ if (isset($_SERVER['HTTPS'])) {
|
||||
$is_admin = TRUE;
|
||||
$username = $_SESSION['editor'];
|
||||
} elseif (check_persistent_login()) {
|
||||
// check_persistent_login() sets $_SESSION['editor']
|
||||
// Note that check_persistent_login() sets $_SESSION['editor']
|
||||
$is_admin = TRUE;
|
||||
$username = $_SESSION['editor'];
|
||||
} else {
|
||||
$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() {
|
||||
|
||||
+1
-5
@@ -1,7 +1,3 @@
|
||||
<?
|
||||
if (!isset($is_admin))
|
||||
$is_admin=FALSE
|
||||
?>
|
||||
<aside id="sidebar">
|
||||
|
||||
<div class="logo">
|
||||
@@ -22,7 +18,7 @@ if (preg_match("#^(/$|/index)#", $_SERVER['REQUEST_URI'])) {
|
||||
<li><a href="/about">About <span class="xxx">x·x·x</span></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>
|
||||
<? if ($is_admin) {
|
||||
<? if (isset($is_admin) && $is_admin) {
|
||||
echo '<li><a href="/publish/addeditor">Add editor</a></li>';
|
||||
echo '<li><a href="/publish/logout">Logout</a></li>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user