56 lines
2.2 KiB
PHP
Executable File
56 lines
2.2 KiB
PHP
Executable File
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Data extends CI_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
define("HOOSK_ADMIN",1);
|
|
$this->load->model('Cmap_model');
|
|
$this->load->helper(array('admincontrol', 'url', 'hoosk_admin', 'file', 'form'));
|
|
$this->load->library('session');
|
|
define ('LANG', $this->Cmap_model->getLang());
|
|
$this->lang->load('admin', LANG);
|
|
//Define what page we are on for nav
|
|
$this->data['current'] = $this->uri->segment(2);
|
|
define ('SITE_NAME', $this->Cmap_model->getSiteName());
|
|
define('THEME', $this->Cmap_model->getTheme());
|
|
define ('THEME_FOLDER', BASE_URL.'/theme/'.THEME);
|
|
//check session exists
|
|
Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
|
|
$this->load->library('cacher');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
|
|
$this->data['footer'] = $this->load->view('admin/footer', '', true);
|
|
$source = $this->uri->segment(3);
|
|
$section = $this->uri->segment(4);
|
|
if($section) {
|
|
echo json_encode($this->cacher->{$source}($section));
|
|
}else {
|
|
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
|
|
$this->data['footer'] = $this->load->view('admin/footer', '', true);
|
|
$this->load->view('admin/data_'. $source, $this->data);
|
|
}
|
|
}
|
|
|
|
public function post()
|
|
{
|
|
$source = $this->uri->segment(3);
|
|
$section = $this->uri->segment(4);
|
|
$articleID = $this->uri->segment(5);
|
|
$this->data['header'] = $this->load->view('admin/header', $this->data, true);
|
|
$this->data['footer'] = $this->load->view('admin/footer', '', true);
|
|
if($articleID) {
|
|
$this->data['article'] = $this->cacher->{$source}($section)[$articleID-1];
|
|
$this->data['article'] = array_merge($this->data['article'], $this->cacher->{$source}($section, $this->data['article']['url'])[0]);
|
|
$this->load->view('admin/data_post', $this->data);
|
|
}else {
|
|
$this->load->view('admin/data_'. $source, $this->data);
|
|
}
|
|
}
|
|
|
|
}
|