Beispiel #1
0
 public static function isAdmin()
 {
     return Session::isSuperAdmin() || "ADMIN" === Session::getUserRole();
 }
Beispiel #2
0
 /**
  * If this is not a superadmin session redirect to the login page.
  */
 public function setSuperAdmin()
 {
     if (!Session::isSuperAdmin()) {
         header("Location: " . KB_HOST . "/?a=login");
     }
 }
        <tbody>
            <?php 
include "conexionBD.php";
$query = "SELECT * FROM  foro WHERE identificador = 0 ORDER BY fecha DESC";
$result = $mysqli->query($query);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    $id = $row['ID'];
    $tema = $row['titulo'];
    $autor = $row['autor'];
    $fecha = $row['fecha'];
    $respuestas = $row['respuestas'];
    echo "<tr>";
    echo "<td><a href='foro.php?id={$id}'>Ver</a></td>";
    echo "<td>{$tema}</td>";
    echo "<td>{$autor}</td>";
    echo "<td>" . date("d-m-y") . "</td>";
    echo "<td>{$respuestas}</td>";
    if (Session::isSuperAdmin()) {
        echo "<td><a href='admin-novedades.php?op=del&titulo={$tema}'><span class='glyphicon glyphicon-trash'></span> Eliminar</a></td>";
    }
    echo "</tr>";
}
?>
        </tbody>
</table>
</div>


<?php 
$contenido = ob_get_clean();
include 'plantillas/base.php';
 /**
  * Returns whether or not a logged-in ThinkUp user is an admin
  *
  * @return bool whether or not logged-in user is an admin
  */
 protected function isSuperAdmin()
 {
     return Session::isSuperAdmin();
 }