mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
0d6f52aa6c
commit
ad9a42b16a
60
classes/lockedaccounts.class.php
Normal file
60
classes/lockedaccounts.class.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* Class to manage locked accounts
|
||||
*/
|
||||
class LockedAccounts
|
||||
{
|
||||
|
||||
/**
|
||||
* Lock an account
|
||||
*
|
||||
* @param int $UserID The ID of the user to lock
|
||||
* @param int $Type The lock type, should be a constant value
|
||||
* @param string $Message The message to write to user notes
|
||||
* @param string $Reason The reason for the lock
|
||||
* @param int $LockedByUserID The ID of the staff member that locked $UserID's account. 0 for system
|
||||
*/
|
||||
public static function lock_account($UserID, $Type, $Message, $Reason, $LockedByUserID)
|
||||
{
|
||||
|
||||
if ($LockedByUserID == 0) {
|
||||
$Username = "System";
|
||||
} else {
|
||||
G::$DB->query("SELECT Username FROM users_main WHERE ID = '" . $UserID . "'");
|
||||
list($Username) = G::$DB->next_record();
|
||||
}
|
||||
|
||||
G::$DB->query("
|
||||
INSERT INTO locked_accounts (UserID, Type)
|
||||
VALUES ('" . $UserID . "', " . $Type . ")");
|
||||
Tools::update_user_notes($UserID, sqltime() . " - " . db_string($Message) . " by $Username\nReason: " . db_string($Reason) . "\n\n");
|
||||
G::$Cache->delete_value('user_info_' . $UserID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock an account
|
||||
*
|
||||
* @param int $UserID The ID of the user to unlock
|
||||
* @param int $Type The lock type, should be a constant value. Used for database verification
|
||||
* to avoid deleting the wrong lock type
|
||||
* @param string $Reason The reason for unlock
|
||||
* @param int $UnlockedByUserID The ID of the staff member unlocking $UserID's account. 0 for system
|
||||
*/
|
||||
public static function unlock_account($UserID, $Type, $Message, $Reason, $UnlockedByUserID)
|
||||
{
|
||||
if ($UnlockedByUserID == 0) {
|
||||
$Username = "System";
|
||||
} else {
|
||||
G::$DB->query("SELECT Username FROM users_main WHERE ID = '" . $UserID . "'");
|
||||
list($Username) = G::$DB->next_record();
|
||||
}
|
||||
|
||||
G::$DB->query("DELETE FROM locked_accounts WHERE UserID = '$UserID' AND Type = '". $Type ."'");
|
||||
|
||||
if (G::$DB->affected_rows() == 1) {
|
||||
G::$Cache->delete_value("user_info_" . $UserID);
|
||||
Tools::update_user_notes($UserID, sqltime() . " - " . db_string($Message) . " by $Username\nReason: " . db_string($Reason) . "\n\n");
|
||||
}
|
||||
}
|
||||
}
|
@ -66,14 +66,14 @@
|
||||
i.ResetExpires = '0000-00-00 00:00:00'
|
||||
WHERE m.ID = '$UserID'
|
||||
AND i.UserID = m.ID");
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO users_history_passwords
|
||||
(UserID, ChangerIP, ChangeTime)
|
||||
VALUES
|
||||
('$UserID', '$_SERVER[REMOTE_ADDR]', '".sqltime()."')");
|
||||
$Reset = true; // Past tense form of "to reset", meaning that password has now been reset
|
||||
G::$LoggedUser['ID'] = $UserID; // Set $LoggedUser['ID'] for logout_all_sessions() to work
|
||||
$LoggedUser['ID'] = $UserID; // Set $LoggedUser['ID'] for logout_all_sessions() to work
|
||||
|
||||
logout_all_sessions();
|
||||
|
||||
|
||||
|
@ -1344,7 +1344,6 @@ function next_hour() {
|
||||
AND AssignedToUser IS NULL");
|
||||
|
||||
Donations::schedule();
|
||||
|
||||
}
|
||||
/*************************************************************************\
|
||||
//--------------Run twice per month -------------------------------------//
|
||||
|
Loading…
Reference in New Issue
Block a user