Initial commit.
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<?
|
||||
require_once("../session.lib.php");
|
||||
if (!isset($_SESSION['editor'])) {
|
||||
$is_admin = FALSE;
|
||||
header("Location: https://xxx.org.za/publish/login");
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
<title>x.x.x [edit]</title>
|
||||
<link rel="icon" href="/favicon.png" />
|
||||
<link rel="shortcut icon" href="/favicon.png" />
|
||||
<link rel="stylesheet" type="text/css" href="/style.css" />
|
||||
<link rel='stylesheet' type='text/css' href='/publish/style.css' />
|
||||
<link rel="alternate" type="application/rss+xml" title="xxx.org.za RSS feed" href="/feed" />
|
||||
<? include_once('./tinymce_init.inc.php'); ?>
|
||||
</script>
|
||||
</head>
|
||||
<?
|
||||
flush();
|
||||
require_once("../get_data.lib.php");
|
||||
open_db('open');
|
||||
require_once("../navigation.lib.php");
|
||||
require_once('./post.lib.php');
|
||||
$editable = TRUE;
|
||||
$id = get_id();
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<div id='container'>
|
||||
|
||||
<!-- Include siderbar here -->
|
||||
<? include_once('../sidebar.inc.php'); ?>
|
||||
<!-- Continue with main page stuff -->
|
||||
|
||||
|
||||
<div id='main'>
|
||||
<div id='maintext'>
|
||||
|
||||
<H1>edit</H1>
|
||||
|
||||
<?
|
||||
|
||||
/* Authenticated admin user allowed to: check the queue
|
||||
edit article on the queue
|
||||
optionally preview
|
||||
post article to database
|
||||
--------------------------
|
||||
choose existing article
|
||||
edit existing article
|
||||
optionally preview
|
||||
update article in database
|
||||
--------------------------
|
||||
write new article
|
||||
preview (required)
|
||||
post article to database
|
||||
--------------------------
|
||||
Ordinary web users can: write article
|
||||
preview (required)
|
||||
submit to the queue
|
||||
|
||||
*/
|
||||
|
||||
$action = NULL;
|
||||
if (isset($_POST['action'])) {
|
||||
$action = strtolower($_POST['action']);
|
||||
// We can trigger only choose and edit via GET variables.
|
||||
} else if (isset($_GET['action'])) {
|
||||
if ($_GET['action'] == 'choose') {
|
||||
$action = 'choose';
|
||||
} else if ($_GET['action'] == 'edit') {
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
if (!isset($action) && $id) {
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'submit': // to queue
|
||||
case 'save': // resave to queue
|
||||
case 'post': // to database
|
||||
if (validate_data() && count($validate) === 0) {
|
||||
$id = save_data($id);
|
||||
echo display_stories();
|
||||
} else {
|
||||
$action = 'preview';
|
||||
include('./preview.inc.php');
|
||||
}
|
||||
break;
|
||||
case 'edit': // edit the chosen story
|
||||
// admin only.
|
||||
include('./modify.inc.php');
|
||||
break;
|
||||
case 'preview': // preview before posting
|
||||
validate_data();
|
||||
include('./preview.inc.php');
|
||||
break;
|
||||
case 'delete': // edit the chosen story
|
||||
// admin only.
|
||||
echo delete_story($id);
|
||||
break;
|
||||
case 'choose': // choose a story to edit
|
||||
default:
|
||||
// admin only: either from queue
|
||||
// or from database
|
||||
include('./choose.inc.php'); // need queue select!
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Include bottom bar here -->
|
||||
<? include_once('../bottombar.inc.php'); ?>
|
||||
<? open_db('close'); ?>
|
||||
<!-- Finis -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user