Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
41
application/core/MY_Controller.php
Normal file
41
application/core/MY_Controller.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class MY_Controller extends CI_Controller
|
||||
{
|
||||
protected $rtn = ['ok' => true, 'msg' => ''];
|
||||
protected $classes = [];
|
||||
|
||||
/**
|
||||
* MY_Controller constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// var_dump(get_cookie('bs_admin'));die;
|
||||
if (!get_cookie('bs_admin')) {
|
||||
redirect('/');
|
||||
}
|
||||
// $this->load->database();
|
||||
}
|
||||
|
||||
public function getPage($func_name)
|
||||
{
|
||||
return strtolower(get_class($this)) . DIRECTORY_SEPARATOR . strtolower($func_name);
|
||||
}
|
||||
|
||||
protected function &getClass($package, $class, $args = array())
|
||||
{
|
||||
if (empty($this->classes[$package . $class]))
|
||||
$this->classes[$package . $class] = $this->classloader->load($package, $class, $args);
|
||||
return $this->classes[$package . $class];
|
||||
}
|
||||
|
||||
protected function response($body)
|
||||
{
|
||||
$this->output
|
||||
->set_status_header(200)
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($body));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user