static public decrypt ( $string, $key ) : decrypted | ||
$string | string to decrypt | |
$key | string key used to decrypt | |
return | decrypted | string |
static function decrypt($string, $key)
{
$result = '';
$string = base64_decode($string);
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, $i % strlen($key) - 1, 1);
$char = chr(ord($char) - ord($keychar));
$result .= $char;
}
return Toolbox::unclean_cross_side_scripting_deep($result);
}
/** * Constructor * **/ function __construct() { global $CFG_GLPI; $this->WordWrap = 80; $this->CharSet = "utf-8"; // Comes from config $this->SetLanguage("en", Config::getLibraryDir("PHPMailer") . "/language/"); if ($CFG_GLPI['smtp_mode'] != MAIL_MAIL) { $this->Mailer = "smtp"; $this->Host = $CFG_GLPI['smtp_host'] . ':' . $CFG_GLPI['smtp_port']; if ($CFG_GLPI['smtp_username'] != '') { $this->SMTPAuth = true; $this->Username = $CFG_GLPI['smtp_username']; $this->Password = Toolbox::decrypt($CFG_GLPI['smtp_passwd'], GLPIKEY); } if ($CFG_GLPI['smtp_mode'] == MAIL_SMTPSSL) { $this->SMTPSecure = "ssl"; } if ($CFG_GLPI['smtp_mode'] == MAIL_SMTPTLS) { $this->SMTPSecure = "tls"; } if (!$CFG_GLPI['smtp_check_certificate']) { $this->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)); } } if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) { $this->do_debug = 3; } }