@author Valware
@contact valerie@valware.co.uk
@description Provides support for PHPMailer() to send emails you care about
- @version 1.0
- @tested 1.0
+ @version 1.2
+ @tested 0.9
@minver 0.9
@icon https://w7.pngwing.com/pngs/78/575/png-transparent-phpmailer-hd-logo.png
@maxver *
{
public $name = "php_mailer";
public $author = "Valware";
- public $version = "1.0";
+ public $version = "1.2";
public $description = "Send mail using PHPMailer()";
public $email = "v.a.pond@outlook.com";
{
Hook::func(HOOKTYPE_USER_LOGIN, 'php_mailer::user_login_notif');
Hook::func(HOOKTYPE_USER_LOGIN_FAIL, 'php_mailer::user_login_fail_notif');
+ Hook::func(HOOKTYPE_NAVBAR, 'php_mailer::navbar_hook');
}
public static function send_mail($to, $subject, $body)
"If this was not you, please contact your Panel Administrator."
);
}
- public static function user_login_fail_notif($fail)
+
+ /**
+ * Send a notification about the failed attempt
+ */
+ public static function user_login_fail_notif($user)
{
self::send_mail(
["email" => get_config("smtp::username"), "name" => get_config("smtp::from_name")],
"Failed login attempt - Unreal Admin Panel",
- "There was a failed login attempt to the admin panel.<br>User: \"".$fail['login']."\"<br>IP: \"".$fail['IP']."\""
+ "-- ADMIN NOTIFICATION --, <br><br>".
+ "There was failed login attempt to account: \"$user->username\"<br><br>".
+ "Details:<br>".
+ "IP: ".$_SERVER['REMOTE_ADDR']." (".$_SERVER['HTTP_CF_IPCOUNTRY'].")<br>".
+ "User Agent: ".$_SERVER['HTTP_USER_AGENT']."<br><br>"
);
- $user = new PanelUser($fail['login']);
+ $user = new PanelUser($user['login']);
if ($user->email)
self::send_mail(
["email" => $user->email, "name" => $user->first_name . " " . $user->last_name],
"If this was not you, please contact your Panel Administrator."
);
}
+
+ public static function navbar_hook(&$pages)
+ {
+ $page_name = "Mail";
+ $page_link = "plugins/php_mailer/mail-settings.php";
+ $pages["Settings"][$page_name] = ["script" => $page_link];
+ }
}