示例#1
0
 public function edit($_id = '')
 {
     $this->assigns_layout["gnb_left"] = "contents";
     if ($_REQUEST["subject"]) {
         $content_parsed = parse_html($_REQUEST["contents"]);
         foreach ($content_parsed as $c) {
             if (strtolower(substr($c, 0, 4)) == "<img") {
                 $t = tag_barase($c);
                 if ($t["src"]) {
                     $_REQUEST["img"] = $t["src"];
                     break;
                 }
             }
         }
         $_id = $this->Content->add($_REQUEST);
         if ($_REQUEST["pic"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['pic']);
             $ck = substr($img_temp_name, 0, 1);
             if ($ck == '/') {
                 $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
             }
             $file_ext = explode('.', $img_temp_name);
             //$filename = basename($_FILES['file']['name']);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/contents/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/contents/' . $_id . $file_ext;
             $this->Content->add_picture($_id, $_pic);
         }
         header("Location: /admin_contents");
     }
     if ($_id) {
         $this->assigns["res"] = $this->Content->get($_id);
     }
     $this->assigns["cat"] = $this->Content_category->list_(1, 100);
 }
示例#2
0
 public function views($_id)
 {
     $res = $this->Recruit->get($_id);
     if ($res && $res["state"] == 1) {
         $this->Recruit->pageview($_id);
         $res["local"] = $this->Recruit_opt->get_detail($_id, 1);
         $res["career"] = $this->Recruit_opt->get_detail($_id, 2);
         $res["term"] = $this->Recruit_opt->get_detail($_id, 4);
         $res["part"] = $this->Recruit_opt->get_detail($_id, 7);
         // $res["dev"] = $this->Recruit_opt->get_detail($_id, 3);
         // $res["lang"] = $this->Recruit_opt->get_detail($_id, 5);
         // $res["job"] = $this->Recruit_opt->get_detail($_id, 6);
         $this->assigns["res"] = $res;
         $st_res = $this->Recruit->list_s_(1, 5, 'r.en < 2 and r.state = 1 ' . 'and (' . '(r.start <= "' . date("Y.m.d") . '" and r.end >= "' . date("Y.m.d") . '") ' . 'or (r.start <= "' . date("Y.m.d") . '" and r.end = "") ' . 'or (r.start = "" and r.end = "")' . ')', 'v_cnt DESC');
         for ($sr = 0; $sr < sizeof($st_res); $sr++) {
             $st_res[$sr]["part"] = $this->Recruit_opt->get_detail($st_res[$sr]["rid"], 7);
         }
         $this->assigns["st_res"] = $st_res;
         $og["type"] = 'article';
         $og["url"] = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $og["title"] = $res["title"] . " on D.CAMP";
         $og["description"] = strip_tags($res["contents"]);
         if (strlen(strip_tags($res["contents"])) > 148) {
             $og["description"] = mb_substr(strip_tags($res["contents"]), 0, 148, 'UTF-8') . '...';
         }
         $content_parsed = parse_html($res["contents"]);
         foreach ($content_parsed as $c) {
             if (strtolower(substr($c, 0, 4)) == "<img") {
                 $t = tag_barase($c);
                 if ($t["src"]) {
                     $img = $t["src"];
                     break;
                 }
             }
         }
         if ($img) {
             $og["image"] = $img;
         } else {
             $og["image"] = 'http://' . $_SERVER['SERVER_NAME'] . $res["slogo"];
         }
         $this->assigns_layout["og"] = $og;
         if (!strpos($_SERVER["HTTP_REFERER"], "dcamp.kr")) {
             $this->assigns_layout["cards"] = bottom_main();
         }
     } else {
         header("Location: /");
     }
 }
示例#3
0
 public function edit($_id = '')
 {
     if (!$_SESSION["s"]) {
         header("Location: /404_error");
     }
     if ($_REQUEST["subject"]) {
         $content_parsed = parse_html($_REQUEST["contents"]);
         foreach ($content_parsed as $c) {
             if (strtolower(substr($c, 0, 4)) == "<img") {
                 $t = tag_barase($c);
                 if ($t["src"]) {
                     $_REQUEST["img"] = $t["src"];
                     break;
                 }
             }
         }
         $_id = $this->Content->add($_REQUEST);
         if ($_REQUEST["pic"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['pic']);
             $ck = substr($img_temp_name, 0, 1);
             if ($ck == '/') {
                 $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
             }
             $file_ext = explode('.', $img_temp_name);
             //$filename = basename($_FILES['file']['name']);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/contents/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/contents/' . $_id . $file_ext;
             $this->Content->add_picture($_id, $_pic);
         }
         header("Location: /member/edit_contents");
     }
     $this->assigns["cate"] = $this->Content_category->get_cat_by_user($_SESSION["s"]["id"], 'cc.hidden = 0');
     if ($_id) {
         $res = $this->Content->get($_id);
         if ($res["user_id"] != $_SESSION["s"]["id"]) {
             $this->assigns["cate"] = null;
         } else {
             $this->assigns["res"] = $res;
         }
     }
 }