├── README.md
├── app
├── config
│ └── routes.php
├── controllers
│ ├── AdminController.php
│ ├── AuthController.php
│ ├── ErrorController.php
│ ├── HomeController.php
│ └── TutorialsController.php
├── core
│ ├── Controller.php
│ ├── Dispatcher.php
│ ├── Model.php
│ ├── Page.php
│ ├── Route.php
│ ├── Router.php
│ ├── Track.php
│ └── View.php
├── models
│ ├── Admin.php
│ └── Page.php
└── views
│ └── admin
│ ├── 404.php
│ ├── add_post.php
│ ├── add_thread.php
│ ├── blog_cat.php
│ ├── blog_edit.php
│ ├── blog_list.php
│ └── category.php
├── htaccess.txt
├── index.php
├── public
├── admin
│ ├── admin.txt
│ ├── css
│ │ ├── sb-admin-2.css
│ │ └── sb-admin-2.min.css
│ ├── img
│ │ └── undraw_posting_photo.svg
│ ├── js
│ │ ├── demo
│ │ │ ├── chart-area-demo.js
│ │ │ ├── chart-bar-demo.js
│ │ │ ├── chart-pie-demo.js
│ │ │ └── datatables-demo.js
│ │ ├── sb-admin-2.js
│ │ └── sb-admin-2.min.js
│ ├── scss
│ │ ├── _buttons.scss
│ │ ├── _cards.scss
│ │ ├── _charts.scss
│ │ ├── _dropdowns.scss
│ │ ├── _error.scss
│ │ ├── _footer.scss
│ │ ├── _global.scss
│ │ ├── _login.scss
│ │ ├── _mixins.scss
│ │ ├── _navs.scss
│ │ ├── _utilities.scss
│ │ ├── _variables.scss
│ │ ├── navs
│ │ │ ├── _global.scss
│ │ │ ├── _sidebar.scss
│ │ │ └── _topbar.scss
│ │ ├── sb-admin-2.scss
│ │ └── utilities
│ │ │ ├── _animation.scss
│ │ │ ├── _background.scss
│ │ │ ├── _border.scss
│ │ │ ├── _display.scss
│ │ │ ├── _progress.scss
│ │ │ ├── _rotate.scss
│ │ │ └── _text.scss
│ └── vendor
│ │ ├── bootstrap
│ │ ├── js
│ │ │ ├── bootstrap.bundle.js
│ │ │ ├── bootstrap.bundle.js.map
│ │ │ ├── bootstrap.bundle.min.js
│ │ │ ├── bootstrap.bundle.min.js.map
│ │ │ ├── bootstrap.js
│ │ │ ├── bootstrap.js.map
│ │ │ ├── bootstrap.min.js
│ │ │ └── bootstrap.min.js.map
│ │ └── scss
│ │ │ ├── _alert.scss
│ │ │ ├── _badge.scss
│ │ │ ├── _breadcrumb.scss
│ │ │ ├── _button-group.scss
│ │ │ ├── _buttons.scss
│ │ │ ├── _card.scss
│ │ │ ├── _carousel.scss
│ │ │ ├── _close.scss
│ │ │ ├── _code.scss
│ │ │ ├── _custom-forms.scss
│ │ │ ├── _dropdown.scss
│ │ │ ├── _forms.scss
│ │ │ ├── _functions.scss
│ │ │ ├── _grid.scss
│ │ │ ├── _images.scss
│ │ │ ├── _input-group.scss
│ │ │ ├── _jumbotron.scss
│ │ │ ├── _list-group.scss
│ │ │ ├── _media.scss
│ │ │ ├── _mixins.scss
│ │ │ ├── _modal.scss
│ │ │ ├── _nav.scss
│ │ │ ├── _navbar.scss
│ │ │ ├── _pagination.scss
│ │ │ ├── _popover.scss
│ │ │ ├── _print.scss
│ │ │ ├── _progress.scss
│ │ │ ├── _reboot.scss
│ │ │ ├── _root.scss
│ │ │ ├── _spinners.scss
│ │ │ ├── _tables.scss
│ │ │ ├── _toasts.scss
│ │ │ ├── _tooltip.scss
│ │ │ ├── _transitions.scss
│ │ │ ├── _type.scss
│ │ │ ├── _utilities.scss
│ │ │ ├── _variables.scss
│ │ │ ├── bootstrap-grid.scss
│ │ │ ├── bootstrap-reboot.scss
│ │ │ ├── bootstrap.scss
│ │ │ ├── mixins
│ │ │ ├── _alert.scss
│ │ │ ├── _background-variant.scss
│ │ │ ├── _badge.scss
│ │ │ ├── _border-radius.scss
│ │ │ ├── _box-shadow.scss
│ │ │ ├── _breakpoints.scss
│ │ │ ├── _buttons.scss
│ │ │ ├── _caret.scss
│ │ │ ├── _clearfix.scss
│ │ │ ├── _deprecate.scss
│ │ │ ├── _float.scss
│ │ │ ├── _forms.scss
│ │ │ ├── _gradients.scss
│ │ │ ├── _grid-framework.scss
│ │ │ ├── _grid.scss
│ │ │ ├── _hover.scss
│ │ │ ├── _image.scss
│ │ │ ├── _list-group.scss
│ │ │ ├── _lists.scss
│ │ │ ├── _nav-divider.scss
│ │ │ ├── _pagination.scss
│ │ │ ├── _reset-text.scss
│ │ │ ├── _resize.scss
│ │ │ ├── _screen-reader.scss
│ │ │ ├── _size.scss
│ │ │ ├── _table-row.scss
│ │ │ ├── _text-emphasis.scss
│ │ │ ├── _text-hide.scss
│ │ │ ├── _text-truncate.scss
│ │ │ ├── _transition.scss
│ │ │ └── _visibility.scss
│ │ │ ├── utilities
│ │ │ ├── _align.scss
│ │ │ ├── _background.scss
│ │ │ ├── _borders.scss
│ │ │ ├── _clearfix.scss
│ │ │ ├── _display.scss
│ │ │ ├── _embed.scss
│ │ │ ├── _flex.scss
│ │ │ ├── _float.scss
│ │ │ ├── _overflow.scss
│ │ │ ├── _position.scss
│ │ │ ├── _screenreaders.scss
│ │ │ ├── _shadows.scss
│ │ │ ├── _sizing.scss
│ │ │ ├── _spacing.scss
│ │ │ ├── _stretched-link.scss
│ │ │ ├── _text.scss
│ │ │ └── _visibility.scss
│ │ │ └── vendor
│ │ │ └── _rfs.scss
│ │ ├── chart.js
│ │ ├── Chart.bundle.js
│ │ ├── Chart.bundle.min.js
│ │ ├── Chart.js
│ │ └── Chart.min.js
│ │ ├── datatables
│ │ ├── dataTables.bootstrap4.css
│ │ ├── dataTables.bootstrap4.js
│ │ ├── dataTables.bootstrap4.min.css
│ │ ├── dataTables.bootstrap4.min.js
│ │ ├── jquery.dataTables.js
│ │ └── jquery.dataTables.min.js
│ │ ├── dontpayattention.txt
│ │ ├── fontawesome-free
│ │ └── readme.txt
│ │ ├── jquery-easing
│ │ ├── jquery.easing.compatibility.js
│ │ ├── jquery.easing.js
│ │ └── jquery.easing.min.js
│ │ └── jquery
│ │ ├── jquery.js
│ │ ├── jquery.min.js
│ │ ├── jquery.min.map
│ │ ├── jquery.slim.js
│ │ ├── jquery.slim.min.js
│ │ └── jquery.slim.min.map
├── css
│ ├── addons
│ │ ├── datatables-select.min.css
│ │ ├── datatables.min.css
│ │ ├── directives.min.css
│ │ ├── flag.min.css
│ │ ├── jquery.zmd.hierarchical-display.min.css
│ │ └── rating.min.css
│ ├── bootstrap.css
│ ├── bootstrap.min.css
│ ├── custom.css
│ ├── mdb.css
│ ├── mdb.lite.css
│ ├── mdb.lite.min.css
│ ├── mdb.min.css
│ ├── modules
│ │ └── animations-extended.min.css
│ └── style.css
├── img
│ ├── bg.jpg
│ ├── books.png
│ ├── bootstrap.png
│ ├── c-plus-plus.png
│ ├── circle-t.png
│ ├── css3.png
│ ├── html-5.png
│ ├── java-coffee-cup-logo.png
│ ├── javascript.png
│ ├── mdb-favicon.ico
│ ├── mysql-logo.png
│ ├── overlays
│ │ ├── 01.png
│ │ ├── 02.png
│ │ ├── 03.png
│ │ ├── 04.png
│ │ ├── 05.png
│ │ ├── 06.png
│ │ ├── 07.png
│ │ ├── 08.png
│ │ └── 09.png
│ ├── php-logo.png
│ ├── python.png
│ ├── question-mark.png
│ ├── road.png
│ ├── road50.png
│ ├── rubiks-cube.png
│ ├── section.png
│ ├── svg
│ │ ├── arrow_left.svg
│ │ └── arrow_right.svg
│ ├── t.png
│ ├── talk-male.png
│ └── unity.png
├── js
│ ├── addons
│ │ ├── datatables-select.min.js
│ │ ├── datatables.min.js
│ │ ├── directives.min.js
│ │ ├── flag.min.js
│ │ ├── imagesloaded.pkgd.min.js
│ │ ├── jquery.zmd.hierarchical-display.min.js
│ │ ├── masonry.pkgd.min.js
│ │ └── rating.min.js
│ ├── bootstrap.js
│ ├── bootstrap.min.js
│ ├── custom.js
│ ├── jquery.js
│ ├── jquery.min.js
│ ├── mdb.js
│ ├── mdb.min.js
│ ├── modules
│ │ ├── animations-extended.min.js
│ │ ├── forms-free.min.js
│ │ ├── scrolling-navbar.min.js
│ │ ├── treeview.min.js
│ │ └── wow.min.js
│ ├── popper.js
│ └── popper.min.js
├── layouts
│ ├── admin.php
│ ├── auth.php
│ └── default.php
├── readme.txt
├── scss
│ ├── _custom-styles.scss
│ ├── _custom-variables.scss
│ ├── addons
│ │ ├── _datatables-select.scss
│ │ ├── _datatables.scss
│ │ ├── _directives.scss
│ │ ├── _flag.scss
│ │ ├── _hierarchical-display.scss
│ │ └── _rating.scss
│ ├── core
│ │ ├── _colors.scss
│ │ ├── _global.scss
│ │ ├── _helpers.scss
│ │ ├── _masks.scss
│ │ ├── _mixins.scss
│ │ ├── _typography.scss
│ │ ├── _variables.scss
│ │ ├── _waves.scss
│ │ └── bootstrap
│ │ │ ├── _functions.scss
│ │ │ ├── _rfs.scss
│ │ │ └── _variables.scss
│ ├── free
│ │ ├── _animations-basic.scss
│ │ ├── _badges.scss
│ │ ├── _buttons.scss
│ │ ├── _cards.scss
│ │ ├── _carousels.scss
│ │ ├── _depreciated.scss
│ │ ├── _dropdowns.scss
│ │ ├── _footers.scss
│ │ ├── _forms.scss
│ │ ├── _input-group.scss
│ │ ├── _list-group.scss
│ │ ├── _loader.scss
│ │ ├── _modals.scss
│ │ ├── _msc.scss
│ │ ├── _navbars.scss
│ │ ├── _pagination.scss
│ │ ├── _steppers.scss
│ │ ├── _tables.scss
│ │ ├── _treeview.scss
│ │ └── modules
│ │ │ └── animations-extended
│ │ │ ├── _module.scss
│ │ │ └── animations-extended.scss
│ ├── mdb-free.scss
│ └── mdb-lite-free.scss
└── src
│ └── js
│ ├── free
│ ├── forms-free.js
│ ├── scrolling-navbar.js
│ ├── treeview.js
│ └── wow.js
│ └── vendor
│ ├── addons
│ ├── datatables-select.js
│ ├── datatables.js
│ ├── imagesloaded.pkgd.min.js
│ ├── jquery.zmd.hierarchical-display.js
│ ├── masonry.pkgd.min.js
│ └── rating.js
│ └── free
│ ├── bs-custom-file-input.js
│ ├── chart.js
│ ├── chartjs-datalabels.js
│ ├── enhanced-modals.js
│ ├── jquery.easing.js
│ ├── velocity.js
│ └── waves.js
└── upload
├── img1029585761.jpg
├── img1061839367.jpg
├── img1201512751.jpg
├── img1216096094.png
├── img1413972691.jpg
├── img1448369210.jpg
├── img1593942392.png
├── img1691733482.png
├── img1818635649.jpg
├── img1834831690.png
├── img2110835325.jpg
├── img2121409065.jpg
├── img289529877.jpg
├── img309758151.png
├── img325537517.jpg
├── img492428815.jpg
├── img550102324.jpg
├── img559888226.png
├── img727267822.png
├── img763771475.jpg
├── img832290346.jpg
├── img880739612.jpg
├── img88715849.jpg
├── img91828733.jpg
├── img938141007.jpg
├── img97332032.jpg
└── img973888313.jpg
/README.md:
--------------------------------------------------------------------------------
1 | Tutorials.uz ning ochiq manbali kodi
2 |
3 | Iltimos, mualliflik huquqini buzmang. Muallif - Sanjarbek Sobirjonov(telegram @SobirjonovSanjarbek).
4 |
5 | Loyihaga hissangizni qo'shishingizdan juda minnatdormiz. Manbadagi mavjud xatoliklar va kamchiliklarni to'g'irlab, loyihaning rivojiga katta hissa qo'shgan bo'lasiz.
6 |
7 | Manbada g'alati kodlar mavjud. Loyihani ochiq manbali qilishdan maqsad, ko'proq tajriba orttirish.
8 |
9 | E'tiboringiz uchun rahmat!
10 |
11 | 👉Tutorials.uz telegram channel : https://t.me/tutorialsuz
12 | 👉Tutorials.uz telegram group: https://t.me/tutorialsgroup
13 | 👉Tutorials.uz website : https://tutorials.uz
14 | 👉Tutorials.uz youtube channel : https://youtube.com/tutorialsuz
15 |
16 | ============================================
17 |
18 | Open source code of the Tutorials.uz
19 |
20 | Please, follow the copyright. Author - Sanjarbek Sobirjonov(telegram @SobirjonovSanjarbek).
21 |
22 | We are pleased with your contribution for our project. By correcting the bugs and faults, you would be contributed for this project.
23 |
24 | There are some shit codes. An aim to deploy an open source code in github is to get more experienced.
25 |
26 | Thanks for your attention!
27 |
28 | 👉Tutorials.uz telegram channel : https://t.me/tutorialsuz
29 | 👉Tutorials.uz telegram group: https://t.me/tutorialsgroup
30 | 👉Tutorials.uz website : https://tutorials.uz
31 | 👉Tutorials.uz youtube channel : https://youtube.com/tutorialsuz
32 |
--------------------------------------------------------------------------------
/app/config/routes.php:
--------------------------------------------------------------------------------
1 | title = "Avtorizatsiya";
16 | $admin = (new Admin)->getAdmin();
17 | if (!isset($_SESSION['admin'])) {
18 | if (isset($_POST['submit'])) {
19 | foreach ($admin as $value) {
20 | if ($value['password'] == md5(htmlspecialchars(trim($_POST['password']))) && $value['email'] == trim(htmlspecialchars($_POST['email']))) {
21 | $_SESSION['admin'] = $_POST['email'];
22 | echo '';
23 | }else{
24 | echo "";
25 | }
26 | }
27 | }else{
28 | echo "";
29 | }
30 | }else
31 | {
32 | echo '';
33 | }
34 | return $this->render('admin/login',['jsurl'=>'']);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/controllers/ErrorController.php:
--------------------------------------------------------------------------------
1 | title = "404 not Found";
12 | return $this->render('error/notFound',['jsurl'=>'']);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/controllers/HomeController.php:
--------------------------------------------------------------------------------
1 | title = 'Bosh sahifa';
12 | $categories = (new Page)->getCatList();
13 | return $this->render('home/index',['jsurl'=>'','categories'=>$categories]);
14 | }
15 | public function about()
16 | {
17 | $this->title = "Biz haqimizda";
18 | return $this->render('home/aboutus',['jsurl'=>'']);
19 | }
20 | public function contact()
21 | {
22 | $this->title = 'Bog\'lanish';
23 | return $this->render('home/contact',['jsurl'=>'']);
24 | }
25 | public function gallery()
26 | {
27 | $this->title = 'Rasmlar';
28 | return $this->render('home/gallery',['jsurl'=>'']);
29 | }
30 | public function login()
31 | {
32 | $this->title = 'Avtorizatsiya';
33 | return $this->render('home/login',['jsurl'=>'']);
34 | }
35 | public function register()
36 | {
37 | $this->title = 'Registratsiya';
38 | return $this->render('home/register',['jsurl'=>'']);
39 | }
40 | public function blogList()
41 | {
42 | $this->title = "Blog postlar";
43 | $blogList = (new Page)->fetchBlogList();
44 | return $this->render('home/blog',['jsurl'=>'','blogs'=>$blogList]);
45 | }
46 | public function blogPost()
47 | {
48 | $blogList = (new Page)->fetchBlogList();
49 | $page = new Page;
50 | $url = explode("/",$_SERVER['REQUEST_URI']);
51 | $realUrl = end($url);
52 | $lastTenPosts = (new Page)->fetchLastPost();
53 | foreach ($blogList as $blog) {
54 | if ($blog['blog_post_slug'] == $realUrl) {
55 | $this->title = $blog['blog_title'];
56 | $this->content = $blog['blog_post'];
57 | $this->date = $blog['blog_post_date'];
58 | $this->views = $blog['blog_views'];
59 | $this->author = $blog['blog_post_author'];
60 | if (isset($_SERVER['REMOTE_ADDR'])) {
61 | $id = $blog['blog_id'];
62 | $ip = $_SERVER['REMOTE_ADDR'];
63 | $execute = [':ip'=>$ip];
64 | $page->insert('user_ip',['columns'=>'ip_addr, date','values'=>':ip, NOW()','execute'=>$execute]);
65 | $datas = ['ip'=>$ip,'row'=>'user_ip','table'=>'ip_addr'];
66 | $page->deleteAfterMinute();
67 | $counts = $page->rowCounter($datas);
68 | if ($counts < 2) {
69 | $page->updateBlog('blog',['row'=>'blog_views','id'=>$id,'quantity'=>1]);
70 | }
71 | }
72 | return $this->render('home/blog_post',['jsurl'=>'','title'=>$this->title,'content'=>$this->content,'date'=>$this->date,'author'=>$this->author,'lastPost'=>$lastTenPosts,'views'=>$this->views]);
73 | }
74 | }
75 | $this->title = "Sahifa topilmadi";
76 | return $this->render('error/notFound',['jsurl'=>'']);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/controllers/TutorialsController.php:
--------------------------------------------------------------------------------
1 | fetchData('tutorials',['category'=>strtoupper($catName)]);
14 | $this->title = $catName.' darslari';
15 | return $this->render('tutorials/tutorial', ['tutorials'=>$tutorials,'jsurl'=>'','catname'=>$catName]);
16 | }
17 | public function pager()
18 | {
19 | $page = new Page;
20 | $urlArr = explode("/",$_SERVER['REQUEST_URI']);
21 | $catName = $urlArr[2];
22 | $slug = end($urlArr);
23 | $tutorials = $page->fetchData('tutorials',['category'=>$catName]);
24 | foreach ($tutorials as $tutorial) {
25 | if ($slug == $tutorial['slug']) {
26 | $this->title = $tutorial['title'];
27 | $this->content = $tutorial['content'];
28 | if (isset($_SERVER['REMOTE_ADDR'])) {
29 | $id = $tutorial['id'];
30 | $ip = $_SERVER['REMOTE_ADDR'];
31 | $execute = [':ip'=>$ip];
32 | $page->insert('user_ip',['columns'=>'ip_addr, date','values'=>':ip, NOW()','execute'=>$execute]);
33 | $datas = ['ip'=>$ip,'row'=>'user_ip','table'=>'ip_addr'];
34 | $page->deleteAfterMinute();
35 | $counts = $page->rowCounter($datas);
36 | if ($counts < 2) {
37 | $page->update('tutorials',['row'=>'views','id'=>$id,'quantity'=>1]);
38 | }
39 | }
40 | return $this->render('tutorials/pager', ['title'=>$this->title,'content'=>$this->content,'jsurl'=>'','tutorials'=>$tutorials,'slug'=>$slug]);
41 | }
42 | }
43 | $this->title = "Sahifa topilmadi";
44 | return $this->render('error/notFound',['jsurl'=>'']);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/core/Controller.php:
--------------------------------------------------------------------------------
1 | layout, $this->title, $view, $data);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/app/core/Dispatcher.php:
--------------------------------------------------------------------------------
1 | controller) . "Controller";
10 | $fullName = "\\app\\controllers\\{$className}";
11 |
12 | try {
13 | $controller = new $fullName;
14 | $methodName = $track->action;
15 | if(method_exists($controller, $methodName))
16 | {
17 | $result = $controller->{$methodName}($track->params);
18 | if ($result) {
19 | return $result;
20 | } else {
21 | return new Page('default');
22 | }
23 | }else {
24 | echo "Metod page topilmadi";
25 | }
26 | } catch (\Exception $error) {
27 | echo $error->getMessage(); die();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/core/Model.php:
--------------------------------------------------------------------------------
1 | connection = new PDO("mysql:host=localhost;dbname=alpha", 'alpha', 'alpha',[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
14 | $this->connection->exec("SET NAMES UTF8");
15 | } catch (PDOException $error) {
16 | echo $error->getMessage();
17 | }
18 | }
19 | public function query($query)
20 | {
21 | return $this->connection->query($query);
22 | }
23 | public function findMany($query)
24 | {
25 | $customQuery = $this->query($query);
26 | return $customQuery->fetchAll(PDO::FETCH_ASSOC);
27 | }
28 | public function findOne($query)
29 | {
30 | $customQuery = $this->query($query);
31 | return $customQuery->fetch(PDO::FETCH_ASSOC);
32 | }
33 | public function prepare($prdstmt)
34 | {
35 | return $this->connection->prepare($prdstmt);
36 | }
37 | public function insertData($query)
38 | {
39 | return $this->prepare($query);
40 | }
41 | public function counter($query)
42 | {
43 | $query = $this->query($query);
44 | return $query->rowCount();
45 | }
46 | public function executer($query)
47 | {
48 | return $query->execute();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/core/Page.php:
--------------------------------------------------------------------------------
1 | layout = $layout;
14 | $this->title = $title;
15 | $this->view = $view;
16 | $this->data = $data;
17 | }
18 | public function __get($proper)
19 | {
20 | return $this->$proper;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/core/Route.php:
--------------------------------------------------------------------------------
1 | path = $path;
14 | $this->controller = $controller;
15 | $this->action = $action;
16 | }
17 |
18 | public function __get($property)
19 | {
20 | return $this->$property;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/core/Router.php:
--------------------------------------------------------------------------------
1 | createPattern($route->path);
12 | if (preg_match($pattern, $uri, $params)) {
13 | $params = $this->clearParams($params);
14 |
15 | return new Track($route->controller,$route->action,$params);
16 | }
17 | }
18 | http_response_code(404);
19 | return new Track('error','notFound');
20 |
21 | }
22 | public function createPattern($path)
23 | {
24 | return "#^". preg_replace("#/:([^/]+)#", "/(?<$1>[^/]+)", $path) . "/?$#";
25 | }
26 | public function clearParams($param)
27 | {
28 | $result = [];
29 | foreach ($param as $key => $value) {
30 | if (!is_int($key)) {
31 | $result[$key] = $value;
32 | }
33 | }
34 | return $result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/core/Track.php:
--------------------------------------------------------------------------------
1 | controller = $controller;
14 | $this->action = $action;
15 | $this->params = $params;
16 | }
17 | public function __get($prop)
18 | {
19 | return $this->$prop;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/core/View.php:
--------------------------------------------------------------------------------
1 | renderLayout($page, $this->renderView($page));
10 | }
11 | private function renderLayout(Page $page, $content)
12 | {
13 | $layoutPath = $_SERVER['DOCUMENT_ROOT'] . "/public/layouts/{$page->layout}.php";
14 |
15 | if (file_exists($layoutPath)) {
16 | ob_start();
17 | $title = $page->title;
18 | $jsurl = $page->data['jsurl'];
19 | include_once $layoutPath;
20 | return ob_get_clean();
21 | }else {
22 | echo "Fayl topilmadi";
23 | }
24 | }
25 | private function renderView(Page $page)
26 | {
27 | if ($page->view) {
28 | $viewPath = $_SERVER['DOCUMENT_ROOT'] . "/app/views/{$page->view}.php";
29 | if (file_exists($viewPath)) {
30 | ob_start();
31 | $data = $page->data;
32 | extract($data);
33 | include_once $viewPath;
34 | return ob_get_clean();
35 | }
36 | }else {
37 | echo "View topilmadi";
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/models/Admin.php:
--------------------------------------------------------------------------------
1 | findMany("SELECT email, password, user_type FROM users");
12 | }
13 | public function getTutorials()
14 | {
15 | return $this->findMany("SELECT id, title, author, views, slug, category, content FROM tutorials");
16 | }
17 | public function getBlogList()
18 | {
19 | return $this->findMany("SELECT * FROM blog");
20 | }
21 | public function getCatList()
22 | {
23 | return $this->findMany("SELECT id,cat_name, cat_image_path FROM category");
24 | }
25 | public function insert($table, $params = [])
26 | {
27 | $columns = $params['columns'];
28 | $values = $params['values'];
29 | foreach ($params as $value) {
30 | $query = "INSERT INTO `$table` ($columns) VALUES ($values)";
31 | }
32 | $stmt = $this->insertData($query);
33 | $stmt->execute($params['execute']);
34 | }
35 | public function deleteData($table, $id)
36 | {
37 | $query = "DELETE FROM `$table` WHERE id = '$id'";
38 | return $this->query($query);
39 | }
40 | public function deleteThread($table, $id)
41 | {
42 | $query = "DELETE FROM `$table` WHERE blog_id = '$id'";
43 | return $this->query($query);
44 | }
45 | public function update($table, $params = [])
46 | {
47 | $rowVal = $params['rowVal'];
48 | $ok = $params['id'];
49 | $query = "UPDATE `$table` SET $rowVal WHERE id = $ok";
50 | return $this->query($query);
51 | }
52 | public function updateBlog($table, $params = [])
53 | {
54 | $rowVal = $params['rowVal'];
55 | $ok = $params['id'];
56 | $query = "UPDATE `$table` SET $rowVal WHERE blog_id = $ok";
57 | return $this->query($query);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/models/Page.php:
--------------------------------------------------------------------------------
1 | findMany("SELECT * FROM $table WHERE `category` = '$cat'");
13 | }
14 | public function fetchBlogList()
15 | {
16 | return $this->findMany("SELECT * FROM blog");
17 | }
18 | public function fetchLastPost()
19 | {
20 | return $this->findMany("SELECT * FROM blog ORDER BY blog_title, blog_post_slug DESC LIMIT 10");
21 | }
22 | public function getTutorials()
23 | {
24 | return $this->findMany("SELECT id, title, author, content, category, views, slug FROM tutorials");
25 | }
26 | public function getCatList()
27 | {
28 | return $this->findMany("SELECT cat_name, cat_image_path FROM category");
29 | }
30 | public function update($table, $params = [])
31 | {
32 | $row = $params['row'];
33 | $quantity = $params['quantity'];
34 | $ok = $params['id'];
35 | $query = "UPDATE `$table` SET $row = $row + $quantity WHERE id = $ok";
36 | return $this->query($query);
37 | }
38 | public function updateBlog($table, $params = [])
39 | {
40 | $row = $params['row'];
41 | $quantity = $params['quantity'];
42 | $ok = $params['id'];
43 | $query = "UPDATE `$table` SET $row = $row + $quantity WHERE blog_id = $ok";
44 | return $this->query($query);
45 | }
46 | public function insert($table, $params = [])
47 | {
48 | $columns = $params['columns'];
49 | $values = $params['values'];
50 | $execute = $params['execute'];
51 | $query = "INSERT INTO `$table` ($columns) VALUES ($values)";
52 | $stmt = $this->insertData($query);
53 | $stmt->execute($execute);
54 | }
55 | public function rowCounter($params = [])
56 | {
57 | $table = $params['table'];
58 | $row = $params['row'];
59 | $ip = $params['ip'];
60 | $query = "SELECT `$table` FROM `$row` WHERE `$table` = '$ip'";
61 | return $this->counter($query);
62 | }
63 | public function deleteAfterMinute()
64 | {
65 | return $this->query("DELETE FROM `user_ip` WHERE date <= NOW() - INTERVAL 2 SECOND");
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/views/admin/404.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Page Not Found
8 |It looks like you found a glitch in the matrix...
9 | ← Back to Dashboard 10 |Nom | 39 |Ko'rishlar | 40 |Muallif | 41 |Sana | 42 |Rasm | 43 |URL | 44 |Harakat | 45 |
---|---|---|---|---|---|---|
Nom | 50 |Ko'rishlar | 51 |Muallif | 52 |Sana | 53 |Rasm | 54 |URL | 55 |Harakat | 56 |
= $blog['blog_title'] ?> | 62 |= $blog['blog_views'] ?> | 63 |= $blog['blog_post_author'] ?> | 64 |= $blog['blog_post_date'] ?> | 65 |= $blog['blog_post_img'] ?> | 66 |= $blog['blog_post_slug'] ?> | 67 |68 | O'chirish 69 | Tahrirlash 70 | | 71 |