10
votes

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'); <--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

7
Does the file security.php exist in the library-folder? - Tobias
the security.php is part of codeigniter itself so it is not located in the modules/auth/libraries/... folder. Do i have to grab the instance of CI in order to call its libraries/helpers within constructor of a modules controller? - CI_Guy
So I changed $this->load->library('security'); to $this->load->helper('security'); and now a new error occurs , I think when it tries to load tank_auth library, saying that the configuration file tank_auth.php can not be found..although there is modules/modulename/config/tank_auth.php intact. Not sure why its finding it but I'm assuming it simliar to my other problems - CI_Guy
There are different kinds of security-files in CodeIgniter, one of them is a helper, and the other one is used to escape data on submission to the database. - Tobias
well the original tank auth calls for the library security not the helper, tank auth only uses CI's native security library and doesn't supply its own - CI_Guy

7 Answers

4
votes

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

4
votes

it is in Helper now according to CodeIgniter 3.0 user guide

try:

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

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 { }
0
votes

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

0
votes
  • 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');

0
votes

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

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

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.