1
votes

I have a system on the production server which I want to emulate in local to update it but the previous programmer have use a strange architecture. There is a codeigniter architecture and another one inside the first...

  • application
    • admin (which content controller and models... probably unused)
    • common (language and models...)
    • controllers
    • js (why here...)
    • kanri
      • cache, config, controllers, core, helpers, models, views, ...
    • user
      • cache, config, controllers, core, helpers, models, views, ...
  • system
  • etc...

I had a lot of fun to emulate this on my local machine because all path are absolute, yeepee. So currently, it's on my localhost, correctly configurated but when I try to login, the page just reload. I found out the method login of the controller login (so kanri/login/login) is called but always routed to kanri/login/index.

On the index page, there is only a form which redirect to the kanri/login/login method, so even the simple redirection do not work.

The file kanri/route.php :

defined('BASEPATH') OR exit('No direct script access allowed');
$route['default_controller'] = 'login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

The main .htaccess :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^kanri(/(.*))?$ kanri.php?/$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^user(/(.*))?$ user.php?/$2 [L]
</IfModule>

MY_Controller :

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Controller extends CI_Controller {

public function __construct()
{
    parent::__construct();

    if($this->session->userdata('flag_admin_login')===FALSE || empty($this->session->userdata('flag_admin_login'))){
        //print "***".$this->session->userdata('member_id')."!!!!!";
        redirect('/', 'refresh');
    }
}
}

My Login controller :

class Login extends CI_Controller {
    public function __construct()
    {
        parent::__construct();
        echo $this->router->fetch_class() . "<br/>"; // display the controller
        echo $this->router->fetch_method() . "<br/>"; //display the method
    }

    public function index(){
        //all code commented
    }

    public function login(){
        //all code commented
    }
} 

I have a lot to work to do on it and I'm still stuck on the running... Thanks for your time!

1
using HMVC? i.e. are the controller extending MX_Controller? - Alex
Nop, it's extending CI_controller - Eiji
Then I've got no clue how that structure was ever working. If one isn't using HMVC controllers have to be in the controllers folder. - Alex
Currently, there is a lot of controller in different folder... In the original "controllers" folder of the initial setup, in "admin", in "kanri" and in "user"... In the subfolder "core" of the "Kanri", there is a "MY_Controller" than I have add on the previous post, but... nothing like HMVC... - Eiji
Yes, I see that, hence my comment. If it's not HMVC it must be a serious hack - in which case I doubt you'll find help on code we can't see. - Alex

1 Answers

0
votes

The solution was quite simple...

$config['uri_protocol'] = 'REQUEST_URI';
$config['enable_query_strings'] = FALSE;