function send($to, $subject, $message, $countThisMail = True, $signThisMail = True) { global $apps_listOfEmails; $this->dbg('send', "to={$to} from={$this->from} subject=" . $this->subjectID . $subject); if (!$this->from) { $this->from = 'noReply'; } if (!$this->fromExtended) { $this->fromExtended = $this->from; } if (!$this->signature) { $this->signature = core_getConfig('signature', 'Computing support'); } if ($GLOBALS["mailDejaVu"][$to][$this->fromExtended][$subject]++) { return; } if ($this->cc) { $headers[] = "Cc: {$this->cc}"; } if ($this->bcc) { $headers[] = "Bcc: {$this->bcc}"; } $headers[] = "X-Mailer: mailClassYB"; $realTO = core_getConfig('redirectMailsInPlaygoundMode') && core_getOption('playground') ? core_getConfig('plygroundEmail') : $to; $realTOdisplay = $realTO == $to ? $to : "{$realTO} <{$to}>"; if ($signThisMail) { $message .= $this->signature; } $autoSignature = "this is an automatic e-mail sent by the {$this->mailID}"; while ($l++ < strlen($autoSignature)) { $autoSignature1 .= '-'; } $message .= join("\n", array("\n", $autoSignature1, $autoSignature)); if (core_getOption('playground')) { $message = "*** This E-mail is sent by the test version of the {$this->mailID} software and should be ignored\n" . "*** (unless you participate in the debugging and expect this E-mail).\n" . "*** Sorry if you got it my mistake...\n\n" . $message; } if (core_getConfig('dontSendMail_Point')) { $this->reallySendMail = False; } if ($this->reallySendMail) { $headers[] = "From: " . $this->fromExtended; $crlf = "\r\n"; #print "realTO=$realTO<br>";$realTO='*****@*****.**'; if (!mail($realTO, $this->subjectID . $subject, $message, join($crlf, $headers) . $crlf)) { core_internalError(get_class($this) . " Can't send an E-mail to {$realTOdisplay}<br>Please restart the procedure"); } // keep trace of the mails sent, useful for a summary core_syslog("mail from={$this->from} to={$realTO}" . ($to == $realTO ? "" : "<{$to}>") . " subject={$subject}"); if ($countThisMail) { $apps_listOfEmails[$realTOdisplay][] = $this->subjectID . $subject; $this->log($realTO, $this->from, $subject); } } else { $headers[] = "From: " . $this->fromForDebug; core_importantMessage("The following E-mail is prepared, but NOT sent:", 'h3', '<b>' . join('<br>', array("To: {$realTOdisplay}", "Subject: " . $this->subjectID . $subject, join('<br>', $headers) . '</b><br><br>' . eregi_replace(' ', ' ', eregi_replace("\n", "<br>", $message))))); } }
function loginPrompt($modeForced = "") { // mode = "login" // "tellpwd" $this->dbg("loginPrompt", "start execution"); $mode = "login"; if ($_POST["remindpassword"]) { unset($_GET["forgotpassword"]); if ($message = $this->remindPassword($_POST["auth_username"])) { $message = $this->errMsg($message); $mode = "tellpwd"; } else { $message = "<font color=green size=-1>The password reminder is sent to you</font>"; } } if ($_GET["forgotpassword"] && !$_SESSION["auth_pwdsent"]) { $mode = "tellpwd"; } if ($_POST["auth_pwd1"] || $_POST["auth_pwd2"]) { if ($message = $this->changePwd($_POST["auth_username"], $_POST["auth_password"], $_POST["auth_pwd1"], $_POST["auth_pwd2"])) { $mode = "cpw"; $message = $this->errMsg($message); } else { return array("cpw", False, False); } } if ($this->titleMessage) { print $this->titleMessage; } $this->dbg("loginPrompt", "mode={$mode} modeForced={$modeForced}"); if ($modeForced) { $this->dbg("loginPrompt", "mode {$mode} -> {$modeForced}"); $mode = $modeForced; } $post = "login"; if ($mode == "login") { if (list($g, $l, $u) = $this->login($_POST["auth_username"], $_POST["auth_password"])) { return $this->whoAmI(); } if ($_POST["auth_username"] && $_POST["auth_password"]) { $message = $this->errMsg("Wrong username or password"); } $pwPrompt = "password"; $suPrompt = "login"; $lnPrompt = "user name"; } elseif ($mode == "tellpwd") { $pwPrompt = ""; $suPrompt = "remind password"; $lnPrompt = "e-mail address"; $post = "remindpassword"; } elseif ($mode == "cpw") { $pwPrompt = "current password"; $suPrompt = "change password"; $lnPrompt = "user name"; } core_importantMessage($this->loginMessage, "font"); echo "<center>\n", "<form name=login action=", core_rebuildURL(array(), array("forgotpassword" => "drop", "quit" => "drop")), "&", htmlspecialchars(SID), " method=post>\n"; $t = new table("class='login'"); $t->tr("", "colspan='3' align='center'", eregi_replace("\n|\r", "<br>", $message)); $this->tr($t, "auth_username", "text", $lnPrompt, "auth_man.png", $value = $_POST["auth_username"]); if ($pwPrompt) { $this->tr($t, "auth_password", "password", $pwPrompt); } if ($mode == "cpw") { $this->tr($t, "auth_pwd1", "password", "new password"); $this->tr($t, "auth_pwd2", "password", "retype new password"); } $t->tro(); $t->td("", "<input name='{$post}' value='{$suPrompt}' type='submit'>"); $t->td(); $t->td("align='right'", $this->showPasswordReminder && $mode == "login" && !$_SESSION["auth_pwdsent"] ? x("a href=" . core_rebuildURL(array("forgotpassword" => "yes")), "forgot your password?") : ""); $t->trc(); $t->close(); echo "</form></center>"; }
function loginPrompt($modeForced = '') { // mode = 'login' // 'tellpwd' $this->dbg("loginPrompt", "start execution"); $mode = 'login'; if ($_POST["remindpassword"]) { unset($_GET["forgotpassword"]); if ($message = $this->remindPassword($_POST["auth_username"])) { $message = $this->errMsg($message); $mode = 'tellpwd'; } else { $message = "<font color=green size=-1>The password reminder is sent to you</font>"; } } if ($_GET["forgotpassword"] && !$_SESSION["auth_pwdsent"]) { $mode = 'tellpwd'; } if ($_POST["auth_pwd1"] || $_POST["auth_pwd2"]) { if ($message = $this->changePwd($_POST["auth_username"], $_POST["auth_password"], $_POST["auth_pwd1"], $_POST["auth_pwd2"])) { $mode = 'cpw'; $message = $this->errMsg($message); } else { return array('cpw', False, False); } } if ($this->titleMessage) { print $this->titleMessage; } $this->dbg("loginPrompt", "mode={$mode} modeForced={$modeForced}"); if ($modeForced) { $this->dbg("loginPrompt", "mode {$mode} -> {$modeForced}"); $mode = $modeForced; } $post = 'login'; if ($mode == 'login') { if (list($g, $l, $u) = $this->login($_POST["auth_username"], $_POST["auth_password"])) { return $this->whoAmI(); } if ($_POST["auth_username"] && $_POST["auth_password"]) { $message = $this->errMsg("Wrong username or password"); } $pwPrompt = 'password'; $suPrompt = 'login'; $lnPrompt = 'user name'; } elseif ($mode == 'tellpwd') { $pwPrompt = ''; $suPrompt = 'remind password'; $lnPrompt = 'e-mail address'; $post = 'remindpassword'; } elseif ($mode == 'cpw') { $pwPrompt = 'current password'; $suPrompt = 'change password'; $lnPrompt = 'user name'; } core_importantMessage($this->loginMessage, 'font'); echo "<center>\n", "<form name=login action=", core_rebuildURL(array(), array('forgotpassword' => 'drop', 'quit' => 'drop')), '&', htmlspecialchars(SID), " method=post>\n"; $t = new table('class=login'); $t->tr('', 'colspan=3 align=center', eregi_replace("\n|\r", "<br>", $message)); $this->tr($t, 'auth_username', 'text', $lnPrompt, 'auth_man.png', $value = $_POST["auth_username"]); if ($pwPrompt) { $this->tr($t, 'auth_password', 'password', $pwPrompt); } if ($mode == 'cpw') { $this->tr($t, 'auth_pwd1', 'password', 'new password'); $this->tr($t, 'auth_pwd2', 'password', 'retype new password'); } $t->tro(); $t->td('', "<input name='{$post}' value='{$suPrompt}' type='submit'>"); $t->td(); $t->td('align=right', $this->showPasswordReminder && $mode == 'login' && !$_SESSION["auth_pwdsent"] ? x("a href=" . core_rebuildURL(array('forgotpassword' => 'yes')), "forgot your password?") : ""); $t->trc(); $t->close(); echo "</form></center>"; }