Merge branch 'feature1'
|
@ -6,299 +6,261 @@ use Database\Database;
|
|||
use PHPMailer\PHPMailer\Exception;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
|
||||
class Auth{
|
||||
class Auth
|
||||
{
|
||||
|
||||
protected function redirect($url)
|
||||
{
|
||||
header('Location: ' . trim(CURRENT_DOMAIN, '/ ') . '/' . trim($url, '/ '));
|
||||
exit;
|
||||
protected function redirect($url)
|
||||
{
|
||||
header('Location: ' . trim(CURRENT_DOMAIN, '/ ') . '/' . trim($url, '/ '));
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function redirectBack()
|
||||
{
|
||||
header("Location: " . $_SERVER['HTTP_REFERER']);
|
||||
exit;
|
||||
}
|
||||
|
||||
private function hash($password)
|
||||
{
|
||||
$hashPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||
return $hashPassword;
|
||||
}
|
||||
|
||||
private function random()
|
||||
{
|
||||
return bin2hex(openssl_random_pseudo_bytes(32));
|
||||
}
|
||||
|
||||
// public function activationMessage($username, $verifyToken)
|
||||
// {
|
||||
// $message = '
|
||||
// <h1>Account activation</h1>
|
||||
// <p>' . $username . Dear, to activate your account, please click on the link below'</p>
|
||||
// <div><a href="' . url('activation/' . $verifyToken) . '">Account activation</a></div>
|
||||
// ';
|
||||
// return $message;
|
||||
// }
|
||||
|
||||
public function sendMail($emailAddress, $subject, $body)
|
||||
{
|
||||
//Create an instance; passing `true` enables exceptions
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
//Server settings
|
||||
$mail->CharSet = "UTF-8";
|
||||
$mail->isSMTP(); //Send using SMTP
|
||||
$mail->Host = MAIL_HOST; //Set the SMTP server to send through
|
||||
$mail->SMTPAuth = SMTP_AUTH; //Enable SMTP authentication
|
||||
$mail->Username = MAIL_USERNAME; //SMTP username
|
||||
$mail->Password = MAIL_PASSWORD; //SMTP password
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = MAIL_PORT; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom(SENDER_MAIL, SENDER_NAME);
|
||||
$mail->addAddress($emailAddress); //Add a recipient
|
||||
|
||||
//Content
|
||||
$mail->isHTML(true); //Set email format to HTML
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
require_once BASE_PATH . '/template/auth/register.php';
|
||||
}
|
||||
|
||||
public function registerStore($request)
|
||||
{
|
||||
if (empty($request['email']) || empty($request['username']) || empty($request['password'])) {
|
||||
flash('register_error', 'All fields are required');
|
||||
$this->redirectBack();
|
||||
} else if (strlen($request['password']) < 8) {
|
||||
flash('register_error', 'Password must be at least 8 characters long');
|
||||
$this->redirectBack();
|
||||
} else if (!filter_var($request['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
flash('register_error', 'The email entered is not valid');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE email = ?", [$request['email']])->fetch();
|
||||
if ($user != null) {
|
||||
flash('register_error', 'Email already exists');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
$randomToken = $this->random();
|
||||
// $activationMessage = $this->activationMessage($request['username'], $randomToken);
|
||||
// $result = $this->sendMail($request['email'], 'Account activation', $activationMessage);
|
||||
// if($result)
|
||||
// {
|
||||
$request['verify_token'] = $randomToken;
|
||||
$request['password'] = $this->hash($request['password']);
|
||||
$db->insert('users', array_keys($request), $request);
|
||||
$this->redirect('login');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// flash('register_error', 'The activation email was not sent');
|
||||
$this->redirectBack();
|
||||
|
||||
protected function redirectBack()
|
||||
{
|
||||
header("Location: " . $_SERVER['HTTP_REFERER']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function hash($password)
|
||||
{
|
||||
$hashPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||
return $hashPassword;
|
||||
public function activation($verifyToken)
|
||||
{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE verify_token = ? AND is_active = 0", [$verifyToken])->fetch();
|
||||
if ($user == null) {
|
||||
$this->redirect('login');
|
||||
} else {
|
||||
$result = $db->update('users', $user['id'], ['is_active'], [1]);
|
||||
$this->redirect('login');
|
||||
}
|
||||
}
|
||||
|
||||
private function random(){
|
||||
return bin2hex(openssl_random_pseudo_bytes(32));
|
||||
}
|
||||
public function login()
|
||||
{
|
||||
require_once BASE_PATH . '/template/auth/login.php';
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
//Create an instance; passing `true` enables exceptions
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
//Server settings
|
||||
$mail->CharSet = "UTF-8";
|
||||
$mail->isSMTP(); //Send using SMTP
|
||||
$mail->Host = MAIL_HOST; //Set the SMTP server to send through
|
||||
$mail->SMTPAuth = SMTP_AUTH; //Enable SMTP authentication
|
||||
$mail->Username = MAIL_USERNAME; //SMTP username
|
||||
$mail->Password = MAIL_PASSWORD; //SMTP password
|
||||
$mail->SMTPSecure = 'tls';
|
||||
$mail->Port = MAIL_PORT; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom(SENDER_MAIL, SENDER_NAME);
|
||||
$mail->addAddress($emailAddress); //Add a recipient
|
||||
|
||||
|
||||
//Content
|
||||
$mail->isHTML(true); //Set email format to HTML
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function register(){
|
||||
require_once(BASE_PATH .'/template/auth/register.php');
|
||||
}
|
||||
|
||||
|
||||
public function registerStore($request)
|
||||
{
|
||||
if(empty($request['email']) || empty($request['username']) || empty($request['password']))
|
||||
{
|
||||
flash('register_error', 'تمامی فیلد ها الزامی میباشند');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else if(strlen($request['password']) < 8 )
|
||||
{
|
||||
flash('register_error', 'رمز عبور باید حداقل ۸ کاراکتر باشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else if(!filter_var($request['email'], FILTER_VALIDATE_EMAIL))
|
||||
{
|
||||
flash('register_error', 'ایمیل وارد شده معتبر نمیباشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE email = ?", [$request['email']])->fetch();
|
||||
if($user != null){
|
||||
flash('register_error', 'ایمیل از قبل وجود دارد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
$randomToken = $this->random();
|
||||
// $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');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// flash('register_error', 'ایمیل فعال سازی ارسال نشد');
|
||||
$this->redirectBack();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function activation($verifyToken)
|
||||
{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE verify_token = ? AND is_active = 0", [$verifyToken])->fetch();
|
||||
if($user == null){
|
||||
$this->redirect('login');
|
||||
}
|
||||
else{
|
||||
$result = $db->update('users', $user['id'], ['is_active'], [1]);
|
||||
$this->redirect('login');
|
||||
public function checkLogin($request)
|
||||
{
|
||||
if (empty($request['email']) || empty($request['password'])) {
|
||||
flash('login_error', 'All fields are required');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE email = ?", [$request['email']])->fetch();
|
||||
if ($user != null) {
|
||||
if (password_verify($request['password'], $user['password']) && $user['is_active'] == 1) {
|
||||
$_SESSION['user'] = $user['id'];
|
||||
$this->redirect('admin');
|
||||
} else {
|
||||
flash('login_error', 'The password is wrong');
|
||||
$this->redirectBack();
|
||||
}
|
||||
} else {
|
||||
flash('login_error', 'User not found');
|
||||
$this->redirectBack();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function login(){
|
||||
require_once(BASE_PATH .'/template/auth/login.php');
|
||||
}
|
||||
|
||||
|
||||
public function checkLogin($request)
|
||||
{
|
||||
if(empty($request['email']) || empty($request['password']))
|
||||
{
|
||||
flash('login_error', 'تمامی فیلد ها الزامی میباشند');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE email = ?", [$request['email']])->fetch();
|
||||
if($user != null){
|
||||
if(password_verify($request['password'], $user['password']) && $user['is_active'] == 1)
|
||||
{
|
||||
$_SESSION['user'] = $user['id'];
|
||||
$this->redirect('admin');
|
||||
}
|
||||
else{
|
||||
flash('login_error', 'کلمه عبور اشتباه است');
|
||||
$this->redirectBack();
|
||||
}
|
||||
}
|
||||
else{
|
||||
flash('login_error', 'کاربر یافت نشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
public function checkAdmin()
|
||||
{
|
||||
if (isset($_SESSION['user'])) {
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE id = ?", [$_SESSION['user']])->fetch();
|
||||
if ($user != null) {
|
||||
if ($user['permission'] != 'admin') {
|
||||
$this->redirect('home');
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->redirect('home');
|
||||
}
|
||||
} else {
|
||||
$this->redirect('home');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function checkAdmin(){
|
||||
if(isset($_SESSION['user']))
|
||||
{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE id = ?", [$_SESSION['user']])->fetch();
|
||||
if($user != null){
|
||||
if($user['permission'] != 'admin'){
|
||||
$this->redirect('home');
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$this->redirect('home');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$this->redirect('home');
|
||||
}
|
||||
public function logout()
|
||||
{
|
||||
if (isset($_SESSION['user'])) {
|
||||
unset($_SESSION['user']);
|
||||
session_destroy();
|
||||
}
|
||||
$this->redirect('login');
|
||||
|
||||
public function logout()
|
||||
{
|
||||
if(isset($_SESSION['user']))
|
||||
{
|
||||
unset($_SESSION['user']);
|
||||
session_destroy();
|
||||
}
|
||||
$this->redirect('login');
|
||||
}
|
||||
|
||||
}
|
||||
public function forgot()
|
||||
{
|
||||
require_once BASE_PATH . '/template/auth/forgot-password.php';
|
||||
}
|
||||
|
||||
|
||||
public function forgot(){
|
||||
require_once(BASE_PATH .'/template/auth/forgot-password.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function forgotMessage($username, $forgotToken)
|
||||
{
|
||||
$message = '
|
||||
<h1>بازیابی رمز عبور</h1>
|
||||
<p>' . $username . 'عزیز برای بازیابی رمز عبور خود لطفا روی لینک زیر کلیک نمایید</p>
|
||||
<div><a href="'. url('reset-password-form/' . $forgotToken) .'">فعال سازی حساب کاربری</a></div>
|
||||
public function forgotMessage($username, $forgotToken)
|
||||
{
|
||||
$message = '
|
||||
<h1>Password recovery</h1>
|
||||
<p>' . $username . 'Dear, to recover your password, please click on the link below</p>
|
||||
<div><a href="' . url('reset-password-form/' . $forgotToken) . '">Account activation</a></div>
|
||||
';
|
||||
return $message;
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
public function forgotRequest($request)
|
||||
{
|
||||
if(empty($request['email']))
|
||||
{
|
||||
flash('forgot_error', ' فیلد ایمیل الزامی میباشد');
|
||||
$this->redirectBack();
|
||||
public function forgotRequest($request)
|
||||
{
|
||||
if (empty($request['email'])) {
|
||||
flash('forgot_error', 'The email field is required');
|
||||
$this->redirectBack();
|
||||
} else if (!filter_var($request['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
flash('forgot_error', 'The entered email is not correct');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE email = ?", [$request['email']])->fetch();
|
||||
if ($user == null) {
|
||||
flash('forgot_error', 'There is no email entered');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
$randomToken = $this->random();
|
||||
$forgotMessage = $this->forgotMessage($user['username'], $randomToken);
|
||||
$result = $this->sendMail($request['email'], 'Password recovery', $forgotMessage);
|
||||
if ($result) {
|
||||
$db->update('users', $user['id'], ['forgot_token', 'forgot_token_expire'], [$randomToken, date("Y-m-d H:i:s", strtotime('+15 minutes'))]);
|
||||
$this->redirect('login');
|
||||
} else {
|
||||
flash('forgot_error', 'Email could not be sent.');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else if(!filter_var($request['email'], FILTER_VALIDATE_EMAIL))
|
||||
{
|
||||
flash('forgot_error', ' ایمیل وارد شده صحیح نمیباشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE email = ?", [$request['email']])->fetch();
|
||||
if($user == null)
|
||||
{
|
||||
flash('forgot_error', ' ایمیل وارد شده وجود ندارد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
$randomToken = $this->random();
|
||||
$forgotMessage = $this->forgotMessage($user['username'], $randomToken);
|
||||
$result = $this->sendMail($request['email'], 'بازیابی رمز عبور', $forgotMessage);
|
||||
if($result)
|
||||
{
|
||||
$db->update('users', $user['id'], ['forgot_token', 'forgot_token_expire'], [$randomToken, date("Y-m-d H:i:s", strtotime('+15 minutes'))]);
|
||||
$this->redirect('login');
|
||||
}
|
||||
else{
|
||||
flash('forgot_error', ' ایمیل ارسال نشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function resetPasswordView($forgot_token){
|
||||
require_once(BASE_PATH .'/template/auth/reset-password.php');
|
||||
}
|
||||
public function resetPasswordView($forgot_token)
|
||||
{
|
||||
require_once BASE_PATH . '/template/auth/reset-password.php';
|
||||
}
|
||||
|
||||
|
||||
public function resetPassword($request, $forgot_token)
|
||||
{
|
||||
if(!isset($request['password']) || strlen($request['password']) < 8)
|
||||
{
|
||||
flash('reset_error', 'یا رمز عبور نباید کمتر از ۸ کاراکتر باشد رمز عبور نباید خالی باشد');
|
||||
$this->redirectBack();
|
||||
public function resetPassword($request, $forgot_token)
|
||||
{
|
||||
if (!isset($request['password']) || strlen($request['password']) < 8) {
|
||||
flash('reset_error', 'The password must not be less than 8 characters or the password must not be empty');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE forgot_token = ?", [$forgot_token])->fetch();
|
||||
if ($user == null) {
|
||||
flash('reset_error', 'User with this profile was not found');
|
||||
$this->redirectBack();
|
||||
} else {
|
||||
if ($user['forgot_token_expire'] < date('Y-m-d H:i:s')) {
|
||||
flash('reset_error', 'This token has expired');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
$db = new Database();
|
||||
$user = $db->select("SELECT * FROM users WHERE forgot_token = ?", [$forgot_token])->fetch();
|
||||
if($user == null){
|
||||
flash('reset_error', 'کاربری با این مشخصات یافت نشد');
|
||||
$this->redirectBack();
|
||||
}
|
||||
else{
|
||||
if($user['forgot_token_expire'] < date('Y-m-d H:i:s'))
|
||||
{
|
||||
flash('reset_error', 'مهلت استفاده از این توکن به پایان رسیده است');
|
||||
$this->redirectBack();
|
||||
}
|
||||
if($user)
|
||||
{
|
||||
$db->update('users', $user['id'], ['password'], [$this->hash($request['password'])]);
|
||||
$this->redirect('login');
|
||||
}
|
||||
else{
|
||||
$this->redirectBack();
|
||||
}
|
||||
}
|
||||
if ($user) {
|
||||
$db->update('users', $user['id'], ['password'], [$this->hash($request['password'])]);
|
||||
$this->redirect('login');
|
||||
} else {
|
||||
$this->redirectBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 1 MiB |
Before Width: | Height: | Size: 675 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 197 KiB |
Before Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 342 KiB |
BIN
public/post-image/2022-10-24-18-38-25.webp
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
public/post-image/2022-10-24-18-39-32.webp
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
public/post-image/2022-10-24-18-42-13.jpeg
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
public/post-image/2022-10-24-18-50-58.webp
Normal file
After Width: | Height: | Size: 154 KiB |
BIN
public/post-image/2022-10-24-19-01-31.webp
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
public/post-image/2022-10-24-19-27-44.webp
Normal file
After Width: | Height: | Size: 131 KiB |
|
@ -45,8 +45,8 @@ require_once(BASE_PATH . "/template/admin/layouts/head-tag.php");
|
|||
<div class="card-body">
|
||||
<!-- <h5 class="card-title">Info card title</h5>-->
|
||||
<section class="d-flex justify-content-between align-items-center font-12">
|
||||
<span class=""><i class="far fa-eye-slash"></i> Unseen <span class="badge badge-pill mx-1"><?= $commentsUnseenCount['COUNT(*)']; ?></span></span>
|
||||
<span class=""><i class="far fa-check-circle"></i> Approved <span class="badge badge-pill mx-1"><?= $commentsApprovedCount['COUNT(*)']; ?></span></span>
|
||||
<span class=""><i class="fa fa-eye-slash"></i> Unseen <span class="badge badge-pill mx-1"><?= $commentsUnseenCount['COUNT(*)']; ?></span></span>
|
||||
<span class=""><i class="fa fa-check-circle"></i> Approved <span class="badge badge-pill mx-1"><?= $commentsApprovedCount['COUNT(*)']; ?></span></span>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -71,10 +71,10 @@ require_once(BASE_PATH . "/template/admin/layouts/head-tag.php");
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($postsWithView as $post) {?>
|
||||
<?php foreach($postsWithView as $key => $post) {?>
|
||||
<tr>
|
||||
<td><a class="text-primary" href="<?= url('admin/post/show/' . $post['id']) ?>"><?= $post['id'] ?></a></td>
|
||||
<td><?= $post['title'] ?></td>
|
||||
<td><a class="text-primary" href="<?= url('admin/post') ?>"><?= $key += 1 ?></a></td>
|
||||
<td><a class="text-dark" href="<?= url('admin/post') ?>"><?= $post['title'] ?></a></td>
|
||||
<td><span class="badge badge-secondary"><?= $post['view'] ?></span></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
@ -98,10 +98,10 @@ require_once(BASE_PATH . "/template/admin/layouts/head-tag.php");
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($postsComments as $post) {?>
|
||||
<?php foreach($postsComments as $key => $post) {?>
|
||||
<tr>
|
||||
<td><a class="text-primary" href="<?= url('admin/post/show/' . $post['id']) ?>"><?= $post['id'] ?></a></td>
|
||||
<td><?= $post['title'] ?></td>
|
||||
<td><a class="text-primary" href="<?= url('admin/post') ?>"><?= $key +=1 ?></a></td>
|
||||
<td><a class="text-dark" href="<?= url('admin/post') ?>"><?= $post['title'] ?></a></td>
|
||||
<td><span class="badge badge-success"><?= $post['comment_count'] ?></span></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
@ -125,12 +125,12 @@ require_once(BASE_PATH . "/template/admin/layouts/head-tag.php");
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($lastComments as $comment) {?>
|
||||
<?php foreach($lastComments as $key => $comment) {?>
|
||||
|
||||
<tr>
|
||||
<td><a class="text-primary" href="<?= url('admin/comment/show/' . $comment['id']) ?>"><?= $comment['id'] ?></a></td>
|
||||
<td><?= $comment['username'] ?></td>
|
||||
<td><?= $comment['comment'] ?></td>
|
||||
<tr >
|
||||
<td><a class="text-primary" href="<?= url('admin/comment') ?>"><?= $key +=1 ?></a></td>
|
||||
<td><a class="text-dark" href="<?= url('admin/comment') ?>"><?= $comment['username'] ?></a></td>
|
||||
<td><a class="text-dark" href="<?= url('admin/comment') ?>"><?= $comment['comment'] ?></a></td>
|
||||
<td><span class="badge badge-warning"><?= $comment['status'] ?></span></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item" href="<?= url('logout') ?>">logout</a>
|
||||
<a class="dropdown-item" href="<?= url('logout') ?>">Logout</a>
|
||||
</div>
|
||||
</span>
|
||||
</span>
|
||||
|
|
|
@ -26,7 +26,7 @@ require_once BASE_PATH . '/template/admin/layouts/head-tag.php';
|
|||
<label for="parent_id">parent ID</label>
|
||||
<select name="parent_id" id="parent_id" class="form-control" autofocus>
|
||||
|
||||
<option value="">منوی اصلی</option>
|
||||
<option value="">main menu</option>
|
||||
|
||||
<?php foreach($menus as $menu) { ?>
|
||||
<option value="<?= $menu['id'] ?>">
|
||||
|
|
|
@ -26,7 +26,7 @@ require_once BASE_PATH . '/template/admin/layouts/head-tag.php';
|
|||
<label for="parent_id">parent ID</label>
|
||||
<select name="parent_id" id="parent_id" class="form-control" autofocus>
|
||||
|
||||
<option value="" <?php if($menu['parent_id'] == '') echo 'selected' ?>>root</option>
|
||||
<option value="" <?php if($menu['parent_id'] == '') echo 'selected' ?>>main menu</option>
|
||||
|
||||
<?php foreach($menus as $selectMenu) { ?>
|
||||
<?php if ($menu['id'] != $selectMenu['id']) { ?>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<?= $menu['url'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $menu['parent_id'] == null ? 'منوی اصلی' : $menu['parent_name'] ?>
|
||||
<?= $menu['parent_id'] == null ? 'main menu' : $menu['parent_name'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<a role="button" class="btn btn-sm btn-primary text-white" href="<?= url('admin/menu/edit/'.$menu['id']) ?>">edit</a>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label for="published_at">published at</label>
|
||||
<input type="text" class="form-control d-none" id="published_at" name="published_at" required autofocus>
|
||||
<input type="text" class="form-control d-none" id="published_at" name="published_at">
|
||||
<input type="text" class="form-control" id="published_at_view" required autofocus>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</a>
|
||||
<ul class="meta">
|
||||
<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]['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>
|
||||
|
@ -39,14 +39,14 @@
|
|||
</div>
|
||||
<div class="top-post-details">
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $topSelectedPosts[1]['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $topSelectedPosts[1]['cat_id']) ?>"><?= $topSelectedPosts[1]['category'] ?></a></li>
|
||||
</ul>
|
||||
<a href="<?= url('show-post/' . $topSelectedPosts[1]['id']) ?>">
|
||||
<h4><?= $topSelectedPosts[1]['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $topSelectedPosts[1]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($topSelectedPosts[1]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $topSelectedPosts[1]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $topSelectedPosts[1]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -60,14 +60,14 @@
|
|||
</div>
|
||||
<div class="top-post-details">
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $topSelectedPosts[2]['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $topSelectedPosts[2]['cat_id']) ?>"><?= $topSelectedPosts[2]['category'] ?></a></li>
|
||||
</ul>
|
||||
<a href="<?= url('show-post/' . $topSelectedPosts[2]['id']) ?>">
|
||||
<h4><?= $topSelectedPosts[2]['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $topSelectedPosts[2]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($topSelectedPosts[2]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $topSelectedPosts[2]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $topSelectedPosts[2]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -77,8 +77,8 @@
|
|||
|
||||
<?php if(!empty($breakingNews)) { ?>
|
||||
<div class="col-lg-12">
|
||||
<div class="news-tracker-wrap">
|
||||
<h6><span>خبر فوری:</span> <a href="<?= url('show-post/' . $breakingNews['id']) ?>"><?= $breakingNews['title'] ?></a></h6>
|
||||
<div class="news-tracker-wrap text-left">
|
||||
<h6><span> Breaking News :</span> <a href="<?= url('show-post/' . $breakingNews['id']) ?>"><?= $breakingNews['title'] ?></a></h6>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
@ -93,7 +93,7 @@
|
|||
<div class="col-lg-8 post-list">
|
||||
<!-- Start latest-post Area -->
|
||||
<div class="latest-post-wrap">
|
||||
<h4 class="cat-title">آخرین اخبار</h4>
|
||||
<h4 class="cat-title post-left text-left">Latest News</h4>
|
||||
<?php foreach ($lastPosts as $lastPost) { ?>
|
||||
<div class="single-latest-post row align-items-center">
|
||||
<div class="col-lg-5 post-left">
|
||||
|
@ -102,20 +102,21 @@
|
|||
<img class="img-fluid" src="<?= asset($lastPost['image']) ?>" alt="">
|
||||
</div>
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $lastPost['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $lastPost['cat_id']) ?>"><?= $lastPost['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-7 post-right">
|
||||
<div class="col-lg-7 post-left text-left">
|
||||
<a href="<?= url('show-post/' . $lastPost['id']) ?>">
|
||||
<h4><?= $lastPost['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $lastPost['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($lastPost['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $lastPost['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $lastPost['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p class="excert">
|
||||
خلاصه متن خبر
|
||||
<p class="excert text-left">
|
||||
<?= $lastPost['summary'] ?>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -138,23 +139,23 @@
|
|||
<!-- End banner-ads Area -->
|
||||
<!-- Start popular-post Area -->
|
||||
<div class="popular-post-wrap">
|
||||
<h4 class="title">اخبار پربازدید</h4>
|
||||
<h4 class="title post-left text-left">Popular News</h4>
|
||||
<?php if(isset($popularPosts[0])) { ?>
|
||||
<div class="feature-post relative">
|
||||
<div class="feature-post relative post-left text-left">
|
||||
<div class="feature-img relative">
|
||||
<div class="overlay overlay-bg"></div>
|
||||
<img class="img-fluid" src="<?= asset($popularPosts[0]['image']) ?>" alt="">
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details post-left text-left">
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $popularPosts[0]['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $popularPosts[0]['cat_id']) ?>"><?= $popularPosts[0]['category'] ?></a></li>
|
||||
</ul>
|
||||
<a href="<?= url('show-post/' . $popularPosts[0]['id']) ?>">
|
||||
<h3><?= $popularPosts[0]['title'] ?></h3>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $popularPosts[0]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($popularPosts[0]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[0]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[0]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -169,20 +170,20 @@
|
|||
<img class="img-fluid" src="<?= asset($popularPosts[1]['image']) ?>" alt="">
|
||||
</div>
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $popularPosts[1]['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $popularPosts[1]['cat_id']) ?>"><?= $popularPosts[1]['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details post-left text-left">
|
||||
<a href="<?= url('show-post/' . $popularPosts[1]['id']) ?>">
|
||||
<h4><?= $popularPosts[1]['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $popularPosts[1]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($popularPosts[1]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[1]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[1]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p class="excert">
|
||||
خلاصه متن خبر
|
||||
<p class="excert post-left text-left">
|
||||
<?= $popularPosts[1]['summary'] ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -195,21 +196,22 @@
|
|||
<div class="overlay overlay-bg"></div>
|
||||
<img class="img-fluid" src="<?= asset($popularPosts[2]['image']) ?>" alt="">
|
||||
</div>
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $popularPosts[2]['category'] ?></a></li>
|
||||
<ul class="tags post-left text-left">
|
||||
<li><a href="<?= url('show-category/' . $popularPosts[2]['cat_id']) ?>"><?= $popularPosts[2]['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details post-left text-left">
|
||||
<a href="<?= url('show-post/' . $popularPosts[2]['id']) ?>">
|
||||
<h4><?= $popularPosts[2]['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $popularPosts[2]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($popularPosts[2]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[2]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[2]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p class="excert">
|
||||
خلاصه متن خبر
|
||||
<p class="excert post-left text-left">
|
||||
<?= $popularPosts[2]['summary'] ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
@ -2,22 +2,29 @@
|
|||
<footer class="footer-area section-gap">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 single-footer-widget">
|
||||
<h4>اخبار پربازدید</h4>
|
||||
<div class="col-lg-4 col-md-4 single-footer-widget text-left">
|
||||
<h4>Popular News</h4>
|
||||
<ul>
|
||||
<?php foreach ($popularPosts as $popularPost) { ?>
|
||||
<li><a href="<?= url('show-post/' . $popularPost['id']) ?>"><?= $popularPost['title'] ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 single-footer-widget">
|
||||
<h4>لینک سریع</h4>
|
||||
<div class="col-lg-4 col-md-4 single-footer-widget text-left">
|
||||
<h4>quick link</h4>
|
||||
<ul>
|
||||
<?php foreach ($menus as $menu) { ?>
|
||||
<li><a href="<?= $menu['url'] ?>"><?= $menu['name'] ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 single-footer-widget text-left">
|
||||
<h4>Contact us</h4>
|
||||
<ul>
|
||||
<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>
|
||||
<div class="footer-bottom row align-items-center">
|
||||
<p class="footer-text m-0 col-lg-8 col-md-12">
|
||||
|
|
|
@ -5,50 +5,51 @@
|
|||
<!-- Mobile Specific Meta -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<!-- Favicon-->
|
||||
<link rel="shortcut icon" href="<?= asset($setting['icon']) ?>">
|
||||
<link rel="shortcut icon" href="<?=asset($setting['icon'])?>">
|
||||
<!-- Meta Description -->
|
||||
<meta name="description" content="<?= $setting['description'] ?>">
|
||||
<meta name="description" content="<?=$setting['description']?>">
|
||||
<!-- Meta Keyword -->
|
||||
<meta name="keywords" content="<?= $setting['keywords'] ?>">
|
||||
<meta name="keywords" content="<?=$setting['keywords']?>">
|
||||
<!-- meta character set -->
|
||||
<meta charset="UTF-8">
|
||||
<!-- Site Title -->
|
||||
<title><?= $setting['title'] ?></title>
|
||||
<title><?=$setting['title']?></title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700" rel="stylesheet">
|
||||
<!--
|
||||
CSS
|
||||
============================================= -->
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/linearicons.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/font-awesome.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/bootstrap.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/magnific-popup.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/nice-select.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/animate.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/owl.carousel.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/jquery-ui.css') ?>">
|
||||
<link rel="stylesheet" href="<?= asset('public/app/css/main.css') ?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/linearicons.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/font-awesome.min.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/bootstrap.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/magnific-popup.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/nice-select.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/animate.min.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/owl.carousel.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/jquery-ui.css')?>">
|
||||
<link rel="stylesheet" href="<?=asset('public/app/css/main.css')?>">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
|
||||
<div class="header-top">
|
||||
<div class="header-top" style="padding-bottom:30px;">
|
||||
<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="row text-left float-left mb-10">
|
||||
|
||||
<div class="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-left no-padding">
|
||||
<ul>
|
||||
<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>
|
||||
<li><a href="<?= url('login') ?>"><span class="lnr lnr-enter-down"></span><span style="font-size:15px;"> Login</span></a></li>
|
||||
<li><a href="<?= url('register') ?>"><span class="lnr lnr-user"></span><span style="font-size:15px;"> Register</span></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="header-top-left no-padding text-dark">
|
||||
<ul>
|
||||
<li><span>ONLINE NEWS</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -57,31 +58,20 @@
|
|||
<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="http://localhost/NewsProject/">
|
||||
<img class="img-fluid" src="<?= asset($setting['logo']) ?>" alt="">
|
||||
<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="<?= asset($bodyBanner['image']) ?>" alt="">
|
||||
<img class="img-fluid" src="<?=asset($bodyBanner['image'])?>" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container main-menu" id="main-menu">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<nav id="nav-menu-container">
|
||||
<ul class="nav-menu">
|
||||
<?php foreach ($menus as $menu) { ?>
|
||||
<li class="menu-active">
|
||||
<a href="<?= $menu['url'] ?>">
|
||||
<?= $menu['name'] ?>
|
||||
</a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- #nav-menu-container -->
|
||||
<div class="navbar-right">
|
||||
<div class="navbar-right">
|
||||
<form class="Search">
|
||||
<input type="text" class="form-control Search-box" name="Search-box" id="Search-box" placeholder="جستجو">
|
||||
<input type="text" class="form-control Search-box text-left" name="Search-box" id="Search-box" placeholder="Search">
|
||||
<label for="Search-box" class="Search-box-label">
|
||||
<span class="lnr lnr-magnifier"></span>
|
||||
</label>
|
||||
|
@ -90,6 +80,21 @@
|
|||
</span>
|
||||
</form>
|
||||
</div>
|
||||
<nav id="nav-menu-container">
|
||||
<ul class="nav-menu">
|
||||
<?php foreach ($menus as $menu) {?>
|
||||
<li class="menu-active">
|
||||
<a href="<?=$menu['url']?>">
|
||||
<?=$menu['name']?>
|
||||
</a></li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<!-- #nav-menu-container -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="col-lg-4">
|
||||
<div class="sidebars-area">
|
||||
<div class="single-sidebar-widget editors-pick-widget">
|
||||
<h6 class="title">انتخاب سردبیر</h6>
|
||||
<h6 class="title text-left">Editor's Choice</h6>
|
||||
<div class="editors-pick-post">
|
||||
<?php if(isset($topSelectedPosts[0])) { ?>
|
||||
<div class="feature-img-wrap relative">
|
||||
|
@ -10,16 +10,16 @@
|
|||
<img class="img-fluid" src="<?= asset($topSelectedPosts[0]['image']) ?>" alt="">
|
||||
</div>
|
||||
<ul class="tags">
|
||||
<li><a href="#"><?= $topSelectedPosts[0]['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $topSelectedPosts[0]['cat_id']) ?>"><?= $topSelectedPosts[0]['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details text-left">
|
||||
<a href="<?= url('show-post/' . $topSelectedPosts[0]['id']) ?>">
|
||||
<h4 class="mt-20"><?= $topSelectedPosts[0]['title'] ?></h4>
|
||||
</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]['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>
|
||||
</ul>
|
||||
|
||||
|
@ -37,19 +37,19 @@
|
|||
<?php } ?>
|
||||
|
||||
<div class="single-sidebar-widget most-popular-widget">
|
||||
<h6 class="title">پر بحث ترین ها</h6>
|
||||
<h6 class="title text-left">The most controversial</h6>
|
||||
|
||||
<?php foreach($mostCommentsPosts as $mostCommentsPost) { ?>
|
||||
<div class="single-list flex-row d-flex">
|
||||
<div class="thumb">
|
||||
<img src="<?= asset($mostCommentsPost['image']) ?>" alt="" width="150" height="100">
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details text-left">
|
||||
<a href="<?= url('show-post/' . $mostCommentsPost['id']) ?>">
|
||||
<h6><?= $mostCommentsPost['title'] ?></h6>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><?= jalaliDate($mostCommentsPost['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $mostCommentsPost['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $mostCommentsPost['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
require_once(BASE_PATH . "/template/app/layouts/header.php");
|
||||
?>
|
||||
<?php
|
||||
require_once(BASE_PATH . '/template/app/layouts/header.php');
|
||||
?>
|
||||
|
||||
<div class="site-main-container">
|
||||
<!-- Start top-post Area -->
|
||||
|
@ -9,14 +9,14 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="hero-nav-area">
|
||||
<h1 class="text-white">اخبار دسته بندی <?= $category['name'] ?></h1>
|
||||
<h1 class="text-white"><?= $category['name'] ?> News</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($breakingNews)) { ?>
|
||||
<div class="col-lg-12">
|
||||
<div class="news-tracker-wrap">
|
||||
<h6><span>خبر فوری:</span> <a href="<?= url('show-post/' . $breakingNews['id']) ?>"><?= $breakingNews['title'] ?></a></h6>
|
||||
<div class="news-tracker-wrap text-left">
|
||||
<h6><span>Breaking News:</span> <a href="<?= url('show-post/' . $breakingNews['id']) ?>"><?= $breakingNews['title'] ?></a></h6>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
@ -30,8 +30,8 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<div class="row">
|
||||
<div class="col-lg-8 post-list">
|
||||
<!-- Start latest-post Area -->
|
||||
<div class="latest-post-wrap">
|
||||
<h4 class="cat-title">آخرین اخبار</h4>
|
||||
<div class="latest-post-wrap post-left text-left">
|
||||
<h4 class="cat-title">Latest Post</h4>
|
||||
|
||||
<?php foreach ($categoryPosts as $categoryPost) { ?>
|
||||
<div class="single-latest-post row align-items-center">
|
||||
|
@ -44,13 +44,13 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<li><a href="<?= url('show-category/' . $categoryPost['cat_id']) ?>"><?= $categoryPost['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-7 post-right">
|
||||
<div class="col-lg-7 post-left text-left">
|
||||
<a href="<?= url('show-post/' . $categoryPost['id']) ?>">
|
||||
<h4><?= $categoryPost['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $categoryPost['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($categoryPost['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $categoryPost['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"> <?= $categoryPost['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p class="excert">
|
||||
|
@ -72,8 +72,8 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<?php } ?>
|
||||
<!-- End banner-ads Area -->
|
||||
<!-- Start popular-post Area -->
|
||||
<div class="popular-post-wrap">
|
||||
<h4 class="title">اخبار پربازدید</h4>
|
||||
<div class="popular-post-wrap post-left text-left">
|
||||
<h4 class="title">Popular Post</h4>
|
||||
|
||||
<?php if (isset($popularPosts[0])) { ?>
|
||||
<div class="feature-post relative">
|
||||
|
@ -81,7 +81,7 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<div class="overlay overlay-bg"></div>
|
||||
<img class="img-fluid" src="<?= asset($popularPosts[0]['image']) ?>" alt="">
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details post-left text-left"">
|
||||
<ul class="tags">
|
||||
<li><a href="<?= url('show-category/' . $popularPosts[0]['cat_id']) ?>"><?= $popularPosts[0]['category'] ?></a></li>
|
||||
</ul>
|
||||
|
@ -109,13 +109,13 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<li><a href="<?= url('show-category/' . $popularPosts[1]['cat_id']) ?>"><?= $popularPosts[1]['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details post-left text-left"">
|
||||
<a href="<?= url('show-post/' . $popularPosts[1]['id']) ?>">
|
||||
<h4><?= $popularPosts[1]['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $popularPosts[1]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($popularPosts[1]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[1]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"> <?= $popularPosts[1]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p class="excert">
|
||||
|
@ -135,13 +135,13 @@ require_once(BASE_PATH . "/template/app/layouts/header.php");
|
|||
<li><a href="<?= url('show-category/' . $popularPosts[2]['cat_id']) ?>"><?= $popularPosts[2]['category'] ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="details post-left text-left"">
|
||||
<a href="<?= url('show-post/' . $popularPosts[2]['id']) ?>">
|
||||
<h4><?= $popularPosts[2]['title'] ?></h4>
|
||||
</a>
|
||||
<ul class="meta">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $popularPosts[2]['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($popularPosts[2]['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[2]['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $popularPosts[2]['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p class="excert">
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
<div class="overlay overlay-bg"></div>
|
||||
<img class="img-fluid" src="<?= asset($post['image']) ?>" alt="">
|
||||
</div>
|
||||
<div class="content-wrap">
|
||||
<div class="content-wrap post-left text-left"">
|
||||
<ul class="tags mt-10">
|
||||
<li><a href="#"><?= $post['category'] ?></a></li>
|
||||
<li><a href="<?= url('show-category/' . $post['cat_id']) ?>"><?= $post['category'] ?></a></li>
|
||||
</ul>
|
||||
<a href="#">
|
||||
<h3><?= $post['title'] ?></h3>
|
||||
</a>
|
||||
<ul class="meta pb-20">
|
||||
<li><a href="#"><span class="lnr lnr-user"></span><?= $post['username'] ?></a></li>
|
||||
<li><a href="#"><?= jalaliDate($post['created_at']) ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $post['created_at'] ?><span class="lnr lnr-calendar-full"></span></a></li>
|
||||
<li><a href="#"><?= $post['comments_count'] ?><span class="lnr lnr-bubble"></span></a></li>
|
||||
</ul>
|
||||
<p>
|
||||
|
@ -34,16 +34,16 @@
|
|||
<div class="comment-sec-area">
|
||||
<div class="container">
|
||||
<div class="row flex-column">
|
||||
<h6>نظرات</h6>
|
||||
<h6>Comment</h6>
|
||||
<?php foreach ($comments as $comment) { ?>
|
||||
<div class="comment-list">
|
||||
<div class="single-comment justify-content-between d-flex">
|
||||
<div class="user justify-content-between d-flex">
|
||||
<div class="comment-list float-left post-left text-left"">
|
||||
<div class="single-comment justify-content-between ">
|
||||
<div class="user justify-content-between ">
|
||||
|
||||
<div class="desc">
|
||||
<div class="desc post-left text-left"">
|
||||
<h5><a href="#"><?= $comment['username'] ?></a></h5>
|
||||
<p class="date mt-3"><?= jalaliDate($comment['created_at']) ?></p>
|
||||
<p class="comment">
|
||||
<p class="date mt-3"><?= $comment['created_at'] ?></p>
|
||||
<p class="comment ml-10">
|
||||
<?= $comment['comment'] ?>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -58,13 +58,13 @@
|
|||
</div>
|
||||
<?php if(isset($_SESSION['user'])) { ?>
|
||||
<div class="comment-form">
|
||||
<h4>درج نظر جدید</h4>
|
||||
<h4>Add new comment</h4>
|
||||
<form action="<?= url('comment-store') ?>" method="post">
|
||||
<div class="form-group">
|
||||
<input type="text" value="<?= $id ?>" name="post_id" class="d-none">
|
||||
<textarea class="form-control mb-10" rows="5" name="comment" placeholder="متن نظر" onfocus="this.placeholder = ''" onblur="this.placeholder = 'متن نظر'" required=""></textarea>
|
||||
<textarea class="form-control mb-10 text-left" rows="5" name="comment" placeholder="text" onfocus="this.placeholder = ''" onblur="this.placeholder = 'text'" required=""></textarea>
|
||||
</div>
|
||||
<button type="submit" class="primary-btn text-uppercase">ارسال</button>
|
||||
<button type="submit" class="primary-btn text-uppercase">Send</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
|
||||
<div class="text-center p-t-136">
|
||||
<a class="txt2" href="#">
|
||||
<a class="txt2" href="<?= url('register') ?>">
|
||||
Create your Account
|
||||
<i class="fa fa-long-arrow-right m-l-5" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
</div>
|
||||
|
||||
<div class="text-center p-t-136">
|
||||
<a class="txt2" href="#">
|
||||
<a class="txt2" href="<?= url('register') ?>">
|
||||
Create your Account
|
||||
<i class="fa fa-long-arrow-right m-l-5" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<span class="txt1">
|
||||
Forgot
|
||||
</span>
|
||||
<a class="txt2" href="#">
|
||||
<a class="txt2" href="<?= url('forgot') ?>">
|
||||
Username / Password?
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -61,13 +61,13 @@
|
|||
<span class="txt1">
|
||||
Forgot
|
||||
</span>
|
||||
<a class="txt2" href="#">
|
||||
<a class="txt2" href="<?= url('forgot') ?>">
|
||||
Username / Password?
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="text-center p-t-136">
|
||||
<a class="txt2" href="#">
|
||||
<a class="txt2" href="<?= url('login') ?>">
|
||||
Login your Account
|
||||
<i class="fa fa-long-arrow-right m-l-5" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
|