Exemplo n.º 1
0
 function authHtacess($login = "", $pwd = "")
 {
     if (!$login) {
         $login = $_SERVER["PHP_AUTH_USER"];
     }
     if (!$pwd) {
         $pwd = $_SERVER["PHP_AUTH_PW"];
     }
     $this->dbg("authHtacess: {$login} (htaccess file '" . $this->htaccess . "')");
     if (!$login || !$pwd) {
         return;
     }
     // get and parce the .htpasswd file
     if ($f = $this->locateHTpasswd()) {
         if (!ereg($this->RequireUser, $login)) {
             $this->dbg("authHtacess", "{$login} rejected by 'Require user' " . $this->RequireUser);
             return;
         }
         $lines = file($f);
         while (list($k, $line) = each($lines)) {
             $this->dbg("authHtacess", "{$line}");
             list($Huser, $Hpwd) = split(":", $line);
             if ($Huser == $login && preg_match("/" . crypt($pwd, $Hpwd) . "/i", $Hpwd)) {
                 core_syslog("Accepted htaccess_auth for {$login} from " . $_SERVER["REMOTE_ADDR"]);
                 $_SESSION["auth"]["type"] = "htaccess";
                 if ($u = core_getpwnam($login)) {
                     return array($login, $u["gecos"], -1);
                 } else {
                     return array($login, $login, -1);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
function core_internalError($txt, $class = False, $forced = False)
{
    global $headerClass, $core_debug, $cnf;
    if ($GLOBALS["core_internalError"]++) {
        exit;
    }
    if (True || $forced || $core_debug || core_getOption('YBhere') || core_getOption('test')) {
        $toPrinError = True;
    } else {
        core_bug2mail($txt, 'core_internalError ' . $cnf["version"]);
        if (function_exists('apps_getBugReport')) {
            apps_getBugReport($class, $txt);
        }
        $toPrinError = function_exists('apps_internalError') ? apps_internalError($txt, $class) : True;
    }
    if ($toPrinError) {
        $message = ($class ? "class " . get_class($class) . ': ' : '') . "{$txt}";
        core_syslog("BUG {$message}");
        print "<font color='red'><h1>Internal error</h1>{$message}</font>";
        core_backtrace('internal error', $class);
        #    if     (function_exists('appsGetFooter')) appsGetFooter();
        #    elseif (@$headerClass)            $headerClass->getFooter();
        exit;
    }
}
Exemplo n.º 3
0
 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} &lt;{$to}&gt;";
     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(' ', '&nbsp;', eregi_replace("\n", "<br>", $message)))));
     }
 }