public function action_index() { $res = Model_Db_User::byCustom(); //throw new \HttpServerErrorException(); $d['user_list'] = $res; $this->template->content = View_Smarty::forge('user', $d); }
public function action_index() { $ext = Input::extension(); Log::info('500:' . Input::uri() . '.' . $ext); $this->response_status = 500; $this->template->content = View_Smarty::forge('500'); }
public function action_index() { $d = []; if ($this->is_post()) { $d = $this->get_form()->repopulate()->input(); } $this->template->content = View_Smarty::forge('login', $d); }
/** * Load the template and create the $this->template object */ public function before() { if (!empty($this->template) and is_string($this->template)) { // marietta //$this->template = \View::forge($this->template); $this->template = \View_Smarty::forge($this->template); } return parent::before(); }
public function after($response) { $response = parent::after($response); $this->post($this->template->content->tplname(), 'admin'); $this->template->set_global('menu', View_Smarty::forge("admin/parts/menu", [])); $this->template->set_global('top', View_Smarty::forge("admin/parts/top", ['user' => $this->get_user()])); $this->template->set_global('header', View_Smarty::forge("admin/parts/header", [])); $this->template->set_global('footer', View_Smarty::forge("admin/parts/footer", [])); Model_Db_Operationlog::write('admin', Model_Db_Admin::by_session(), $this->request->action); return $response; }
public function action_index() { $ext = Input::extension(); Log::info('404:' . Input::uri() . '.' . $ext); // コンテンツの場合は404を返す $ext = Input::extension(); if (in_array($ext, array('png', 'jpg', 'jpeg', 'gif', 'js', 'css', 'aspx', 'xml', 'json'))) { header('HTTP/1.1 404 Not Found'); exit; } $this->response_status = 404; $this->template->content = View_Smarty::forge('404'); }
public function action_index() { $this->breadcrumb = array(array("トップ", Uri::create("/"))); $this->template->content = View_Smarty::forge("about"); }
public function action_do() { try { $this->checkCsrf(); // 入力チェック $val = $this->getEditForm()->validation(); if (!$val->run()) { $this->invalid($val); } $data = $val->validated(); // メール通知(サンクス) **************************************************** $title = "お問い合わせを承りました"; $email = Email::forge(); $email->clear_addresses(); $email->from(Config::get("mail.account.help.addr"), Config::get("mail.account.help.name")); $email->to($data["mail_address"], $data["name"] . "様"); $email->subject(Config::get("mail.prefix") . $title); $body = View_Smarty::forge("mail/contact_complete"); $body->data = $data; $body->contact_type_list = $this->contactType; $email->body($body); Common::sendmail($email); // メール通知(管理者) **************************************************** $title = "お問い合わせ"; $email = Email::forge(); $email->clear_addresses(); $email->from($data["mail_address"], $data["name"] . "様"); $email->to(Config::get("mail.account.help.addr"), Config::get("mail.account.help.name")); $email->subject(Config::get("mail.prefix") . $title); $body = View_Smarty::forge("mail/contact_complete_admin"); $body->data = $data; $body->contact_type_list = $this->contactType; $email->body($body); Common::sendmail($email); $this->template->content = View_Smarty::forge("contact_complete", $data); } catch (Exception $e) { $this->error($e); $this->action_index(); } }
public function action_index() { $this->template->content = View_Smarty::forge('admin/index', []); }
public function update() { $this->verify_csrf(); $d = $this->verify($this->get_form()); if (!$d) { $this->action_edit(); return; } $now = System::now(); $user = null; if ($d['ope'] == Ope::ADD) { $user = Model_Db_User::anew(); $user->user_password = Auth::hash_password(Str::random('alnum', 6)); } else { $user = Model_Db_User::by_id($d['id']); } $user->user_name = $d['name']; $user->user_email = $d['email']; $user->user_status = $d['status']; $user->user_updated_at = $now; $user->save(); $this->template->content = View_Smarty::forge('admin/user/do', $d); }
public function action_do($type = 0) { $this->checkCsrf("admin"); try { DB::start_transaction(); // 入力チェック $val = $this->getForm($type)->validation(); if (!$val->run()) { $this->invalid($val); } $data = $val->validated(); $adminId = $this->adminId(); // DB更新 $admin = Model_Db_Madmin::find_by_pk($adminId); switch ($type) { case SettingType::MAILADDRESS: $admin->m_admin_mail_address = $data["mail_address_new"]; break; case SettingType::PASSWORD: if ($admin->m_admin_hashed_password != Auth::hash_password($data["password"])) { $this->invalid2("password", "現在のパスワードが間違っています"); } $admin->m_admin_hashed_password = Auth::hash_password($data["password_new"]); break; default: } $admin->m_admin_updated_at = System::now(); if ($admin->save() == 0) { throw new Exception("設定情報更新に失敗しました"); } // メール通知 **************************************************** switch ($type) { case SettingType::MAILADDRESS: $title = "管理者メールアドレス変更のお知らせ"; $email = Email::forge(); $email->clear_addresses(); $email->from(Config::get("mail.addr_info"), Config::get("mail.addr_info_name")); $email->to($data["mail_address_new"], $this->adminName() . "さん"); $email->subject(Config::get("mail.prefix") . $title); $body = View_Smarty::forge("admin/mail/setting_mail"); $body->title = $title; $body->name = $this->adminName(); $body->mail_address = $data["mail_address_new"]; $email->body($body); Common::sendmail($email); break; case SettingType::PASSWORD: $title = "管理者パスワード変更のお知らせ"; $email = Email::forge(); $email->clear_addresses(); $email->from(Config::get("mail.addr_info"), Config::get("mail.addr_info_name")); $email->to($this->adminMail(), $this->adminName() . "さん"); $email->subject(Config::get("mail.prefix") . $title); $body = View_Smarty::forge("admin/mail/setting_password"); $body->title = $title; $body->name = $this->adminName(); $body->password = $data["password_new"]; $email->body($body); Common::sendmail($email); break; default: } if ($type == SettingType::MAILADDRESS) { //$this->dispInfo("入力したメールアドレス宛に確認メールを送信しました。\\nメールが届かない場合は、入力したメールアドレスを確認してください。"); } else { //$this->dispInfo(SettingType::$name[$type] . "を更新しました"); } $this->action_index(true); DB::commit_transaction(); } catch (Exception $e) { DB::rollback_transaction(); $this->error($e); $this->action_index(false); } }