Welcome Guest, Not a member yet? Register   Sign In
EzAuth 0.6 - The Easiest User Management System for CI
#42

[eluser]Unknown[/eluser]
Just found an issue with the _remap() method supplied - it was shifting my segments if the controller was in a folder. The issue is the hardcoded 2 value...

For example, http://example.com/controllerfolder/test/page/1/2/3 would render "page, 1, 2" instead of "1, 2, 3"

Code:
class Test extends Controller {    
    function __construct()
    {
        parent::__construct();
    }
    
    function page($id1='', $id2='', $id3='')
    {
        die($id1.', '.$id2.', '.$id3); //$id1 == "page" - wrong!
    }

    function _remap($method)
    {
        $auth = $this->ezauth->authorize($method, true);
        if ($auth['authorize'] == 'yes') {
            $segments = array_slice($this->uri->segment_array(),2);    //redirect with method arguments by marlar on CodeIgniter forums
            call_user_func_array(array(&$this, $method), $segments);
        } else {
            // user login information incorrect, so show login screen again
            $this->login();
        }
    }
}


Here's my fix:

Code:
// remap for ezauth
    function _remap($method)
    {
        $auth = $this->ezauth->authorize($method, true);
        if ($auth['authorize'] == 'yes')
        {
            
            // find method in segment (fix)
            $i=1;
            foreach($this->uri->rsegment_array() as $segment)
            {
                if($segment == $method) break;
                $i++;
            }
            
            $segments = array_slice($this->uri->rsegment_array(),$i);    //redirect with method arguments
            call_user_func_array(array(&$this, $method), $segments);
        }
        else
        {
            // user login information incorrect, so show login screen again
            $this->login();
        }
    }


Messages In This Thread
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 01-31-2008, 12:40 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-01-2008, 07:45 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-01-2008, 08:17 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-01-2008, 09:36 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-01-2008, 12:48 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-01-2008, 01:06 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-01-2008, 01:47 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-12-2008, 09:49 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-12-2008, 11:00 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-12-2008, 11:11 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-22-2008, 01:04 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-22-2008, 01:08 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-22-2008, 09:12 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 03-22-2008, 03:43 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 04-23-2008, 11:40 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 06-23-2008, 11:06 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 06-24-2008, 01:07 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 06-29-2008, 05:59 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 07-05-2008, 03:08 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 07-29-2008, 04:32 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 07-31-2008, 12:25 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 07-31-2008, 12:29 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 10-30-2008, 12:31 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 11-01-2008, 06:21 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 11-01-2008, 10:18 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 11-03-2008, 05:51 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 12-11-2008, 04:32 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 12-27-2008, 02:53 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 12-29-2008, 01:48 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 12-29-2008, 01:59 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 12-29-2008, 02:44 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 12-29-2008, 03:05 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-22-2009, 05:50 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-25-2009, 06:58 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-25-2009, 07:06 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-25-2009, 07:51 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-25-2009, 08:06 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-26-2009, 01:52 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 02-26-2009, 09:56 AM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 09-19-2009, 01:52 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 01-11-2010, 02:49 PM
EzAuth 0.6 - The Easiest User Management System for CI - by El Forum - 06-16-2010, 12:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB