Hi, I tried to get the forum work in an iframe and on my localhost. Found several issues which should be solved:
1. In the function _phpbbforum_page_inframe the following lines are buggy:
if ($scrolling = 2)
$output .= ' scrolling="auto"';
elseif ($scrolling = 1)
$output .= ' scrolling="yes"';
else
$output .= ' scrolling="no"';
They should be replaced with:
if ($scrolling == 2)
$output .= ' scrolling="auto"';
elseif ($scrolling == 1)
$output .= ' scrolling="yes"';
else
$output .= ' scrolling="no"';
2. Found another bug in _phpbbforum_set_globals:
the line:
$site_forum_url = $base_url ."/". $site_phpbb_page;
should be:
$site_forum_url = $base_url ."?q=". $site_phpbb_page;
3. And I have a suggestion:
in _phpbbforum_set_globals function the following line should be added:
define('FORUM_URL', $base_url.str_replace(realpath('.'), "", variable_get('phpbbforum_root', 0)));
and than you could replace the following line in phpbb_forum_page:
$path = $phpbb_config['forum_url'];
with this one:
$path = FORUM_URL;
and also you should replace in _phpbbforum_replace_links:
$phpbburl = '<img src="'. $phpbburl;
with:
$phpbburl = '<img src="'. FORUM_URL;
and also:
$phpbburl = '<img src="'. $phpbburl .'/images';
should be:
$phpbburl = '<img src="'. FORUM_URL .'/images';
With these changes you would solve the following issues:
- iframe scrolling settings should now work as set in the admin panel
- iframe page can point to different subdirectories and subdomains
- in the blocks you have valid working links, and valid images
Comments
Comment #1
Udi commentedComment #2
vb commented1. agree, thanks, stupid mistake
2. not agree, i am not not sure it is a bug, it is my deсision, i do not like how links looks with '?q='
3. $phpbb_config['forum_url'] is set by slightly modified phpbb function generate_board_url()
if generate_board_url() does not set url properly you can always set it manually in phpBB Admin, i do so on subdomains and all work
it is more general decision.
Your define('FORUM_URL'... does not work on my subdomain installation.
of course, i could not take all cases in account.
Comment #3
Udi commented2. It's a bug! If people want to use the modul on servers where .htaccess files must be deleted, than your decision brakes your modul, because they will get a 404 error. Without a .htaccess file the /phpbbforum url string will point to a probably non-existent directory. You have to check whether clean urls are allowed or not:
And everybody is happy :). Or you can use the built in url() function to create valid Drupal urls.
3. Yes, phpBB3 defines it's path variables fine by the installation, but by default it is set to false to use this variables, and the automatic variables are wrong. So your suggestion to manually set these variables works. My line to set the FORUM_URL works only if the phpbb3 directory is inside the Drupal directory. Is your installation like this? I have another suggestion to solve this problem:
This compares the phpBB3 forum root path to the document root path, and adds the protocol and server name. It only uses php variables which are hopefully set correctly. If the above line is correct, than we will have an out of the box correct forum path.
Comment #4
cog.rusty commentedAbout (2), why not use http://api.drupal.org/api/function/url/6 ?
Then
$site_forum_url = url($site_phpbb_page);won't break if the user can't use clean URLs.Comment #5
wietze commentedI tried this php line
$site_forum_url = url($site_phpbb_page);The links that get made don't work.
Because they have two ? in the url. for example it generates:
http://www.websitename.net/?q=forums/viewtopic.php?f=2&t=17&p=17543&hilit=#p17543?q and ?f don't work well together.
I tried to use str_replace function, but it does not change the output for some odd reason.
Comment #6
fizk commented