예제 #1
0
 public function add($_id = '')
 {
     //        echo $this->settings->root_path;
     $this->assigns_layout["gnb_left"] = "add";
     if ($_REQUEST["title"]) {
         if ($_REQUEST["writer_type"] == 1) {
             $_REQUEST["writer"] = $_SESSION["s"]["name"];
         }
         if ($_REQUEST["contents"]) {
             $_REQUEST["contents"] = str_replace('"../../', '"' . '/', $_REQUEST["contents"]);
             $_REQUEST["contents"] = str_replace('"../', '"' . '/', $_REQUEST["contents"]);
         }
         $_id = $this->Notice->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/news/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/news/' . $_id . $file_ext;
             $this->Notice->add_picture($_id, $_pic);
         }
         header("Location: /admin_notice");
     }
     if ($_id) {
         $this->assigns["res"] = $this->Notice->get($_id);
     }
 }
예제 #2
0
파일: program.php 프로젝트: byyeong/dc2016
 public function edit($_id = '')
 {
     header("Location: /benefit/edit/" . $_id);
     if (!$_SESSION["s"]) {
         $_SESSION["msg"] = "로그인 후 이용하실 수 있습니다.";
         header("Location: /");
     }
     if ($_REQUEST["title"]) {
         if ($_REQUEST["a_start"]) {
             $_REQUEST["a_start"] = $_REQUEST["a_start_d"] . " " . $_REQUEST["a_start_t"];
             $_REQUEST["a_end"] = $_REQUEST["a_end_d"] . " " . $_REQUEST["a_end_t"];
         } else {
             $_REQUEST["a_start"] = '';
             $_REQUEST["a_end"] = '';
         }
         if ($_REQUEST["cnt_c"] == 0) {
             $_REQUEST["cnt"] = 0;
         }
         $_id = $this->Program->add($_REQUEST);
         if ($_REQUEST["img"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['img']);
             $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);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/program/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/program/' . $_id . $file_ext;
             $this->Program->add_picture($_id, $_pic);
         }
         if ($_REQUEST["del_file"]) {
             $this->Program->add_file($_id, '');
             unlink('media/program/' . $_REQUEST["del_file"]);
         }
         if ($_FILES["file"]["name"]) {
             $file = make_upload("/media/program/", "file");
             if ($file) {
                 $this->Program->add_file($_id, $file, str_replace(" ", "_", $_FILES["file"]["name"]));
             }
         }
         $this->assigns["msgt"] = 1;
     }
     if ($_id) {
         $res = $this->Program->get($_id);
         if (!$res) {
             header("Location: /error_404");
         }
         $this->assigns["res"] = $res;
     }
     $this->assigns["category"] = $this->Program->get_category();
 }
예제 #3
0
 public function edit($_id = '')
 {
     $this->assigns_layout["gnb_left"] = 'program';
     if ($_REQUEST["title"]) {
         if ($_REQUEST["a_start"]) {
             $_REQUEST["a_start"] = $_REQUEST["a_start_d"] . " " . $_REQUEST["a_start_t"];
             $_REQUEST["a_end"] = $_REQUEST["a_end_d"] . " " . $_REQUEST["a_end_t"];
         } else {
             $_REQUEST["a_start"] = '';
             $_REQUEST["a_end"] = '';
         }
         if ($_REQUEST["cnt_c"] == 0) {
             $_REQUEST["cnt"] = 0;
         }
         if ($_REQUEST["status"] != 2) {
             $_REQUEST["status_des"] = "";
         }
         $_id = $this->Program->add($_REQUEST);
         if ($_REQUEST["img"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['img']);
             $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);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/program/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/program/' . $_id . $file_ext;
             $this->Program->add_picture($_id, $_pic);
         }
         if ($_REQUEST["del_file"]) {
             $this->Program->add_file($_id, '');
             unlink('media/program/' . $_REQUEST["del_file"]);
         }
         if ($_FILES["file"]["name"]) {
             $file = make_upload("/media/program/", "file");
             if ($file) {
                 $this->Program->add_file($_id, $file, str_replace(" ", "_", $_FILES["file"]["name"]));
             }
         }
         if ($_REQUEST["o_status"] != $_REQUEST["status"] && $_REQUEST["status"] != 0) {
             $_st = "승인";
             if ($_REQUEST["status"] == 2) {
                 $_st = "반려";
             }
             $ev = $this->Program->get_list('', '', "c.id = " . $_id);
             $_ev = $ev[0];
             $m = new TF_mailer($this->settings);
             $m->mailto = $_ev["memail"];
             $m->subject = "[D.CAMP] " . $_ev["name"] . "님의 스타트업 지원 프로그램이 " . $_st . "되었습니다.";
             $m->tpl_name = "program_accept";
             $m->assigns["res"] = $_ev;
             $m->assigns["main_service_url"] = $this->globals->my_host;
             $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
             $m->send();
         }
         $this->assigns["msgt"] = 1;
     }
     if ($_id) {
         $res = $this->Program->get($_id);
         $u = $this->Members->get($res["user_id"]);
         $u["com"] = $this->Startup_member->get_by_user($res["user_id"]);
         if (!$res) {
             header("Location: /error_404");
         }
         $this->assigns["res"] = $res;
         $this->assigns["u"] = $u;
     }
     $this->assigns["category"] = $this->Program->get_category();
 }
예제 #4
0
파일: event.php 프로젝트: byyeong/dc2016
 public function add_process()
 {
     $payment = 0;
     if (array_key_exists('payment1', $_REQUEST)) {
         $payment = $payment | $this->settings->payment1;
     } else {
         $payment = $payment & ~$this->settings->payment1;
     }
     if (array_key_exists('payment2', $_REQUEST)) {
         $payment = $payment | $this->settings->payment2;
     } else {
         $payment = $payment & ~$this->settings->payment2;
     }
     if (array_key_exists('payment3', $_REQUEST)) {
         $payment = $payment | $this->settings->payment3;
     } else {
         $payment = $payment & ~$this->settings->payment3;
     }
     if (array_key_exists('payment4', $_REQUEST)) {
         $payment = $payment | $this->settings->payment4;
     } else {
         $payment = $payment & ~$this->settings->payment4;
     }
     $_REQUEST['payment'] = $payment;
     if ($_REQUEST["space"] == 0) {
         $_REQUEST["space_id"] = 0;
     } else {
         $_REQUEST["space_etc"] = null;
     }
     $_id = $this->Event->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/event/' . $_id . $file_ext;
         GD2_make_thumb_x(300, "", $original_file);
         //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
         copy($original_file, $copy_file);
         unlink($original_file);
         $_pic = '/media/event/' . $_id . $file_ext;
         $this->Event->add_picture($_id, $_pic);
     }
     if ($_REQUEST["del_file"]) {
         $this->Event->add_file($_id, '');
         unlink('media/event_file/' . $_REQUEST["del_file"]);
     }
     if ($_FILES["file"]["name"]) {
         $file = make_upload("/media/event_file/", "file");
         if ($file) {
             $this->Event->add_file($_id, $file, $_FILES["file"]["name"]);
         }
     }
     add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 0, "", Activity_model::A_TYPE_EVENT, $_id, 1);
     $_SESSION["msg"] = "이벤트가 신청되었습니다.<br />관리자 승인이 완료되면 이벤트 페이지에 노출됩니다.";
     header("Location: /member/edit_event_m");
 }
예제 #5
0
파일: contents.php 프로젝트: byyeong/dc2016
 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;
         }
     }
 }
예제 #6
0
파일: ajax.php 프로젝트: byyeong/dc2016
 public function startup_add_step3()
 {
     if ($_REQUEST["id"]) {
         $ex = $this->Startup_service->get($_REQUEST["id"]);
     }
     $_id = $this->Startup_service->add($_REQUEST);
     if (!$_REQUEST["id"]) {
         $_REQUEST["id"] = $_id;
     }
     for ($i = 1; $i < 5; $i++) {
         $_ord = 'img' . $i;
         if ($_REQUEST[$_ord]) {
             if (strpos($_REQUEST[$_ord], '/temp/')) {
                 $img_temp_name = str_replace(" ", "", $_REQUEST[$_ord]);
                 $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/service/' . $i . '_' . $_id . $file_ext;
                 $_REQUEST[$_ord] = '/media/service/' . $i . '_' . $_id . $file_ext;
                 $_REQUEST[$_ord . "_thumb"] = '/media/service/thumb/' . $i . '_' . $_id . $file_ext;
                 if ($ex[$_ord]) {
                     unlink(substr($ex[$_ord], 1));
                     unlink(substr($ex[$_ord . "_thumb"], 1));
                 }
                 //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
                 copy($original_file, $copy_file);
                 unlink($original_file);
                 GD2_make_thumb_x(180, 'thumb/', $copy_file);
             } else {
                 $_REQUEST[$_ord] = $ex[$_ord];
                 $_REQUEST[$_ord . "_thumb"] = $ex[$_ord . "_thumb"];
             }
         } else {
             $_REQUEST[$_ord] = '';
             $_REQUEST[$_ord . "_thumb"] = '';
             if ($ex[$_ord]) {
                 unlink(substr($ex[$_ord], 1));
                 unlink(substr($ex[$_ord . "_thumb"], 1));
             }
         }
     }
     for ($k = 1; $k < 5; $k++) {
         $_o = "movie" . $k;
         if ($_REQUEST[$_o]) {
             $video_info = get_video_id($_REQUEST[$_o]);
             if ($video_info['id']) {
                 $video_data = get_video_data($video_info['id'], $video_info['type']);
                 $_REQUEST[$_o] = $video_info['id'];
                 $_REQUEST[$_o . "_type"] = $video_info['type'];
                 $_REQUEST[$_o . "_thumb"] = $video_data['b_thumbnail'];
             } else {
                 $_REQUEST[$_o] = '';
                 $_REQUEST[$_o . "_type"] = '';
                 $_REQUEST[$_o . "_thumb"] = '';
             }
         }
     }
     for ($j = 1; $j < 5; $j++) {
         $_or = "gr" . $j;
         if ($_REQUEST[$_or]) {
             if (strpos($_REQUEST[$_or], '/temp/')) {
                 $img_temp_name = str_replace(" ", "", $_REQUEST[$_or]);
                 $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/service/' . $_or . '_' . $_id . $file_ext;
                 $_REQUEST[$_or] = '/media/service/' . $_or . '_' . $_id . $file_ext;
                 $_REQUEST[$_or . "_thumb"] = '/media/service/thumb/' . $_or . '_' . $_id . $file_ext;
                 if ($ex[$_or]) {
                     unlink(substr($ex[$_or], 1));
                     unlink(substr($ex[$_or . "_thumb"], 1));
                 }
                 //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
                 copy($original_file, $copy_file);
                 unlink($original_file);
                 GD2_make_thumb_x(180, 'thumb/', $copy_file);
             } else {
                 $_REQUEST[$_or] = $ex[$_or];
                 $_REQUEST[$_or . "_thumb"] = $ex[$_or . "_thumb"];
             }
         } else {
             $_REQUEST[$_or . '_title'] = '';
             $_REQUEST[$_or . '_thumb'] = '';
             $_REQUEST[$_or] = '';
             if ($ex[$_or]) {
                 unlink(substr($ex[$_or], 1));
                 unlink(substr($ex[$_or . "_thumb"], 1));
             }
         }
     }
     $this->Startup_service->add($_REQUEST);
     $result["id"] = $_id;
     echo json_encode($result);
     $this->tpl_name = "";
 }
예제 #7
0
 public function add_lounge_posting()
 {
     if (!$_SESSION["s"]["id"]) {
         echo "error_user";
         exit(1);
     }
     $tw = $this->Member_ext->get_by_user_id_type($_SESSION["s"]["id"], Member_ext_model::TWITTER_TYPE);
     $fb = $this->Member_ext->get_by_user_id_type($_SESSION["s"]["id"], Member_ext_model::FACEBOOK_TYPE);
     if ($_REQUEST["tw"] && !$tw || $_REQUEST["fb"] && !$fb) {
         echo "error_sns";
         exit(1);
     }
     // $arr["p_type"] = Board_model::EVENT_TYPE;
     if (!$_REQUEST["type"]) {
         $_REQUEST["type"] = 3;
     }
     $arr["p_type"] = $_REQUEST["type"];
     $arr["p_id"] = $_REQUEST["id"];
     $arr["user_id"] = $_SESSION["s"]["id"];
     $arr["contents"] = $_REQUEST["cont"];
     $arr["parent"] = 0;
     $arr["depth"] = 0;
     $id = $this->Board->add($arr);
     if ($_REQUEST["image"]) {
         $new_i = $this->settings->root_path . "media/board/" . $id . ".jpg";
         $ori_i = $this->settings->root_path . substr($_REQUEST["image"], 1);
         GD2_make_thumb_x(600, "", $ori_i);
         copy($ori_i, $new_i);
         unlink(substr($_REQUEST["image"], 1));
         $_arr["id"] = $id;
         $_arr["image"] = "/media/board/" . $id . ".jpg";
         $this->Board->add_image($_arr);
     }
     $res = $this->Board->get_detail($id);
     $addr = "http://" . $_SERVER["HTTP_HOST"] . "/lounge/comment/" . $res["id"];
     $cont = "[D.CAMP Lounge] " . $_REQUEST["cont"];
     if ($_type == 10) {
         $addr = "http://" . $_SERVER["HTTP_HOST"] . "/showcase/views/" . $res["id"];
         $cont = "[D.CAMP Showcase] " . $_REQUEST["cont"];
     }
     if ($_REQUEST["tw"]) {
         require_once '../tf_app/ext/twitter/twitteroauth.php';
         $parameters = array('status' => set_sns_len_post($cont, $addr, 140));
         $connection = new TwitterOAuth($this->settings->TWITTER_COMSUMER_KEY, $this->settings->TWITTER_COMSUMER_SECRET, $tw["key_"], $tw["secret"]);
         $status = $connection->post('statuses/update', $parameters);
     }
     if ($_REQUEST["fb"]) {
         if ($fb["public"]) {
             $APP_ID = $this->settings->FACEBOOK_API_KEY;
             $APP_SECRET = $this->settings->FACEBOOK_SECRET;
             FacebookSession::setDefaultApplication($APP_ID, $APP_SECRET);
             $session = new FacebookSession($fb["secret"]);
             $request = new FacebookRequest($session, 'POST', '/me/feed', array('message' => $cont, 'link' => $addr));
             $response = $request->execute();
             $graphObject = $response->getGraphObject();
         }
     }
     $rc = $this->Members->get($_SESSION["s"]["id"]);
     if ($_REQUEST["type"] == 8) {
         // challenge, competition
         $ev = $this->Office_hours->get_detail($_REQUEST["id"]);
         $m = "<a href='/member/" . $rc["ids"] . "'>" . $rc["name"] . "</a>님이 \"<a href='/office_hours/views/" . $ev["id"] . "#comment'>" . $ev["mname"] . " " . $ev["mposition"] . "</a>\" Office Hours에 댓글을 달았습니다.";
         $mailto = $ev["memail"];
         $subject = "[D.CAMP] " . $rc["name"] . "님이 \"" . $ev["mname"] . " " . $ev["mposition"] . "\" Office Hours에 댓글을 달았습니다.";
         $title = "<a href='http://dcamp.kr/member/" . $rc["ids"] . "'>" . $rc["name"] . "</a>님이 \"<a href='http://dcamp.kr/office_hours/views/" . $ev["id"] . "'>" . $ev["mname"] . " " . $ev["mposition"] . "</a>\" Office Hours에 댓글을 달았습니다.";
         $url = "/office_hours/views/" . $ev["id"] . "#comment";
         $cid = $ev["mid"];
     } else {
         if ($_REQUEST["type"] == 3) {
             $ev = $this->Event->get_detail($_REQUEST["id"]);
             $m = "<a href='/member/" . $rc["ids"] . "'>" . $rc["name"] . "</a>님이 \"<a href='/event/apply/" . $ev["id"] . "#comment'>" . $ev["title"] . "</a>\" 이벤트에 댓글을 달았습니다.";
             $mailto = $ev["memail"];
             $subject = "[D.CAMP] " . $rc["name"] . "님이 \"" . $ev["title"] . "\" 이벤트에 댓글을 달았습니다.";
             $title = "<a href='http://dcamp.kr/member/" . $rc["ids"] . "'>" . $rc["name"] . "</a>님이 \"<a href='http://dcamp.kr/event/apply/" . $ev["id"] . "'>" . $ev["title"] . "</a>\" 이벤트에 댓글을 달았습니다.";
             $url = "/event/apply/" . $ev["id"] . "#comment";
             $cid = $ev["user_id"];
         }
     }
     // noti
     $arr1["com_type"] = 1;
     $arr1["com_id"] = $cid;
     $arr1["act_type"] = 1;
     $arr1["act_id"] = $rc["id"];
     $arr1["msg"] = $m;
     $this->Activity->add($arr1);
     if ($_REQUEST["type"] == 3 || $_REQUEST["type"] == 8) {
         // maill
         $m = new TF_mailer($this->settings);
         $m->mailto = $mailto;
         $m->subject = $subject;
         $m->tpl_name = "timeline_act";
         $m->assigns["title"] = $title;
         $m->assigns["url"] = $url;
         $m->assigns["rc"] = $rc;
         $m->assigns["content"] = $_REQUEST["cont"];
         $m->assigns["main_service_url"] = $this->globals->my_host;
         $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
         $m->send();
     }
     $this->get_lounge_timeline($_REQUEST["type"], $_REQUEST["id"], 1, 1);
     $this->tpl_name = "get_lounge_timeline";
 }
예제 #8
0
 public function add_process()
 {
     $payment = 0;
     if (array_key_exists('payment1', $_REQUEST)) {
         $payment = $payment | $this->settings->payment1;
     } else {
         $payment = $payment & ~$this->settings->payment1;
     }
     if (array_key_exists('payment2', $_REQUEST)) {
         $payment = $payment | $this->settings->payment2;
     } else {
         $payment = $payment & ~$this->settings->payment2;
     }
     if (array_key_exists('payment3', $_REQUEST)) {
         $payment = $payment | $this->settings->payment3;
     } else {
         $payment = $payment & ~$this->settings->payment3;
     }
     if (array_key_exists('payment4', $_REQUEST)) {
         $payment = $payment | $this->settings->payment4;
     } else {
         $payment = $payment & ~$this->settings->payment4;
     }
     $_REQUEST['payment'] = $payment;
     if ($_REQUEST["space"] == 0) {
         $_REQUEST["space_id"] = 0;
     } else {
         $_REQUEST["space_etc"] = null;
     }
     $_id = $this->Event->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/event/' . $_id . $file_ext;
         GD2_make_thumb_x(300, "", $original_file);
         //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
         copy($original_file, $copy_file);
         unlink($original_file);
         $_pic = '/media/event/' . $_id . $file_ext;
         $this->Event->add_picture($_id, $_pic);
     }
     if ($_REQUEST["del_file"]) {
         $this->Event->add_file($_id, '');
         unlink('media/event_file/' . $_REQUEST["del_file"]);
     }
     if ($_FILES["file"]["name"]) {
         $file = make_upload("/media/event_file/", "file");
         if ($file) {
             $this->Event->add_file($_id, $file, $_FILES["file"]["name"]);
         }
     }
     // if ($_REQUEST["id"]) {
     //     $apply = $this->Event_reserve->cnt("event_id = ".$_REQUEST["id"]);
     //     if ($apply <= $_REQUEST["cnt"]) {
     //         $this->Event_reserve->edit_state_by_cnt($_REQUEST["id"], $_REQUEST["cnt"]);
     //     }
     // }
     header("Location: /admin_event");
 }
예제 #9
0
 public function category_info($_id = '')
 {
     $this->assigns_layout["gnb_left"] = "category";
     if ($_REQUEST["name"]) {
         $_id = $this->Content_category->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(750, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/contents/' . $_id . $file_ext;
             $this->Content_category->add_picture($_id, $_pic);
         }
         $this->assigns["msg"] = "수정되었습니다.";
     }
     if ($_id) {
         $this->assigns["res"] = $this->Content_category->get($_id);
     }
 }
예제 #10
0
 public function edit($_id = '')
 {
     $this->assigns_layout["gnb_left"] = "competition";
     if ($_REQUEST["cancel"]) {
     }
     if ($_REQUEST["subject"]) {
         $_id = $this->Competitions->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/comp/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/comp/' . $_id . $file_ext;
             $this->Competitions->add_pic($_id, $_pic);
         }
         if ($_FILES["source"]["name"]) {
             $file = make_upload("/media/comp_file/", "source");
             $this->Competitions->add_file($_id, $file, $_FILES["source"]["name"]);
         }
         $this->assigns["msg"] = "저장되었습니다.";
         if ($_REQUEST["status_o"] != $_REQUEST["status"] && $_REQUEST["status"] == 1) {
             // accept mail
             $us = $this->Members->get($_REQUEST["user_id"]);
             $res = $this->Competitions->get($_id);
             $m = new TF_mailer($this->settings);
             $m->mailto = $us["email"];
             $m->subject = "[D.CAMP] " . $us["name"] . "님의 경진대회가 승인되었습니다.";
             $m->tpl_name = "competition_accept";
             $m->assigns["res"] = $res;
             $m->assigns["main_service_url"] = $this->globals->my_host;
             $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
             $m->send();
         }
     }
     if ($_id) {
         $res = $this->Competitions->get($_id);
         $this->assigns["res"] = $res;
         $this->get_process($res);
     }
 }
예제 #11
0
 public function edit_next($_id = '')
 {
     if (!$_SESSION["s"]) {
         $_SESSION["msg"] = "로그인 후 이용하실 수 있습니다.";
         header("Location: /");
     }
     if ($_REQUEST["cancel"]) {
     }
     if ($_REQUEST["announce_d"]) {
         $_id = $this->Competitions->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/comp/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/comp/' . $_id . $file_ext;
             $this->Competitions->add_pic($_id, $_pic);
         }
         if ($_REQUEST["top_img"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['top_img']);
             $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/comp/top_' . $_id . $file_ext;
             GD2_make_thumb_x(800, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/comp/top_' . $_id . $file_ext;
             $this->Competitions->add_pic($_id, $_pic, 'top_img');
         }
         // $this->Competitions->del_a_file($_id);
         for ($f = 1; $f < $_REQUEST["f_cnt"] + 1; $f++) {
             if ($_FILES["afile" . $f]["name"]) {
                 $file = make_upload("/media/comp_file/", "afile" . $f);
                 $this->Competitions->edit_a_file($_id, $file, $_FILES["afile" . $f]["name"]);
             }
         }
         for ($d = 2; $d < $_REQUEST["dpt_cnt"] + 1; $d++) {
             if ($_REQUEST["dpt" . $d]) {
                 if ($d == 2) {
                     $_d_arr["id"] = $_id;
                     $_d_arr["did"] = $_id;
                     $_d_arr["department"] = $_REQUEST["dpt" . $d];
                     $this->Competitions->add($_d_arr);
                 } else {
                     $_d_arr = $this->Competitions->get($_id);
                     $_d_arr["id"] = "";
                     $_d_arr["did"] = $_id;
                     $_d_arr["parent"] = $_id;
                     $_d_arr["url"] = '';
                     $_d_arr["open"] = '';
                     $_d_arr["department"] = $_REQUEST["dpt" . $d];
                     $this->Competitions->add($_d_arr);
                 }
             }
         }
         $this->assigns["msgt"] = 1;
     }
     if ($_id) {
         $res = $this->Competitions->get($_id);
         $res["a_file"] = $this->Competitions->get_a_file($_id);
         $res["dpt_l"] = $this->Competitions->get_department_group($_id);
         $opr = $this->Competitions_examiner->operator_check($res["id"], $_SESSION["s"]["id"]);
         $this->assigns["res"] = $res;
         if ($_SESSION["s"]["id"] != $res["user_id"] && !$opr) {
             header("Location: /error_404");
         }
         $this->get_process($res);
     }
     if ($_SESSION["msg"]) {
         $this->assigns_layout["msg"] = $_SESSION["msg"];
         unset($_SESSION["msg"]);
     }
 }
예제 #12
0
 public function edit($_id = '')
 {
     if (!$_SESSION["s"]) {
         $_SESSION["msg"] = "로그인 후 이용하실 수 있습니다.";
         header("Location: /");
     }
     if ($_REQUEST["cancel"]) {
     }
     if ($_REQUEST["subject"]) {
         $_REQUEST["contents"] = str_replace('"../../', '"' . '/', $_REQUEST["contents"]);
         $_REQUEST["contents"] = str_replace('"../', '"' . '/', $_REQUEST["contents"]);
         $_id = $this->Competitions->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/comp/' . $_id . $file_ext;
             GD2_make_thumb_x(300, "", $original_file);
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/comp/' . $_id . $file_ext;
             $this->Competitions->add_pic($_id, $_pic);
         }
         if ($_FILES["source"]["name"]) {
             $file = make_upload("/media/comp_file/", "source");
             $this->Competitions->add_file($_id, $file, $_FILES["source"]["name"]);
         }
         $this->assigns_layout["msg"] = "저장되었습니다.";
     }
     if ($_id) {
         $res = $this->Competitions->get($_id);
         $this->assigns["res"] = $res;
         if ($_SESSION["s"]["id"] != $res["user_id"]) {
             header("Location: /error_404");
         }
         $this->get_process($res);
     }
 }