Ejemplo n.º 1
0
 function get_content()
 {
     include_once 'classes/Dashboard.php';
     $updates0 = Updates::get_updates(0);
     $updates1 = Updates::get_updates(1);
     foreach ($updates0 as $id => $value) {
         $updates[$id] = $value;
     }
     foreach ($updates1 as $id => $value) {
         $updates[$id] = $value;
     }
     $index = 1;
     $updateStr = '';
     $updateStr .= "<ul>";
     foreach ($updates as $id => $action) {
         $curUpdate = new Updates($id);
         if ($index < 10) {
             $updateStr .= '<li>' . $curUpdate->get_date() . ' by ' . $curUpdate->get_username() . ' - ' . $curUpdate->get_action() . '</li>';
         } else {
             $updateStr .= "<li class=\"hidden\">" . $curUpdate->get_date() . " by " . $curUpdate->get_username() . " - " . $curUpdate->get_action() . "</li>";
         }
         if ($index == 9) {
             $updateStr .= "<li style='float:right; list-style:none;'><input type='checkbox' id='showArchived'>Show archived updates</input></li><hr>";
         }
         $index++;
     }
     $updateStr .= "</ul>";
     return $updateStr;
 }
Ejemplo n.º 2
0
session_start();
include_once "config/opendb.php";
include_once "classes/Dashboard.php";
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
    header("Location: login.php");
}
$access = $_SESSION['access'];
if (preg_match("/configurations.php/", $_SERVER['PHP_SELF'])) {
    if ($access != 100) {
        header("Location: index.php");
        echo "<h1>You have no permission</h1>";
    }
}
if ($_SESSION['action'] != "") {
    $allUpdates = Updates::get_updates();
    $index = 0;
    foreach ($allUpdates as $id => $value) {
        $index++;
        if ($index > 10) {
            $curUpdate = new Updates($id);
            if ($curUpdate->get_archived() == 0) {
                $curUpdate->set_archived(1);
                if (!$curUpdate->update()) {
                    echo 'update widget failed. Reason: ' . $curUpdate->get_error();
                }
            }
        }
    }
    $update = new Updates();
    $update->set_action($_SESSION['action']);