editContentsByTitle() публичный Метод

public editContentsByTitle ( $originalTitle, $contents )
Пример #1
0
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "blog.class.php";
$common = new common();
$account = new account();
$blog = new blog();
// Check if the user is logged in.
if (!$account->isAuthenticated()) {
    // The user is not logged in so forward them to the login page.
    header("Location: login.php");
}
// Set updated variable to FALSE.
$updated = FALSE;
if ($common->postBack()) {
    // Update the contents of the blog post.
    $blog->editContentsByTitle($_POST['originalTitle'], $_POST['contents']);
    // Set updated to TRUE since settings were updated.
    $updated = TRUE;
}
// Get titles and dates for all blog posts.
$post = $blog->getPostByTitle(urldecode($_GET['title']));
////////////////
// BEGIN HTML
require_once '../includes/header.inc.php';
// Display the updated message if settings were updated.
if ($updated) {
    ?>
        <div id="contents-saved" class="alert alert-success fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
Пример #2
0
require_once '../../classes/common.class.php';
require_once '../../classes/account.class.php';
require_once '../../classes/blog.class.php';
$common = new common();
$account = new account();
$blog = new blog();
// Check if the user is logged in.
if (!$account->isAuthenticated()) {
    // The user is not logged in so forward them to the login page.
    header("Location: login.php");
}
// Set updated variable to FALSE.
$updated = FALSE;
if ($common->postBack()) {
    // Update the contents of the blog post.
    $blog->editContentsByTitle(urldecode($_GET['title']), $_POST['contents']);
    // Set updated to TRUE since settings were updated.
    $updated = TRUE;
}
// Get titles and dates for all blog posts.
$post = $blog->getPostByTitle(urldecode($_GET['title']));
////////////////
// BEGIN HTML
require_once '../includes/header.inc.php';
// Display the updated message if settings were updated.
if ($updated) {
    ?>
        <div id="contents-saved" class="alert alert-success fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>