docs: add documents

This commit is contained in:
Mobina 2022-09-09 15:37:26 +04:30
parent 2856fbc333
commit c055bbacbe
39 changed files with 78 additions and 100 deletions

View file

@ -28,8 +28,7 @@ class Admin{
} }
// saveImage($_FILES['image'], 'post-image', 'logo');
// saveImage($_FILES['image'], 'post-image');
protected function saveImage($image, $imagePath, $imageName = null) protected function saveImage($image, $imagePath, $imageName = null)
{ {
@ -63,7 +62,7 @@ class Admin{
} }
// removeImage('/public/image/hassan.png/');
protected function removeImage($path) protected function removeImage($path)
{ {
// $path = trim($this->basePath, '/ ') . '/' . trim($path, '/ '); // $path = trim($this->basePath, '/ ') . '/' . trim($path, '/ ');

View file

@ -13,7 +13,6 @@ class Dashboard extends Admin
$db = new DataBase(); $db = new DataBase();
$postCount = $db->select('SELECT COUNT(*) FROM `posts` ;')->fetch(); $postCount = $db->select('SELECT COUNT(*) FROM `posts` ;')->fetch();
$postsViews = $db->select('SELECT SUM(view) FROM `posts` ;')->fetch(); $postsViews = $db->select('SELECT SUM(view) FROM `posts` ;')->fetch();
$commentsCount = $db->select('SELECT COUNT(*) FROM `comments` ;')->fetch(); $commentsCount = $db->select('SELECT COUNT(*) FROM `comments` ;')->fetch();
$commentsUnseenCount = $db->select("SELECT COUNT(*) FROM `comments` WHERE `status` = 'unseen' ;")->fetch(); $commentsUnseenCount = $db->select("SELECT COUNT(*) FROM `comments` WHERE `status` = 'unseen' ;")->fetch();
$commentsApprovedCount = $db->select("SELECT COUNT(*) FROM `comments` WHERE `status` = 'approved' ;")->fetch(); $commentsApprovedCount = $db->select("SELECT COUNT(*) FROM `comments` WHERE `status` = 'approved' ;")->fetch();

View file

@ -30,15 +30,15 @@ class Auth{
return bin2hex(openssl_random_pseudo_bytes(32)); return bin2hex(openssl_random_pseudo_bytes(32));
} }
public function activationMessage($username, $verifyToken) // public function activationMessage($username, $verifyToken)
{ // {
$message = ' // $message = '
<h1>فعال سازی حساب کاربری</h1> // <h1>فعال سازی حساب کاربری</h1>
<p>' . $username . 'عزیز برای فعال سازی حساب کاربری خود لطفا روی لینک زیر کلیک نمایید</p> // <p>' . $username . 'عزیز برای فعال سازی حساب کاربری خود لطفا روی لینک زیر کلیک نمایید</p>
<div><a href="'. url('activation/' . $verifyToken) .'">فعال سازی حساب کاربری</a></div> // <div><a href="'. url('activation/' . $verifyToken) .'">فعال سازی حساب کاربری</a></div>
'; // ';
return $message; // return $message;
} // }
public function sendMail($emailAddress, $subject, $body) public function sendMail($emailAddress, $subject, $body)
{ {
@ -108,20 +108,21 @@ try {
} }
else{ else{
$randomToken = $this->random(); $randomToken = $this->random();
$activationMessage = $this->activationMessage($request['username'], $randomToken); // $activationMessage = $this->activationMessage($request['username'], $randomToken);
$result = $this->sendMail($request['email'], 'فعال سازی حساب کاربری', $activationMessage); // $result = $this->sendMail($request['email'], 'فعال سازی حساب کاربری', $activationMessage);
if($result) // if($result)
{ // {
$request['verify_token'] = $randomToken; $request['verify_token'] = $randomToken;
$request['password'] = $this->hash($request['password']); $request['password'] = $this->hash($request['password']);
$db->insert('users', array_keys($request), $request); $db->insert('users', array_keys($request), $request);
$this->redirect('login'); $this->redirect('login');
} // }
else{
flash('register_error', 'ایمیل فعال سازی ارسال نشد');
$this->redirectBack();
}
} }
// flash('register_error', 'ایمیل فعال سازی ارسال نشد');
$this->redirectBack();
} }
} }

View file

@ -31,22 +31,18 @@ define('SENDER_NAME', 'Mobina nj');
require_once 'database/Database.php'; require_once 'database/Database.php';
require_once 'database/CreateDB.php'; require_once 'database/CreateDB.php';
// $db = new Database\Database();
// $db = new CreateDB();
// $db->run();
//admin //admin
require_once 'activities/Admin/Admin.php'; require_once 'activities/Admin/Admin.php';
require_once 'activities/Admin/Category.php'; require_once 'activities/Admin/Category.php';
require_once ("activities/Admin/Dashboard.php"); require_once 'activities/Admin/Dashboard.php';
require_once 'activities/Admin/Post.php'; require_once 'activities/Admin/Post.php';
require_once 'activities/Admin/Banner.php'; require_once 'activities/Admin/Banner.php';
require_once 'activities/Admin/User.php'; require_once 'activities/Admin/User.php';
require_once 'activities/Admin/Comment.php'; require_once 'activities/Admin/Comment.php';
require_once 'activities/Admin/Menu.php'; require_once 'activities/Admin/Menu.php';
require_once ("activities/Admin/WebSetting.php"); require_once 'activities/Admin/WebSetting.php';
@ -62,8 +58,6 @@ require_once ("activities/Home.php");
//helpers //helpers
@ -76,7 +70,7 @@ spl_autoload_register(function($className){
function jalaliDate($date) function jalaliDate($date)
{ {
return jDate::forge($date)->format('%A, %d %B %y'); return jDate::forge($date)->format('%A, %d %B %Y');
} }
@ -137,9 +131,6 @@ function uri($reservedUrl, $class, $method, $requestMethod = "GET")
$object = new $class; $object = new $class;
call_user_func_array(array($object, $method), $parameters); call_user_func_array(array($object, $method), $parameters);
// Category
// $category = new Category;
// $category->index();
exit; exit;
} }
@ -187,7 +178,7 @@ function dd($vars){
} }
// dd('hi');
function displayError($displayError){ function displayError($displayError){
@ -231,12 +222,6 @@ function flash($name, $value = null)
} }
// flash('cart', 'محصول با موفقیت به سبد خرید شما اضافه شد');
// flash('register', 'ثبت نام شما با موفقیت انجام شد');
// echo flash('cart');
// echo flash('register');
// flash('hasaan');
// flash('cart', 'محصول با موفقیت به سبد خرید شما اضافه شد');
//dashboard //dashboard

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 KiB

BIN
public/setting/icon.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -25,18 +25,11 @@
</thead> </thead>
<tbody> <tbody>
<?php foreach ($banners as $banner) { ?> <?php foreach ($banners as $key => $banner) { ?>
<tr> <tr>
<td> <td><?= $key += 1 ?></td>
<?= $banner['id'] ?> <td><?= $banner['url'] ?></td>
</td> <td><img style="width: 80px;" src="<?= asset($banner['image']) ?>" alt=""></td>
<td>
<?= $banner['url'] ?>
</td>
<td>
<img style="width: 80px;" src="<?= asset($banner['image']) ?>" alt="">
</td>
<td> <td>
<a role="button" class="btn btn-sm btn-primary text-white" href="<?= asset('admin/banner/edit/' . $banner['id']) ?>">edit</a> <a role="button" class="btn btn-sm btn-primary text-white" href="<?= asset('admin/banner/edit/' . $banner['id']) ?>">edit</a>
<a role="button" class="btn btn-sm btn-danger text-white" href="<?= asset('admin/banner/delete/' . $banner['id']) ?>">delete</a> <a role="button" class="btn btn-sm btn-danger text-white" href="<?= asset('admin/banner/delete/' . $banner['id']) ?>">delete</a>

View file

@ -22,10 +22,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($categories as $category) { ?> <?php foreach ($categories as $key => $category) { ?>
<tr> <tr>
<td> <td>
<?= $category['id'] ?> <?= $key += 1 ?>
</td> </td>
<td> <td>
<?= $category['name'] ?> <?= $category['name'] ?>

View file

@ -25,9 +25,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($comments as $comment) { ?> <?php foreach ($comments as $key => $comment) { ?>
<tr> <tr>
<td><a href=""><?= $comment['id'] ?></a> <td><a href=""><?= $key += 1 ?></a>
</td> </td>
<td> <td>
<?= $comment['email'] ?> <?= $comment['email'] ?>

View file

@ -30,8 +30,8 @@ require_once BASE_PATH . '/template/admin/layouts/head-tag.php';
<?php foreach($menus as $menu) { ?> <?php foreach($menus as $menu) { ?>
<option value="<?= $menu['id'] ?>"> <option value="<?= $menu['id'] ?>">
<?= $menu['name'] ?> <?= $menu['name'] ?>
</option> </option>
<?php } ?> <?php } ?>

View file

@ -25,10 +25,10 @@
</thead> </thead>
<tbody> <tbody>
<?php foreach ($menus as $menu) { ?> <?php foreach ($menus as $key => $menu) { ?>
<tr> <tr>
<td> <td>
<?= $menu['id'] ?> <?= $key += 1 ?>
</td> </td>
<td> <td>
<?= $menu['name'] ?> <?= $menu['name'] ?>

View file

@ -28,33 +28,33 @@
</thead> </thead>
<tbody> <tbody>
<?php foreach ($posts as $post) { ?> <?php foreach ($posts as $key => $post) { ?>
<tr> <tr>
<td> <td>
<?= $post['id'] ?> <?= $key += 1 ?>
</td> </td>
<td> <td>
<?= $post['title'] ?> <?= $post['title'] ?>
<td> <td>
<?= $post['summary'] ?> <?= $post['summary'] ?>
</td> </td>
<td> <td>
<?= $post['view'] ?> <?= $post['view'] ?>
</td> </td>
<td> <td>
<?php if($post['breaking_news'] == 2) { ?> <?php if($post['breaking_news'] == 2) { ?>
<span class="badge badge-success">#breaking_news</span> <span class="badge badge-success">#breaking_news</span>
<?php } <?php }
if($post['selected'] == 2) { ?> if($post['selected'] == 2) { ?>
<span class="badge badge-dark">#editor_selected</span> <span class="badge badge-dark">#editor_selected</span>
<?php } ?> <?php } ?>
</td> </td>
<td> <td>
<?= $post['user_id'] ?> <?= $post['user_id'] ?>
</td> </td>
<td> <td>
<?= $post['cat_id'] ?> <?= $post['cat_id'] ?>
</td> </td>
<td> <td>
<img style="width: 80px;" src="<?= asset($post['image']) ?>" alt=""> <img style="width: 80px;" src="<?= asset($post['image']) ?>" alt="">

View file

@ -24,9 +24,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($users as $user) { ?> <?php foreach ($users as $key => $user) { ?>
<tr> <tr>
<td><?= $user['id'] ?></td> <td><?= $key += 1 ?></td>
<td><?= $user['username'] ?></td> <td><?= $user['username'] ?></td>
<td><?= $user['email'] ?></td> <td><?= $user['email'] ?></td>
<td><?= $user['permission'] ?></td> <td><?= $user['permission'] ?></td>

View file

@ -27,21 +27,26 @@ require_once(BASE_PATH . "/template/admin/layouts/head-tag.php");
<div class="form-group"> <div class="form-group">
<?php if($setting !=null){ ?>
<img style="width: 100px;" src="<?= asset($setting['logo']); ?>" alt="" >
<hr/>
<?php } ?>
<label for="logo">Logo</label> <label for="logo">Logo</label>
<input type="file" id="logo" name="logo" class="form-control-file" autofocus> <input type="file" id="logo" name="logo" class="form-control-file" autofocus>
<?php if($setting !=null){ ?>
<img style="width: 100px;" src="<?= asset($setting['logo']); ?>" alt="" >
<hr/>
<?php } ?>
</div> </div>
<div class="form-group"> <div class="form-group">
<?php if($setting !=null){ ?>
<img style="width: 100px;" src="<?= asset($setting['icon']); ?>" alt="" >
<hr/>
<?php } ?>
<label for="icon">Icon</label> <label for="icon">Icon</label>
<input type="file" id="icon" name="icon" class="form-control-file" autofocus> <input type="file" id="icon" name="icon" class="form-control-file" autofocus>
<?php if($setting !=null){ ?>
<img style="width: 100px;" src="<?= asset($setting['icon']); ?>" alt="" >
<hr/>
<?php } ?>
</div> </div>
<button type="submit" class="btn btn-primary btn-sm">set</button> <button type="submit" class="btn btn-primary btn-sm">set</button>

View file

@ -19,12 +19,12 @@
<li><a href="<?= url('show-category/' . $topSelectedPosts[0]['cat_id']) ?>"><?= $topSelectedPosts[0]['category'] ?></a></li> <li><a href="<?= url('show-category/' . $topSelectedPosts[0]['cat_id']) ?>"><?= $topSelectedPosts[0]['category'] ?></a></li>
</ul> </ul>
<a href="<?= url('show-post/' . $topSelectedPosts[0]['id']) ?>"> <a href="<?= url('show-post/' . $topSelectedPosts[0]['id']) ?>">
<h3><?= $topSelectedPosts[0]['title'] ?></h3> <h3 style="color: black;"><?= $topSelectedPosts[0]['title'] ?></h3>
</a> </a>
<ul class="meta"> <ul class="meta">
<li><a href="#"><span class="lnr lnr-user"></span><?= $topSelectedPosts[0]['username'] ?></a></li> <li><a href="#" style="color: black;"><span class="lnr lnr-user" style="color: black;"></span><?= $topSelectedPosts[0]['username'] ?></a></li>
<li><a href="#"><?= jalaliDate($topSelectedPosts[0]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li> <li><a href="#" style="color: black;"><?= jalaliDate($topSelectedPosts[0]['created_at']) ?><span class="lnr lnr-calendar-full" style="color: black;"></span></a></li>
<li><a href="#"><?= $topSelectedPosts[0]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li> <li><a href="#" style="color: black;"><?= $topSelectedPosts[0]['comments_count'] ?><span class="lnr lnr-bubble" style="color: black;"></span></a></li>
</ul> </ul>
</div> </div>
<?php } ?> <?php } ?>

View file

@ -21,18 +21,17 @@
</div> </div>
<div class="footer-bottom row align-items-center"> <div class="footer-bottom row align-items-center">
<p class="footer-text m-0 col-lg-8 col-md-12"> <p class="footer-text m-0 col-lg-8 col-md-12">
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy; Copyright &copy;
<script> <script>
document.write(new Date().getFullYear()); document.write(new Date().getFullYear());
</script> All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a> </script> All rights reserved
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</p> </p>
<div class="col-lg-4 col-md-12 footer-social"> <div class="col-lg-4 col-md-12 footer-social">
<a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a> <a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a> <a href="#"><i class="fa fa-instagram"></i></a>
<a href="#"><i class="fa fa-behance"></i></a> <a href="#"><i class="fa fa-linkedin"></i></a>
<a href="#"><i class="fa fa-telegram"></i></a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -6,8 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Favicon--> <!-- Favicon-->
<link rel="shortcut icon" href="<?= asset($setting['icon']) ?>"> <link rel="shortcut icon" href="<?= asset($setting['icon']) ?>">
<!-- Author Meta -->
<meta name="author" content="colorlib">
<!-- Meta Description --> <!-- Meta Description -->
<meta name="description" content="<?= $setting['description'] ?>"> <meta name="description" content="<?= $setting['description'] ?>">
<!-- Meta Keyword --> <!-- Meta Keyword -->
@ -37,18 +35,18 @@
<div class="header-top"> <div class="header-top">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-6 header-top-left no-padding"> <!-- <div class="col-lg-6 col-md-6 col-sm-6 col-6 header-top-left no-padding">
<ul> <ul>
<li><a href="#"><i class="fa fa-facebook"></i></a></li> <li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li> <li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-dribbble"></i></a></li> <li><a href="#"><i class="fa fa-dribbble"></i></a></li>
<li><a href="#"><i class="fa fa-behance"></i></a></li> <li><a href="#"><i class="fa fa-behance"></i></a></li>
</ul> </ul>
</div> </div> -->
<div class="col-lg-6 col-md-6 col-sm-6 col-6 header-top-right no-padding"> <div class="col-lg-6 col-md-6 col-sm-6 col-6 header-top-left no-padding">
<ul> <ul>
<li><a href="tel:+440 012 3654 896"><span class="lnr lnr-phone-handset"></span><span>+440 012 3654 896</span></a></li> <li><a href=""><span class="lnr lnr-phone-handset"></span><span> 0903 958 2466</span></a></li>
<li><a href="mailto:support@colorlib.com"><span class="lnr lnr-envelope"></span><span>support@colorlib.com</span></a></li> <li><a href=""><span class="lnr lnr-envelope"></span><span> nimobina99@gmail.com</span></a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -58,12 +56,12 @@
<div class="container"> <div class="container">
<div class="row justify-content-between align-items-center"> <div class="row justify-content-between align-items-center">
<div class="col-lg-4 col-md-4 col-sm-12 logo-left no-padding"> <div class="col-lg-4 col-md-4 col-sm-12 logo-left no-padding">
<a href="index.html"> <a href="http://localhost/NewsProject/">
<img class="img-fluid" src="<?= asset($setting['logo']) ?>" alt=""> <img class="img-fluid" src="<?= asset($setting['logo']) ?>" alt="">
</a> </a>
</div> </div>
<div class="col-lg-8 col-md-8 col-sm-12 logo-right no-padding ads-banner"> <div class="col-lg-8 col-md-8 col-sm-12 logo-right no-padding ads-banner">
<img class="img-fluid" src="img/banner-ad.jpg" alt=""> <img class="img-fluid" src="<?= asset($bodyBanner['image']) ?>" alt="">
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,7 +1,6 @@
<?php <?php
require_once(BASE_PATH . '/template/app/layouts/header.php'); require_once(BASE_PATH . '/template/app/layouts/header.php');
?> ?>
<div class="site-main-container"> <div class="site-main-container">
<!-- Start top-post Area --> <!-- Start top-post Area -->
<!-- End top-post Area --> <!-- End top-post Area -->