Example #1
0
 function __construct($func = false, $title = false, $custom = false)
 {
     self::$temp = CORE::$temp_main;
     self::$temp['MAIN'] = 'ogs-response-tpl.html';
     $tplPath = CORE::$temp . self::$temp['MAIN'];
     file_put_contents($tplPath, SYSTEM::$setting['response']);
     switch ($func) {
         case "feedback":
             VIEW::assignGlobal(array('SEO_H1' => !empty($title) ? $title : '感謝您的評價'));
             break;
         case "contact":
             VIEW::assignGlobal(array('SEO_H1' => !empty($title) ? $title : '感謝您的留言'));
             break;
     }
     if (is_array($custom)) {
         VIEW::assignGlobal($custom);
     }
     $msg = SESS::get('msg');
     if (empty($msg)) {
         header('location: ' . CORE::$root . $func . '/');
         exit;
     }
     SESS::del('msg');
     if (is_array($msg)) {
         $output['TAG_NAME'] = CORE::fetchName(array($msg['lastName'], $msg['firstName']), 'call', $msg['gender']);
         foreach ($msg as $field => $var) {
             $output['TAG_' . strtoupper($field)] = $var;
         }
     } else {
         $output['TAG_MSG'] = $msg;
     }
     VIEW::assignGlobal($output);
     CORE::common_resource();
     new VIEW(CORE::$temp_option["HULL"], self::$temp, false, false);
 }
Example #2
0
 private static function add($m_id = false)
 {
     $recaptcha = self::recaptcha();
     CHECK::is_must($_POST["name"], $_POST["tel"], $_POST["content"]);
     CHECK::is_email($_POST["email"]);
     if ($recaptcha && CHECK::is_pass()) {
         $args = array('m_id' => !empty($m_id) ? $m_id : "null", 'content' => htmlspecialchars($_POST["content"], ENT_NOQUOTES));
         $args = array_merge($_POST, $args);
         CRUD::dataInsert('contact', $args);
         if (!empty(DB::$error)) {
             $msg = DB::$error;
         } else {
             foreach ($_POST as $field => $var) {
                 switch ($field) {
                     case "subject":
                         $subjectmail = self::subjectFetch($var, 'email');
                         $var = self::subjectFetch($var, 'subject');
                         break;
                     case "gender":
                         $var = empty($var) ? CORE::$lang["female"] : CORE::$lang["male"];
                         break;
                 }
                 VIEW::assignGlobal('VALUE_' . strtoupper($field), $var);
             }
             $msg = CORE::$lang["submit_done"];
             $mail_temp = 'ogs-mail-contact-tpl.html';
             # 信件樣板
             new VIEW($mail_temp, false, true, false);
             $fromMail = !empty($subjectmail) ? $subjectmail : SYSTEM::$setting["email"];
             CORE::mail_handle($_POST["email"], $fromMail, VIEW::$output, CORE::$lang["contact_mail"], SYSTEM::$setting["name"]);
             # 寄出認證信
             $rs = true;
         }
     } else {
         $msg = CHECK::$alert;
         if (empty($recaptcha)) {
             $msg = '請勾選驗證';
         }
         CRUD::args_output();
     }
     if ($rs) {
         RESPONSE::register($_POST, CORE::$root . 'contact/thankyou/');
         exit;
     } else {
         CORE::msg($msg, CORE::$root . 'contact/');
     }
 }
Example #3
0
 private static function add()
 {
     CHECK::is_must($_POST["callback"], $_POST["name"], $_POST["content"]);
     CHECK::is_email($_POST["email"]);
     if (CHECK::is_pass()) {
         foreach ($_POST as $field => $var) {
             switch ($field) {
                 case "name":
                 case "content":
                 case "gender":
                     $insert[$field] = strip_tags($var);
                     break;
                 default:
                     $insert[$field] = $var;
                     break;
             }
         }
         CRUD::dataInsert('feedback', $insert);
         if (!empty(DB::$error)) {
             $msg = 'Error! ' . DB::$error;
         } else {
             $msg = CORE::$lang['submit_done'];
         }
     } else {
         $msg = CHECK::$alert;
     }
     RESPONSE::register($msg, CORE::$root . 'feedback/thankyou/');
 }