public function insert_image($url, $mem_sn) { $data = array("raw_url" => $url, "mem_sn" => $mem_sn, "createDate" => db_current_date()); $this->db->insert($this->_table, $data); }
} return false; } // fetches a single column with translated html special characters
public function posting($on = 1) { $fields = array("title", "type", "content", "intro", "youtube", "is_report"); $data = array(); foreach ($fields as $field) { $data[$field] = $this->input->post($field); } $this->load->library("htmlpurifierhelper"); $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($config); $category = get_post_category(); if (!isset($category[$data["type"]])) { die("not exist category"); } $data["content"] = $purifier->purify($data["content"]); $data["intro"] = $purifier->purify($data["intro"]); $inserted_data = array(); //$inserted_data["bl_sn"] = $inserted_data["title"] = $data["title"]; $inserted_data["article"] = $data["content"]; $inserted_data["article_desc"] = strip_tags($data["content"]); //article_pic $inserted_data["date_year"] = date("Y"); $inserted_data["date_month"] = date("m"); $inserted_data["date_day"] = date("d"); $inserted_data["date_ym"] = date("Ym"); $inserted_data["is_news"] = $data["is_report"] != "" ? 1 : 0; if ($on == 1) { $inserted_data["is_on"] = 1; } else { $inserted_data["is_on"] = 0; } $inserted_data["date_new"] = db_current_date(); $inserted_data["date_update"] = db_current_date(); $this->load->model("blogModel"); $this->blogModel->insert_blog_post($this->_mem->mem_sn, $inserted_data); redirect(site_url("member/posts")); }
function insert_new($auth, $mid, $email, $nick, $pwd, $is_paper) { $this->db->where("email", $email); $this->db->limit(1); $query = $this->db->get($this->_table_); if (count($query->result()) > 0) { return new ReturnMessage(false, -1, "email 已被使用過"); } $this->db->where("nick_name", $nick); $this->db->limit(1); $query = $this->db->get($this->_table_); if (count($query->result()) > 0) { return new ReturnMessage(false, -1, "暱稱已被使用過"); } $this->db->insert($this->_table_, array("is_repoter" => 0, "auth_code" => $auth, "need_auth" => 1, "date_new" => db_current_date(), "date_update" => db_current_date(), "date_last" => db_current_date(), "is_on" => 1, "sex" => null, "mid" => $mid, "is_vip_name" => "", "nmlcat_sn" => "", "upass" => sha1($pwd), "email" => $email, "nick_name" => $nick, "is_epaper" => $is_paper)); return new ReturnMessage(true, 0, null, $this->db->insert_id()); // is_repoter = 0 // auth_code = sha1 // need_auth = 1 // date_new // date_update // date_last // is_on =1 // //mid //upass //nick_name //is_epaper //is_on }