public function add() { if ($_POST) { //标签过滤 tool::filter_strip_tags($_POST, array('content')); $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); $faq = Myfaq::instance(); if ($faq->add($_POST)) { //判断添加成功去向 switch ($submit_target) { case 1: remind::set(Kohana::lang('o_global.add_success'), 'site/faq/add', 'success'); case 2: remind::set(Kohana::lang('o_global.add_success'), $site_next_flow['url'], 'success'); default: remind::set(Kohana::lang('o_global.add_success'), 'site/faq', 'success'); } } else { remind::set(Kohana::lang('o_global.add_error'), 'site/faq/add'); } } $this->template->content = new View("site/faq_add"); $this->template->content->title = "site faq add"; }
public function index() { $route_data = Myroute::instance()->get(); if ($_POST) { $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); if (Myroute::instance()->edit($_POST)) { //判断添加成功去向 switch ($submit_target) { case 2: remind::set(Kohana::lang('o_global.update_success'), $site_next_flow['url'], 'success'); default: remind::set(Kohana::lang('o_global.update_success'), 'site/route', 'success'); } } else { remind::set(Kohana::lang('o_global.update_error'), 'site/route'); } } $this->template->content = new View("site/route_edit"); $this->template->content->is_modify = 0; if ($this->manager_is_admin == 1) { $this->template->content->is_modify = 1; } $this->template->content->data = $route_data; $this->template->content->site_id = $this->site_id; }
/** * set mail template */ public function set() { if ($_POST) { $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); $flag = 0; $mail_ids = $this->input->post('mail_id'); foreach ($mail_ids as $mail_id) { if ($mail_id > 0) { $data = Mymail_template::instance($mail_id)->get(); if (!Mymail::instance()->set($data)) { $flag++; } } } if ($flag > 0) { $error = Mymail::instance()->error(); remind::set(Kohana::lang('o_global.set_error') . $error, 'site/mail'); } else { //判断添加成功去向 switch ($submit_target) { case 1: remind::set(Kohana::lang('o_global.update_success'), $site_next_flow['url'], 'success'); default: remind::set(Kohana::lang('o_global.update_success'), 'site/mail', 'success'); } } } $mails = Mymail::instance()->mails(); $query_struct = array(); $mail_categories = Mymail_category::instance()->mail_categories($query_struct); foreach ($mail_categories as $key => $value) { $query_struct = array(); $query_struct['where']['mail_category_id'] = $value['id']; $mail_template = Mymail_template::instance()->mail_templates($query_struct); $mail_categories[$key]['mail_template_list'] = $mail_template; $mail_categories[$key]['mail_template'] = " -未设定- "; $mail_categories[$key]['mail_template_perview_link'] = "#"; foreach ($mails as $m_key => $m_value) { if ($m_value['mail_category_id'] == $value['id']) { $mail_categories[$key]['mail_template'] = $m_value['name']; $mail_categories[$key]['mail_template_perview_link'] = url::base() . "site/mail/perview/site/" . $m_value['id']; } } } $this->template->content = new View('site/mail_set'); $this->template->content->site_categories = $mail_categories; }
/** * 添加新币种 */ function add() { if ($_POST) { //标签过滤 tool::filter_strip_tags($_POST); $data = $_POST; $currency = Mycurrency::instance(); if ($currency->exist($data)) { remind::set(Kohana::lang('o_site.current_has_exist'), null, 'error'); } else { unset($data['id']); $data['active'] = 1; if ($id = $currency->add($data)) { //更新默认币种显示 Mycurrency::instance($id)->update_currencies_default(); $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); //判断添加成功去向 switch ($submit_target) { case 1: remind::set(Kohana::lang('o_global.add_success'), 'site/currency/add', 'success'); case 2: remind::set(Kohana::lang('o_global.add_success'), $site_next_flow['url'], 'success'); default: remind::set(Kohana::lang('o_global.add_success'), 'site/currency', 'success'); } } else { $errors = $currency->errors(); remind::set(Kohana::lang('o_global.add_error'), request::referrer(), 'error'); } } } $currency_code = kohana::config('currency.code'); $currency_sign = kohana::config('currency.sign'); $currency_name = kohana::config('currency.name'); $currency_rate = kohana::config('currency.rate'); $currency_format = kohana::config('currency.format'); $currency_data = json_encode(array('code' => $currency_code, 'sign' => $currency_sign, 'name' => $currency_name, 'rate' => $currency_rate)); $this->template->content = new View("site/currency_add"); $this->template->content->currency_data = $currency_data; $this->template->content->currency_name = $currency_name; $this->template->content->currency_format = $currency_format; }
/** * add doc */ public function add() { $post = array(); if ($_POST) { $post =& $_POST; $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); $doc = Mydoc::instance(); //标签过滤 tool::filter_strip_tags($_POST, array('content')); /* 判断url是否重复*/ $permalink = $this->input->post('permalink'); if ($doc->url_exist($permalink)) { remind::set(Kohana::lang('o_site.url_exist')); } else { if ($doc->add($_POST)) { //判断添加成功去向 switch ($submit_target) { case 1: remind::set(Kohana::lang('o_global.add_success'), 'site/doc/add', 'success'); break; case 2: remind::set(Kohana::lang('o_global.add_success'), 'site/doc/add', 'success'); break; default: remind::set(Kohana::lang('o_global.update_success'), 'site/doc', 'success'); } } else { remind::set(Kohana::lang('o_global.access_denied')); } } } //分类树 $category_list = ''; $categories = Mydoc_category::instance()->doc_categories(0); if (!empty($categories)) { foreach ($categories as $category) { $icon = ''; for ($i = 1; $i <= $category['level_depth']; $i++) { $icon = $icon . '--'; } $select = ''; if (isset($post['category_id']) && $post['category_id'] == $category['id']) { $select = ' selected'; } $category_list .= '<option value="' . $category['id'] . '"' . $select . '>' . $icon . $category['category_name'] . '</option>'; } } $this->template->content = new View("site/doc_add"); $this->template->content->post = $post; $this->template->content->title = "site doc add"; $this->template->content->category_list = $category_list; }