mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Some more code clean-up (global pointers, $this->e107->, etc.)
This commit is contained in:
parent
dc1d867aff
commit
8e7414a855
@ -69,6 +69,9 @@ class userlogin
|
||||
public function login($username, $userpass, $autologin, $response = '', $noredirect = false)
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
|
||||
$e_event = e107::getEvent();
|
||||
$_E107 = e107::getE107();
|
||||
|
||||
@ -79,9 +82,6 @@ class userlogin
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
|
||||
$forceLogin = ($autologin === 'signup');
|
||||
if(!$forceLogin && $autologin === 'provider') $forceLogin = 'provider';
|
||||
@ -227,7 +227,7 @@ class userlogin
|
||||
/* restrict more than one person logging in using same us/pw */
|
||||
if($pref['disallowMultiLogin'])
|
||||
{
|
||||
if($this->e107->sql->db_Select("online", "online_ip", "online_user_id='".$user_id.".".$user_name."'"))
|
||||
if($sql->db_Select("online", "online_ip", "online_user_id='".$user_id.".".$user_name."'"))
|
||||
{
|
||||
return $this->invalidLogin($username,LOGIN_MULTIPLE,$user_id);
|
||||
}
|
||||
@ -263,7 +263,7 @@ class userlogin
|
||||
{ // 'New user' probationary period expired - we can take them out of the class
|
||||
$this->userData['user_class'] = $this->e107->user_class->ucRemove(e_UC_NEWUSER, $this->userData['user_class']);
|
||||
// $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Login new user complete",$this->userData['user_class'],FALSE,FALSE);
|
||||
$this->e107->sql->db_Update('user',"`user_class` = '".$this->userData['user_class']."'", 'WHERE `user_id`='.$this->userData['user_id']);
|
||||
$sql->update('user',"`user_class` = '".$this->userData['user_class']."'", 'WHERE `user_id`='.$this->userData['user_id']);
|
||||
unset($class_list[e_UC_NEWUSER]);
|
||||
$edata_li = array('user_id' => $user_id, 'user_name' => $username, 'class_list' => implode(',',$class_list), 'user_email'=> $user_email);
|
||||
$e_event->trigger('userNotNew', $edata_li);
|
||||
@ -343,13 +343,13 @@ class userlogin
|
||||
|
||||
$query = $this->getLookupQuery($username, $forceLogin);
|
||||
|
||||
if ($this->e107->sql->db_Select('user', '*', $query) !== 1) // Handle duplicate emails as well
|
||||
if ($sql->select('user', '*', $query) !== 1) // Handle duplicate emails as well
|
||||
{ // Invalid user
|
||||
return $this->invalidLogin($username,LOGIN_BAD_USER);
|
||||
}
|
||||
|
||||
// User is in DB here
|
||||
$this->userData = $this->e107->sql->db_Fetch(MYSQL_ASSOC); // Get user info
|
||||
$this->userData = $sql->fetch(MYSQL_ASSOC); // Get user info
|
||||
$this->userData['user_perms'] = trim($this->userData['user_perms']);
|
||||
$this->lookEmail = $this->lookEmail && ($username == $this->userData['user_email']); // Know whether login name or email address used now
|
||||
|
||||
@ -458,7 +458,7 @@ class userlogin
|
||||
*/
|
||||
protected function invalidLogin($username, $reason, $extra_text = '')
|
||||
{
|
||||
global $pref;
|
||||
global $pref, $sql;
|
||||
|
||||
$doCheck = FALSE; // Flag set if need to ban check
|
||||
switch ($reason)
|
||||
@ -534,11 +534,11 @@ class userlogin
|
||||
{ // See if ban required (formerly the checkibr() function)
|
||||
if($pref['autoban'] == 1 || $pref['autoban'] == 3)
|
||||
{ // Flood + Login or Login Only.
|
||||
$fails = $this->e107->sql->db_Count("generic", "(*)", "WHERE gen_ip='{$this->userIP}' AND gen_type='failed_login' ");
|
||||
$fails = $sql->count("generic", "(*)", "WHERE gen_ip='{$this->userIP}' AND gen_type='failed_login' ");
|
||||
if($fails > 10)
|
||||
{
|
||||
e107::getIPHandler()->add_ban(4,LAN_LOGIN_18,$this->userIP,1);
|
||||
e107::getDb()->db_Insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".$this->e107->tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
|
||||
e107::getDb()->insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".$this->e107->tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
{
|
||||
// TODO - use download plugin API
|
||||
|
||||
if($sql->db_Select("download", "download_url,download_name", "download_id !='' ORDER BY download_name"))
|
||||
if($sql->select("download", "download_url,download_name", "download_id !='' ORDER BY download_name"))
|
||||
{
|
||||
$text .= "<tr>
|
||||
<td>".LAN_MAILOUT_07.": </td>
|
||||
@ -929,7 +929,7 @@ class mailoutAdminClass extends e107MailManager
|
||||
$text .= "<select class='tbox' name='email_attachment' >
|
||||
<option value=''> </option>\n";
|
||||
|
||||
while ($row = $this->e107->sql->db_Fetch())
|
||||
while ($row = $sql->fetch())
|
||||
{
|
||||
$selected = ($mailSource['mail_attach'] == $row['download_url']) ? "selected='selected'" : '';
|
||||
// $text .= "<option value='".urlencode($row['download_url'])."' {$selected}>".htmlspecialchars($row['download_name'])."</option>\n";
|
||||
|
@ -226,13 +226,13 @@ class calendar_menu_cron // include plugin-folder in the name.
|
||||
if ($this->debugLevel >= 2) $this->logLine("\r\n Query is: ".$cal_query);
|
||||
}
|
||||
|
||||
if ($num_cat_proc = $this->e107->sql->db_Select_gen($cal_query))
|
||||
if ($num_cat_proc = e107::getDb()->gen($cal_query))
|
||||
{ // Got at least one event to process here
|
||||
if ($this->logRequirement > 1)
|
||||
$this->logLine(' - '.$num_cat_proc.' categories found to process');
|
||||
|
||||
$this->checkDB(); // Make sure we've got another DB object
|
||||
while ($thisevent = $this->e107->sql->db_Fetch())
|
||||
while ($thisevent = e107::getDb()->fetch())
|
||||
{ // Process one event at a time
|
||||
|
||||
$this->logLine(' Processing event: '.$event_title);
|
||||
@ -397,7 +397,7 @@ class calendar_menu_cron // include plugin-folder in the name.
|
||||
}
|
||||
elseif ($num_cat === FALSE)
|
||||
{
|
||||
$this->logLine(' DB read error for '.$shot_type.': '.$this->e107->sql->$mySQLlastErrNum.':'.$this->e107->sql->$mySQLlastErrText);
|
||||
$this->logLine(' DB read error for '.$shot_type.': '.e107::getDb()->$mySQLlastErrNum.':'.e107::getDb()->$mySQLlastErrText);
|
||||
}
|
||||
elseif ($this->logRequirement > 1)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user