From 9b6cd189ea37dfaf885ec680c89979120b734f4c Mon Sep 17 00:00:00 2001 From: hieutmd Date: Sun, 28 Jan 2024 11:27:52 +0700 Subject: [PATCH] c --- .htaccess | 7 ++++ data/menu_item/article.php | 10 ++--- data/menu_item/ask.php | 6 +-- data/menu_item/customer.php | 16 ++++---- data/menu_item/distributor.php | 2 +- data/menu_item/investor_relation.php | 16 ++++---- data/menu_item/job.php | 4 +- data/menu_item/marketing.php | 34 ++++++++-------- data/menu_item/order.php | 10 ++--- data/menu_item/payinstall.php | 6 +-- data/menu_item/pcbuilder.php | 4 +- data/menu_item/product.php | 32 +++++++-------- data/menu_item/report.php | 16 ++++---- data/menu_item/system.php | 38 +++++++++--------- data/menu_item/warranty.php | 4 +- inc/Hura8/AppAdmin.php | 7 ++-- inc/Hura8/Router.php | 60 ++++++++++++++++++++++++++++ inc/Hura8/Url.php | 47 ++++++++++++++++++++++ index.php | 2 +- template/order/bargain.html | 1 + template/pcbuilder/home.html | 1 + template/report/visitor.html | 1 + template/theme.html | 6 +-- 23 files changed, 223 insertions(+), 107 deletions(-) create mode 100644 .htaccess create mode 100644 inc/Hura8/Router.php create mode 100644 inc/Hura8/Url.php create mode 100644 template/order/bargain.html create mode 100644 template/pcbuilder/home.html create mode 100644 template/report/visitor.html diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..fbca9d3 --- /dev/null +++ b/.htaccess @@ -0,0 +1,7 @@ +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_URI} !^/index.php +# prevent rewrite non-existent files +RewriteCond %{REQUEST_URI} !\.(jpg|png|gif|css|js|php|tiff|jpeg|ico)$ +RewriteRule ^(.*)$ /index.php [QSA,L] \ No newline at end of file diff --git a/data/menu_item/article.php b/data/menu_item/article.php index 1a4af8a..cf8fa98 100644 --- a/data/menu_item/article.php +++ b/data/menu_item/article.php @@ -12,7 +12,7 @@ return array( 'view' => 'home', 'id' => 'article/home', 'name' => 'Tin bài', - 'url' => '/admin/?opt=article', + 'url' => '/admin/article', ), array( @@ -21,7 +21,7 @@ return array( 'view' => 'home', 'id' => 'media/home', 'name' => 'Thư viện file Media', - 'url' => '/admin/?opt=media', + 'url' => '/admin/media', ), array( @@ -30,7 +30,7 @@ return array( 'view' => 'home', 'id' => 'page/home', 'name' => 'Nội dung cố định', - 'url' => '/admin/?opt=page', + 'url' => '/admin/page', ), array( @@ -39,7 +39,7 @@ return array( 'view' => 'home', 'id' => 'album/home', 'name' => 'Thư viện ảnh', - 'url' => '/admin/?opt=album', + 'url' => '/admin/album', ), array( @@ -48,7 +48,7 @@ return array( 'view' => 'home', 'id' => 'video/home', 'name' => 'Video', - 'url' => '/admin/?opt=video', + 'url' => '/admin/video', ), ), ); diff --git a/data/menu_item/ask.php b/data/menu_item/ask.php index 3956130..9b9dbc5 100644 --- a/data/menu_item/ask.php +++ b/data/menu_item/ask.php @@ -12,7 +12,7 @@ return array( 'view' => 'home', 'id' => 'ask/home', 'name' => 'Danh sách câu hỏi', - 'url' => '/admin/?opt=ask', + 'url' => '/admin/ask', ), 1 => array( @@ -21,7 +21,7 @@ return array( 'view' => 'answer-list', 'id' => 'ask/answer-list', 'name' => 'Danh sách trả lời', - 'url' => '/admin/?opt=ask&view=answer-list', + 'url' => '/admin/ask/answer-list', ), 2 => array( @@ -30,7 +30,7 @@ return array( 'view' => 'category', 'id' => 'ask/ask', 'name' => 'Danh mục hỏi đáp', - 'url' => '/admin/?opt=ask&view=category', + 'url' => '/admin/ask/category', ), ), ); diff --git a/data/menu_item/customer.php b/data/menu_item/customer.php index 4ff3dfa..45c4ec3 100644 --- a/data/menu_item/customer.php +++ b/data/menu_item/customer.php @@ -12,7 +12,7 @@ return array( 'view' => 'home', 'id' => 'customer/home', 'name' => 'Danh sách khách hàng', - 'url' => '/admin/?opt=customer', + 'url' => '/admin/customer', ), /*array( @@ -21,7 +21,7 @@ return array( 'view' => 'customer-group', 'id' => 'customer/customer-group', 'name' => 'Nhóm khách hàng', - 'url' => '/admin/?opt=customer&view=customer-group', + 'url' => '/admin/customer/customer-group', ),*/ array( @@ -30,7 +30,7 @@ return array( 'view' => 'customer-contact', 'id' => 'customer/customer-contact', 'name' => 'Khách hàng liên hệ', - 'url' => '/admin/?opt=customer&view=customer-contact', + 'url' => '/admin/customer/customer-contact', ), array( @@ -39,7 +39,7 @@ return array( 'view' => 'comment', 'id' => 'customer/comment', 'name' => 'Tổng hợp trao đổi', - 'url' => '/admin/?opt=customer&view=comment', + 'url' => '/admin/customer/comment', ), array( @@ -48,7 +48,7 @@ return array( 'view' => 'review', 'id' => 'customer/review', 'name' => 'Tổng hợp Đánh giá', - 'url' => '/admin/?opt=customer&view=review', + 'url' => '/admin/customer/review', ), array( @@ -57,7 +57,7 @@ return array( 'view' => 'customer-review', 'id' => 'customer/customer-review', 'name' => 'Khách hàng góp ý', - 'url' => '/admin/?opt=customer&view=customer-review', + 'url' => '/admin/customer/customer-review', ), array( @@ -66,10 +66,8 @@ return array( 'view' => 'customer-newsletter', 'id' => 'customer/customer-newsletter', 'name' => 'Khách hàng nhận bản tin', - 'url' => '/admin/?opt=customer&view=customer-newsletter', + 'url' => '/admin/customer/customer-newsletter', ), - - ), ); diff --git a/data/menu_item/distributor.php b/data/menu_item/distributor.php index 060024f..baae46b 100644 --- a/data/menu_item/distributor.php +++ b/data/menu_item/distributor.php @@ -11,7 +11,7 @@ return array( 'view' => 'home', 'id' => 'distributor/home', 'name' => 'Danh sách', - 'url' => '/admin/?opt=distributor', + 'url' => '/admin/distributor', ), ), ); diff --git a/data/menu_item/investor_relation.php b/data/menu_item/investor_relation.php index e097f9d..f52e418 100644 --- a/data/menu_item/investor_relation.php +++ b/data/menu_item/investor_relation.php @@ -11,7 +11,7 @@ return array( 'view' => 'annual_report', 'name' => 'Báo cáo thường niên', 'id' => 'investor_relation/annual_report', - 'url' => '/admin/?opt=investor_relation&view=annual_report', + 'url' => '/admin/investor_relation/annual_report', ), array( 'enable' => true , @@ -19,7 +19,7 @@ return array( 'view' => 'charter', 'name' => 'Điều lệ hoạt động', 'id' => 'investor_relation/charter', - 'url' => '/admin/?opt=investor_relation&view=charter', + 'url' => '/admin/investor_relation/charter', ), array( 'enable' => true , @@ -27,7 +27,7 @@ return array( 'view' => 'governance', 'name' => 'Quy chế quản trị', 'id' => 'investor_relation/governance', - 'url' => '/admin/?opt=investor_relation&view=governance', + 'url' => '/admin/investor_relation/governance', ), array( 'enable' => true , @@ -35,7 +35,7 @@ return array( 'view' => 'financial_reports', 'name' => 'Báo cáo tài chính', 'id' => 'investor_relation/financial_reports', - 'url' => '/admin/?opt=investor_relation&view=financial_reports', + 'url' => '/admin/investor_relation/financial_reports', ), array( 'enable' => true , @@ -43,7 +43,7 @@ return array( 'view' => 'info_disclosure', 'name' => 'Công bố thông tin', 'id' => 'investor_relation/info_disclosure', - 'url' => '/admin/?opt=investor_relation&view=info_disclosure', + 'url' => '/admin/investor_relation/info_disclosure', ), array( 'enable' => true , @@ -51,7 +51,7 @@ return array( 'view' => 'management_report', 'name' => 'Báo cáo quản trị', 'id' => 'investor_relation/management_report', - 'url' => '/admin/?opt=investor_relation&view=management_report', + 'url' => '/admin/investor_relation/management_report', ), array( 'enable' => true , @@ -59,7 +59,7 @@ return array( 'view' => 'shareholder_meeting', 'name' => 'Đại hội cổ đông', 'id' => 'investor_relation/shareholder_meeting', - 'url' => '/admin/?opt=investor_relation&view=shareholder_meeting', + 'url' => '/admin/investor_relation/shareholder_meeting', ), array( 'enable' => true , @@ -67,7 +67,7 @@ return array( 'view' => 'whitepaper', 'name' => 'Báo cáo bạch', 'id' => 'investor_relation/whitepaper', - 'url' => '/admin/?opt=investor_relation&view=whitepaper', + 'url' => '/admin/investor_relation/whitepaper', ), ), ); diff --git a/data/menu_item/job.php b/data/menu_item/job.php index be261a6..33340ab 100644 --- a/data/menu_item/job.php +++ b/data/menu_item/job.php @@ -11,7 +11,7 @@ return array( 'view' => 'home', 'id' => 'job/home', 'name' => 'Vị trí tuyển', - 'url' => '/admin/?opt=job', + 'url' => '/admin/job', ), array( @@ -20,7 +20,7 @@ return array( 'view' => 'home', 'id' => 'job/home', 'name' => 'Quản lý hồ sơ', - 'url' => '/admin/?opt=job&view=applicants', + 'url' => '/admin/job/applicants', ), ), ); diff --git a/data/menu_item/marketing.php b/data/menu_item/marketing.php index 91ec640..0a6e503 100644 --- a/data/menu_item/marketing.php +++ b/data/menu_item/marketing.php @@ -11,7 +11,7 @@ return array( 'view' => 'promotion', 'id' => 'marketing/promotion', 'name' => 'Khuyến mại theo sản phẩm', - 'url' => '/admin/?opt=marketing&view=promotion', + 'url' => '/admin/marketing/promotion', ), array( @@ -20,7 +20,7 @@ return array( 'view' => 'coupon', 'id' => 'marketing/coupon', 'name' => 'Phiếu giảm giá - Voucher', - 'url' => '/admin/?opt=marketing&view=coupon', + 'url' => '/admin/marketing/coupon', ), array( @@ -29,7 +29,7 @@ return array( 'view' => 'home', 'id' => 'banner/home', 'name' => 'Danh sách banner', - 'url' => '/admin/?opt=banner', + 'url' => '/admin/banner', ), array( @@ -38,7 +38,7 @@ return array( 'view' => 'store-design', 'id' => 'system/store-design', 'name' => 'Banner pop-up', - 'url' => '/admin/?opt=system&view=store-design§ion=popup', + 'url' => '/admin/system/store-design§ion=popup', ), array( @@ -47,7 +47,7 @@ return array( 'view' => 'poster-upload', 'id' => 'marketing/poster-upload', 'name' => 'Poster', - 'url' => '/admin/?opt=marketing&view=poster-upload', + 'url' => '/admin/marketing/poster-upload', ), /* array( @@ -56,7 +56,7 @@ return array( 'view' => 'store-design', 'id' => 'system/store-design', 'name' => 'Hình nền website', - 'url' => '/admin/?opt=system&view=store-design§ion=background', + 'url' => '/admin/system/store-design§ion=background', ),*/ /* array( @@ -65,7 +65,7 @@ return array( 'view' => 'home', 'id' => 'email/home', 'name' => 'Email', - 'url' => '/admin/?opt=email', + 'url' => '/admin/email', ),*/ array( @@ -74,7 +74,7 @@ return array( 'view' => 'meta-list', 'id' => 'url/meta-list', 'name' => 'Sửa thông tin URL', - 'url' => '/admin/?opt=url&view=meta-list', + 'url' => '/admin/url/meta-list', ), array( @@ -83,7 +83,7 @@ return array( 'view' => 'url-seo', 'id' => 'url/url-seo', 'name' => 'Link SEO', - 'url' => '/admin/?opt=url&view=url-seo', + 'url' => '/admin/url/url-seo', ), array( @@ -92,7 +92,7 @@ return array( 'view' => 'feed', 'id' => 'marketing/feed', 'name' => 'Facebook/Google Feed', - 'url' => '/admin/?opt=marketing&view=feed', + 'url' => '/admin/marketing/feed', ), array( @@ -101,7 +101,7 @@ return array( 'view' => 'product-offer', 'id' => 'marketing/product-offer', 'name' => 'Cài biểu tượng giảm giá', - 'url' => '/admin/?opt=marketing&view=product-offer', + 'url' => '/admin/marketing/product-offer', ), /*array( @@ -110,7 +110,7 @@ return array( 'view' => 'lead-program', 'id' => 'marketing/lead-program', 'name' => 'Thu thập khách hàng', - 'url' => '/admin/?opt=marketing&view=lead-program', + 'url' => '/admin/marketing/lead-program', ),*/ array( @@ -119,7 +119,7 @@ return array( 'view' => 'program', 'id' => 'marketing/program', 'name' => 'Chương trình khuyến mại', - 'url' => '/admin/?opt=marketing&view=program', + 'url' => '/admin/marketing/program', ), array( @@ -128,7 +128,7 @@ return array( 'view' => 'home', 'id' => 'deal/home', 'name' => 'Deal/giờ vàng', - 'url' => '/admin/?opt=deal', + 'url' => '/admin/deal', ), array( @@ -137,7 +137,7 @@ return array( 'view' => 'combo-deal', 'id' => 'marketing/combo-deal', 'name' => 'Bán Combo', - 'url' => '/admin/?opt=marketing&view=combo-deal', + 'url' => '/admin/marketing/combo-deal', ), array( @@ -146,7 +146,7 @@ return array( 'view' => 'conditional-promotion', 'id' => 'marketing/conditional-promotion', 'name' => 'Khuyến mại BuildPC', - 'url' => '/admin/?opt=marketing&view=conditional-promotion', + 'url' => '/admin/marketing/conditional-promotion', ), array( @@ -155,7 +155,7 @@ return array( 'view' => 'live-support-per-category', 'id' => 'marketing/live-support-per-category', 'name' => 'Hỗ trợ theo từng danh mục', - 'url' => '/admin/?opt=marketing&view=live-support-per-category', + 'url' => '/admin/marketing/live-support-per-category', ), ), diff --git a/data/menu_item/order.php b/data/menu_item/order.php index a558c2f..7baeb5a 100644 --- a/data/menu_item/order.php +++ b/data/menu_item/order.php @@ -11,7 +11,7 @@ return array( 'view' => 'home', 'id' => 'order/home', 'name' => 'Danh sách đơn hàng', - 'url' => '/admin/?opt=order', // &list=new + 'url' => '/admin/order', // &list=new ), array( @@ -20,7 +20,7 @@ return array( 'view' => 'bargain', 'id' => 'order/bargain', 'name' => 'Mặc cả giá', - 'url' => '/admin/?opt=order&view=bargain', + 'url' => '/admin/order/bargain', ), array( @@ -29,7 +29,7 @@ return array( 'view' => 'wait-order', 'id' => 'order/wait-order', 'name' => 'Chờ mua sản phẩm', - 'url' => '/admin/?opt=order&view=wait-order', + 'url' => '/admin/order/wait-order', ), @@ -39,7 +39,7 @@ return array( 'view' => 'paygate', 'id' => 'order/paygate', 'name' => 'Thanh toán qua cổng dịch vụ', - 'url' => '/admin/?opt=order&view=paygate', + 'url' => '/admin/order/paygate', ), array( @@ -48,7 +48,7 @@ return array( 'view' => 'price-quote', 'id' => 'order/price-quote', 'name' => 'Lập báo giá', - 'url' => '/admin/?opt=order&view=price-quote', + 'url' => '/admin/order/price-quote', ), ), ); diff --git a/data/menu_item/payinstall.php b/data/menu_item/payinstall.php index 925ffe0..2b9f4e8 100644 --- a/data/menu_item/payinstall.php +++ b/data/menu_item/payinstall.php @@ -11,7 +11,7 @@ return array( 'view' => 'order', 'id' => 'payinstall/order', 'name' => 'Danh sách đơn hàng', - 'url' => '/admin/?opt=payinstall&view=order', + 'url' => '/admin/payinstall/order', ), array( @@ -20,7 +20,7 @@ return array( 'view' => 'home', 'id' => 'payinstall/home', 'name' => 'Cài đặt trả góp', - 'url' => '/admin/?opt=payinstall', + 'url' => '/admin/payinstall', ), array( @@ -29,7 +29,7 @@ return array( 'view' => 'category', 'id' => 'payinstall/category', 'name' => 'Danh mục sản phẩm', - 'url' => '/admin/?opt=payinstall&view=category', + 'url' => '/admin/payinstall/category', ), ), ); diff --git a/data/menu_item/pcbuilder.php b/data/menu_item/pcbuilder.php index 97b6adf..fd1f6ba 100644 --- a/data/menu_item/pcbuilder.php +++ b/data/menu_item/pcbuilder.php @@ -12,7 +12,7 @@ return array( 'view' => 'home', 'id' => 'pcbuilder/home', 'name' => 'Linh kiện xây dựng', - 'url' => '/admin/?opt=pcbuilder', + 'url' => '/admin/pcbuilder', ), array( @@ -21,7 +21,7 @@ return array( 'view' => 'preconfig', 'id' => 'pcbuilder/preconfig', 'name' => 'Bộ máy tính mẫu', - 'url' => '/admin/?opt=pcbuilder&view=preconfig', + 'url' => '/admin/pcbuilder/preconfig', ), ), diff --git a/data/menu_item/product.php b/data/menu_item/product.php index d24ab22..f965866 100644 --- a/data/menu_item/product.php +++ b/data/menu_item/product.php @@ -13,7 +13,7 @@ return array( 'view' => 'home', 'id' => 'product/home', 'name' => 'Sản phẩm', - 'url' => '/admin/?opt=product', + 'url' => '/admin/product', ), /* array( @@ -22,7 +22,7 @@ return array( 'view' => 'user-rating', 'id' => 'product/user-rating', 'name' => 'Đánh giá ', - 'url' => '/admin/?opt=product&view=user-rating', + 'url' => '/admin/product/user-rating', ),*/ /*array( @@ -31,7 +31,7 @@ return array( 'view' => 'product-customer-image', 'id' => 'product/product-customer-image', 'name' => 'Ảnh người dùng gửi', - 'url' => '/admin/?opt=product&view=product-customer-image', + 'url' => '/admin/product/product-customer-image', ),*/ /*array( @@ -40,7 +40,7 @@ return array( 'view' => 'product-list-update', 'id' => 'product/product-list-update', 'name' => 'Bảng giá cập nhật', - 'url' => '/admin/?opt=product&view=product-list-update', + 'url' => '/admin/product/product-list-update', ),*/ array( @@ -49,7 +49,7 @@ return array( 'view' => 'category', 'id' => 'product/category', 'name' => 'Danh mục', - 'url' => '/admin/?opt=product&view=category', + 'url' => '/admin/product/category', ), array( 'enable' => true , @@ -57,7 +57,7 @@ return array( 'view' => 'home', 'id' => 'brand/home', 'name' => 'Thương hiệu', - 'url' => '/admin/?opt=brand', + 'url' => '/admin/brand', ), array( 'enable' => true , @@ -65,7 +65,7 @@ return array( 'view' => 'attribute', 'id' => 'product/attribute', 'name' => 'Thuộc tính ', - 'url' => '/admin/?opt=product&view=attribute', + 'url' => '/admin/product/attribute', ), array( 'enable' => true , @@ -73,7 +73,7 @@ return array( 'view' => 'collection', 'id' => 'product/collection', 'name' => 'Bộ sưu tập', - 'url' => '/admin/?opt=product&view=collection', + 'url' => '/admin/product/collection', ), array( @@ -82,7 +82,7 @@ return array( 'view' => 'product-wait-list', 'id' => 'product/product-wait-list', 'name' => 'Chờ mua sản phẩm', - 'url' => '/admin/?opt=product&view=product-wait-list', + 'url' => '/admin/product/product-wait-list', ), array( @@ -91,7 +91,7 @@ return array( 'view' => 'home', 'id' => 'addon/home', 'name' => 'SP/Dịch vụ mua kèm', - 'url' => '/admin/?opt=addon', + 'url' => '/admin/addon', ), array( @@ -100,7 +100,7 @@ return array( 'view' => 'home', 'id' => 'config_group/home', 'name' => 'Nhóm cấu hình', - 'url' => '/admin/?opt=config_group', + 'url' => '/admin/config_group', ), /*array( @@ -109,7 +109,7 @@ return array( 'view' => 'home', 'id' => 'supplier/home', 'name' => 'Nhà cung cấp', - 'url' => '/admin/?opt=supplier', + 'url' => '/admin/supplier', ),*/ /* array( @@ -118,7 +118,7 @@ return array( 'view' => 'set-promotion-price', 'id' => 'product/set-promotion-price', 'name' => 'Cài đặt giá khuyến mại', - 'url' => '/admin/?opt=product&view=set-promotion-price', + 'url' => '/admin/product/set-promotion-price', ),*/ /*array( @@ -127,7 +127,7 @@ return array( 'view' => 'product-per-customer-group', 'id' => 'product/product-per-customer-group', 'name' => 'Giá theo nhóm khách hàng', - 'url' => '/admin/?opt=product&view=product-per-customer-group', + 'url' => '/admin/product/product-per-customer-group', ),*/ array( @@ -136,7 +136,7 @@ return array( 'view' => 'set', 'id' => 'product/set', 'name' => 'Set sản phẩm', - 'url' => '/admin/?opt=product&view=set', + 'url' => '/admin/product/set', ), array( @@ -145,7 +145,7 @@ return array( 'view' => 'spec-group', 'id' => 'product/spec-group', 'name' => 'Nhóm thông số kỹ thuật', - 'url' => '/admin/?opt=product&view=spec-group', + 'url' => '/admin/product/spec-group', ), ), ); diff --git a/data/menu_item/report.php b/data/menu_item/report.php index e6b634c..fab36e0 100644 --- a/data/menu_item/report.php +++ b/data/menu_item/report.php @@ -12,7 +12,7 @@ return array( 'view' => 'visitor', 'id' => 'report/visitor', 'name' => 'Thống kê truy cập', - 'url' => '/admin/?opt=report&view=visitor', + 'url' => '/admin/report/visitor', ), array( @@ -21,7 +21,7 @@ return array( 'view' => 'customer', 'id' => 'report/customer', 'name' => 'Thống kê khách hàng', - 'url' => '/admin/?opt=report&view=customer', + 'url' => '/admin/report/customer', ), array( @@ -30,7 +30,7 @@ return array( 'view' => 'order', 'id' => 'report/order', 'name' => 'Thống kê đơn hàng', - 'url' => '/admin/?opt=report&view=order', + 'url' => '/admin/report/order', ), array( @@ -39,7 +39,7 @@ return array( 'view' => 'product-buy', 'id' => 'report/product-buy', 'name' => 'Sản phẩm mua nhiều', - 'url' => '/admin/?opt=report&view=product-buy', + 'url' => '/admin/report/product-buy', ), array( @@ -48,7 +48,7 @@ return array( 'view' => 'product-visit', 'id' => 'report/product-visit', 'name' => 'Sản phẩm xem nhiều', - 'url' => '/admin/?opt=report&view=product-visit', + 'url' => '/admin/report/product-visit', ), array( @@ -57,7 +57,7 @@ return array( 'view' => 'referer', 'id' => 'report/referer', 'name' => 'Web giới thiệu', - 'url' => '/admin/?opt=report&view=referer', + 'url' => '/admin/report/referer', ), array( @@ -66,7 +66,7 @@ return array( 'view' => 'search', 'id' => 'report/search', 'name' => 'Từ khóa tìm kiếm', - 'url' => '/admin/?opt=report&view=search', + 'url' => '/admin/report/search', ), array( @@ -75,7 +75,7 @@ return array( 'view' => 'error-page', 'id' => '', 'name' => 'Lỗi website', - 'url' => '/admin/?opt=report&view=error-page', + 'url' => '/admin/report/error-page', ), ), ); diff --git a/data/menu_item/system.php b/data/menu_item/system.php index 422b671..0721b79 100644 --- a/data/menu_item/system.php +++ b/data/menu_item/system.php @@ -11,7 +11,7 @@ return array( 'view' => 'settings', 'id' => 'system/settings', 'name' => 'Cài đặt chung', - 'url' => '/admin/?opt=system&view=settings', + 'url' => '/admin/system/settings', ), array( @@ -20,7 +20,7 @@ return array( 'view' => 'home', 'id' => 'template/home', 'name' => 'Sửa file template', - 'url' => '/admin/?opt=template', + 'url' => '/admin/template', ), array( @@ -29,7 +29,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Quản trị viên', - 'url' => '/admin/?opt=admin', + 'url' => '/admin/admin', ), array( @@ -38,7 +38,7 @@ return array( 'view' => 'store-address', 'id' => '', 'name' => 'Địa chỉ cửa hàng', - 'url' => '/admin/?opt=system&view=store-address', + 'url' => '/admin/system/store-address', ), /*4 => array( @@ -47,7 +47,7 @@ return array( 'view' => 'domain', 'id' => 'system/domain', 'name' => 'Cài đặt tên miền', - 'url' => '/admin/?opt=system&view=domain', + 'url' => '/admin/system/domain', ),*/ /*array( @@ -56,7 +56,7 @@ return array( 'view' => 'ban-ip', 'id' => '', 'name' => 'Chặn IP truy cập website', - 'url' => '/admin/?opt=system&view=ban-ip', + 'url' => '/admin/system/ban-ip', ), array( @@ -65,7 +65,7 @@ return array( 'view' => 'change-info', 'id' => '', 'name' => 'Thông tin website', - 'url' => '/admin/?opt=system&view=change-info', + 'url' => '/admin/system/change-info', ),*/ /* @@ -76,7 +76,7 @@ return array( 'view' => 'province-list', 'id' => '', 'name' => 'Cài đặt tỉnh thành', - 'url' => '/admin/?opt=system&view=province-list', + 'url' => '/admin/system/province-list', ),*/ /*9 => array( @@ -85,7 +85,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Tình trạng đơn hàng', - 'url' => '/admin/?opt=system&view=order-status', + 'url' => '/admin/system/order-status', ),*/ /*array( @@ -94,7 +94,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Hỗ trợ bán hàng', - 'url' => '/admin/?opt=online_support', + 'url' => '/admin/online_support', ),*/ /*array( @@ -103,7 +103,7 @@ return array( 'view' => 'country', 'id' => '', 'name' => 'Quốc gia', - 'url' => '/admin/?opt=system&view=country', + 'url' => '/admin/system/country', ),*/ /*12 => array( @@ -112,7 +112,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Cài đặt thông báo ngoài', - 'url' => '/admin/?opt=report_out', + 'url' => '/admin/report_out', ),*/ /*array( @@ -121,7 +121,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Cài đặt phí vận chuyển', - 'url' => '/admin/?opt=shipping2', + 'url' => '/admin/shipping2', ),*/ array( @@ -130,7 +130,7 @@ return array( 'view' => 'redirect', 'id' => 'url/redirect', 'name' => 'Url Redirect', - 'url' => '/admin/?opt=url&view=redirect', + 'url' => '/admin/url/redirect', ), array( @@ -139,7 +139,7 @@ return array( 'view' => 'home', 'id' => 'tool/home', 'name' => 'Công cụ', - 'url' => '/admin/?opt=tool', + 'url' => '/admin/tool', ), /*array( @@ -148,7 +148,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Civi Affiliate', - 'url' => '/admin/?opt=civi', + 'url' => '/admin/civi', ), array( @@ -157,7 +157,7 @@ return array( 'view' => 'home', 'id' => 'menu/home', 'name' => 'Quản trị menu', - 'url' => '/admin/?opt=menu', + 'url' => '/admin/menu', ), array( @@ -166,7 +166,7 @@ return array( 'view' => 'keyword-suggest', 'id' => 'system/keyword-suggest', 'name' => 'Từ khóa gợi ý', - 'url' => '/admin/?opt=system&view=keyword-suggest', + 'url' => '/admin/system/keyword-suggest', ),*/ array( @@ -175,7 +175,7 @@ return array( 'view' => 'home', 'id' => 'tag/home', 'name' => 'Quản trị Tag', - 'url' => '/admin/?opt=tag', + 'url' => '/admin/tag', ), ), ); diff --git a/data/menu_item/warranty.php b/data/menu_item/warranty.php index 112d4af..32b71ee 100644 --- a/data/menu_item/warranty.php +++ b/data/menu_item/warranty.php @@ -12,7 +12,7 @@ return array( 'view' => 'home', 'id' => '', 'name' => 'Khách hàng đăng ký', - 'url' => '/admin/?opt=warranty&view=customer-register', + 'url' => '/admin/warranty/customer-register', ),*/ array( @@ -21,7 +21,7 @@ return array( 'view' => 'home', 'id' => 'warranty/home', 'name' => 'Danh sách bảo hành', - 'url' => '/admin/?opt=warranty', + 'url' => '/admin/warranty', ), ), ); diff --git a/inc/Hura8/AppAdmin.php b/inc/Hura8/AppAdmin.php index eb29ac5..58de2ea 100644 --- a/inc/Hura8/AppAdmin.php +++ b/inc/Hura8/AppAdmin.php @@ -32,12 +32,13 @@ class AppAdmin protected function getRouter() { - $route = [ + /*$route = [ "module" => (isset($_REQUEST['module'])) ? $_REQUEST['module'] : 'home', "view" => (isset($_REQUEST['view'])) ? $_REQUEST['view'] : 'home', - ]; + ];*/ - $this->current_route_info = $route; + $objRouter = new Router(); + $this->current_route_info = $objRouter->getRouting(); } diff --git a/inc/Hura8/Router.php b/inc/Hura8/Router.php new file mode 100644 index 0000000..1361840 --- /dev/null +++ b/inc/Hura8/Router.php @@ -0,0 +1,60 @@ +path_config) { + //$path_config_file = APP_DIR . '/config/routing.php'; + //$this->path_config = require $path_config_file; + //} + } + + // url: admin/abc/product.php?para1=value1 + public function getRouting() { + $parsed = Url::parse($_SERVER['REQUEST_URI']); //abc/product?param1=12¶m2=value2 + + // home + if($parsed['path'] == '/') { + return [ + 'module' => preg_replace("/[^a-z0-9_\-]/i","", getRequest('module', 'home')), + 'view' => preg_replace("/[^a-z0-9_\-]/i","", getRequest('view', 'home')), + 'view_id' => 0, + 'query' => $parsed['query'], + ]; + } + + // check match pattern in $this->path_config + foreach ($this->path_config as $_config => $_route ) { + if(preg_match("{^".$_config."$}", $parsed['path'], $match )) { + + if(isset($_route['query']) && is_array($_route['query'])) { + $_route['query'] = array_merge($_route['query'], $parsed['query']); + }else{ + $_route['query'] = $parsed['query']; + } + + return array_merge([ + 'path' => $parsed['path'], + 'match' => $match, + ], $_route); + } + } + + // auto parse path base on convention: admin/module/view/view_id + $ele = explode("/", $parsed['path']); + + // else error + return [ + 'module' => $ele[2] ?? 'home', + 'view' => isset($ele[3]) ? preg_replace("/[^a-z0-9_\-]/i","", $ele[3] ) : 'home', + 'view_id' => isset($ele[4]) ? preg_replace("/[^a-z0-9_]/i","", $ele[4] ) : '', + 'query' => $parsed['query'], + ]; + } + +} diff --git a/inc/Hura8/Url.php b/inc/Hura8/Url.php new file mode 100644 index 0000000..f5f8250 --- /dev/null +++ b/inc/Hura8/Url.php @@ -0,0 +1,47 @@ + '', + 'host' => '', + 'port' => '', + 'user' => '', + 'pass' => '', + 'path' => '', + 'query' => [], + 'fragment' => '', + ]; + foreach ($data as $key => $value) { + if(isset($default[$key])) { + $default[$key] = ($key == 'query') ? self::parsedQuery($value) : $value; + } + } + + return $default; + } + + + public static function parsedQuery($query = '') { + if(!$query) return []; + $result = []; + $parts = explode("&", $query); + + foreach ($parts as $part) { + $el = explode("=", $part); + if(sizeof($el) != 2) continue; + + $cleaned_key = preg_replace("/[^a-z0-9_\-\.]/i", '', $el[0]); + $cleaned_value = preg_replace("/[^a-z0-9_\.\-;&]/i", '', $el[1]); + + $result[$cleaned_key] = $cleaned_value; + } + + return $result; + } +} diff --git a/index.php b/index.php index 524cac6..bb1668f 100644 --- a/index.php +++ b/index.php @@ -6,7 +6,7 @@ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); -const TEMPLATE_ASSET = 'assets'; +const TEMPLATE_ASSET = '/assets'; include __DIR__."/_shared.php"; diff --git a/template/order/bargain.html b/template/order/bargain.html new file mode 100644 index 0000000..c76f091 --- /dev/null +++ b/template/order/bargain.html @@ -0,0 +1 @@ +template/order/bargain.html \ No newline at end of file diff --git a/template/pcbuilder/home.html b/template/pcbuilder/home.html new file mode 100644 index 0000000..0181a33 --- /dev/null +++ b/template/pcbuilder/home.html @@ -0,0 +1 @@ +template/pcbuilder/home.html \ No newline at end of file diff --git a/template/report/visitor.html b/template/report/visitor.html new file mode 100644 index 0000000..2e6ce2d --- /dev/null +++ b/template/report/visitor.html @@ -0,0 +1 @@ +template/report/visitor.html \ No newline at end of file diff --git a/template/theme.html b/template/theme.html index 1c47122..53d44aa 100644 --- a/template/theme.html +++ b/template/theme.html @@ -75,7 +75,7 @@ @@ -154,7 +154,7 @@ @@ -173,7 +173,7 @@