Ejemplo n.º 1
0
 function deleteAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = FALSE;
     foreach ($modelsID as $id) {
         $model = new Smtp();
         $model->model_uset_id = $this->user->user_id;
         if ($model->fillFromDbPk($id)) {
             $model->delete($id);
         } else {
             $errors = TRUE;
         }
         if ($model->getErrors()) {
             $errors = TRUE;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('smtp_not_deleted'));
         } else {
             $countE = AF::get($_POST, 'countE', 100000);
             if (count($modelsID) >= $countE) {
                 $link = AF::link(array('smtp' => 'view'));
                 Message::echoJsonRedirect($link);
             } else {
                 Message::echoJsonSuccess(__('smtp_deleted'));
             }
         }
     }
     $this->redirect();
 }
Ejemplo n.º 2
0
             $saveOrder->payment_total = $orderModel->payment_total - $countRefunded;
             echo $saveOrder->payment_total . '<br>';
             $saveOrder->setIsNewRecord(false);
             $saveOrder->save(false);
             OrderLog::createLog(0, $jobModel->order_id, 13, $countRefunded);
         } else {
             $jobModel->setStatusError(json_encode($paymentSystem->geterrors()));
         }
     } catch (Exception $e) {
         $jobModel->setStatusError($e->getMessage());
     }
     break;
 case 'mail':
     $mailArray = unserialize($jobModel->content);
     $smtpModel = new Smtp();
     $smtpModel->fillFromDbPk((int) $mailArray['smtp_id']);
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->IsHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->SMTPSecure = "tls";
     $mail->SMTPAuth = true;
     $mail->Username = $smtpModel->smtp_username;
     $mail->Password = $smtpModel->smtp_password;
     $mail->Host = $smtpModel->smtp_host;
     $mail->From = $smtpModel->smtp_email;
     $mail->FromName = $smtpModel->smtp_name;
     $mail->AddAddress($mailArray['email']);
     $mail->Subject = $mailArray['body_subject'];
     $mail->Body = $mailArray['body_html'];
     $mail->AltBody = $mailArray['body_plain'];