开发者

Setting up Codeigniter HMVC with tank auth

开发者 https://www.devze.com 2023-03-31 11:09 出处:网络
I am having trouble getting a working Codeigniter version 2.0.3 with hmvc and tank auth(set up as a module) setup properly. I have installed CI properlly and then install HMVC with these directions ht

I am having trouble getting a working Codeigniter version 2.0.3 with hmvc and tank auth(set up as a module) setup properly. I have installed CI properlly and then install HMVC with these directions https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home

I get to my welcome controller/view as example just fine which means the HMVC is working. Next I try to add tank auth to the project by adding it to a folder in the modules folder. It has the proper controller/view/model etc.. setup within the tank auth. I even added in routes something like

$route["auth"]="auth/login";

I also extended the controller within the auth module to MX_Controller like as directed. Also in the constructor I have :

$this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
    $this->load->library('security')开发者_StackOverflow; <--failing to load this

    $this->load->library('tank_auth');
    $this->lang->load('tank_auth');
     $this->form_validation->CI =& $this;

It seems to be redirecting fine to the module however it comes up with an error saying ::

An Error Was Encountered

Unable to load the requested class: security

What am I doing wrong? Does any one have a working CI installation with HMVC and tank auth as a module so I can see how its done? I'm new to HMVC, thanks


I found the same problem, but i solved by simple adding a comment to the

$this->load->library('security');

so it will look like this:

//$this->load->library('security');

since security its now part of the codeigniter core, i guess its already loaded by default, and everything seems to be working pretty good


it is in Helper now according to CodeIgniter 3.0 user guide

try:

$this->load->helper('security');


I fix this, by creating Security.php file in application/libraries directory with the following code:

require_once(BASEPATH.'core/Security.php');

class Security extends CI_Security { }


I found a solution, I simply took the security.php file from codeigniters system/core folder and dropped it into system/libraries.


  • move the file security.php from system/core to system/libraries

  • then edit core/codeigniter.php line number 204 from $SEC =& load_class('Security', 'core'); to $SEC =& load_class('Security', 'libraries');


Security.php is present in "codeigniter/system/core/Security.php" so provide this path your problem gets solved easily

load->library('../core/security');


I Read CodeIgniter 3.X User Guide and I was found that "Security" is available as a 'helper' Now.

So you need to change this;

$this->load->library('security');

into

$this->load->helper('security');

XSS Filtering

The Input class has the ability to filter input automatically to prevent cross-site scripting attacks. If you want the filter to run automatically every time it encounters POST or COOKIE data you can enable it by opening your application/config/config.php file and setting this:

$config['global_xss_filtering'] = TRUE;

You need to read a CodeIgniter 3.0 User Guide there are so many changes and implementation or please Refer change log.

0

精彩评论

暂无评论...
验证码 换一张
取 消