Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain #20

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions 404.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
require_once('lib/model.php');
$title = 'Error 404 Not Found - Quán Chị Kòi';
Expand Down
8 changes: 4 additions & 4 deletions admin/controllers/feedback/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
}

if (isset($_GET['order_id'])) {
$order_id = intval($_GET['order_id']);
$orderId = intval($_GET['order_id']);
} else {
$order_id = 0;
$orderId = 0;
}

$order = get_a_record('orders', $order_id);
$order_detail = order_detail($order_id);
$order = get_a_record('orders', $orderId);
$orderDetail = order_detail($orderId);

if (isset($userNav)) {
$user_action = get_a_record('users', $userNav);
Expand Down
2 changes: 1 addition & 1 deletion admin/controllers/feedback/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$feedback = get_a_record('feedbacks', $feedbackId);

if ($feedback['order_id'] <> 0) {
$order_detail = order_detail($feedback['order_id']);
$orderDetail = order_detail($feedback['order_id']);
$order = get_a_record('orders', $feedback['order_id']);
}
if ($feedback['product_id'] <> 0) {
Expand Down
2 changes: 1 addition & 1 deletion admin/controllers/feedback/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$feedback = get_a_record('feedbacks', $feedbackId);

if ($feedback['order_id'] <> 0) {
$order_detail = order_detail($feedback['order_id']);
$orderDetail = order_detail($feedback['order_id']);
$order = get_a_record('orders', $feedback['order_id']);
}

Expand Down
2 changes: 1 addition & 1 deletion admin/controllers/home/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];

update_sesion_cart();
updateCartSession();
update_cart_user_db();

if ($user['role_id'] == 1 || $user['role_id'] == 2) {
Expand Down
8 changes: 4 additions & 4 deletions admin/controllers/media/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
}

if (isset($_GET['media_id'])) {
$media_id = intval($_GET['media_id']);
$mediaId = intval($_GET['media_id']);
} else {
$media_id = 0;
$mediaId = 0;
}

$title = ($media_id == 0) ? '' : 'Cập nhật ảnh';
$title = ($mediaId == 0) ? '' : 'Cập nhật ảnh';
$navMedia = 'class="active open"';
$media_info = get_a_record('media', $media_id);
$media_info = get_a_record('media', $mediaId);

require('admin/views/media/add.php');
4 changes: 2 additions & 2 deletions admin/controllers/media/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

require_once('admin/models/media.php');

$media_id = intval($_GET['media_id']);
media_delete($media_id);
$mediaId = intval($_GET['media_id']);
media_delete($mediaId);

header('location:admin.php?controller=media');
8 changes: 4 additions & 4 deletions admin/controllers/media/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
}

if (isset($_GET['media_id'])) {
$media_id = intval($_GET['media_id']);
$mediaId = intval($_GET['media_id']);
} else {
$media_id = 0;
$mediaId = 0;
}

$title = ($media_id == 0) ? 'Thêm Ảnh mới' : 'Cập nhật ảnh';
$title = ($mediaId == 0) ? 'Thêm Ảnh mới' : 'Cập nhật ảnh';
$navMedia = 'class="active open"';
$media_info = get_a_record('media', $media_id);
$media_info = get_a_record('media', $mediaId);

require('admin/views/media/edit.php');
2 changes: 1 addition & 1 deletion admin/controllers/media/image-gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

permission_user();

$user_info_nav = get_a_record('users', $userNav);
$userInfoNav = get_a_record('users', $userNav);

$options = array(
'order_by' => 'id ASC'
Expand Down
7 changes: 1 addition & 6 deletions admin/controllers/order/complete.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
<?php
permission_user();
require_once('admin/models/order.php');
//submit form click
Expand Down
9 changes: 2 additions & 7 deletions admin/controllers/order/delete.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
permission_moderator();
//load model
require_once('admin/models/order.php');
$order_id = intval($_GET['order_id']);
order_delete($order_id);
$orderId = intval($_GET['order_id']);
order_delete($orderId);
header('location:admin.php?controller=order');
13 changes: 4 additions & 9 deletions admin/controllers/order/index.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
if (isset($_POST['order_id'])) {
foreach ($_POST['order_id'] as $order_id) {
$order_id = intval($order_id);
foreach ($_POST['order_id'] as $orderId) {
$orderId = intval($orderId);
}
}
$options = array(
'order_by' => 'status ASC, id DESC'
);
$url = 'admin.php?controller=order';
$total_rows = get_total('orders', $options);
$totalRows = get_total('orders', $options);
$title = 'Đơn hàng';
$nav_order = 'class="active open"';
$orderNav = 'class="active open"';
$orders = get_all('orders', $options);
$status = array(
0 => 'Chưa xử lý',
Expand Down
5 changes: 0 additions & 5 deletions admin/controllers/order/inprocess.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
require_once('admin/models/order.php');
Expand Down
9 changes: 2 additions & 7 deletions admin/controllers/order/order-cancell.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
$options = array(
'where' => 'status = 3',
'order_by' => 'createtime DESC'
);
$order_complete = get_all('orders', $options);
$orderComplete = get_all('orders', $options);

$title = 'Đơn hàng đã bị hủy';
$nav_order = 'class="active open"';
$orderNav = 'class="active open"';
$status = array(
0 => 'Chưa xử lý',
1 => 'Đã xử lý',
Expand Down
9 changes: 2 additions & 7 deletions admin/controllers/order/order-complete.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
$options = array(
'where' => 'status = 1',
'order_by' => 'createtime DESC'
);
$order_complete = get_all('orders', $options);
$orderComplete = get_all('orders', $options);

$title = 'Đơn hàng đã xử lý';
$nav_order = 'class="active open"';
$orderNav = 'class="active open"';
$status = array(
0 => 'Chưa xử lý',
1 => 'Đã xử lý',
Expand Down
7 changes: 1 addition & 6 deletions admin/controllers/order/order-inprocess.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
$title = 'Đơn hàng đang xử lý';
$nav_order = 'class="active open"';
$orderNav = 'class="active open"';
require('admin/views/order/order-inprocess.php');
7 changes: 1 addition & 6 deletions admin/controllers/order/order-noprocess.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
$title = 'Đơn hàng chưa xử lý';
$nav_order = 'class="active open"';
$orderNav = 'class="active open"';
require('admin/views/order/order-noprocess.php');
13 changes: 4 additions & 9 deletions admin/controllers/order/view.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
require_once('admin/models/order.php');
if (isset($_GET['order_id'])) $order_id = intval($_GET['order_id']); else $order_id=0;
$order = get_a_record('orders', $order_id);
if (isset($_GET['order_id'])) $orderId = intval($_GET['order_id']); else $orderId=0;
$order = get_a_record('orders', $orderId);
if (!$order) {
show_404();
}
$title = 'Chi tiết đơn hàng';
$nav_order = 'class="active open"';
$order_detail = order_detail($order_id);
$orderNav = 'class="active open"';
$orderDetail = order_detail($orderId);
$status = array(
0 => 'Đã xác nhận đơn hàng',
2 => 'Đang giao hàng',
Expand Down
13 changes: 4 additions & 9 deletions admin/controllers/page/add.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
//load model
Expand All @@ -11,9 +6,9 @@
page_add();
}

if (isset($_GET['post_id'])) $post_id = intval($_GET['post_id']);
else $post_id = 0;
$post = get_a_record('posts', $post_id);
$nav_page = 'class="active open"';
if (isset($_GET['post_id'])) $postId = intval($_GET['post_id']);
else $postId = 0;
$post = get_a_record('posts', $postId);
$pageNav = 'class="active open"';
$title = 'Thêm trang mới - Chị Kòi Quán';
require('admin/views/page/add.php');
9 changes: 2 additions & 7 deletions admin/controllers/page/delete.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
permission_moderator();
require_once('admin/models/posts.php');
$page_id = intval($_GET['page_id']);
post_delete($page_id);
$pageId = intval($_GET['page_id']);
post_delete($pageId);
header('location:admin.php?controller=page');
9 changes: 2 additions & 7 deletions admin/controllers/page/draft.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
permission_moderator();
require_once('admin/models/posts.php');
$page_id = intval($_GET['page_id']);
post_draft($page_id);
$pageId = intval($_GET['page_id']);
post_draft($pageId);
header('location:admin.php?controller=page&action=viewdraft');
17 changes: 6 additions & 11 deletions admin/controllers/page/edit.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
//load model
require_once('admin/models/posts.php');
if (!empty($_POST)) {
page_update();
}
if (isset($_GET['post_id'])) $post_id = intval($_GET['post_id']);
else $post_id = 0;
if (isset($_GET['post_id'])) $postId = intval($_GET['post_id']);
else $postId = 0;
$title = 'Sửa trang - Chị Kòi Quán';
$nav_page = 'class="active open"';
$post = get_a_record('posts', $post_id);
$pageNav = 'class="active open"';
$post = get_a_record('posts', $postId);
global $userNav;
$login_user = get_a_record('users', $userNav);
if ($login_user['role_id'] == 2) {
$loginUser = get_a_record('users', $userNav);
if ($loginUser['role_id'] == 2) {
if ($post['post_author'] == $userNav) require('admin/views/page/edit.php');
else header('location:admin.php?controller=page');
} else require('admin/views/page/edit.php');
11 changes: 3 additions & 8 deletions admin/controllers/page/index.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<!--
Developed by: TanHongIT
Website: https://tanhongit.com - https://tanhongit.net
Github: https://github.com/TanHongIT
-->
<?php
permission_user();
require_once('admin/models/posts.php');

$title = 'All Page - Chị Kòi Quán';
$nav_page = 'class="active open"';
$pageNav = 'class="active open"';
if (isset($_GET['page'])) $page = intval($_GET['page']);
else $page = 1;

Expand All @@ -25,8 +20,8 @@
$pages = get_all('posts', $options);

$url = 'admin.php?controller=page';
$total_rows = get_total('posts', $options);
$total = ceil($total_rows / $limit);
$totalRows = get_total('posts', $options);
$total = ceil($totalRows / $limit);

$pagination = pagination_admin($url, $page, $total);
require('admin/views/page/index.php');
Loading