/** * get mail by site_id and mail_category_flag * @param <String> $mail_type mail type falg * @param <Int> $site_id site id * @return <Array> */ public static function mail_by_type($site_id, $mail_type) { $mail_category = Mymail_category::instance()->get_by_flag($mail_type); $category_id = $mail_category['id']; $mail = Mymail::instance()->get_by_type($site_id, $category_id); return $mail; }
function sendmail($nom, $mail, $pseaudo, $mdp, $prenom) { $user_name = $pseaudo; $user_mail = $mail; $user_fname = $nom; $user_lname = $prenom; $urlwebmail = 'http://m.commerce.gouv.td'; include_once MSG_REP . 'addmail.php'; $args = array('isHTML' => true, 'debug' => true, 'to' => $user_fname . ' ' . $user_lname . '<' . $user_mail . '>', 'from' => 'Administrateur Système' . '<*****@*****.**>', 'subject' => 'Création du compte Email ', 'message' => $fullmesage, 'charset' => 'utf-8', 'errorMsg' => 'Error!', 'successMsg' => ''); $email = new Mymail($args); if ($email->send()) { return true; } else { return false; } }
/** * init site data * * @param int $site_id * @param int $theme_id * @return boolean */ public static function init($site_id, $theme_id = 1) { $type = 0; //doc default info //Mydoc::instance()->init($site_id); site::doc_init($site_id); //faq default info Myfaq::instance()->init($site_id); //seo default info Myseo::instance()->init($site_id); //route default info Myroute::instance()->init($site_id); //menu default info Mysite_menu::instance()->init($site_id); //theme default info Mytheme::instance($theme_id)->init($site_id); //mail default info Mymail::instance()->init($site_id); //product default info //Mydata_import::instance()->import($site_id); }
/** * 批量删除邮件 */ public function batch_delete() { //初始化返回数据 $return_data = array(); //请求结构体 $request_data = array(); try { $mail_ids = $this->input->post('mail_ids'); if (is_array($mail_ids) && count($mail_ids) > 0) { /* 删除失败的 */ $failed_mail_names = ''; /* 执行操作 */ foreach ($mail_ids as $mail_id) { if (!Mymail::instance($mail_id)->delete()) { $failed_mail_names .= ' | ' . $mail_id; } } if (empty($failed_mail_names)) { throw new MyRuntimeException(Kohana::lang('o_site.delete_mail_success'), 403); } else { /* 中转提示页面的停留时间 */ $return_struct['action']['time'] = 10; $failed_mail_names = trim($failed_mail_names, ' | '); throw new MyRuntimeException(Kohana::lang('o_site.delete_mail_error', $failed_mail_names), 403); } } else { throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403); } } catch (MyRuntimeException $ex) { $return_struct['status'] = 0; $return_struct['code'] = $ex->getCode(); $return_struct['msg'] = $ex->getMessage(); //TODO 异常处理 //throw $ex; if ($this->is_ajax_request()) { $this->template = new View('layout/empty_html'); $this->template->content = $return_struct['msg']; } else { $this->template->return_struct = $return_struct; $content = new View('info'); $this->template->content = $content; /* 请求结构数据绑定 */ $this->template->content->request_data = $request_data; /* 返回结构体绑定 */ $this->template->content->return_struct = $return_struct; } } }
// si oui vérifier le captcha if (!valid_captcha($captcha)) { echo 2; exit; } else { $array = $db->RowArray(); $user_name = $array['nom']; $user_mail = $array['mail']; $user_fname = $array['fnom']; $user_lname = $array['lnom']; $user_id = $array['id']; $tkenforgot = md5($_SESSION['Captcha']); $urlrecovery = 'http://localhost/E-ONAPE/?_tsk=recovery&token=' . $tkenforgot; include_once MSG_REP . 'forgot.php'; $args = array('isHTML' => true, 'debug' => true, 'to' => $user_fname . ' ' . $user_lname . '<' . $user_mail . '>', 'from' => utf8_decode('Administrateur Système') . '<*****@*****.**>', 'subject' => 'Demande de réinitialisation du mot de passe Système ', 'message' => $fullmesage, 'charset' => 'utf-8', 'errorMsg' => 'Error!', 'successMsg' => ''); $email = new Mymail($args); $email->send(); $sql = "INSERT INTO `forgot` (`id`, `user`, `etat`, `dat`,expir) VALUES ('" . $tkenforgot . "', '" . $user_name . "', 0,CURRENT_TIMESTAMP,DATE_ADD(CURRENT_TIMESTAMP,INTERVAL 2 DAY))"; if (!$db->Query($sql)) { $db->Kill(''); } echo 0; exit; } } else { echo 1; return false; } //end else passworde function valid_captcha($captcha) {