Welcome Guest, Not a member yet? Register   Sign In
Integrate with joomla 3 auth. system
#1

I have a joomla 3 website and i want to create a simple application using CI3, i wondered is it possible (in other word, how i can) integrate my CI3 application with joomla login / acl system?
ressan.ir
CI is nice Heart
Reply
#2

I asked this question in joomla forum[http://forum.joomla.org/viewtopic.php?f=...&p=3321459] , luckly is has an easy solution ( at least for some cases).

here 2 links for that, thanks for joomla/codeigniter community :

http://perfexionit.com/codeigniter-jooml...on-part-1/

http://perfexionit.com/codeigniter-jooml...on-part-2/
ressan.ir
CI is nice Heart
Reply
#3

Now I can copy some lines of code from joomla's index.php file and pase then into codeigniter's index.php and get logined joomla user info:

CI3's index.php file :
PHP Code:
...
// joooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooomla
if (version_compare(PHP_VERSION'5.3.1''<'))
{
die(
'Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!');
}
 
define('_JEXEC'1);

if (
file_exists(realpath(__DIR__ '/..') . '/defines.php'))
{
include_once 
realpath(__DIR__ '/..') . '/defines.php';
}
 
if (!
defined('_JDEFINES'))
{
define('JPATH_BASE'realpath(__DIR__ '/..'));
require_once 
JPATH_BASE '/includes/defines.php';
}
 
require_once 
JPATH_BASE '/includes/framework.php';
// jooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooomla


/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 */
... 

and in any index function of default welcome.php controller :
PHP Code:
...
    public function 
index()
    {
            
$this->output->enable_profiler(TRUE);

            
$this->joomla_app JFactory::getApplication('site');
            
$this->joomla_app->initialise();
            
$this->user JFactory::getUser();
            if(
$this->user->id 0)
            {
                
$this->user_groups $this->user->getAuthorisedGroups();
            }
            
            
print_r($this->user->id);
            echo 
'<br/>';

            
print_r($this->user_groups);
            echo 
'<br/>';
            
            
print_r($this->user->getAuthorisedViewLevels());
            
            
            
        
$this->load->view('welcome_message');
    }
... 

i wondered how it add extra resource usage to normal ci application? i activated ci's profiler and here is some memory usage in different cases:

Just unchanged CI3 welcome page :
~269,000 bytes

Just copied require_once JPATH_BASE . '/includes/framework.php' line into CI's index.php file:
~330,000 bytes

Copies required include file and some lines of code for retrieve user's id and groups (above second code block):
~761,000 bytes

now is it good choice to use this method (checking joomla user) in every page/controller/function? (my application need to check user's access almost in every action)

in real web application/or website, this solution can make issues?
ressan.ir
CI is nice Heart
Reply
#4

Hi, i have a simple CI application and i want to create a simple module for joomla for injecting some parts of my CI application into that, so i have created a library in CI and some function for that, and one simple module for joomla, now i want to create an object (instance of CI's library) and print its output to user.

now problem is that : which (minimum) files (of CI) i have to include in joomla, to CI works?
ressan.ir
CI is nice Heart
Reply




Theme © iAndrew 2016 - Forum software by © MyBB