<?php

  /*

      security.php

      Contains security functions.

      ----

      Copyright (C) 2006  Central Manchester CLC
      Copyright (C) 2006  David Thorne (davethorne@gmail.com)

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation version 2.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

   */

  require_once "system/lang.php";

  // Deny a user access, and display the login sidebar
  function ThrowOut() {
    $redirect = $_SERVER["REQUEST_URI"];
    $ptitle = 'Access Error';
    include "header.php";
    AccessDenied();
  }

  // Deny access to a user - use after sidebar has been displayed
  function AccessDenied() {
    // Set Language
    set_text_domain("security");

    print "<<h1>".gettext("Access Error")."</h1>\n";
    print "<h2>".gettext("Either you do not have permission to access this page or you are not currently logged in.")."</h2>\n";
    print "<div class=\"block\" align=\"center\"><p>".gettext("Please choose another option or log in as a user who does have permission to access the page.")."</p></div>";

    // Include
    require 'footer.php';
    exit;
  }



?>