Setting up Codeigniter HMVC with tank auth
Asked Answered
A

7

10

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

Allowed answered 30/8, 2011 at 6:33 Comment(16)
Does the file security.php exist in the library-folder?Foilsman
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?Allowed
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 problemsAllowed
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.Foilsman
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 ownAllowed
not sure whys its NOT finding it , ment to say in previous post but was too late to edit itAllowed
If you creates a new module, with a controller in it and only load the security-library - do you get the same error?Foilsman
yes, just tried with with a module that only included a controller with a call : $this->load->library('security'); and I get same error as before but if i change it to $this->load->helper('security') it works fine. This is a fresh install of codeigniter so I didnt remove any original libraries/helpers etc..Allowed
What happens if you put a new controller within your original controller-folder? (Not within a module) and try the same thing? Might be some setting within HMVC that messes things up.Foilsman
still dont understand why it can't find the auth_tank config file thoughAllowed
If i create a normal controller (not module) and try to load library it says same error.Allowed
I'd suggest you redownload and reinstall codeigniter from scratch and at each step you do - try to debug and test everything (especially $this->load->library('security')). When you find the source of the problem it's much easier to find how to solve it.Foilsman
I'm using another copy of the same installation just without the HMVC and tank auth is calling security library just fine...so what else could it be?Allowed
i have redone ci reinstall and hmv step by step and am getting same error w tank auth..why did the hmvc developer even bother making it w o documentation...stupid. im done being frustrated..giving up on hmvcAllowed
any one have a ci install w tank auth running through hmvc? i have followed the directions andam lostAllowed
I have tried to set up hmvc and CI 2.0.3 and made a simple module with just a controller to try to load the security library and im running into the same problem. this is without trying to install tank auth. I followed the directions perfect for both hvmc installation and CI. Is it possible to zip up the files so someone can look at what im doing? it wouldn't be practical to try to copy and paste everythingAllowed
H
4

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

Hibernal answered 10/10, 2011 at 15:28 Comment(2)
try this : $this->load->helper('security');Rhapsodize
and replace $this->security->xss_clean(); to `xss_clean();Lilli
R
4

it is in Helper now according to CodeIgniter 3.0 user guide

try:

$this->load->helper('security');
Rhapsodize answered 18/5, 2015 at 6:29 Comment(1)
so you mean this is helper not libraryJigging
N
2

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 { }
Naarah answered 2/9, 2012 at 17:5 Comment(0)
A
0

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

Allowed answered 31/8, 2011 at 16:55 Comment(0)
S
0
  • 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');

Sismondi answered 4/10, 2011 at 20:37 Comment(0)
N
0

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

load->library('../core/security');
Nystagmus answered 2/4, 2013 at 11:26 Comment(0)
R
0

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.

Roland answered 20/1, 2016 at 12:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.