The key to PHPRunner/Joomla integration is to display PHPRunner app in iframe. There are at least two ways to do so. We'll walk through both, step by step.
1. Wrapper extension (com_wrapper).
Copy components/com_wrapper/views/wrapper/tmpl/default.php to templates/<your_template_here>/html/com_wrapper/wrapper/default.php. Default template in Joomla 1.5 is 'rhuk_milkyway' so you need to copy default.php to templates/rhuk_milkyway/html/com_wrapper/wrapper folder.
Modify com_wrapper/views/wrapper/tmpl/default.php the following way (see changes in bold).
We retrieve the current session id and pass it to PHPRunner application via URL.
Quote
$session =& JFactory::getSession();
$sid = $session->getId();
?>
...
name="iframe"
src="<?php echo $this->wrapper->url . "?sessionid=$sid"; ?>"
width="<?php echo $this->params->get( 'width' ); ?>"
...
Once you made this change create a new menu item in Joomla choosing Wrapper as a menu item type. Enter your application URL as a Wrapper URL. Make sure URL points to PHP page i.e. http://localhost/joo...rscars_list.php or http://localhost/joo...unner/menu.php.
It doesn't really matter where PHPRunner application is located, just make sure it uses the same database as Joomla does.
2. Wrapper plugin.
Another approach is to use iframe plugin.
We'll need to implement a similar change in plugins/content/plg_iframe.php file. See changes in bold.
Quote
defined( '_JEXEC' ) or die();
$session =& JFactory::getSession();
$sid = $session->getId();
jimport( 'joomla.event.plugin' );
...
$params0['src'] = (@$params0['src'])? $params0['src']."?sessionid=$sid":$this->params->get( 'src', 'http://www.luyenkim.net' );
if($url !='') {
...
Now you can insert the following in any article:
Quote
You can use any of methods above or even both methods together.
3. Add Joomla sessions support to PHPRunner application
Now we need to make PHPRunner application understand Joomla session id.
Add the following code to 'After application initialized' event.
$jconn=db_connect();
// Get sessionvariable of Joomla-Session over the URL which passes the Joomla-Wrapper to the iframe
if (@$_GET["sessionid"])
$_SESSION["sessionid"] = @$_GET["sessionid"];
if (@$_SESSION["sessionid"])
{
//Get the values out of the jos-session-table:
$rs=db_query("select * from `jos_session` where session_id='" . $_SESSION["sessionid"]. "'",$jconn);
$data=db_fetch_array($rs);
if($data)
// log in
{
$_SESSION["UserID"] = $data["username"];
$_SESSION["GroupID"] = $data["usertype"];
if ($data["gid"]>=24)
$_SESSION["AccessLevel"] = ACCESS_LEVEL_ADMINGROUP;
else
$_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;
}
else
// log out
{
$_SESSION["UserID"] = "";
$_SESSION["AccessLevel"] = "";
$_SESSION["GroupID"] = "";
}
}
This will logon you to PHPRunner application automatically. It will log out you automatically as well.
If your PHPRunner applications uses advanced security options or AfterSuccessfulLogin event you need to copy some code from login.php to 'After application initialized' event.
Open login.php file in any text editor and find the following section:
if($logged)
{
$_SESSION["UserID"] = $pUsername;
$_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;
...
if($myurl)
header("Location: ".$myurl);
else
header("Location: ".$defaulturl);
return;
}
Select and copy everything between $_SESSION["AccessLevel"] = ACCESS_LEVEL_USER; and if($myurl)
Paste it to the end of 'After application initialized' event;
4. Static permissions
You may want to use Joomla's user groups. For this purpose turn on User Group Permissions in PHPRunner and create one or more groups named after Joomla usergroups.
Super Administrator
Administrator
Manager
Publisher
Editor
Author
Registered
5. Further considerations
- dynamic permissions
It is possible to make Joomla/PHPRunner work with dynamic permissions though it requires some code changes in PHPRunner. Technically speaking we'll need to modify admin area to read a list of groups from jos_core_acl_aro_groups table and disable 'user management' and 'assign users to groups' pages. We'll implement this in one of the following versions.
Here is how it looks in action

Update
According to number of votes we received via email here is the list of what we should implement next.
Drupal
Wordpress
Typo3
http://www.cmsmadesimple.org/
xoops.org
X-site Pro 2
http://www.concrete5.org/
redaxo
SPIP
glfusion

Sign In
Register
Help

MultiQuote