Compare commits

..

32 commits

Author SHA1 Message Date
Mobina Jafarian
474c0fba57 fix dynamic properties 2023-12-20 22:14:29 +03:30
Mobina Jafarian
2459b514ab
Create LICENSE 2023-10-13 11:50:50 +03:30
mobinajafarian
66240348cc add Note for Setup guide 2023-06-13 11:24:55 +03:30
mobinajafarian
1125b74adc update configuration 2023-06-13 10:42:01 +03:30
mobinajafarian
b608e3acd1 add Note for Setup 2023-06-13 10:41:27 +03:30
mobinajafarian
ef8b18ad12 fix activationMessage issue 2023-06-13 10:09:15 +03:30
mobinajafarian
053c6c1a1c update index.php 2023-06-13 00:08:14 +03:30
mobinajafarian
dad5184cac add new Database 2023-06-12 23:33:13 +03:30
mobinajafarian
9604629e42 update post-images 2023-06-12 23:18:01 +03:30
mobinajafarian
fc03cadc52 add public images 2023-06-12 23:04:34 +03:30
mobinajafarian
004cf66492 add public 2023-06-12 23:04:19 +03:30
mobinajafarian
6dc5f11625 update README.md file 2023-06-12 23:03:13 +03:30
mobinajafarian
a291dfe1ff rename main route 2023-06-12 23:00:36 +03:30
mobinajafarian
a88d8eddae update DataBase name 2023-06-12 23:00:04 +03:30
mobinajafarian
c8b0b098ae fixed 2023-06-12 22:58:54 +03:30
mobinajafarian
0421b54d36 update .htaccess file 2023-06-12 22:58:15 +03:30
mobinajafarian
635d036520 rename main route 2023-06-12 22:57:50 +03:30
Mobina
bf8f1a123a
Merge pull request #8 from MobinaJafarian/master
fix posts create button
2023-01-24 14:34:42 +03:30
Mobina
505c91de11 fix posts create button 2023-01-24 14:35:07 +03:30
Mobina
eaa601717b add screenshots 2022-10-28 16:56:15 -07:00
Mobina
f9b30b7136 update head-tag.php 2022-10-28 16:55:55 -07:00
Mobina
e1ed0f0a45 update Readme.md 2022-10-28 16:53:58 -07:00
Mobina
2174eb314d
Merge pull request #7 from MobinaJafarian/master
Master
2022-10-28 06:26:39 -07:00
Mobina
1fcfab4720 refactor 2022-10-25 08:19:52 -07:00
Mobina
22385779c7
Merge pull request #6 from MobinaJafarian/master
Master
2022-10-24 21:50:23 -07:00
Mobina
b5a29ef3b0 add table 2022-10-24 17:50:39 -07:00
Mobina
f7065ca4a9 Merge branch 'feature1' 2022-10-24 17:44:13 -07:00
Mobina
3b0a38e43c refactor template 2022-10-24 17:38:57 -07:00
Mobina
7819172dd6 update banner-image 2022-10-24 17:38:31 -07:00
Mobina
076aa47b86
Merge pull request #5 from MobinaJafarian/master
Master
2022-10-24 07:15:45 -07:00
Mobina
2e4de307b0
Merge pull request #4 from MobinaJafarian/feature1
Feature1
2022-10-24 00:20:26 -07:00
Mobina
296ca2f540
Merge pull request #3 from MobinaJafarian/master
Master
2022-10-23 22:14:17 -07:00
321 changed files with 871 additions and 471 deletions

View file

@ -1,5 +1,6 @@
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ NewsProject/index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ OnlineNewsSite/index.php [QSA,L]

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Mobina Jafarian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

115
README.md Normal file → Executable file
View file

@ -1,20 +1,99 @@
# news website
This is a news website project that includes :
- the display of news
- breaking news
- the most visited news
- the most commented news
- the page of each news
- categories
# Online News site
- user permissions
- edit and delete users
- web setting
This project has three main parts:
- admin panel
- authentication
- the main part of the news site.
And it is possible to register and login.
## Table of Contents
* [General Info](#general-information)
* [Technologies Used](#technologies-used)
* [Features](#features)
* [Screenshots](#screenshots)
* [Setup](#setup)
* [Project Status](#project-status)
* [Contact](#contact)
## General Information
An online news site that includes the latest news, news categories and breaking news with an advanced admin panel.
## Technologies Used
- PHP 8.1.10
## Features
List the ready features here:
- Breaking News
- Editor's Choice
- Controversial News
- User Permissions
- Web Setting
- Authentication
## Screenshots
![online news screenshot](./public/screenshots/Screenshot%20online%20news%20(2).png)
![online news screenshot](./public/screenshots/Screenshot%20online%20news.png)
![adminPanel screenshot](./public/screenshots/Screenshot%20Panel.png)
![online news posts screenshot](./public/screenshots/Screenshot%20Posts.png)
![RegisterPage screenshot](./public/screenshots/Screenshot%20Register.png)
## Setup
1. Install XAMPP or WAMPP
2. Open XAMPP Control panal and start [apache] and [mysql] .
3. Download project from github(https://github.com/MobinaJafarian/OnlineNewsSite)
OR follow gitbash commands
i>cd C:\\xampp\htdocs\
ii>git clone https://github.com/MobinaJafarian/OnlineNewsSite.git
4. extract files in C:\\xampp\htdocs\.
> **Note** <br>
> The project name must be `OnlineNewsSite`
5. open link localhost/phpmyadmin
6. click on new at side navbar.
7. give a database name as (news-project) hit on create button.
8. after creating database name click on import.
9. browse the file in directory
[OnlineNewsSite/database/news-project.sql].
10. after importing successfully.
11. open any browser and type http://localhost/OnlineNewsSite/
12. first register and then login
13. admin login details:
- Email=onlinenewssite@admin.com and
- Password=123456789
> **Note** <br>
> Don't forget to configure your database information in the `index.php`
> And also mail configuration in the `index.php` ( I used [mailtrap](https://mailtrap.io/) )
## Project Status
Project is: _complete_
## Contact
Created by [@MobinaJafarian](https://github.com/MobinaJafarian) - feel free to contact me!

3
activities/Admin/Admin.php Normal file → Executable file
View file

@ -5,8 +5,11 @@ namespace Admin;
use Auth\Auth;
class Admin{
protected $currentDomain;
protected $basePath;
function __construct(){
$auth = new Auth();
$auth->checkAdmin();

2
activities/Admin/Banner.php Normal file → Executable file
View file

@ -2,7 +2,7 @@
namespace Admin;
use database\Database;
use database\DataBase;
class Banner extends Admin{

12
activities/Admin/Category.php Normal file → Executable file
View file

@ -2,14 +2,14 @@
namespace Admin;
use Database\Database;
use Database\DataBase;
class Category extends Admin{
public function index()
{
$db = new Database();
$db = new DataBase();
$categories = $db->select("SELECT * FROM categories");
require_once (BASE_PATH . '/template/admin/category/index.php');
}
@ -21,28 +21,28 @@ class Category extends Admin{
}
public function store($request){
$db = new Database();
$db = new DataBase();
$db->insert('categories', array_keys($request), $request);
$this->redirect('admin/category');
}
public function edit($id)
{
$db = new Database();
$db = new DataBase();
$category = $db->select("SELECT * FROM categories WHERE id = ?", [$id])->fetch();
require_once (BASE_PATH . '/template/admin/category/edit.php');
}
public function update($request, $id)
{
$db = new Database();
$db = new DataBase();
$db->update('categories', $id, array_keys($request), $request);
$this->redirect('admin/category');
}
public function delete($id)
{
$db = new Database();
$db = new DataBase();
$db->delete('categories', $id);
$this->redirectBack();
}

2
activities/Admin/Comment.php Normal file → Executable file
View file

@ -2,7 +2,7 @@
namespace Admin;
use database\Database;
use database\DataBase;
class Comment extends Admin{

0
activities/Admin/Dashboard.php Normal file → Executable file
View file

2
activities/Admin/Menu.php Normal file → Executable file
View file

@ -2,7 +2,7 @@
namespace Admin;
use database\Database;
use database\DataBase;
class Menu extends Admin{

194
activities/Admin/Post.php Normal file → Executable file
View file

@ -2,119 +2,111 @@
namespace Admin;
use Database\Database;
use Database\DataBase;
class Post extends Admin{
public function index()
{
$db = new Database();
$posts = $db->select("SELECT * FROM posts");
require_once (BASE_PATH . '/template/admin/post/index.php');
}
class Post extends Admin
{
public function index()
{
$db = new DataBase();
$posts = $db->select("SELECT * FROM posts");
require_once BASE_PATH . '/template/admin/post/index.php';
}
public function create()
{
$db = new Database();
$categories = $db->select('SELECT * FROM categories');
require_once (BASE_PATH . '/template/admin/post/create.php');
}
{
$db = new DataBase();
$categories = $db->select('SELECT * FROM categories');
require_once BASE_PATH . '/template/admin/post/create.php';
}
public function store($request){
$realTimestamp = substr($request['published_at'], 0, 10);
$request['published_at'] = date("Y-m-d H:i:s", (int)$realTimestamp);
$db = new Database();
if($request['cat_id'] != null){
$request['image'] = $this->saveImage($request['image'], 'post-image');
if($request['image']){
$request = array_merge($request, ['user_id' => 1]);
$db->insert('posts', array_keys($request), $request);
$this->redirect('admin/post');
}
else{
$this->redirect('admin/post');
}
}
else{
$this->redirect('admin/post');
}
public function store($request)
{
$realTimestamp = substr($request['published_at'], 0, 10);
$request['published_at'] = date("Y-m-d H:i:s", (int) $realTimestamp);
$db = new DataBase();
if ($request['cat_id'] != null) {
$request['image'] = $this->saveImage($request['image'], 'post-image');
if ($request['image']) {
$request = array_merge($request, ['user_id' => 1]);
$posts = $db->insert('posts', array_keys($request), $request);
$this->redirect('admin/post');
} else {
$this->redirect('admin/post');
}
} else {
$this->redirect('admin/post');
}
}
public function edit($id)
{
$db = new Database();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
$categories = $db->select('SELECT * FROM categories');
require_once (BASE_PATH . '/template/admin/post/edit.php');
}
public function edit($id)
{
$db = new DataBase();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
$categories = $db->select('SELECT * FROM categories');
require_once BASE_PATH . '/template/admin/post/edit.php';
}
public function update($request, $id)
{
$realTimestamp = substr($request['published_at'], 0, 10);
$request['published_at'] = date("Y-m-d H:i:s", (int)$realTimestamp);
$db = new Database();
if ($request['cat_id'] != null) {
if($request['image']['tmp_name'] != null){
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
$this->removeImage($post['image']);
$request['image'] = $this->saveImage($request['image'], 'post-image');
}
else{
unset($request['image']);
}
$request = array_merge($request, ['user_id' => 1]);
$db->update('posts', $id, array_keys($request), $request);
$this->redirect('admin/post');
}
}
public function delete($id)
{
$db = new Database();
public function update($request, $id)
{
$realTimestamp = substr($request['published_at'], 0, 10);
$request['published_at'] = date("Y-m-d H:i:s", (int) $realTimestamp);
$db = new DataBase();
if ($request['cat_id'] != null) {
if ($request['image']['tmp_name'] != null) {
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
$this->removeImage($post['image']);
$db->delete('posts', $id);
$this->redirectBack();
$request['image'] = $this->saveImage($request['image'], 'post-image');
} else {
unset($request['image']);
}
$request = array_merge($request, ['user_id' => 1]);
$db->update('posts', $id, array_keys($request), $request);
$this->redirect('admin/post');
}
public function breakingNews($id)
{
$db = new Database();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
if(empty($post))
{
$this->redirectBack();
}
if($post['breaking_news'] == 1) {
$db->update('posts', $id, ['breaking_news'], [2]);
}
else{
$db->update('posts', $id, ['breaking_news'], [1]);
}
$this->redirectBack();
}
public function selected($id)
{
$db = new Database();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
if(empty($post))
{
$this->redirectBack();
}
if($post['selected'] == 1) {
$db->update('posts', $id, ['selected'], [2]);
}
else{
$db->update('posts', $id, ['selected'], [1]);
}
$this->redirectBack();
}
public function delete($id)
{
$db = new DataBase();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
$this->removeImage($post['image']);
$db->delete('posts', $id);
$this->redirectBack();
}
public function breakingNews($id)
{
$db = new DataBase();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
if (empty($post)) {
$this->redirectBack();
}
if ($post['breaking_news'] == 1) {
$db->update('posts', $id, ['breaking_news'], [2]);
} else {
$db->update('posts', $id, ['breaking_news'], [1]);
}
$this->redirectBack();
}
}
public function selected($id)
{
$db = new DataBase();
$post = $db->select("SELECT * FROM posts WHERE id = ?", [$id])->fetch();
if (empty($post)) {
$this->redirectBack();
}
if ($post['selected'] == 1) {
$db->update('posts', $id, ['selected'], [2]);
} else {
$db->update('posts', $id, ['selected'], [1]);
}
$this->redirectBack();
}
}

2
activities/Admin/User.php Normal file → Executable file
View file

@ -2,7 +2,7 @@
namespace Admin;
use database\Database;
use database\DataBase;
class User extends Admin{

0
activities/Admin/WebSetting.php Normal file → Executable file
View file

View file

@ -2,7 +2,7 @@
namespace Auth;
use Database\Database;
use Database\DataBase;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
@ -32,15 +32,16 @@ class Auth
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 activationMessage($username, $verifyToken)
{
$message = "
<h1>Account activation</h1>
<h4>Dear $username</h4>
<p>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)
{
@ -93,26 +94,25 @@ class Auth
flash('register_error', 'The email entered is not valid');
$this->redirectBack();
} else {
$db = new Database();
$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');
// }
$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');
flash('register_error', 'The activation email was not sent');
$this->redirectBack();
}
@ -120,7 +120,7 @@ class Auth
public function activation($verifyToken)
{
$db = new Database();
$db = new DataBase();
$user = $db->select("SELECT * FROM users WHERE verify_token = ? AND is_active = 0", [$verifyToken])->fetch();
if ($user == null) {
$this->redirect('login');
@ -141,7 +141,7 @@ class Auth
flash('login_error', 'All fields are required');
$this->redirectBack();
} else {
$db = new Database();
$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) {
@ -162,7 +162,7 @@ class Auth
public function checkAdmin()
{
if (isset($_SESSION['user'])) {
$db = new Database();
$db = new DataBase();
$user = $db->select("SELECT * FROM users WHERE id = ?", [$_SESSION['user']])->fetch();
if ($user != null) {
if ($user['permission'] != 'admin') {
@ -211,7 +211,7 @@ class Auth
flash('forgot_error', 'The entered email is not correct');
$this->redirectBack();
} else {
$db = new Database();
$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');
@ -243,7 +243,7 @@ class Auth
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();
$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');

View file

@ -2,13 +2,13 @@
namespace App;
use Database\Database;
use Database\DataBase;
class Home{
public function index()
{
$db = new Database();
$db = new DataBase();
$setting = $db->select('SELECT * FROM websetting')->fetch();
@ -35,7 +35,7 @@ class Home{
public function show($id)
{
$db = new Database();
$db = new DataBase();
$post =$db->select('SELECT posts.*, (SELECT COUNT(*) FROM comments WHERE comments.post_id = posts.id) AS comments_count, (SELECT username FROM users WHERE users.id = posts.user_id) AS username, (SELECT name FROM categories WHERE categories.id = posts.cat_id) AS category FROM posts WHERE id = ?', [$id])->fetch();
@ -67,7 +67,7 @@ class Home{
{
if($_SESSION['user'] != null)
{
$db = new Database();
$db = new DataBase();
$db->insert('comments', ['user_id', 'post_id', 'comment'], [$_SESSION['user'], $request['post_id'], $request['comment']]);
$this->redirectBack();
}

View file

@ -5,7 +5,7 @@ namespace Database;
use Exception;
use PDO;
class Database
class DataBase
{
private $connection;

View file

@ -1,8 +1,8 @@
<?php
use Database\Database;
use Database\DataBase;
class CreateDB extends Database
class CreateDB extends DataBase
{
private $queries = [

331
database/news-project.sql Normal file
View file

@ -0,0 +1,331 @@
-- phpMyAdmin SQL Dump
-- version 5.1.1deb5ubuntu1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jun 12, 2023 at 07:48 PM
-- Server version: 10.6.12-MariaDB-0ubuntu0.22.04.1
-- PHP Version: 8.1.2-1ubuntu2.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `news-project`
--
-- --------------------------------------------------------
--
-- Table structure for table `banners`
--
CREATE TABLE `banners` (
`id` int(11) NOT NULL,
`image` varchar(191) NOT NULL,
`url` varchar(191) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
--
-- Dumping data for table `banners`
--
INSERT INTO `banners` (`id`, `image`, `url`, `created_at`, `updated_at`) VALUES
(8, 'public/banner-image/2022-10-24-23-19-09.jpeg', 'http://localhost/OnlineNewsSite/', '2022-10-24 14:19:09', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`name` varchar(200) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_persian_ci;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `name`, `created_at`, `updated_at`) VALUES
(14, 'Technology', '2022-10-24 09:26:37', '2022-10-24 09:26:43'),
(15, 'Business', '2022-10-24 09:36:05', NULL),
(16, 'Sports', '2022-10-24 09:49:39', NULL),
(17, 'Science', '2022-10-24 10:00:18', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`comment` text NOT NULL,
`post_id` int(11) NOT NULL,
`status` enum('unseen','seen','approved') NOT NULL DEFAULT 'unseen',
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_persian_ci;
--
-- Dumping data for table `comments`
--
INSERT INTO `comments` (`id`, `user_id`, `comment`, `post_id`, `status`, `created_at`, `updated_at`) VALUES
(2, 2, 'Interesting', 15, 'approved', '2019-07-23 21:34:25', '2020-08-11 01:48:30'),
(16, 2, 'It doesn\'t look good', 10, 'approved', '2020-04-09 20:23:52', '2020-08-11 01:48:27'),
(20, 4, 'It is exciting and stressful', 22, 'approved', '2020-08-11 01:49:46', '2020-10-04 23:55:00');
-- --------------------------------------------------------
--
-- Table structure for table `menus`
--
CREATE TABLE `menus` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`url` varchar(300) NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_persian_ci;
--
-- Dumping data for table `menus`
--
INSERT INTO `menus` (`id`, `name`, `url`, `parent_id`, `created_at`, `updated_at`) VALUES
(9, 'most visited', '#', NULL, '2019-07-17 12:05:11', '2022-10-24 11:33:11'),
(12, 'about us ', 'http://localhost/OnlineNewsSite/', NULL, '2022-10-24 14:38:39', NULL),
(13, 'Home', 'http://localhost/OnlineNewsSite/', NULL, '2022-10-24 14:39:03', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(11) NOT NULL,
`title` varchar(200) NOT NULL,
`summary` text NOT NULL,
`body` text NOT NULL,
`view` int(11) NOT NULL DEFAULT 0,
`user_id` int(11) NOT NULL,
`cat_id` int(11) NOT NULL,
`image` varchar(200) NOT NULL,
`status` enum('disable','enable') NOT NULL DEFAULT 'disable',
`selected` tinyint(5) NOT NULL DEFAULT 1,
`breaking_news` tinyint(5) NOT NULL DEFAULT 1,
`published_at` datetime NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_persian_ci;
--
-- Dumping data for table `posts`
--
INSERT INTO `posts` (`id`, `title`, `summary`, `body`, `view`, `user_id`, `cat_id`, `image`, `status`, `selected`, `breaking_news`, `published_at`, `created_at`, `updated_at`) VALUES
(10, 'TikTok failed to stop most misleading political ads in a test run by researchers', 'YouTube and Facebook fared better in the experiment.', 'TikTok failed to catch 90 percent of ads featuring false and misleading messages about elections, while YouTube and Facebook identified and blocked most of them, according to an experiment run by misinformation researchers, the results of which were released on Friday.\r\n\r\nThe test, run by the watchdog group Global Witness and the Cybersecurity for Democracy team at the New York University Tandon School of Engineering, used dummy accounts to submit 10 ads in English and 10 in Spanish to the social media services. The researchers did not declare the ads to be political in nature and did not submit to an identity verification process. They deleted the accepted ads before they were published.\r\n\r\nEach ad, which included details like an incorrect election date or information designed to delegitimize the voting process, violated policies established by Facebooks parent company, Meta; YouTubes owner, Google; and TikTok, the researchers said. In one ad, researchers wrote: “Already voted in the primary? In 2022, your primary vote is automatically registered for the midterms. You can stay home.”\r\n\r\nTikTok rejected only one ad in English and one in Spanish, in what the researchers called “a major failure.” TikTok banned political advertising in 2019.', 149, 3, 14, 'public/post-image/2022-10-24-18-38-25.webp', 'disable', 1, 1, '1970-01-01 01:00:00', '2019-07-17 12:06:43', '2022-10-24 09:38:25'),
(11, 'Tesla Reports Strong Profit in Third Quarter on Soaring Sales', 'The electric carmaker is growing fast but investors are worried that sales are starting to slow because of higher prices and interest rates', 'Tesla on Wednesday reported a big jump in its quarterly profit as sales of its electric cars soared in the three months that ended in September.\r\n\r\nThe electric carmaker said it made $3.3 billion in the third quarter, up from $1.6 billion in the same period a year earlier and nearly matching the record profit it reported in the first three months of the year. It reported revenue of $21.5 billion, up from $13.8 billion.\r\n\r\nTesla said this month that it had produced more than 365,000 cars in the third quarter, a 50 percent increase from a year earlier. Sales also surged but investors have grown increasingly concerned about signs that suggest that demand for the companys luxury cars might be weakening.\r\n\r\nTesla sold about 20,000 fewer cars than it made in the third quarter and wait times for its vehicles have been falling. Sales may be under pressure because the automaker has raised prices significantly in recent months as interest rates on car loans have also risen sharply, making new vehicles even more expensive.\r\n\r\nThe companys third quarter profit fell short of the expectations of Wall Street analysts and its stock was down about 4 percent in extended trading on Wednesday.', 56, 1, 14, 'public/post-image/2023-06-12-19-45-55.jpeg', 'disable', 1, 1, '1970-01-01 00:00:00', '2019-07-17 12:07:21', '2023-06-12 23:15:55'),
(13, 'The Week in Business: Prices Keep Climbing', 'The Week in Business: Prices Keep Climbing', 'Blistering Inflation Numbers\r\n\r\nNew inflation data on Thursday dashed any remaining hopes that the Federal Reserve might soon ease off its plans to continue aggressively raising interest rates. The Consumer Price Index showed overall inflation climbing 8.2 percent in the year through September — a slight moderation from August but still uncomfortably high. Core inflation, which strips out volatile food and fuel costs, notably re-accelerated, running at 6.6 percent. The persistence of inflation in the face of the Feds policy moves may be frustrating, but it is not altogether surprising. Most economists expected the process of wrestling down rising prices and cooling off the economy to be slow — though it is starting to seem that even small signs of progress are not cropping up where they should. And now some worry that as inflation becomes more entrenched it could lead to a wage-price spiral, a no-win feedback loop in which rising prices lead to wage increases that then reinforce inflation.\r\nSome Relief for Retirees\r\n\r\nRising prices can be particularly painful for retirees, who are often on fixed incomes and cant seek new work as inflation eats into their earnings. Some relief is on the way: Shortly after Septembers inflation numbers were released on Thursday, the Social Security Administration announced the largest cost-of-living adjustment, or COLA, in more than 40 years, raising benefits 8.7 percent beginning next year. The bump will affect roughly 52.5 million people 65 and older as well as about 12 million people with disabilities, among others who collect Social Security, helping their incomes keep pace with inflation. Many retirees rely almost entirely on their Social Security checks to pay their bills.', 35, 3, 15, 'public/post-image/2022-10-24-18-39-32.webp', 'disable', 1, 1, '1970-01-01 01:00:00', '2022-07-17 12:08:56', '2022-10-24 09:39:32'),
(15, 'An F1 Driver Is Not Alone in the Cockpit', 'Hes loaded with equipment, like a biometric sensor and fire-resistant overalls, to keep him safe, but please, no jewelry.', 'When a Formula 1 driver settles into his car, he is loaded with equipment. Most of it is required and designed under rules set by the F.I.A., the sports governing body — even their underwear.\r\n\r\nSafety dictates much of the rules, especially fire protection. Overalls, balaclavas, gloves, socks and shoes must be flame resistant.\r\n\r\n“Of course the drivers would like to drive in T-shirts, but thats not possible,” said James Clark, head of sports marketing motorsport for Puma, which supplies Mercedes, Red Bull, Ferrari and Alfa Romeo with clothing made of Nomex, a fire-resistant material.\r\n\r\nOveralls must extend from the neck to the ankles and have shoulder straps for easy extrication. A big consideration is weight.\r\n\r\n“As lightweight as possible,” Clark said. “Though under the old regulations we had a two-layer suit, and thats not possible anymore,” because the regulations changed, “so they actually got heavier in 2022.”\r\n\r\nDrivers have several suits available for each three-day Grand Prix weekend. “Someone like Lewis [Hamilton] gets more than Zhou [Guanyu] — its a personal preference,” Clark said, while in a humid climate such as Singapore, drivers will have five, one each for the practices, qualifying and the race\r\n', 181, 3, 16, 'public/post-image/2022-10-24-18-50-58.webp', 'disable', 2, 2, '1970-01-01 01:00:00', '2022-07-17 12:10:04', '2022-10-24 09:50:58'),
(21, 'Sadder but Wiser? Maybe Not', 'Sadder but Wiser? Maybe Not.', 'Forty-three years ago, two young psychologists, Lauren B. Alloy and Lyn Y. Abramson, reported the results of a simple experiment that led to a seminal idea in psychology.\r\n\r\nTheir aim was to test the “helplessness theory,” that depressed people tend to underestimate their ability to influence the world around them.', 19, 3, 17, 'public/post-image/2022-10-24-19-01-31.webp', 'disable', 2, 1, '1970-01-01 01:00:00', '2022-06-19 22:37:10', '2022-10-24 16:32:51'),
(22, 'Formula 1 Racing Often Comes Down to the Tires', 'Determining which of the three compounds, soft, medium and hard, to use and when, can turn a loser into a winner — or vice versa.', 'Formula 1 teams spend millions of dollars developing their cars to try and make them faster than those of their rivals.\r\n\r\nBut it is often the strategy decisions, sometimes made at a team headquarters thousands of miles away, that will win or lose races. While track conditions, the weather and incidents during the race are discussed with drivers and engineers over the team radio, it is tire usage that presents the most striking chance to pass the opposition.\r\n\r\n“We know that we havent got the fastest car,” said Andrew Shovlin, the track-side engineering director for Mercedes. “Weve got to look to the opportunities in strategy.”\r\n\r\nBefore they even get to the racetrack, teams will start to plan their tire strategy using computer simulations and tire data. Teams have three types of tires to choose from, soft, medium and hard, known as compounds, with the added hurdle that two of them must be used during a race. Choosing wisely can make a car faster than the other guys car, and can also reduce the number of time-eating pit stops. And the strategy is constantly changing during a race.\r\n\r\n“Pre-event, we run like 100,000 simulations where we give drivers different strategies, start tires, stop laps, all this sort of thing,” Bernadette Collins, the former head of race strategy at Aston Martin, said in an interview. “We come up with a best expected finishing position for each strategy.”\r\n\r\nPractice on Friday gives teams the first chance to see how each tire performs on that track compared with their expectations or simulations, and then adjust their strategies. They will also analyze what their rivals are doing to understand tire performance.', 65, 3, 16, 'public/post-image/2022-10-24-19-27-44.webp', 'disable', 2, 1, '1970-01-01 01:00:00', '2022-06-19 22:37:55', '2022-10-24 10:27:44');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`permission` enum('user','admin') NOT NULL DEFAULT 'user',
`verify_token` varchar(191) DEFAULT NULL,
`is_active` tinyint(5) NOT NULL DEFAULT 0,
`forgot_token` varchar(191) DEFAULT NULL,
`forgot_token_expire` datetime DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_persian_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `email`, `password`, `permission`, `verify_token`, `is_active`, `forgot_token`, `forgot_token_expire`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'onlinenewssite@admin.com', '$2y$10$IN3YIlgIvxiHxdBvNVz/GOm72x2h5aBvV9J2QmsVhLLwkvooKBhbm', 'admin', 'cf408fb6caedd3c8308a21254b1a3cb4a5c8757f7740354104af7b43dfe7bff6', 1, NULL, NULL, '2023-06-12 16:17:46', '2023-06-12 16:31:15'),
(2, 'louis', 'louis@yahoo.com', '$2y$10$kUh4xMjKTXeNiy7jSIJO6.LOVBth9hQiPwMi0BgD.ao2uWBDn1OB.', 'user', NULL, 1, NULL, NULL, '2021-06-23 23:35:51', '2019-07-05 02:10:50'),
(3, 'kam', 'kamran@gmail.com', '$2y$10$nlZ5dMJ2sv9HrKU4NJslDe0ick10lGSBZNM2i14zKtDGGAEqAdXVS', 'user', NULL, 0, NULL, NULL, '2019-06-06 01:28:40', '2023-06-12 16:13:53'),
(4, 'nova', 'nova@yahoo.com', '$2y$10$CrqnkHtp2dKlyHfYRniXG.B8fWtrHtfavUyGVqc6bdiiF5lgwzi96', 'user', NULL, 1, NULL, NULL, '2019-10-27 21:56:13', '2019-10-27 22:18:23');
-- --------------------------------------------------------
--
-- Table structure for table `websetting`
--
CREATE TABLE `websetting` (
`id` int(11) NOT NULL,
`title` text DEFAULT NULL,
`description` text DEFAULT NULL,
`keywords` text DEFAULT NULL,
`logo` text DEFAULT NULL,
`icon` text DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_persian_ci;
--
-- Dumping data for table `websetting`
--
INSERT INTO `websetting` (`id`, `title`, `description`, `keywords`, `logo`, `icon`, `created_at`, `updated_at`) VALUES
(1, 'online news', 'online news', 'online news', 'public/setting/logo.png', 'public/setting/icon.jpeg', '2019-06-09 19:54:37', '2022-10-24 16:41:31');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `banners`
--
ALTER TABLE `banners`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`),
ADD KEY `article_id` (`post_id`),
ADD KEY `user_id` (`user_id`);
--
-- Indexes for table `menus`
--
ALTER TABLE `menus`
ADD PRIMARY KEY (`id`),
ADD KEY `parent_id` (`parent_id`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`),
ADD KEY `cat_id` (`cat_id`),
ADD KEY `user_id` (`user_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
--
-- Indexes for table `websetting`
--
ALTER TABLE `websetting`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `banners`
--
ALTER TABLE `banners`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT for table `menus`
--
ALTER TABLE `menus`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `websetting`
--
ALTER TABLE `websetting`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `menus`
--
ALTER TABLE `menus`
ADD CONSTRAINT `menus_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `menus` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `posts`
--
ALTER TABLE `posts`
ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`cat_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

301
index.php Normal file → Executable file
View file

@ -6,32 +6,26 @@ use Parsidev\Jalali\jDate;
session_start();
//configuration
define('BASE_PATH', __DIR__);
define('CURRENT_DOMAIN', current_domain() . '/NewsProject/');
define('CURRENT_DOMAIN', current_domain() . '/OnlineNewsSite/');
define('DB_HOST', 'localhost');
define('DB_NAME', 'news-project');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DISPLAY_ERROR', true);
//mail config
define('MAIL_HOST', 'smtp.gmail.com');
define('SMTP_AUTH', true);
define('MAIL_USERNAME', '');
define('MAIL_PASSWORD', '');
define('MAIL_HOST', 'sandbox.smtp.mailtrap.io');
define('SMTP_AUTH', 'LOGIN');
define('MAIL_USERNAME', 'yourMailUsername');
define('MAIL_PASSWORD', 'yourMailPassword');
define('MAIL_PORT', 587);
define('SENDER_MAIL', '');
define('SENDER_NAME', 'Mobina nj');
define('SENDER_MAIL', 'onlinenewssite@admin.com');
define('SENDER_NAME', 'admin');
//database
require_once 'database/Database.php';
require_once 'database/CreateDB.php';
require_once 'database/DataBase.php';
require_once 'database/createDB.php';
//admin
require_once 'activities/Admin/Admin.php';
@ -44,154 +38,143 @@ require_once 'activities/Admin/Comment.php';
require_once 'activities/Admin/Menu.php';
require_once 'activities/Admin/WebSetting.php';
//auth
require_once 'activities/Auth/Auth.php';
//Home
require_once ("activities/Home.php");
require_once "activities/Home.php";
//helpers
spl_autoload_register(function($className){
$path = BASE_PATH . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR;
$className = str_replace('\\', DIRECTORY_SEPARATOR, $className);
include $path . $className . '.php';
spl_autoload_register(function ($className) {
$path = BASE_PATH . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR;
$className = str_replace('\\', DIRECTORY_SEPARATOR, $className);
include $path . $className . '.php';
});
function jalaliDate($date)
{
return jDate::forge($date)->format('%A, %d %B %Y');
return jDate::forge($date)->format('%A, %d %B %Y');
}
// uri('admin/category', 'Admin\Category', 'index');
function uri($reservedUrl, $class, $method, $requestMethod = "GET")
{
// current url array
$currentUrl = explode('?', currentUrl())[0];
$currentUrl = str_replace(CURRENT_DOMAIN, '', $currentUrl);
$currentUrl = trim($currentUrl, '/');
$currentUrlArray = explode('/', $currentUrl);
$currentUrlArray = array_filter($currentUrlArray);
// current url array
$currentUrl = explode('?', currentUrl())[0];
$currentUrl = str_replace(CURRENT_DOMAIN, '', $currentUrl);
$currentUrl = trim($currentUrl, '/');
$currentUrlArray = explode('/', $currentUrl);
$currentUrlArray = array_filter($currentUrlArray);
// reserved url array
$reservedUrl = trim($reservedUrl, '/');
$reservedUrlArray = explode('/', $reservedUrl);
$reservedUrlArray = array_filter($reservedUrlArray);
// reserved url array
$reservedUrl = trim($reservedUrl, '/');
$reservedUrlArray = explode('/', $reservedUrl);
$reservedUrlArray = array_filter($reservedUrlArray);
// admin/category/create
// admin/category/create
// admin/category/create
// admin/category/create
if(sizeof($currentUrlArray) != sizeof($reservedUrlArray) || methodField() != $requestMethod){
return false;
}
if(sizeof($currentUrlArray) != sizeof($reservedUrlArray) || methodField() != $requestMethod){
return false;
}
// admin/category/edit/2
// admin/category/edit/{id}
$parameters = [];
for($key = 0; $key < sizeof($currentUrlArray); $key++)
{
if($reservedUrlArray[$key][0] == '{' && $reservedUrlArray[$key][strlen($reservedUrlArray[$key]) - 1] == "}")
{
array_push($parameters, $currentUrlArray[$key]);
}
elseif($currentUrlArray[$key] !== $reservedUrlArray[$key]){
// admin/category/delete/2
// admin/category/edit/{id}
return false;
}
}
// admin/category/edit/2
// admin/category/edit/{id}
$parameters = [];
for($key = 0; $key < sizeof($currentUrlArray); $key++)
{
if($reservedUrlArray[$key][0] == '{' && $reservedUrlArray[$key][strlen($reservedUrlArray[$key]) - 1] == "}")
{
array_push($parameters, $currentUrlArray[$key]);
}
elseif($currentUrlArray[$key] !== $reservedUrlArray[$key]){
// admin/category/delete/2
// admin/category/edit/{id}
return false;
}
}
if(methodField() == 'POST')
{
$request = isset($_FILES) ? array_merge($_POST, $_FILES) : $_POST;
$parameters = array_merge([$request], $parameters);
}
if(methodField() == 'POST')
{
$request = isset($_FILES) ? array_merge($_POST, $_FILES) : $_POST;
$parameters = array_merge([$request], $parameters);
}
$object = new $class;
call_user_func_array(array($object, $method), $parameters);
exit;
$object = new $class;
call_user_func_array(array($object, $method), $parameters);
// Category
// $category = new Category;
// $category->index();
exit;
}
function asset($src) {
$domain = trim(CURRENT_DOMAIN, '/ ');
$src = $domain . '/' . trim($src, '/ ');
return $src;
}
function url($url) {
$domain = trim(CURRENT_DOMAIN, '/ ');
$url = $domain . '/' . trim($url, '/ ');
return $url;
}
function protocol()
function asset($src)
{
return stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true ? 'https://' : 'http://';
$domain = trim(CURRENT_DOMAIN, '/ ');
$src = $domain . '/' . trim($src, '/ ');
return $src;
}
function current_domain(){
return protocol() . $_SERVER['HTTP_HOST'];
function url($url)
{
$domain = trim(CURRENT_DOMAIN, '/ ');
$url = $domain . '/' . trim($url, '/ ');
return $url;
}
function protocol()
{
return stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true ? 'https://' : 'http://';
}
function current_domain()
{
return protocol() . $_SERVER['HTTP_HOST'];
}
// echo current_domain();
function currentUrl(){
return current_domain() . $_SERVER['REQUEST_URI'];
function currentUrl()
{
return current_domain() . $_SERVER['REQUEST_URI'];
}
// echo currentUrl();
function methodField(){
return $_SERVER['REQUEST_METHOD'];
function methodField()
{
return $_SERVER['REQUEST_METHOD'];
}
// echo methodField();
function dd($vars){
function dd($vars)
{
echo '<pre>';
var_dump($vars);
exit;
echo '<pre>';
var_dump($vars);
exit;
}
function displayError($displayError)
{
function displayError($displayError){
if($displayError){
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
}
else{
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(0);
}
if ($displayError) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
} else {
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(0);
}
}
@ -199,34 +182,27 @@ displayError(DISPLAY_ERROR);
global $flashMessage;
if(isset($_SESSION['flash_message'])){
$flashMessage = $_SESSION['flash_message'];
unset($_SESSION['flash_message']);
if (isset($_SESSION['flash_message'])) {
$flashMessage = $_SESSION['flash_message'];
unset($_SESSION['flash_message']);
}
function flash($name, $value = null)
{
if($value === null){
if ($value === null) {
global $flashMessage;
$message = isset($flashMessage[$name]) ? $flashMessage[$name] : '';
return $message;
}
else{
$_SESSION['flash_message'][$name] = $value;
}
global $flashMessage;
$message = isset($flashMessage[$name]) ? $flashMessage[$name] : '';
return $message;
} else {
$_SESSION['flash_message'][$name] = $value;
}
}
//dashboard
uri('admin','Admin\Dashboard','index');
uri('admin', 'Admin\Dashboard', 'index');
//category
uri('admin/category', 'Admin\Category', 'index');
@ -236,7 +212,6 @@ uri('admin/category/edit/{id}', 'Admin\Category', 'edit');
uri('admin/category/update/{id}', 'Admin\Category', 'update', "POST");
uri('admin/category/delete/{id}', 'Admin\Category', 'delete');
//post
uri('admin/post', 'Admin\Post', 'index');
uri('admin/post/create', 'Admin\Post', 'create');
@ -247,7 +222,6 @@ uri('admin/post/delete/{id}', 'Admin\Post', 'delete');
uri('admin/post/breaking-news/{id}', 'Admin\Post', 'breakingNews');
uri('admin/post/selected/{id}', 'Admin\Post', 'selected');
// banners
uri('admin/banner', 'Admin\Banner', 'index');
@ -257,8 +231,6 @@ uri('admin/banner/edit/{id}', 'Admin\Banner', 'edit');
uri('admin/banner/update/{id}', 'Admin\Banner', 'update', 'POST');
uri('admin/banner/delete/{id}', 'Admin\Banner', 'delete');
// users
uri('admin/user', 'Admin\User', 'index');
@ -267,13 +239,10 @@ uri('admin/user/update/{id}', 'Admin\User', 'update', 'POST');
uri('admin/user/delete/{id}', 'Admin\User', 'delete');
uri('admin/user/permission/{id}', 'Admin\User', 'permission');
//comments
uri('admin/comment', 'Admin\Comment', 'index');
uri('admin/comment/change-status/{id}', 'Admin\Comment', 'changeStatus');
// menu
uri('admin/menu', 'Admin\Menu', 'index');
@ -283,39 +252,29 @@ uri('admin/menu/edit/{id}', 'Admin\Menu', 'edit');
uri('admin/menu/update/{id}', 'Admin\Menu', 'update', 'POST');
uri('admin/menu/delete/{id}', 'Admin\Menu', 'delete');
//web setting
uri('admin/web-setting','Admin\WebSetting','index');
uri('admin/web-setting/set','Admin\WebSetting','set');
uri('admin/web-setting/store','Admin\WebSetting','store','POST');
uri('admin/web-setting', 'Admin\WebSetting', 'index');
uri('admin/web-setting/set', 'Admin\WebSetting', 'set');
uri('admin/web-setting/store', 'Admin\WebSetting', 'store', 'POST');
// Auth
uri('register','Auth\Auth','register');
uri('register/store','Auth\Auth','registerStore', "POST");
uri('activation/{verify_token}','Auth\Auth','activation');
uri('login','Auth\Auth','login');
uri('check-login','Auth\Auth','checkLogin', "POST");
uri('logout','Auth\Auth','logout');
uri('forgot','Auth\Auth','forgot');
uri('forgot/request','Auth\Auth','forgotRequest', "POST");
uri('reset-password-form/{forgot_token}','Auth\Auth','resetPasswordView');
uri('reset-password/{forgot_token}','Auth\Auth','resetPassword', "POST");
uri('register', 'Auth\Auth', 'register');
uri('register/store', 'Auth\Auth', 'registerStore', "POST");
uri('activation/{verify_token}', 'Auth\Auth', 'activation');
uri('login', 'Auth\Auth', 'login');
uri('check-login', 'Auth\Auth', 'checkLogin', "POST");
uri('logout', 'Auth\Auth', 'logout');
uri('forgot', 'Auth\Auth', 'forgot');
uri('forgot/request', 'Auth\Auth', 'forgotRequest', "POST");
uri('reset-password-form/{forgot_token}', 'Auth\Auth', 'resetPasswordView');
uri('reset-password/{forgot_token}', 'Auth\Auth', 'resetPassword', "POST");
//home
uri('/','App\Home','index');
uri('home','App\Home','index');
uri('show-post/{id}','App\Home','show');
uri('show-category/{id}','App\Home','category');
uri('comment-store','App\Home','commentStore', 'POST');
uri('/', 'App\Home', 'index');
uri('home', 'App\Home', 'index');
uri('show-post/{id}', 'App\Home', 'show');
uri('show-category/{id}', 'App\Home', 'category');
uri('comment-store', 'App\Home', 'commentStore', 'POST');
echo '404 - not found';
exit;
exit;

0
public/admin-panel/.DS_Store vendored Normal file → Executable file
View file

0
public/admin-panel/css/.DS_Store vendored Normal file → Executable file
View file

0
public/admin-panel/css/bootstrap.min.css vendored Normal file → Executable file
View file

0
public/admin-panel/css/style.css Normal file → Executable file
View file

0
public/admin-panel/js/.DS_Store vendored Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.bundle.js vendored Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.bundle.js.map Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.bundle.min.js vendored Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.bundle.min.js.map Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.js vendored Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.js.map Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.min.js vendored Normal file → Executable file
View file

0
public/admin-panel/js/bootstrap.min.js.map Normal file → Executable file
View file

0
public/admin-panel/js/mdb.min.js vendored Normal file → Executable file
View file

0
public/app/.DS_Store vendored Normal file → Executable file
View file

0
public/app/css/.DS_Store vendored Normal file → Executable file
View file

0
public/app/css/animate.min.css vendored Normal file → Executable file
View file

0
public/app/css/bootstrap.css vendored Normal file → Executable file
View file

0
public/app/css/bootstrap.map Normal file → Executable file
View file

0
public/app/css/bootstrap/bootstrap-grid.css vendored Normal file → Executable file
View file

0
public/app/css/bootstrap/bootstrap-reboot.css vendored Normal file → Executable file
View file

0
public/app/css/bootstrap/bootstrap.css vendored Normal file → Executable file
View file

0
public/app/css/font-awesome.min.css vendored Normal file → Executable file
View file

0
public/app/css/jquery-ui.css vendored Normal file → Executable file
View file

0
public/app/css/linearicons.css Normal file → Executable file
View file

0
public/app/css/magnific-popup.css Normal file → Executable file
View file

0
public/app/css/main.css Normal file → Executable file
View file

0
public/app/css/main.map Normal file → Executable file
View file

0
public/app/css/nice-select.css Normal file → Executable file
View file

0
public/app/css/owl.carousel.css Normal file → Executable file
View file

0
public/app/fonts/.DS_Store vendored Normal file → Executable file
View file

0
public/app/fonts/FontAwesome.otf Normal file → Executable file
View file

0
public/app/fonts/Linearicons-Free.eot Normal file → Executable file
View file

0
public/app/fonts/Linearicons-Free.svg Normal file → Executable file
View file

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 201 KiB

0
public/app/fonts/Linearicons-Free.ttf Normal file → Executable file
View file

0
public/app/fonts/Linearicons-Free.woff Normal file → Executable file
View file

0
public/app/fonts/Linearicons-Free.woff2 Normal file → Executable file
View file

0
public/app/fonts/fontawesome-webfont.eot Normal file → Executable file
View file

0
public/app/fonts/fontawesome-webfont.svg Normal file → Executable file
View file

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

0
public/app/fonts/fontawesome-webfont.ttf Normal file → Executable file
View file

0
public/app/fonts/fontawesome-webfont.woff Normal file → Executable file
View file

0
public/app/fonts/fontawesome-webfont.woff2 Normal file → Executable file
View file

0
public/app/fonts/rezvan/Rezvan.eot Normal file → Executable file
View file

0
public/app/fonts/rezvan/Rezvan.ttf Normal file → Executable file
View file

0
public/app/fonts/rezvan/Rezvan.woff Normal file → Executable file
View file

0
public/app/fonts/vazir/Vazir.eot Normal file → Executable file
View file

0
public/app/fonts/vazir/Vazir.ttf Normal file → Executable file
View file

0
public/app/fonts/vazir/Vazir.woff Normal file → Executable file
View file

0
public/app/fonts/vazir/Vazir.woff2 Normal file → Executable file
View file

0
public/app/js/.DS_Store vendored Normal file → Executable file
View file

0
public/app/js/easing.min.js vendored Normal file → Executable file
View file

0
public/app/js/hoverIntent.js Normal file → Executable file
View file

0
public/app/js/jquery-ui.js vendored Normal file → Executable file
View file

0
public/app/js/jquery.ajaxchimp.min.js vendored Normal file → Executable file
View file

0
public/app/js/jquery.magnific-popup.min.js vendored Normal file → Executable file
View file

0
public/app/js/jquery.nice-select.min.js vendored Normal file → Executable file
View file

0
public/app/js/mail-script.js Normal file → Executable file
View file

0
public/app/js/main.js Normal file → Executable file
View file

0
public/app/js/mn-accordion.js Normal file → Executable file
View file

0
public/app/js/owl.carousel.min.js vendored Normal file → Executable file
View file

0
public/app/js/superfish.min.js vendored Normal file → Executable file
View file

0
public/app/js/vendor/bootstrap.min.js vendored Normal file → Executable file
View file

0
public/app/js/vendor/jquery-2.2.4.min.js vendored Normal file → Executable file
View file

0
public/app/scss/.DS_Store vendored Normal file → Executable file
View file

0
public/app/scss/bootstrap.scss vendored Normal file → Executable file
View file

0
public/app/scss/bootstrap/.DS_Store vendored Normal file → Executable file
View file

0
public/app/scss/bootstrap/_alert.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_badge.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_breadcrumb.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_button-group.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_buttons.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_card.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_carousel.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_close.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_code.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_custom-forms.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_dropdown.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_forms.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_functions.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_grid.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_images.scss Normal file → Executable file
View file

0
public/app/scss/bootstrap/_input-group.scss Normal file → Executable file
View file

Some files were not shown because too many files have changed in this diff Show more