Пример #1
0
 function onError($error)
 {
     global $ost, $thisstaff;
     $ost->logError('Upgrader Error', $error);
     $this->setError($error);
     $this->setState('aborted');
     //Alert staff upgrading the system - if the email is not same as admin's
     // admin gets alerted on error log (above)
     if (!$thisstaff || !strcasecmp($thisstaff->getEmail(), $ost->getConfig()->getAdminEmail())) {
         return;
     }
     $email = null;
     if (!($email = $ost->getConfig()->getAlertEmail())) {
         $email = $ost->getConfig()->getDefaultEmail();
     }
     //will take the default email.
     $subject = 'Upgrader Error';
     if ($email) {
         $email->send($thistaff->getEmail(), $subject, $error);
     } else {
         //no luck - try the system mail.
         Mailer::sendmail($thistaff->getEmail(), $subject, $error, sprintf('"osTicket Alerts"<%s>', $thistaff->getEmail()));
     }
 }
Пример #2
0
//Not in use anymore....as of v 1.7
define('SLA_TABLE', TABLE_PREFIX . 'sla');
define('API_KEY_TABLE', TABLE_PREFIX . 'api_key');
define('TIMEZONE_TABLE', TABLE_PREFIX . 'timezone');
#Connect to the DB && get configuration from database
$ferror = null;
if (!db_connect(DBHOST, DBUSER, DBPASS) || !db_select_database(DBNAME)) {
    $ferror = 'Unable to connect to the database';
} elseif (!($ost = osTicket::start(1)) || !($cfg = $ost->getConfig())) {
    $ferror = 'Unable to load config info from DB. Get tech support.';
}
if ($ferror) {
    //Fatal error
    //try alerting admin using email in config file
    $msg = $ferror . "\n\n" . THISPAGE;
    Mailer::sendmail(ADMIN_EMAIL, 'osTicket Fatal Error', $msg, sprintf('"osTicket Alerts"<%s>', ADMIN_EMAIL));
    //Display generic error to the user
    die("<b>Fatal Error:</b> Contact system administrator.");
    exit;
}
//Init
$session = $ost->getSession();
//System defaults we might want to make global//
#pagenation default - user can overwrite it!
define('DEFAULT_PAGE_LIMIT', $cfg->getPageSize() ? $cfg->getPageSize() : 25);
#Cleanup magic quotes crap.
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
    $_POST = Format::strip_slashes($_POST);
    $_GET = Format::strip_slashes($_GET);
    $_REQUEST = Format::strip_slashes($_REQUEST);
}
Пример #3
0
 function croak($message)
 {
     $msg = $message . "\n\n" . THISPAGE;
     Mailer::sendmail(ADMIN_EMAIL, 'osTicket Fatal Error', $msg, sprintf('"osTicket Alerts"<%s>', ADMIN_EMAIL));
     //Display generic error to the user
     Http::response(500, "<b>Fatal Error:</b> Contact system administrator.");
 }
Пример #4
0
 function alertAdmin($subject, $message, $log = false)
 {
     //Set admin's email address
     if (!($to = $this->getConfig()->getAdminEmail())) {
         $to = ADMIN_EMAIL;
     }
     //append URL to the message
     $message .= "\n\n" . $this->getConfig()->getBaseUrl();
     //Try getting the alert email.
     $email = null;
     if (!($email = $this->getConfig()->getAlertEmail())) {
         $email = $this->getConfig()->getDefaultEmail();
     }
     //will take the default email.
     if ($email) {
         $email->sendAlert($to, $subject, $message, null, array('text' => true));
     } else {
         //no luck - try the system mail.
         Mailer::sendmail($to, $subject, $message, sprintf('"osTicket Alerts"<%s>', $to));
     }
     //log the alert? Watch out for loops here.
     if ($log) {
         $this->log(LOG_CRIT, $subject, $message, false);
     }
     //Log the entry...and make sure no alerts are resent.
 }
Пример #5
0
 function onError($error)
 {
     global $ost, $thisstaff;
     $subject = '[' . $this->name . ']: ' . _S('Upgrader Error');
     $ost->logError($subject, $error);
     $this->setError($error);
     $this->upgrader->setState('aborted');
     //Alert staff upgrading the system - if the email is not same as admin's
     // admin gets alerted on error log (above)
     if (!$thisstaff || !strcasecmp($thisstaff->getEmail(), $ost->getConfig()->getAdminEmail())) {
         return;
     }
     $email = null;
     if (!($email = $ost->getConfig()->getAlertEmail())) {
         $email = $ost->getConfig()->getDefaultEmail();
     }
     //will take the default email.
     if ($email) {
         $email->sendAlert($thisstaff->getEmail(), $subject, $error);
     } else {
         //no luck - try the system mail.
         Mailer::sendmail($thisstaff->getEmail(), $subject, $error, '"' . _S('osTicket Alerts') . "\" <{$thisstaff->getEmail()}>");
     }
 }
Пример #6
0
 public function checkout_post()
 {
     $data = $this->data;
     $this->form_validation->set_rules('receive_name_Str', '收件人姓名', 'required');
     $this->form_validation->set_rules('receive_address_Str', '收件人地址', 'required');
     $this->form_validation->set_rules('receive_phone_Str', '收件人電話', 'required');
     if ($this->form_validation->run() !== FALSE) {
         $receive_name_Str = $this->input->post('receive_name_Str', TRUE);
         $receive_address_Str = $this->input->post('receive_address_Str', TRUE);
         $receive_phone_Str = $this->input->post('receive_phone_Str', TRUE);
         $receive_time_Str = $this->input->post('receive_time_Str', TRUE);
         $receive_remark_Str = $this->input->post('receive_remark_Str', TRUE);
         //讀取建構中的訂單
         $OrderShop = new OrderShop(['db_where_Arr' => array('uid_Num' => $data['User']->uid_Num, 'order_status_Num' => -1)]);
         if ($OrderShop->pay_paytype_Str === 'card') {
             $OrderShop->pay_status_Num = 1;
             $OrderShop->paycheck_status_Num = 1;
         } else {
             if ($OrderShop->pay_paytype_Str === 'cash_on_delivery') {
                 $OrderShop->pay_status_Num = 1;
             }
         }
         $OrderShop->receive_name_Str = $receive_name_Str;
         $OrderShop->receive_address_Str = $receive_address_Str;
         $OrderShop->receive_phone_Str = $receive_phone_Str;
         $OrderShop->receive_time_Str = $receive_time_Str;
         $OrderShop->receive_remark_Str = $receive_remark_Str;
         //將訂單從建構中改為已建立
         $finish_order_Return = $OrderShop->finish_order();
         if ($finish_order_Return === TRUE) {
             //寄出訂單新增通知給管理員
             $smtp_email_Setting = new Setting(['db_where_Arr' => ['keyword_Str' => 'smtp_email']]);
             $smtp_username_Setting = new Setting(['db_where_Arr' => ['keyword_Str' => 'smtp_username']]);
             $email_Str = $smtp_email_Setting->value_Str;
             $email_name_Str = $smtp_username_Setting->value_Str;
             $title_Str = '訂單成交通知';
             $message_Str = '您好:<br><br>我們已經收到一則訂單資訊!<br><br>' . '購買人:' . $data['User']->email_Str . '<br>' . '購買的產品如下:<br><br>';
             foreach ($OrderShop->cart_CartShopList->obj_Arr as $key => $value_CartShop) {
                 $message_Str .= $value_CartShop->product_ProductShop->name_Str . ' ( ' . $value_CartShop->StockProductShop->classname1_Str . ' / ' . $value_CartShop->StockProductShop->classname2_Str . ' ) ' . '單價' . $value_CartShop->price_Num . '元 * ' . $value_CartShop->amount_Num . ' 總價共 ' . $value_CartShop->price_total_Num . '元<br>';
             }
             $message_Str .= '<br><br>運費總金額:' . $OrderShop->pay_price_freight_Num . '元<br>' . '購物總金額(含運費):' . $OrderShop->pay_price_total_Num . '元<br><br>' . '訂購時間:' . date('Y-m-d H:i:s');
             $Mailer = new Mailer();
             $return_message_Str = $Mailer->sendmail($email_Str, $email_name_Str, $title_Str, $message_Str);
             if ($return_message_Str === TRUE) {
                 //寄件成功
             } else {
                 //送出訊息
                 $this->load->model('Message');
                 $this->Message->show(array('message' => 'error(4):郵件伺服器出錯', 'url' => 'order/cartlist'));
                 return FALSE;
             }
             //寄出下單通知給買家
             $email_Str = $data['User']->email_Str;
             $email_name_Str = $data['User']->email_Str;
             $title_Str = '訂單成交通知';
             $message_Str = '您好:<br><br>我們收到您的訂單資訊!<br><br>' . '購買人:' . $data['User']->email_Str . '<br>' . '購買的產品如下:<br><br>';
             foreach ($OrderShop->cart_CartShopList->obj_Arr as $key => $value_CartShop) {
                 $message_Str .= $value_CartShop->product_ProductShop->name_Str . ' ( ' . $value_CartShop->StockProductShop->classname1_Str . ' / ' . $value_CartShop->StockProductShop->classname2_Str . ' ) ' . '單價' . $value_CartShop->price_Num . '元 * ' . $value_CartShop->amount_Num . ' 總價共 ' . $value_CartShop->price_total_Num . '元<br>';
             }
             $message_Str .= '<br><br>運費總金額:' . $OrderShop->pay_price_freight_Num . '元<br>' . '購物總金額(含運費):' . $OrderShop->pay_price_total_Num . '元<br><br>' . '訂購時間:' . date('Y-m-d H:i:s');
             $Mailer = new Mailer();
             $return_message_Str = $Mailer->sendmail($email_Str, $email_name_Str, $title_Str, $message_Str);
             if ($return_message_Str === TRUE) {
                 //寄件成功
             } else {
                 //送出訊息
                 $this->load->model('Message');
                 $this->Message->show(array('message' => 'error(4):郵件伺服器出錯', 'url' => 'order/cartlist'));
                 return FALSE;
             }
             $message_Str = '訂單完成';
             $url_Str = 'admin/user/order_shop/order_shop/tablelist';
             $this->load->model('Message');
             $this->Message->show(array('message' => $message_Str, 'url' => $url_Str));
             return TRUE;
         } else {
             $message_Str = $finish_order_Return;
             $url_Str = 'order/cartlist';
             $this->load->model('Message');
             $this->Message->show(array('message' => $message_Str, 'url' => $url_Str, 'second' => 7));
             return TRUE;
         }
     } else {
         $message_Str = '請填寫詳細收件人資料';
         $url_Str = 'order/checkout';
         $this->load->model('Message');
         $this->Message->show(array('message' => $message_Str, 'url' => $url_Str));
     }
 }