Permalink
Browse files

Adds RSS Feed, Session check

- Added an ajax session check which will prompt if session has expired
and you need to log in again.
- Ajax session check before saving page allowing you to log in again
then save without losing changes.
- Added RSS and Atom feeds.
- Added Hoosk news feed into the dashboard.
  • Loading branch information...
havok89 committed Dec 27, 2016
1 parent 30ac119 commit 887f2fa1d2e30fe71a2a8e65ac1c193f727839a5
Showing with 1,838 additions and 542 deletions.
  1. +3 −1 hoosk/hoosk0/config/routes.php
  2. +22 −0 hoosk/hoosk0/controllers/Hoosk_default.php
  3. +50 −31 hoosk/hoosk0/controllers/admin/Admin.php
  4. +3 −11 hoosk/hoosk0/controllers/admin/Categories.php
  5. +4 −11 hoosk/hoosk0/controllers/admin/Navigation.php
  6. +4 −17 hoosk/hoosk0/controllers/admin/Pages.php
  7. +5 −12 hoosk/hoosk0/controllers/admin/Posts.php
  8. +3 −7 hoosk/hoosk0/controllers/admin/Users.php
  9. +7 −1 hoosk/hoosk0/helpers/hoosk_page_helper.php
  10. +3 −3 hoosk/hoosk0/language/english/admin_lang.php
  11. +287 −0 hoosk/hoosk0/libraries/Feed.php
  12. +245 −0 hoosk/hoosk0/libraries/Rssparser.php
  13. +43 −2 hoosk/hoosk0/views/admin/footer.php
  14. +21 −0 hoosk/hoosk0/views/admin/home.php
  15. +108 −95 hoosk/hoosk0/views/admin/jumbotron_edit.php
  16. +4 −4 hoosk/hoosk0/views/admin/login.php
  17. +52 −38 hoosk/hoosk0/views/admin/nav_edit.php
  18. +51 −37 hoosk/hoosk0/views/admin/nav_new.php
  19. +66 −52 hoosk/hoosk0/views/admin/page_edit.php
  20. +68 −54 hoosk/hoosk0/views/admin/page_new.php
  21. +72 −59 hoosk/hoosk0/views/admin/post_edit.php
  22. +69 −56 hoosk/hoosk0/views/admin/post_new.php
  23. +30 −0 hoosk/hoosk0/views/feed/atom.php
  24. +67 −0 hoosk/hoosk0/views/feed/rss.php
  25. +1 −1 theme/admin/css/sb-admin.css
  26. +34 −6 theme/admin/js/base.js
  27. +1 −0 theme/admin/js/filemanager/error_log
  28. BIN theme/admin/js/trevor/fonts/ST-Columns-Icons.woff
  29. +4 −4 theme/admin/js/trevor/public/images/icons/src/Close.svg
  30. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns.svg
  31. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns12.svg
  32. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns121.svg
  33. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns13.svg
  34. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns2.svg
  35. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns21.svg
  36. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns3.svg
  37. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns31.svg
  38. +4 −4 theme/admin/js/trevor/public/images/icons/src/Columns4.svg
  39. +4 −4 theme/admin/js/trevor/public/images/icons/src/Tick.svg
  40. +38 −0 theme/admin/js/trevor/sir-trevor-columns-block.all.css
  41. +38 −0 theme/admin/js/trevor/sir-trevor-columns-block.css
  42. +198 −0 theme/admin/js/trevor/sir-trevor-columns-block.js
  43. +50 −0 theme/admin/js/trevor/sir-trevor-iframe.js
  44. +50 −0 theme/admin/js/trevor/sir-trevor-imageExtended.js
  45. +30 −0 theme/dark/feed/atom.php
  46. +67 −0 theme/dark/feed/rss.php
@@ -54,6 +54,8 @@
$route['admin/login'] = "admin/admin/login";
$route['admin/login/check'] = "admin/admin/loginCheck";
$route['admin/logout'] = "admin/admin/logout";
$route['admin/check/session'] = "admin/admin/checkSession";
$route['admin/ajax/login'] = "admin/admin/ajaxLogin";
$route['admin/users'] = "admin/users";
$route['admin/users/new'] = "admin/users/addUser";
$route['admin/users/new/add'] = "admin/users/confirm";
@@ -102,7 +104,7 @@
$route['category/(:any)'] = "hoosk_default/category";
$route['article/(:any)'] = "hoosk_default/article";
$route['feed/(:any)'] = "hoosk_default/feed";
$route['(.+)'] = "hoosk_default";
$route['default_controller'] = "hoosk_default";
$route['404_override'] = '';
@@ -70,4 +70,26 @@ public function error()
$this->data['footer'] = $this->load->view('templates/footer', '', true);
$this->load->view('templates/'.$this->data['page']['pageTemplate'], $this->data);
}
public function feed()
{
if (($this->uri->segment(2)=="atom")||($this->uri->segment(2)=="rss"))
{
$posts = getFeedPosts();
$this->load->library('feed');
$feed = new Feed();
$feed->title = SITE_NAME;
$feed->description = SITE_NAME;
$feed->link = BASE_URL;
$feed->pubdate = date("m/d/y H:i:s", $posts[0]['unixStamp']);
foreach ($posts as $post)
{
$feed->add($post['postTitle'], BASE_URL.'/article/'.$post['postURL'], date("m/d/y H:i:s", $post['unixStamp']), $post['postExcerpt']);
}
$feed->render($this->uri->segment(2));
} else {
$this->error();
}
}
}
@@ -6,22 +6,25 @@ function __construct()
{
parent::__construct();
define("HOOSK_ADMIN",1);
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin'));
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'form'));
$this->load->library('session');
$this->load->model('Hoosk_model');
define ('LANG', $this->Hoosk_model->getLang());
$this->lang->load('admin', LANG);
define ('SITE_NAME', $this->Hoosk_model->getSiteName());
define('THEME', $this->Hoosk_model->getTheme());
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
}
public function index()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->data['current'] = $this->uri->segment(2);
$this->data['recenltyUpdated'] = $this->Hoosk_model->getUpdatedPages();
$this->data['recenltyUpdated'] = $this->Hoosk_model->getUpdatedPages();
$this->load->library('rssparser');
$this->rssparser->set_feed_url('http://hoosk.org/feed/rss');
$this->rssparser->set_cache_life(30);
$this->data['hooskFeed'] = $this->rssparser->getFeed(3);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/home', $this->data);
@@ -31,16 +34,16 @@ public function upload()
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$attachment = $this->input->post('attachment');
$uploadedFile = $_FILES['attachment']['tmp_name']['file'];
$path = $_SERVER["DOCUMENT_ROOT"].'/images';
$url = BASE_URL.'/images';
// create an image name
$fileName = $attachment['name'];
// upload the image
move_uploaded_file($uploadedFile, $path.'/'.$fileName);
$this->output->set_output(json_encode(array('file' => array(
'url' => $url . '/' . $fileName,
'filename' => $fileName
@@ -52,14 +55,13 @@ public function upload()
public function login()
{
//Load the form helper
$this->load->helper('form');
$this->data['header'] = $this->load->view('admin/headerlog', '', true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/login', $this->data);
}
public function loginCheck()
{
$username=$this->input->post('username');
@@ -69,45 +71,54 @@ public function loginCheck()
redirect('/admin', 'refresh');
}
else
{
{
$this->data['error'] = "1";
$this->login();
}
}
function ajaxLogin(){
$username=$this->input->post('username');
$password=md5($this->input->post('password').SALT);
$result=$this->Hoosk_model->login($username,$password);
if($result) {
echo 1;
}
else
{
echo 0;
}
}
public function logout()
{
$data = array(
'userID' => '',
'userName' => '',
'logged_in' => FALSE,
'logged_in' => FALSE,
);
$this->session->unset_userdata($data);
$this->session->sess_destroy();
$this->login();
}
public function settings()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form helper
$this->load->helper('form');
$this->load->helper('directory');
$this->data['themesdir'] = directory_map($_SERVER["DOCUMENT_ROOT"].'/theme/', 1);
$this->data['langdir'] = directory_map(APPPATH.'/language/', 1);
$this->data['settings'] = $this->Hoosk_model->getSettings();
$this->data['settings'] = $this->Hoosk_model->getSettings();
$this->data['current'] = $this->uri->segment(2);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/settings', $this->data);
}
public function updateSettings()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
if ($this->input->post('siteLogo') != ""){
//path to save the image
$path_upload = $_SERVER["DOCUMENT_ROOT"] . '/uploads/';
@@ -127,13 +138,13 @@ public function updateSettings()
}
else
{
$this->Hoosk_model->updateSettings();
redirect('/admin', 'refresh');
}
}
public function uploadLogo()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
@@ -153,24 +164,32 @@ public function uploadLogo()
}
}
}
public function social()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form helper
$this->load->helper('form');
$this->data['social'] = $this->Hoosk_model->getSocial();
$this->data['social'] = $this->Hoosk_model->getSocial();
$this->data['current'] = $this->uri->segment(2);
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
$this->load->view('admin/social', $this->data);
}
public function updateSocial()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->Hoosk_model->updateSocial();
redirect('/admin', 'refresh');
}
}
public function checkSession()
{
if(!$this->session->userdata('logged_in')){
echo 0;
} else {
echo 1;
}
}
}
@@ -7,7 +7,7 @@ function __construct()
parent::__construct();
define("HOOSK_ADMIN",1);
$this->load->model('Hoosk_model');
$this->load->helper(array('admincontrol', 'url', 'file'));
$this->load->helper(array('admincontrol', 'url', 'file', 'form'));
$this->load->library('session');
define ('LANG', $this->Hoosk_model->getLang());
$this->lang->load('admin', LANG);
@@ -16,11 +16,12 @@ function __construct()
define ('SITE_NAME', $this->Hoosk_model->getSiteName());
define('THEME', $this->Hoosk_model->getTheme());
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
}
public function index()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->library('pagination');
$result_per_page =15; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/posts/categories/';
@@ -40,9 +41,6 @@ public function index()
public function addCategory()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form helper
$this->load->helper('form');
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
@@ -51,7 +49,6 @@ public function addCategory()
public function confirm()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
@@ -72,9 +69,6 @@ public function confirm()
public function editCategory()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form helper
$this->load->helper('form');
//Get category details from database
$this->data['category'] = $this->Hoosk_model->getCategory($this->uri->segment(5));
//Load the view
@@ -85,7 +79,6 @@ public function editCategory()
public function edited()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
//Set validation rules
@@ -109,7 +102,6 @@ public function edited()
function delete()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
if($this->input->post('deleteid')):
$this->Hoosk_model->removeCategory($this->input->post('deleteid'));
redirect('/admin/posts/categories');
@@ -7,7 +7,7 @@ function __construct()
parent::__construct();
define("HOOSK_ADMIN",1);
$this->load->model('Hoosk_model');
$this->load->helper(array('admincontrol', 'url'));
$this->load->helper(array('admincontrol', 'url', 'form'));
$this->load->library('session');
define ('LANG', $this->Hoosk_model->getLang());
$this->lang->load('admin', LANG);
@@ -16,11 +16,12 @@ function __construct()
define ('SITE_NAME', $this->Hoosk_model->getSiteName());
define('THEME', $this->Hoosk_model->getTheme());
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
//check session exists
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
}
public function index()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
$this->load->library('pagination');
$result_per_page =15; // the number of result per page
$config['base_url'] = BASE_URL. '/admin/navigation/';
@@ -41,10 +42,8 @@ public function index()
public function newNav()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Get pages from database
$this->data['pages'] = $this->Hoosk_model->getPagesAll();
$this->load->helper('form');
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
@@ -53,12 +52,10 @@ public function newNav()
public function editNav()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Get pages from database
$this->data['pages'] = $this->Hoosk_model->getPagesAll();
//Get navigation from database
$this->data['nav'] = $this->Hoosk_model->getNav($this->uri->segment(4));
$this->load->helper('form');
//Load the view
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
$this->data['footer'] = $this->load->view('admin/footer', '', true);
@@ -67,7 +64,6 @@ public function editNav()
public function navAdd()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Get navigation from database
$this->data['page'] = $this->Hoosk_model->getPageNav($this->uri->segment(3));
//Load the view
@@ -76,7 +72,6 @@ public function navAdd()
public function insert()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
@@ -98,7 +93,6 @@ public function insert()
public function update()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
//Load the form validation library
$this->load->library('form_validation');
@@ -118,13 +112,12 @@ public function update()
function deleteNav()
{
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
if($this->input->post('deleteid')):
$this->Hoosk_model->removeNav($this->input->post('deleteid'));
redirect('/admin/navigation');
else:
$this->data['form']=$this->Hoosk_model->getNav($this->uri->segment(4));
$this->load->view('admin/nav_delete.php', $this->data );
$this->load->view('admin/nav_delete.php', $this->data );
endif;
}
}
Oops, something went wrong.

0 comments on commit 887f2fa

Please sign in to comment.