docs: add documents
|
@ -28,8 +28,7 @@ class Admin{
|
|||
}
|
||||
|
||||
|
||||
// saveImage($_FILES['image'], 'post-image', 'logo');
|
||||
// saveImage($_FILES['image'], 'post-image');
|
||||
|
||||
protected function saveImage($image, $imagePath, $imageName = null)
|
||||
{
|
||||
|
||||
|
@ -63,7 +62,7 @@ class Admin{
|
|||
}
|
||||
|
||||
|
||||
// removeImage('/public/image/hassan.png/');
|
||||
|
||||
protected function removeImage($path)
|
||||
{
|
||||
// $path = trim($this->basePath, '/ ') . '/' . trim($path, '/ ');
|
|
@ -13,7 +13,6 @@ class Dashboard extends Admin
|
|||
$db = new DataBase();
|
||||
$postCount = $db->select('SELECT COUNT(*) FROM `posts` ;')->fetch();
|
||||
$postsViews = $db->select('SELECT SUM(view) FROM `posts` ;')->fetch();
|
||||
|
||||
$commentsCount = $db->select('SELECT COUNT(*) FROM `comments` ;')->fetch();
|
||||
$commentsUnseenCount = $db->select("SELECT COUNT(*) FROM `comments` WHERE `status` = 'unseen' ;")->fetch();
|
||||
$commentsApprovedCount = $db->select("SELECT COUNT(*) FROM `comments` WHERE `status` = 'approved' ;")->fetch();
|
|
@ -30,15 +30,15 @@ class Auth{
|
|||
return bin2hex(openssl_random_pseudo_bytes(32));
|
||||
}
|
||||
|
||||
public function activationMessage($username, $verifyToken)
|
||||
{
|
||||
$message = '
|
||||
<h1>فعال سازی حساب کاربری</h1>
|
||||
<p>' . $username . 'عزیز برای فعال سازی حساب کاربری خود لطفا روی لینک زیر کلیک نمایید</p>
|
||||
<div><a href="'. url('activation/' . $verifyToken) .'">فعال سازی حساب کاربری</a></div>
|
||||
';
|
||||
return $message;
|
||||
}
|
||||
// public function activationMessage($username, $verifyToken)
|
||||
// {
|
||||
// $message = '
|
||||
// <h1>فعال سازی حساب کاربری</h1>
|
||||
// <p>' . $username . 'عزیز برای فعال سازی حساب کاربری خود لطفا روی لینک زیر کلیک نمایید</p>
|
||||
// <div><a href="'. url('activation/' . $verifyToken) .'">فعال سازی حساب کاربری</a></div>
|
||||
// ';
|
||||
// return $message;
|
||||
// }
|
||||
|
||||
public function sendMail($emailAddress, $subject, $body)
|
||||
{
|
||||
|
@ -108,20 +108,21 @@ try {
|
|||
}
|
||||
else{
|
||||
$randomToken = $this->random();
|
||||
$activationMessage = $this->activationMessage($request['username'], $randomToken);
|
||||
$result = $this->sendMail($request['email'], 'فعال سازی حساب کاربری', $activationMessage);
|
||||
if($result)
|
||||
{
|
||||
// $activationMessage = $this->activationMessage($request['username'], $randomToken);
|
||||
// $result = $this->sendMail($request['email'], 'فعال سازی حساب کاربری', $activationMessage);
|
||||
// if($result)
|
||||
// {
|
||||
$request['verify_token'] = $randomToken;
|
||||
$request['password'] = $this->hash($request['password']);
|
||||
$db->insert('users', array_keys($request), $request);
|
||||
$this->redirect('login');
|
||||
}
|
||||
else{
|
||||
flash('register_error', 'ایمیل فعال سازی ارسال نشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// flash('register_error', 'ایمیل فعال سازی ارسال نشد');
|
||||
$this->redirectBack();
|
||||
|
||||
|
||||
}
|
||||
}
|
23
index.php
|
@ -31,22 +31,18 @@ define('SENDER_NAME', 'Mobina nj');
|
|||
require_once 'database/Database.php';
|
||||
require_once 'database/CreateDB.php';
|
||||
|
||||
// $db = new Database\Database();
|
||||
|
||||
// $db = new CreateDB();
|
||||
// $db->run();
|
||||
|
||||
|
||||
//admin
|
||||
require_once 'activities/Admin/Admin.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/Banner.php';
|
||||
require_once 'activities/Admin/User.php';
|
||||
require_once 'activities/Admin/Comment.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
|
||||
|
||||
|
||||
|
@ -76,7 +70,7 @@ spl_autoload_register(function($className){
|
|||
|
||||
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;
|
||||
call_user_func_array(array($object, $method), $parameters);
|
||||
// Category
|
||||
// $category = new Category;
|
||||
// $category->index();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -187,7 +178,7 @@ function dd($vars){
|
|||
|
||||
}
|
||||
|
||||
// dd('hi');
|
||||
|
||||
|
||||
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
|
||||
|
|
Before Width: | Height: | Size: 1.5 MiB |
BIN
public/banner-image/2022-09-09-09-21-44.jpeg
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
public/banner-image/2022-09-09-12-21-36.jpeg
Normal file
After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 20 KiB |
BIN
public/post-image/2022-09-09-09-16-27.png
Normal file
After Width: | Height: | Size: 1 MiB |
BIN
public/post-image/2022-09-09-09-20-10.png
Normal file
After Width: | Height: | Size: 675 KiB |
BIN
public/post-image/2022-09-09-09-20-35.jpeg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
public/post-image/2022-09-09-09-22-48.jpeg
Normal file
After Width: | Height: | Size: 197 KiB |
BIN
public/post-image/2022-09-09-12-20-49.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
public/post-image/2022-09-09-12-51-33.png
Normal file
After Width: | Height: | Size: 342 KiB |
BIN
public/setting/icon.jpeg
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 1.4 MiB |
|
@ -25,18 +25,11 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($banners as $banner) { ?>
|
||||
<?php foreach ($banners as $key => $banner) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $banner['id'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $banner['url'] ?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<img style="width: 80px;" src="<?= asset($banner['image']) ?>" alt="">
|
||||
</td>
|
||||
<td><?= $key += 1 ?></td>
|
||||
<td><?= $banner['url'] ?></td>
|
||||
<td><img style="width: 80px;" src="<?= asset($banner['image']) ?>" alt=""></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-danger text-white" href="<?= asset('admin/banner/delete/' . $banner['id']) ?>">delete</a>
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($categories as $category) { ?>
|
||||
<?php foreach ($categories as $key => $category) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $category['id'] ?>
|
||||
<?= $key += 1 ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $category['name'] ?>
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($comments as $comment) { ?>
|
||||
<?php foreach ($comments as $key => $comment) { ?>
|
||||
<tr>
|
||||
<td><a href=""><?= $comment['id'] ?></a>
|
||||
<td><a href=""><?= $key += 1 ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<?= $comment['email'] ?>
|
||||
|
|
|
@ -30,8 +30,8 @@ require_once BASE_PATH . '/template/admin/layouts/head-tag.php';
|
|||
|
||||
<?php foreach($menus as $menu) { ?>
|
||||
<option value="<?= $menu['id'] ?>">
|
||||
<?= $menu['name'] ?>
|
||||
</option>
|
||||
<?= $menu['name'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($menus as $menu) { ?>
|
||||
<?php foreach ($menus as $key => $menu) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $menu['id'] ?>
|
||||
<?= $key += 1 ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $menu['name'] ?>
|
||||
|
|
|
@ -28,33 +28,33 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($posts as $post) { ?>
|
||||
<?php foreach ($posts as $key => $post) { ?>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?= $post['id'] ?>
|
||||
<?= $key += 1 ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $post['title'] ?>
|
||||
<?= $post['title'] ?>
|
||||
<td>
|
||||
<?= $post['summary'] ?>
|
||||
</td>
|
||||
<?= $post['summary'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $post['view'] ?>
|
||||
<?= $post['view'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($post['breaking_news'] == 2) { ?>
|
||||
<span class="badge badge-success">#breaking_news</span>
|
||||
<span class="badge badge-success">#breaking_news</span>
|
||||
<?php }
|
||||
if($post['selected'] == 2) { ?>
|
||||
<span class="badge badge-dark">#editor_selected</span>
|
||||
<?php } ?>
|
||||
<span class="badge badge-dark">#editor_selected</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $post['user_id'] ?>
|
||||
<?= $post['user_id'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $post['cat_id'] ?>
|
||||
<?= $post['cat_id'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<img style="width: 80px;" src="<?= asset($post['image']) ?>" alt="">
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user) { ?>
|
||||
<?php foreach ($users as $key => $user) { ?>
|
||||
<tr>
|
||||
<td><?= $user['id'] ?></td>
|
||||
<td><?= $key += 1 ?></td>
|
||||
<td><?= $user['username'] ?></td>
|
||||
<td><?= $user['email'] ?></td>
|
||||
<td><?= $user['permission'] ?></td>
|
||||
|
|
|
@ -27,21 +27,26 @@ require_once(BASE_PATH . "/template/admin/layouts/head-tag.php");
|
|||
|
||||
|
||||
<div class="form-group">
|
||||
<?php if($setting !=null){ ?>
|
||||
<img style="width: 100px;" src="<?= asset($setting['logo']); ?>" alt="" >
|
||||
<hr/>
|
||||
<?php } ?>
|
||||
|
||||
<label for="logo">Logo</label>
|
||||
<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 class="form-group">
|
||||
<?php if($setting !=null){ ?>
|
||||
<img style="width: 100px;" src="<?= asset($setting['icon']); ?>" alt="" >
|
||||
<hr/>
|
||||
<?php } ?>
|
||||
|
||||
<label for="icon">Icon</label>
|
||||
<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>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-sm">set</button>
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
<li><a href="<?= url('show-category/' . $topSelectedPosts[0]['cat_id']) ?>"><?= $topSelectedPosts[0]['category'] ?></a></li>
|
||||
</ul>
|
||||
<a href="<?= url('show-post/' . $topSelectedPosts[0]['id']) ?>">
|
||||
<h3><?= $topSelectedPosts[0]['title'] ?></h3>
|
||||
<h3 style="color: black;"><?= $topSelectedPosts[0]['title'] ?></h3>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></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="#"><?= $topSelectedPosts[0]['comments_count'] ?><span class="lnr lnr-bubble"></span></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="#" style="color: black;"><?= jalaliDate($topSelectedPosts[0]['created_at']) ?><span class="lnr lnr-calendar-full" style="color: black;"></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>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -21,18 +21,17 @@
|
|||
</div>
|
||||
<div class="footer-bottom row align-items-center">
|
||||
<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 ©
|
||||
<script>
|
||||
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>
|
||||
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
|
||||
</script> All rights reserved
|
||||
</p>
|
||||
<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-twitter"></i></a>
|
||||
<a href="#"><i class="fa fa-dribbble"></i></a>
|
||||
<a href="#"><i class="fa fa-behance"></i></a>
|
||||
<a href="#"><i class="fa fa-instagram"></i></a>
|
||||
<a href="#"><i class="fa fa-linkedin"></i></a>
|
||||
<a href="#"><i class="fa fa-telegram"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<!-- Favicon-->
|
||||
<link rel="shortcut icon" href="<?= asset($setting['icon']) ?>">
|
||||
<!-- Author Meta -->
|
||||
<meta name="author" content="colorlib">
|
||||
<!-- Meta Description -->
|
||||
<meta name="description" content="<?= $setting['description'] ?>">
|
||||
<!-- Meta Keyword -->
|
||||
|
@ -37,18 +35,18 @@
|
|||
<div class="header-top">
|
||||
<div class="container">
|
||||
<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>
|
||||
<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-dribbble"></i></a></li>
|
||||
<li><a href="#"><i class="fa fa-behance"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-6 header-top-right no-padding">
|
||||
</div> -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-6 header-top-left no-padding">
|
||||
<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="mailto:support@colorlib.com"><span class="lnr lnr-envelope"></span><span>support@colorlib.com</span></a></li>
|
||||
<li><a href=""><span class="lnr lnr-phone-handset"></span><span> 0903 958 2466</span></a></li>
|
||||
<li><a href=""><span class="lnr lnr-envelope"></span><span> nimobina99@gmail.com</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -58,12 +56,12 @@
|
|||
<div class="container">
|
||||
<div class="row justify-content-between align-items-center">
|
||||
<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="">
|
||||
</a>
|
||||
</div>
|
||||
<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>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
require_once(BASE_PATH . '/template/app/layouts/header.php');
|
||||
?>
|
||||
|
||||
<div class="site-main-container">
|
||||
<!-- Start top-post Area -->
|
||||
<!-- End top-post Area -->
|
||||
|
|