query_fetchDB("
SELECT post_title, post_content, post_parent, post_status, post_comment_status
FROM ot_posts
WHERE id = '" . $_GET['page'] . "' &&
post_type = 'page' &&
(post_status != 'privé' OR post_author = " . USER_ID . ")
ORDER BY id DESC
LIMIT 1
");
}
elseif(defined("USER_LEVEL_AUTHOR")) // Or the writer himself?
{
$Page = $DB->query_fetchDB("
SELECT post_title, post_content, post_parent, post_status, post_comment_status
FROM ot_posts
WHERE id = '" . $_GET['page'] . "' &&
post_author = '" . USER_ID . "' &&
post_type = 'page'
ORDER BY id DESC
LIMIT 1
");
}
if($Page) // Page exists?
{
if($_SERVER['REQUEST_METHOD'] == "POST") // New post?
{
if( ! empty($_POST['post_status']) && ! empty($_POST['post_comment_status']) && isset($_POST['post_parent']) && isset($_POST['post_title']) && isset($_POST['post_content'])) // Required fields are set?
{
// Generating a user-friendly URL
$_POST['post_url'] = strip_tags($_POST['post_title']);
$_POST['post_url'] = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $_POST['post_url']);
$_POST['post_url'] = str_replace('%', '', $_POST['post_url']);
$_POST['post_url'] = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $_POST['post_url']);
$_POST['post_url'] = strtolower($_POST['post_url']);
$_POST['post_url'] = preg_replace('/&.+?;/', '', $_POST['post_url']); // kill entities
$_POST['post_url'] = preg_replace('/[^%a-z0-9 _-]/', '', $_POST['post_url']);
$_POST['post_url'] = preg_replace('/\s+/', '-', $_POST['post_url']);
$_POST['post_url'] = preg_replace('|-+|', '-', $_POST['post_url']);
$_POST['post_url'] = trim($_POST['post_url'], '-');
// Same post title twice?
$Double = $DB->query_num_rowsDB("
SELECT id
FROM ot_posts
WHERE post_url = '" . addslashes($_POST['post_url']) . "'
"); // Check in DB
if($Double > 0) // Double?
{
$_POST['post_url'] = $_POST['post_url'] . "-" . ($Double + 1); // Add number at the end
}
// Check if user is allow to publish
if( ! (defined("USER_LEVEL_ADMINISTRATOR") OR defined("USER_LEVEL_EDITOR")) && ($_POST['post_status'] == "gepubliceerd"))
{
$_POST['post_status'] = "klad";
}
// We'll update the post in DB
$DB->query_execDB("
UPDATE ot_posts
SET post_title = '" . addslashes($_POST['post_title']) . "',
post_content = '" . addslashes($_POST['post_content']) . "',
post_modified = NOW(),
post_url = '" . $_POST['post_url'] . "',
post_parent = '" . addslashes($_POST['post_parent']) . "',
post_status = '" . addslashes($_POST['post_status']) . "',
post_comment_status = '" . addslashes($_POST['post_comment_status']) . "'
WHERE id = '" . $_GET['page'] . "'
ORDER BY id DESC
LIMIT 1
");
// Everything updated, let's edit !
header("Location: page-edit.php?page=" . $_GET['page']);
}
else
{
header("Location: err-403.php"); // Error
}
}
$PageTitle = " » Schrijven » Pagina bewerken"; // Set page title
include("admin-header.php"); // Load header
?>
De pagina werd succesvol opgeslaan.
Pagina bewerken
Hoofdpagina:
- Geen hoofdpagina
query_fetchDB("
SELECT id, post_title
FROM ot_posts
WHERE post_parent = '" . $TopPage['id'] . "' &&
post_type = 'page'
ORDER BY post_title ASC
"); // Get subpage
if($SubPages)
{
for($i = 0; $i < count($SubPages); $i++)
{
echo "";
echo "- ";
if($SubPages[$i]['id'] == $Page['0']['post_parent'])
{
get_form_radio("post_parent", $SubPages[$i]['id'], "checked");
}
else
{
get_form_radio("post_parent", $SubPages[$i]['id'], "unchecked");
}
echo " " .stripslashes($SubPages[$i]['post_title']) . "
";
get_subpage($SubPages[$i]);
echo "
";
}
return TRUE;
}
else
{
return FALSE;
}
}
// Fetch pages which have no parent !
$Pages = $DB->query_fetchDB("
SELECT id, post_title
FROM ot_posts
WHERE post_parent = 0 &&
post_type = 'page'
ORDER BY post_title ASC
"); // Fetch pages from DB
if($Pages) // Are there pages?
{
for($i = 0; $i < count($Pages); $i++)
{
echo "- ";
if($Page['0']['post_parent'] == $Pages[$i]['id'])
{
get_form_radio("post_parent", $Pages[$i]['id'], "checked");
echo " " . $Pages[$i]['post_title'] . "
";
}
else
{
get_form_radio("post_parent", $Pages[$i]['id'], "unchecked");
echo " " . $Pages[$i]['post_title'] . "";
}
get_subpage($Pages[$i]);
}
}
?>
Pagina status:
";
}
else
{
if($Page['0']['post_status'] == "goedkeuring")
{
get_form_radio("post_status", "goedkeuring", "checked");
}
else
{
get_form_radio("post_status", "goedkeuring", "unchecked");
}
echo " Goedkeuring
";
}
if($Page['0']['post_status'] == "klad")
{
get_form_radio("post_status", "klad", "checked");
}
else
{
get_form_radio("post_status", "klad", "unchecked");
}
echo " Klad
";
if($Page['0']['post_status'] == "privé")
{
get_form_radio("post_status", "privé", "checked");
}
else
{
get_form_radio("post_status", "privé", "unchecked");
}
echo " Privé
";
if($Page['0']['post_status'] == "toekomst")
{
get_form_radio("post_status", "toekomst", "checked");
}
else
{
get_form_radio("post_status", "toekomst", "unchecked");
}
echo " Toekomst";
?>
Reactiemogelijkheden:
";
if($Page['0']['post_comment_status'] == "gesloten")
{
get_form_radio("post_comment_status", "gesloten", "checked");
}
else
{
get_form_radio("post_comment_status", "gesloten", "unchecked");
}
echo " Gesloten
";
if($Page['0']['post_comment_status'] == "leden")
{
get_form_radio("post_comment_status", "leden", "checked");
}
else
{
get_form_radio("post_comment_status", "leden", "unchecked");
}
echo " Geregistreerde leden";
}
elseif(CONF_COMMENT == 0)
{
get_form_radio("post_comment_status", "open", "unchecked");
echo " Open
";
get_form_radio("post_comment_status", "gesloten", "checked");
echo " Gesloten
";
get_form_radio("post_comment_status", "leden", "unchecked");
echo " Geregistreerde leden";
}
?>
Titel:
Inhoud:
Bestand toevoegen
Met onderstaande knop "Bestanden toevoegen" kan u bestanden toevoegen aan uw weblog. De duur van het uploaden is afhankelijk van de grootte van het bestand (max. 2MB) en uw verbindingssnelheid.
Na het uploadproces zal u automatisch de URL naar het bestand krijgen.