├── 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 |
6 |
404
7 |

Page Not Found

8 |

It looks like you found a glitch in the matrix...

9 | ← Back to Dashboard 10 |
11 | -------------------------------------------------------------------------------- /app/views/admin/add_post.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Maqola qo'shish
4 |
5 |
6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 19 |
Example invalid custom select feedback
20 |
21 |
22 | 23 | 24 |
25 |
26 | 27 | 28 |
29 | 30 |
31 | 37 |
38 |
-------------------------------------------------------------------------------- /app/views/admin/add_thread.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Maqola qo'shish
4 |
5 |
6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 |
23 | 24 |
25 | 31 |
32 |
-------------------------------------------------------------------------------- /app/views/admin/blog_edit.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Maqola qo'shish
4 |
5 |
6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 |
23 | 24 |
25 | 31 |
32 |
-------------------------------------------------------------------------------- /app/views/admin/blog_list.php: -------------------------------------------------------------------------------- 1 | 29 |
30 |
31 |
Blog maqolalar ro'yhati
32 |
33 |
34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | $blog): ?> 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 71 | 72 | 73 | 74 |
NomKo'rishlarMuallifSanaRasmURLHarakat
NomKo'rishlarMuallifSanaRasmURLHarakat
68 | O'chirish 69 | Tahrirlash 70 |
75 | 76 |
77 |
78 |
-------------------------------------------------------------------------------- /htaccess.txt: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | Options -Indexes 4 | 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | RewriteCond %{REQUEST_FILENAME} !-f 7 | 8 | ErrorDocument 403 /app/views/error/403.php 9 | 10 | RewriteRule . index.php [NC,L] 11 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | getTrack($routes,$_SERVER['REQUEST_URI']); 29 | $page = (new Dispatcher) -> getPage($track); 30 | echo (new View)->render($page); 31 | -------------------------------------------------------------------------------- /public/admin/admin.txt: -------------------------------------------------------------------------------- 1 | admin frontend 2 | -------------------------------------------------------------------------------- /public/admin/js/demo/chart-bar-demo.js: -------------------------------------------------------------------------------- 1 | // Set new default font family and font color to mimic Bootstrap's default styling 2 | Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; 3 | Chart.defaults.global.defaultFontColor = '#858796'; 4 | 5 | function number_format(number, decimals, dec_point, thousands_sep) { 6 | // * example: number_format(1234.56, 2, ',', ' '); 7 | // * return: '1 234,56' 8 | number = (number + '').replace(',', '').replace(' ', ''); 9 | var n = !isFinite(+number) ? 0 : +number, 10 | prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), 11 | sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, 12 | dec = (typeof dec_point === 'undefined') ? '.' : dec_point, 13 | s = '', 14 | toFixedFix = function(n, prec) { 15 | var k = Math.pow(10, prec); 16 | return '' + Math.round(n * k) / k; 17 | }; 18 | // Fix for IE parseFloat(0.55).toFixed(0) = 0; 19 | s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); 20 | if (s[0].length > 3) { 21 | s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); 22 | } 23 | if ((s[1] || '').length < prec) { 24 | s[1] = s[1] || ''; 25 | s[1] += new Array(prec - s[1].length + 1).join('0'); 26 | } 27 | return s.join(dec); 28 | } 29 | 30 | // Bar Chart Example 31 | var ctx = document.getElementById("myBarChart"); 32 | var myBarChart = new Chart(ctx, { 33 | type: 'bar', 34 | data: { 35 | labels: ["January", "February", "March", "April", "May", "June"], 36 | datasets: [{ 37 | label: "Revenue", 38 | backgroundColor: "#4e73df", 39 | hoverBackgroundColor: "#2e59d9", 40 | borderColor: "#4e73df", 41 | data: [4215, 5312, 6251, 7841, 9821, 14984], 42 | }], 43 | }, 44 | options: { 45 | maintainAspectRatio: false, 46 | layout: { 47 | padding: { 48 | left: 10, 49 | right: 25, 50 | top: 25, 51 | bottom: 0 52 | } 53 | }, 54 | scales: { 55 | xAxes: [{ 56 | time: { 57 | unit: 'month' 58 | }, 59 | gridLines: { 60 | display: false, 61 | drawBorder: false 62 | }, 63 | ticks: { 64 | maxTicksLimit: 6 65 | }, 66 | maxBarThickness: 25, 67 | }], 68 | yAxes: [{ 69 | ticks: { 70 | min: 0, 71 | max: 15000, 72 | maxTicksLimit: 5, 73 | padding: 10, 74 | // Include a dollar sign in the ticks 75 | callback: function(value, index, values) { 76 | return '$' + number_format(value); 77 | } 78 | }, 79 | gridLines: { 80 | color: "rgb(234, 236, 244)", 81 | zeroLineColor: "rgb(234, 236, 244)", 82 | drawBorder: false, 83 | borderDash: [2], 84 | zeroLineBorderDash: [2] 85 | } 86 | }], 87 | }, 88 | legend: { 89 | display: false 90 | }, 91 | tooltips: { 92 | titleMarginBottom: 10, 93 | titleFontColor: '#6e707e', 94 | titleFontSize: 14, 95 | backgroundColor: "rgb(255,255,255)", 96 | bodyFontColor: "#858796", 97 | borderColor: '#dddfeb', 98 | borderWidth: 1, 99 | xPadding: 15, 100 | yPadding: 15, 101 | displayColors: false, 102 | caretPadding: 10, 103 | callbacks: { 104 | label: function(tooltipItem, chart) { 105 | var datasetLabel = chart.datasets[tooltipItem.datasetIndex].label || ''; 106 | return datasetLabel + ': $' + number_format(tooltipItem.yLabel); 107 | } 108 | } 109 | }, 110 | } 111 | }); 112 | -------------------------------------------------------------------------------- /public/admin/js/demo/chart-pie-demo.js: -------------------------------------------------------------------------------- 1 | // Set new default font family and font color to mimic Bootstrap's default styling 2 | Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; 3 | Chart.defaults.global.defaultFontColor = '#858796'; 4 | 5 | // Pie Chart Example 6 | var ctx = document.getElementById("myPieChart"); 7 | var myPieChart = new Chart(ctx, { 8 | type: 'doughnut', 9 | data: { 10 | labels: ["Direct", "Referral", "Social"], 11 | datasets: [{ 12 | data: [55, 30, 15], 13 | backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc'], 14 | hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf'], 15 | hoverBorderColor: "rgba(234, 236, 244, 1)", 16 | }], 17 | }, 18 | options: { 19 | maintainAspectRatio: false, 20 | tooltips: { 21 | backgroundColor: "rgb(255,255,255)", 22 | bodyFontColor: "#858796", 23 | borderColor: '#dddfeb', 24 | borderWidth: 1, 25 | xPadding: 15, 26 | yPadding: 15, 27 | displayColors: false, 28 | caretPadding: 10, 29 | }, 30 | legend: { 31 | display: false 32 | }, 33 | cutoutPercentage: 80, 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /public/admin/js/demo/datatables-demo.js: -------------------------------------------------------------------------------- 1 | // Call the dataTables jQuery plugin 2 | $(document).ready(function() { 3 | $('#dataTable').DataTable(); 4 | }); 5 | -------------------------------------------------------------------------------- /public/admin/js/sb-admin-2.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | "use strict"; // Start of use strict 3 | 4 | // Toggle the side navigation 5 | $("#sidebarToggle, #sidebarToggleTop").on('click', function(e) { 6 | $("body").toggleClass("sidebar-toggled"); 7 | $(".sidebar").toggleClass("toggled"); 8 | if ($(".sidebar").hasClass("toggled")) { 9 | $('.sidebar .collapse').collapse('hide'); 10 | }; 11 | }); 12 | 13 | // Close any open menu accordions when window is resized below 768px 14 | $(window).resize(function() { 15 | if ($(window).width() < 768) { 16 | $('.sidebar .collapse').collapse('hide'); 17 | }; 18 | }); 19 | 20 | // Prevent the content wrapper from scrolling when the fixed side navigation hovered over 21 | $('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) { 22 | if ($(window).width() > 768) { 23 | var e0 = e.originalEvent, 24 | delta = e0.wheelDelta || -e0.detail; 25 | this.scrollTop += (delta < 0 ? 1 : -1) * 30; 26 | e.preventDefault(); 27 | } 28 | }); 29 | 30 | // Scroll to top button appear 31 | $(document).on('scroll', function() { 32 | var scrollDistance = $(this).scrollTop(); 33 | if (scrollDistance > 100) { 34 | $('.scroll-to-top').fadeIn(); 35 | } else { 36 | $('.scroll-to-top').fadeOut(); 37 | } 38 | }); 39 | 40 | // Smooth scrolling using jQuery easing 41 | $(document).on('click', 'a.scroll-to-top', function(e) { 42 | var $anchor = $(this); 43 | $('html, body').stop().animate({ 44 | scrollTop: ($($anchor.attr('href')).offset().top) 45 | }, 1000, 'easeInOutExpo'); 46 | e.preventDefault(); 47 | }); 48 | 49 | })(jQuery); // End of use strict 50 | -------------------------------------------------------------------------------- /public/admin/js/sb-admin-2.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - SB Admin 2 v4.0.7 (https://startbootstrap.com/template-overviews/sb-admin-2) 3 | * Copyright 2013-2019 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/master/LICENSE) 5 | */ 6 | 7 | !function(t){"use strict";t("#sidebarToggle, #sidebarToggleTop").on("click",function(o){t("body").toggleClass("sidebar-toggled"),t(".sidebar").toggleClass("toggled"),t(".sidebar").hasClass("toggled")&&t(".sidebar .collapse").collapse("hide")}),t(window).resize(function(){t(window).width()<768&&t(".sidebar .collapse").collapse("hide")}),t("body.fixed-nav .sidebar").on("mousewheel DOMMouseScroll wheel",function(o){if(768