예제 #1
0
파일: Intro.php 프로젝트: noikiy/lovetolove
 function exeUpdate()
 {
     if (isset($_POST['intro_submit'])) {
         $id = Request::post('id');
         $content = Request::post('content');
         $this->model->updateIntro($id, $content);
     }
     Until::redirectTo('intro');
 }
예제 #2
0
 function exeDelete()
 {
     if ((int) Request::get('id') > 0) {
         $this->model->remove((int) Request::get('id'));
     }
     if (Request::post('check') != null) {
         $delete = Request::post('check');
         foreach ($delete as $value) {
             $this->model->remove((int) $value);
         }
     }
     Until::redirectTo('feedback');
 }
예제 #3
0
 function exeDetail()
 {
     $id = (int) Request::get('service');
     $data = array();
     $data['service'] = $this->model->selectOne($id);
     if (empty($data['service'])) {
         Until::redirectTo('services');
     }
     if ($id > 0) {
         Document::setTitle($data['service']['feature']);
         $art = $this->loadArticle();
         $data['article'] = $art->selectAll(0, 20, '`service_id`="' . $data['service']['id'] . '"');
         $data['detail'] = BASE_URL . '/article/Article?article=';
         $this->view->render('detail', $data);
     } else {
         Until::redirectTo('services');
     }
 }
예제 #4
0
 public function checkLogin()
 {
     if (Session::get('user') == null) {
         if (Router::$controller != 'login') {
             Until::redirectTo('login');
         } else {
             $this->index();
         }
     } else {
         if (Router::$controller == 'login' && Router::$action == 'logout') {
             $this->index();
             return true;
         }
         if (Session::get('user')['user_type'] == 7) {
             $this->index();
             return true;
         } else {
             $this->checkRole(Session::get('user')['id']);
         }
     }
 }
예제 #5
0
파일: Image.php 프로젝트: noikiy/lovetolove
 function exeAdd()
 {
     $id = (int) Session::get('user')['id'];
     if ($id > 0) {
         $error = '';
         if (!empty($_FILES)) {
             $upload = new Upload('file');
             $upload->setFileExtension('jpg|jepg|png|gif');
             $upload->setUploadDir('public/uploads/members/');
             $upload->setFileSize(2048);
             $e = $upload->getError();
             if (!empty($e)) {
                 foreach ($e as $value) {
                     $error .= $value . '<br />';
                 }
             }
             if ($error != '') {
                 $message = '<div class="album" status="true"><p class="red">' . $error . '</p></div>';
             } else {
                 $imageName = Convert::makeLink($_FILES['file']['name']);
                 $imageLink = $upload->uploads($imageName);
                 $id = $this->model->add(Session::get('user')['username'], $imageName, $imageLink);
                 $message = '<div class="album" imageId="' . $id . '">
                     <img src="' . BASE_URL . '/' . $imageLink . '" alt="' . $imageName . '" class="imgage" />
                     <span class="img-delete" imageId="' . $id . '" title="Xoá ảnh này">X</span>
                     <p>Ngày đăng: ' . date('d-m-Y H:i', time()) . '</p>
                     </div>';
             }
         } else {
             $message = '<div class="album" status="true"><p class="red">Bạn chưa chọn file</p></div>';
         }
         echo $message;
     } else {
         Until::redirectTo();
     }
 }
예제 #6
0
 function exeInsert()
 {
     if (Request::post('submit') != null) {
         $fullname = Request::post('fullname');
         $email = Request::post('email');
         $content = Request::post('content');
         $captcha = Request::post('captcha');
         $error = '';
         if ($fullname == null) {
             $error .= 'Bạn chưa nhập họ tên. <br />';
         }
         if ($email == null) {
             $error .= 'Bạn chưa nhập email.<br />';
         } elseif (Validate::email($email) != true) {
             $error .= 'Email của bạn  không đúng.<br />';
         }
         if (strlen($content) < 50) {
             $error .= 'Nội dung phải lớn hơn 50 ký tự.<br />';
         }
         if ($captcha != Session::get('captcha')) {
             $error .= 'Bạn nhập mã bảo vệ không đúng. <br />';
         }
         if ($error == '') {
             $this->model->add($fullname, $email, $content);
             $data['error'] = $data['content'] = $data['email'] = $data['fullname'] = '';
             $data['success'] = '<p class="success">Cảm ơn bạn đã gửi ý kiến.</p>';
             Session::set('feedback', $data);
         } else {
             $data = $_POST;
             $data['error'] = '<p class="error">' . $error . '</p>';
             $data['success'] = '';
             Session::set('feedback', $data);
         }
     }
     Until::redirectTo('feedback');
 }
예제 #7
0
파일: Acl.php 프로젝트: noikiy/lovetolove
 function exeUpdate()
 {
     if (Request::post('submit') == null) {
         Until::redirectTo('acl');
     } else {
         $id = Request::post('id');
         $module = Request::post('module');
         $action = Request::post('action');
         $description = Request::post('description');
         if ($module == null || $action == null || $description == null) {
             Session::set('acl', $_POST);
             Until::redirectTo('acl/edit?id=' . $id);
         } else {
             $this->model->edit($id, $module, $action, $description);
             Until::redirectTo('acl');
         }
     }
 }
예제 #8
0
 function exeDetail()
 {
     $id = (int) Request::get('message');
     if ($id > 0) {
         Document::setJs(array('message'));
         Document::setTitle('Tin nhắn');
         $this->read($id);
         $data = $this->model->selectOne($id);
         if (empty($data)) {
             Until::redirectTo('message');
         }
         $data['reply'] = BASE_URL . '/message/reply?message=';
         $data['imageReply'] = BASE_URL . '/public/css/images/email-reply-icon.png';
         $data['delete'] = BASE_URL . '/message/delete?message=';
         $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png';
         $this->view->render('detail', $data);
     } else {
         Until::redirectTo('message');
     }
 }
예제 #9
0
 function exeDelete()
 {
     $id = (int) Request::get('id');
     if ($id > 0) {
         $this->model->remove($id);
     }
     Until::redirectTo('recharge');
 }
예제 #10
0
파일: User.php 프로젝트: noikiy/lovetolove
 function exeChangeAvatar()
 {
     $id = (int) Session::get('user')['id'];
     if ($id > 0) {
         $error = '';
         if (!empty($_FILES)) {
             $upload = new Upload('file');
             $upload->setFileExtension('jpg|jepg|png|gif');
             $upload->setUploadDir('public/uploads/avatar/');
             $upload->setFileSize(1024);
             $e = $upload->getError();
             if (!empty($e)) {
                 foreach ($e as $value) {
                     $error .= $value . '<br />';
                 }
             }
             if ($error != '') {
                 $message = '<p class="red">' . $error . '</p>';
             } else {
                 $imageName = Convert::makeLink($_FILES['file']['name']);
                 $imageLink = $upload->uploads($imageName);
                 $this->model->changeAvatar(Session::get('user')['id'], $imageLink);
                 if (Session::get('user')['avatar'] != 'public/uploads/members/member-1.png' || Session::get('user')['avatar'] != 'public/uploads/members/member-1.png') {
                     if (file_exists(Session::get('user')['avatar'])) {
                         unlink(Session::get('user')['avatar']);
                     }
                 }
                 $data = Session::get('user');
                 $data['avatar'] = $imageLink;
                 Session::set('user', $data);
                 $message = '1';
             }
         } else {
             $message = '<p class="red">Bạn chưa chọn file</p>';
         }
         echo $message;
     } else {
         Until::redirectTo();
     }
 }
예제 #11
0
 function exeDelete()
 {
     if ((int) Request::get('id') > 0) {
         $data = $this->model->selectOne((int) Request::get('id'));
         if (!empty($data)) {
             $ordinal = $data['ordinal'];
             $condition = '`ordinal` > ' . $ordinal . ' AND `parent_id` = ' . Request::post('parent_id');
             $this->model->ordinalUpdate($condition, true);
             $this->model->remove((int) Request::get('id'));
         }
     }
     Until::redirectTo('services');
 }
예제 #12
0
파일: User.php 프로젝트: noikiy/lovetolove
 function exeLoadType()
 {
     $userId = (int) Request::post('userId');
     if ($userId > 0) {
         $data = $this->model->loadType($userId);
         $type = array('0' => 'Khoá', '2' => 'Thành viên');
         if (Session::get('user')['user_type'] == 7) {
             $type['4'] = 'Mod';
         }
         if (Session::get('user')['user_type'] > $data['user_type']) {
             echo '<form name="editType" method="post"><p>';
             echo '<p>Nhóm thành viên</p>';
             foreach ($type as $key => $value) {
                 if ($key == $data['user_type']) {
                     echo '<label class="label_radio"><input type="radio"  name="editType" value="' . $key . '" checked="checked" />' . $value . '</label>';
                 } else {
                     echo '<label class="label_radio"><input type="radio" name="editType" value="' . $key . '" />' . $value . '</label>';
                 }
             }
             echo '<input type="hidden" name="id" value="' . $userId . '" />';
             echo '</p><p><label class="label_text"></label><input class="input_submit" type="button" name="submitType" value="Thay đổi"></p>';
             echo '</form>';
         } else {
             echo '<p class="error">Bạn không có quyền với user này</p>';
         }
     } else {
         Until::redirectTo();
     }
 }
예제 #13
0
 public function exeService()
 {
     if ((int) Request::get('id') > 0) {
         $service = $this->LoadService();
         $sv = $service->SelectOne((int) Request::get('id'));
         if (empty($sv)) {
             Until::redirectTo('error');
         } else {
             $data = array();
             $data['services'] = $sv['feature'];
             $id = $sv['id'];
             $data['id'] = $id;
             $data['title'] = BASE_URL_ADMIN . '/article/service?id=' . $id;
             Document::setTitle($sv['feature']);
             Document::setJs(array('jquery-1.8.3.min', 'ask-delete', 'jconfirmaction.jquery'));
             $condition = "`service_id`='" . $id . "'";
             $keySearch = Request::get('keySearch');
             $find = Request::get('find');
             $searchTitle = '';
             $searchAuthor = '';
             if ($find == 'title') {
                 $searchTitle = 'selected="selected"';
             } elseif ($find == 'author') {
                 $searchAuthor = 'selected="selected"';
             }
             $link = '?id=' . $id . '&';
             $data['searchTitle'] = $searchTitle;
             $data['searchAuthor'] = $searchAuthor;
             $data['keySearch'] = $keySearch;
             if ($keySearch != null) {
                 $link = 'keySearch=' . $keySearch . '&';
                 if ($searchTitle != '') {
                     $condition .= " AND LOWER(`title`) like '%" . strtolower($keySearch) . "%'";
                 } else {
                     $condition .= "AND LOWER(`author`) like '%" . strtolower($keySearch) . "%'";
                 }
                 if ($find == 'author') {
                     $link .= 'find=' . $find . '&';
                 }
             }
             $display = 20;
             $totalPage = ceil($this->model->total($condition) / $display);
             if ((int) Request::get('page') > 0) {
                 $page = Request::get('page');
                 if ($totalPage < $page) {
                     $page = $totalPage;
                 }
             } else {
                 $page = 1;
             }
             $pageLink = new Paging($page, $totalPage);
             $data['pagination'] = $pageLink->pagination($link);
             $data['article'] = $this->model->selectAll(($page - 1) * $display, $display, $condition);
             $data['add'] = BASE_URL_ADMIN . '/article/add?service=' . $id;
             $data['actionDelete'] = BASE_URL_ADMIN . '/article/delete';
             $data['detail'] = BASE_URL_ADMIN . '/article/detail?id=';
             $data['edit'] = BASE_URL_ADMIN . '/article/edit?id=';
             $data['imageEdit'] = BASE_URL . '/public/css/images/white_edit.png';
             $data['delete'] = BASE_URL_ADMIN . '/article/delete?id=';
             $data['imageDelete'] = BASE_URL . '/public/css/images/trash.png';
             $this->view->render('service', $data);
         }
     } else {
         Until::redirectTo('error');
     }
 }
예제 #14
0
파일: Login.php 프로젝트: noikiy/lovetolove
 function exeCheck()
 {
     if (Session::get('user') != null) {
         Until::redirectTo();
     }
 }
예제 #15
0
 function exeDelete()
 {
     $id = Request::get('id');
     if ($id > 0) {
         $this->model->remove($id);
     }
     Until::redirectTo('support');
 }
예제 #16
0
 function exeDelete()
 {
     $id = (int) Request::get('id');
     if ($id > 0) {
         $data = $this->model->selectOne($id);
         if (!empty($data)) {
             $ordinal = $data['ordinal'];
             $condition = '`ordinal` > ' . $ordinal;
             $this->model->ordinalUpdate($condition, true);
             $this->model->remove($id);
         }
     }
     $check = Request::post('check');
     if ($check != null) {
         foreach ($check as $id) {
             if ($id > 0) {
                 $data = $this->model->selectOne($id);
                 if (!empty($data)) {
                     $ordinal = $data['ordinal'];
                     $condition = '`ordinal` > ' . $ordinal;
                     $this->model->ordinalUpdate($condition, true);
                     $this->model->remove($id);
                 }
             }
         }
     }
     Until::redirectTo('province');
 }