コード例 #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
ファイル: Feedback.php プロジェクト: noikiy/lovetolove
 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
ファイル: Services.php プロジェクト: noikiy/lovetolove
 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
ファイル: Bootstrap.php プロジェクト: noikiy/lovetolove
 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
ファイル: Feedback.php プロジェクト: noikiy/lovetolove
 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
ファイル: Message.php プロジェクト: noikiy/lovetolove
 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
ファイル: Recharge.php プロジェクト: noikiy/lovetolove
 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
ファイル: Services.php プロジェクト: noikiy/lovetolove
 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
ファイル: Article.php プロジェクト: noikiy/lovetolove
 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
ファイル: Support.php プロジェクト: noikiy/lovetolove
 function exeDelete()
 {
     $id = Request::get('id');
     if ($id > 0) {
         $this->model->remove($id);
     }
     Until::redirectTo('support');
 }
コード例 #16
0
ファイル: Province.php プロジェクト: noikiy/lovetolove
 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');
 }