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

CI_Guy
  • 1,039
  • 2
  • 22
  • 39
  • Does the file security.php exist in the library-folder? – Tobias Aug 30 '11 at 08:04
  • 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 Aug 30 '11 at 08:19
  • 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 Aug 30 '11 at 08:47
  • 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 Aug 30 '11 at 08:47
  • 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 Aug 30 '11 at 08:50
  • not sure whys its NOT finding it , ment to say in previous post but was too late to edit it – CI_Guy Aug 30 '11 at 08:53
  • If you creates a new module, with a controller in it and only load the security-library - do you get the same error? – Tobias Aug 30 '11 at 08:59
  • 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.. – CI_Guy Aug 30 '11 at 09:01
  • 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. – Tobias Aug 30 '11 at 09:05
  • still dont understand why it can't find the auth_tank config file though – CI_Guy Aug 30 '11 at 09:05
  • If i create a normal controller (not module) and try to load library it says same error. – CI_Guy Aug 30 '11 at 09:08
  • 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. – Tobias Aug 30 '11 at 09:15
  • 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? – CI_Guy Aug 30 '11 at 09:19
  • 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 hmvc – CI_Guy Aug 30 '11 at 10:46
  • any one have a ci install w tank auth running through hmvc? i have followed the directions andam lost – CI_Guy Aug 30 '11 at 12:06
  • 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 everything – CI_Guy Aug 30 '11 at 12:59

7 Answers7

4

it is in Helper now according to CodeIgniter 3.0 user guide

try:

$this->load->helper('security');
Haseeb
  • 2,214
  • 1
  • 22
  • 43
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

Jorch
  • 64
  • 2
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 { }
biegleux
  • 13,179
  • 11
  • 45
  • 52
proczek
  • 21
  • 1
0

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

load->library('../core/security');
TeamG
  • 1
  • 2
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.

user229044
  • 232,980
  • 40
  • 330
  • 338
Parth Chavda
  • 1,819
  • 1
  • 23
  • 30
0

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

CI_Guy
  • 1,039
  • 2
  • 22
  • 39
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');

Andrew
  • 2,046
  • 1
  • 24
  • 37