The bugzilla (perl-based) system has a feature to login automatically by using a http server environment variable. If you fill in the right ID or username, you are automatically logged in.
bugzilla(基于perl的)系统具有使用http服务器环境变量自动登录的功能。如果您填写正确的ID或用户名,您将自动登录。
My server runs Joomla (PHP-based) and has all the information about who is logged in. It runs bugzilla within a sub-frame.
我的服务器运行Joomla(基于PHP)并拥有有关谁登录的所有信息。它在子帧中运行bugzilla。
So, how can I set this enviroment value from a PHP script?
那么,我如何从PHP脚本中设置此环境值?
To put it in another way, how does the following script return my own-set variable elsewhere in a session from PHP:
换句话说,以下脚本如何在PHP的会话中的其他地方返回我自己的set变量:
#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
while (($key, $val) = each %ENV) {
print "$key = $val<BR>\n";
}
2 个解决方案
#1
0
This is only a guess, but (assuming you are using Apache2) you can set environment variables using apache_setenv()
. However this will only last for the lifetime of the current http request, so I'm not sure how you make it work - the request for the bugzilla page from your browser frame will be considered completely separate by Apache. You might be able to use virtual()
to invoke a sub-request to Bugzilla which should then be able see that environment variable. I'm not sure whether you would need to do that for every Bugzilla page request or just the one that initiates the login.
这只是猜测,但(假设您使用的是Apache2),您可以使用apache_setenv()设置环境变量。但是这只会持续当前http请求的生命周期,所以我不确定你是如何使它工作的 - 浏览器框架中对bugzilla页面的请求将被Apache视为完全独立。您可以使用virtual()来调用Bugzilla的子请求,然后应该能够看到该环境变量。我不确定您是否需要为每个Bugzilla页面请求或仅启动登录的请求执行此操作。
Sorry if I've missed the point or got this very wrong
对不起,如果我错过了这一点或者弄错了
#2
0
I'm not sure about what you need to do to create the session in Bugzilla, but I do know what needs to happen on Joomla!'s end: you will want to create a user plugin that responds to the onLoginUser event. For an example of this in action, take a look at the onLoginUser function in plugins/user/joomla.php.
我不确定你在Bugzilla中创建会话需要做什么,但我知道Joomla需要做什么!最后:你需要创建一个响应onLoginUser事件的用户插件。有关此操作的示例,请查看plugins / user / joomla.php中的onLoginUser函数。
(Note, this is only for Joomla! 1.5)
(注意,这仅适用于Joomla!1.5)
#1
0
This is only a guess, but (assuming you are using Apache2) you can set environment variables using apache_setenv()
. However this will only last for the lifetime of the current http request, so I'm not sure how you make it work - the request for the bugzilla page from your browser frame will be considered completely separate by Apache. You might be able to use virtual()
to invoke a sub-request to Bugzilla which should then be able see that environment variable. I'm not sure whether you would need to do that for every Bugzilla page request or just the one that initiates the login.
这只是猜测,但(假设您使用的是Apache2),您可以使用apache_setenv()设置环境变量。但是这只会持续当前http请求的生命周期,所以我不确定你是如何使它工作的 - 浏览器框架中对bugzilla页面的请求将被Apache视为完全独立。您可以使用virtual()来调用Bugzilla的子请求,然后应该能够看到该环境变量。我不确定您是否需要为每个Bugzilla页面请求或仅启动登录的请求执行此操作。
Sorry if I've missed the point or got this very wrong
对不起,如果我错过了这一点或者弄错了
#2
0
I'm not sure about what you need to do to create the session in Bugzilla, but I do know what needs to happen on Joomla!'s end: you will want to create a user plugin that responds to the onLoginUser event. For an example of this in action, take a look at the onLoginUser function in plugins/user/joomla.php.
我不确定你在Bugzilla中创建会话需要做什么,但我知道Joomla需要做什么!最后:你需要创建一个响应onLoginUser事件的用户插件。有关此操作的示例,请查看plugins / user / joomla.php中的onLoginUser函数。
(Note, this is only for Joomla! 1.5)
(注意,这仅适用于Joomla!1.5)