mirror of
https://github.com/BeitDina/AutoIndex.git
synced 2026-05-07 03:17:13 +02:00
Update UserLoggedIn.php for request class
This commit is contained in:
committed by
GitHub
parent
c95de70c9b
commit
b05f9c933d
@@ -1,25 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package AutoIndex
|
||||
*
|
||||
* @copyright Copyright (C) 2002-2004 Justin Hagstrom
|
||||
* @copyright Copyright (C) 2002-2008 Justin Hagstrom
|
||||
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
|
||||
*
|
||||
* @link http://autoindex.sourceforge.net
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
AutoIndex PHP Script 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; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
AutoIndex PHP Script 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
|
||||
@@ -47,22 +46,23 @@ class UserLoggedIn extends User
|
||||
*/
|
||||
public function login_box()
|
||||
{
|
||||
global $words, $you, $subdir;
|
||||
$txt = '<p><a class="autoindex_a" href="' . Url::html_output($_SERVER['PHP_SELF'])
|
||||
global $words, $request, $you, $subdir;
|
||||
|
||||
$txt = '<p><a class="autoindex_a" href="' . Url::html_output($request->server('PHP_SELF', ''))
|
||||
. '?dir=' . (isset($subdir) ? rawurlencode($subdir) : '')
|
||||
. '&logout=true">' . $words -> __get('logout')
|
||||
. ' [ ' . Url::html_output($this -> username) . ' ]</a></p>';
|
||||
if ($you -> level >= MODERATOR)
|
||||
//show admin options if they are a moderator or higher
|
||||
. '&logout=true">' . $words->__get('logout')
|
||||
. ' [ ' . Url::html_output($this->username) . ' ]</a></p>';
|
||||
|
||||
if ($you->level >= MODERATOR) //show admin options if they are a moderator or higher
|
||||
{
|
||||
$admin_panel = new Admin($you);
|
||||
$txt = $admin_panel -> __toString() . $txt;
|
||||
$txt = $admin_panel->__toString() . $txt;
|
||||
}
|
||||
if ($you -> level >= LEVEL_TO_UPLOAD)
|
||||
//show upload options if they are a logged in user or higher
|
||||
|
||||
if ($you->level >= LEVEL_TO_UPLOAD) //show upload options if they are a logged in user or higher
|
||||
{
|
||||
$upload_panel = new Upload($you);
|
||||
$txt .= $upload_panel -> __toString();
|
||||
$txt .= $upload_panel->__toString();
|
||||
}
|
||||
return $txt;
|
||||
}
|
||||
@@ -73,13 +73,13 @@ class UserLoggedIn extends User
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
global $subdir;
|
||||
$this -> level = GUEST;
|
||||
$this -> sha1_pass = $this -> username = '';
|
||||
global $request, $subdir;
|
||||
$this->level = GUEST;
|
||||
$this->sha1_pass = $this->username = '';
|
||||
session_unset();
|
||||
session_destroy();
|
||||
$home = new Url(Url::html_output($_SERVER['PHP_SELF']), true);
|
||||
$home -> redirect();
|
||||
$home = new Url(Url::html_output($request->server('PHP_SELF', '')), true);
|
||||
$home->redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,22 +93,22 @@ class UserLoggedIn extends User
|
||||
{
|
||||
parent::__construct($username, $sha1_pass);
|
||||
$accounts = new Accounts();
|
||||
if (!($accounts -> is_valid_user($this)))
|
||||
if (!($accounts->is_valid_user($this)))
|
||||
{
|
||||
global $log;
|
||||
$log -> add_entry("Invalid login (Username: $username)");
|
||||
$log->add_entry("Invalid login (Username: $username)");
|
||||
session_unset();
|
||||
sleep(1);
|
||||
throw new ExceptionDisplay('Invalid username or password.');
|
||||
}
|
||||
$this -> level = $accounts -> get_level($username);
|
||||
if ($this -> level <= BANNED)
|
||||
$this->level = $accounts->get_level($username);
|
||||
if ($this->level <= BANNED)
|
||||
{
|
||||
throw new ExceptionDisplay('Your account has been disabled by the site admin.');
|
||||
}
|
||||
$this -> username = $accounts -> get_stored_case($username);
|
||||
$this -> home_dir = $accounts -> get_home_dir($username);
|
||||
$this->username = $accounts->get_stored_case($username);
|
||||
$this->home_dir = $accounts->get_home_dir($username);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user