Exemple #1
0
        $message = __('Someone has requested to reset the password for the following site and username.') . "\n\n" . $page_url . "\n" . __('Username:'******' ' . $user_id . "\n\n" . __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\n" . $page_url . '?akey=' . $recover_key;
        $headers[] = 'From: ' . (defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local');
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
        mail::sendMail($user_email, $subject, $message, $headers);
        $msg = sprintf(__('The e-mail was sent successfully to %s.'), $user_email);
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
} elseif ($akey) {
    try {
        $recover_res = $core->auth->recoverUserPassword($akey);
        $subject = mb_encode_mimeheader('DotClear ' . __('Your new password'), 'UTF-8', 'B');
        $message = __('Username:'******' ' . $recover_res['user_id'] . "\n" . __('Password:'******' ' . $recover_res['new_pass'] . "\n\n" . preg_replace('/\\?(.*)$/', '', $page_url);
        $headers[] = 'From: dotclear@' . $_SERVER['HTTP_HOST'];
        $headers[] = 'Content-Type: text/plain; charset=UTF-8;';
        mail::sendMail($recover_res['user_email'], $subject, $message, $headers);
        $msg = __('Your new password is in your mailbox.');
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
} elseif ($change_pwd) {
    try {
        $tmp_data = explode('/', $_POST['login_data']);
        if (count($tmp_data) != 3) {
            throw new Exception();
        }
        $data = array('user_id' => base64_decode($tmp_data[0]), 'cookie_admin' => $tmp_data[1], 'user_remember' => $tmp_data[2] == '1');
        if ($data['user_id'] === false) {
            throw new Exception();
        }
        # Check login informations
Exemple #2
0
 public function addPaymentReport($payment_details, $mineral_details)
 {
     //first we do query to enter report headers
     $_user = $_SESSION["user"];
     //get user and company info
     $entityType = "";
     $govtid = 'null';
     $TPIN = 'null';
     //check if user is from mine or government
     if ($_user->TPIN != null) {
         $entityType = 'mine';
         $TPIN = $_user->TPIN;
     } else {
         $entityType = 'gov';
         $govtid = $_user->entityID;
     }
     //get date or period
     $period = date("Y");
     $dateSub = date("Y-m-d");
     //get for which mine
     $forWhichMine = isset($_SESSION["forWhichMine"]) ? $_SESSION["forWhichMine"] : 'null';
     //get userid
     $userID = $_user->userID;
     if (!isset($_SESSION["reportID"])) {
         $sql1 = "INSERT INTO report(period,govtEntityID,userID,TPIN,templateID, dateSubmitted, forWhichMine) VALUES('{$period}',{$govtid},{$userID},{$TPIN},2, '{$dateSub}', {$forWhichMine})";
         mysqli_query($this->con, $sql1);
         var_dump(mysqli_error($this->con), $sql1);
     }
     //get reportid
     $reportID = isset($_SESSION["reportID"]) ? $_SESSION["reportID"] : mysqli_insert_id($this->con);
     if ($reportID == 0) {
         exit("Error!");
     }
     //$reportID = 1;
     //need to create an insert statement with a for loop
     $sql = "INSERT INTO paymentdetails(reportID,refNumber,paid_received_zmw,paid_received_usd,comments) VALUES";
     foreach ($payment_details as $value) {
         $sql .= "({$reportID},{$value->refNumber},{$value->paid_receivedZMW},{$value->paid_receivedUSD}, '{$value->comments}'),";
     }
     $sql = chop($sql, ",");
     $sql .= "ON DUPLICATE KEY UPDATE paid_received_zmw = VALUES(paid_received_zmw), paid_received_usd = VALUES(paid_received_usd),comments = VALUES(comments)";
     //
     mysqli_query($this->con, $sql);
     //var_dump(mysqli_error($this->con), $sql);
     //create sql for mineral details
     //need to create an insert statement with a for loop
     $sql = "INSERT INTO mineraldetails(reportID,refNumber,copperTonnes,copperValue_usd,cobaltTonnes,cobaltValue_usd,goldKg_usd,goldValue_usd,coalTonnes,coalValue_usd ) VALUES";
     foreach ($mineral_details as $value) {
         $sql .= "({$reportID},{$value->refNumber},{$value->copperTonnes},{$value->copperValue}, {$value->cobaltTonnes}, {$value->cobaltValue}, {$value->goldkg}, {$value->goldValue},{$value->coalTonnes}, {$value->coalValue}),";
     }
     $sql = chop($sql, ",");
     $sql .= "ON DUPLICATE KEY UPDATE copperTonnes = VALUES(copperTonnes),copperValue_usd = VALUES(copperValue_usd),cobaltTonnes = VALUES(cobaltTonnes),cobaltValue_usd = VALUES(cobaltValue_usd),goldKg_usd = VALUES(goldKg_usd), goldValue_usd = VALUES(goldValue_usd), coalTonnes = VALUES(coalTonnes), coalValue_usd = VALUES(coalValue_usd)";
     mysqli_query($this->con, $sql);
     //var_dump(mysqli_error($this->con), $sql);
     //email sending...must look for standard user
     $sql_gmu = "";
     if ($entityType = 'mine') {
         $sql_gmu = "select emailAddress from user where TPIN = {$TPIN} and role = 'mu'";
     } else {
         $sql_gmu = "select emailAddress from user where entityID = {$govtid} and role = 'mu'";
     }
     $result = mysqli_query($this->con, $sql_gmu);
     $row = mysqli_fetch_row($result);
     $subject = "ZEII submission";
     $message = "Please follow this link www.zambiaeiti.org/ZeitiPortal/entities/viewFacade.php?action=report&id={$reportID}&tid=2&p={$period}";
     mail::sendMail($row[0], $subject, $message);
 }
 function sendSingleMail(MailStack $mail)
 {
     mail::sendMail($mail->address, $mail->theme, $mail->message);
     return $this->setSendedStatus($mail->id);
 }