Example #1
0
     $errorMsg .= $outputPDF . '<br>';
 }
 $savedOrder = $dbm->saveOrder($datasPost, is_bool($outputPDF) && is_bool($outputCSV), $_SESSION['customer_id']);
 if (is_string($savedOrder)) {
     $errorMsg .= $savedOrder . '<br>';
 }
 if (IC::SEND_MAIL_ENABLED) {
     include_once '../Manager/MailManager.php';
     $subject = PURCHASE_ORDER . ' ' . $datasPost['item'] . ' ' . $_SERVER['HTTP_HOST'];
     $msg = '<html><body><h3>Ref: ' . $_SESSION['customer_email'] . ' ' . $dbm->dateOrder . '</h3></body></html>';
     $mm = new MailManager($_SESSION['customer_email'], stristr($_SESSION['customer_email'], '@', TRUE), $subject, $msg, [$fm->pdfPath]);
     $output = $mm->send();
     if (is_string($output)) {
         $errorMsg .= $output;
     }
     $mm2 = new MailManager(IC::PRESTEEGE_BOX, IC::PRESTEEGE_OWNER, $subject, $msg, [$fm->pdfPath, $fm->csvPath]);
     $output2 = $mm2->send();
     if ($output2) {
         if (is_file($fm->csvPath)) {
             unlink($fm->csvPath);
         }
         if (is_file($fm->pdfPath)) {
             unlink($fm->pdfPath);
         }
         echo '<font color="green">' . MAILS_SENT . '</font>';
     } else {
         $errorMsg .= $output;
     }
 } else {
     $errorMsg .= ENABLE_MAIL;
 }
        require_once '../Manager/DatabaseManager.php';
        $dm = new DatabaseManager();
        $outputdm = $dm->fetchUser($rescueEmail);
        if (is_bool($outputdm)) {
            //using redis to store temporary hash and email info
            $hash = sha1(microtime(TRUE));
            $redis = new \Redis();
            $redis->connect('127.0.0.1');
            $redis->set($rescueEmail, $hash, 60 * 60);
            require_once '../Manager/MailManager.php';
            $resetLink = 'http://tampoon.net/resetPassword/?email=' . $rescueEmail . '&hash=' . $hash;
            $msg = '<html><body><br><a href="' . $resetLink . '">' . CLICK_TO_RESET_PASSWD . '</a>';
            $msg .= '<br>' . COPY_RESET_PASSWD_URL;
            $msg .= '<br>' . $resetLink;
            $msg .= '<br><font color="red>"' . AVAILABLE_24H . '</font>';
            $msg .= '</body></html>';
            $mm = new MailManager($rescueEmail, InitConsts::GMAIL_BOX, RESET_PASSWORD, $msg);
            $outputmm = $mm->send();
            if (is_bool($outputmm)) {
                echo MAILS_SENT;
            } else {
                $errorMsg = $outputmm;
            }
        } else {
            $errorMsg = UNEXISTING_EMAIL;
        }
    }
    if (isset($errorMsg)) {
        echo 'e<font color="red">' . $errorMsg . '</font>';
    }
}