Пример #1
0
<?php

/**
 * This is a Branax pagecontroller.
 *
 */
// Include the essential config-file which also creates the $branax variable with its defaults.
include __DIR__ . '/config.php';
$user = new CUser($branax['database']);
$user->isAuthenticated() or die('Check: You must login to delete.');
$content = new CContent($branax['database']);
// Do it and store it all in variables in the Branax container.
$branax['title'] = "Radera";
$branax['main'] = <<<EOD
<h1>Radera innehåll</h1>
{$content->delete()}
EOD;
// Finally, leave it all to the rendering phase of Branax.
include BRANAX_THEME_PATH;
Пример #2
0
$uppdate = isset($_POST['uppdate']) ? true : false;
$title = isset($_POST['title']) ? strip_tags($_POST['title']) : null;
$type = isset($_POST['type']) ? strip_tags($_POST['type']) : null;
$acronym = isset($_SESSION['user']) ? $_SESSION['user']->acronym : null;
if ($acronym == null) {
    echo <<<EOD
<div style=" border: 1px solid #777; border-radius: 3px; padding: 10px 20px;">
    <h2 style="margin-top: 0;">Du måste vara inloggad för att få radera innehåll...</h2>
    <p><a href="?p=clogin" class="aButton">Logga in</a></p>
</div>
EOD;
} else {
    $cont = new CContent($urbax['database']);
    //time to delete a post?
    if ($cont->validContentId($id)) {
        $cont->delete($id);
        //use javascritp to reload - forces the the nav menu to uppdate
        //echo "<script> setTimeout(function (){ window.location.href = '?p=contentdelete'; }, 2000);</script>";
    }
    //var_dump($user->isAdmin());
    $disabled = '';
    $info = '';
    if (!$user->isAdmin()) {
        $disabled = "disabled";
        $info = "<p> Du kan inte radera eftersom du inte är administratör.</p>";
    }
    //show table
    $dbc = new CDatabase($urbax['database']);
    $resultset = $dbc->ExecuteSelectQueryAndFetchAll('SELECT id, title FROM oophp0710_content WHERE deleted IS NULL');
    echo "<h2>Välj post att radera:</h2>";
    echo "<table class='table'>";