PhpBB 3 portals

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Locked
User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: PhpBB 3 portals

Post by EXreaction »

Ectoman wrote: Overall I had to make a change to the above code, and one function in the "template.php" file to make the forum technology work on every page that includes that code. It now looks a bit like this:


Then you have to edit templates.php.. otherwise it will include your root path on any page that uses the templates! (like when I use the code 'login_box()' to display a login box).

phpBB uses relative file locations for all of their files. But if you access them from outside of the 'phpBB' folder (or in my case 'forums') it will cause problems if you load any of the phpBB templates from that outside folder. I liked it better when phpBB knew what the folder it was in was called.


I don't understand how you have a problem with it...all I had to change was the $phpbb_root_path from ./ to phpBB3/ and it worked fine for me(I have it as index.php, my forums start with phpBB3/index.php). :?

Ectoman
Registered User
Posts: 192
Joined: Sat Dec 15, 2001 3:53 pm
Location: Denver CO
Contact:

Re: PhpBB 3 portals

Post by Ectoman »

Michaelo wrote: Ectoman, Just a note re accessing files outside the phpbb root should it be necessary...
Always use file_exists(string filename) where file name includes the full path to file to avoid possible remote injection.
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.


Why? I know when my files exist. (EDIT: I know what you are referring to now.. and I don't use outside files within phpbb, its the other way around).
EXreaction wrote: I don't understand how you have a problem with it...all I had to change was the $phpbb_root_path from ./ to phpBB3/ and it worked fine for me(I have it as index.php, my forums start with phpBB3/index.php). :?


The reason for this is.. I have my site setup in a way that would not allow you to be in a folder other than the phpBB3 folder. I have a top.php page, and a bottom.php page located in root that has the phpBB code in it. It is not possible to include the phpBB files without having phpbb_root_path being the absolute location using the whole path. If I have an /index.php page it would work.. but if I use a folder: /folder/index.php (and include top and bottom using relative paths, it still needs the absolute path for the phpbb files otherwise it would try to find the forum at: /folder/phpBB3/...

Kinda hard to explain.

But I need to use server root path, otherwise it will never know where the phpbB files are when you are in different folders.

It isn't a big deal.. the only thing that would ever get called outside of the phpBB folder is the login_box.. when it generates it outside of the phpBB folder, it tries to call up images, and the form action as being serverroot/htdocs/phpbb/ucp....

Unless someone can show me a better way other than putting in the relative path from each file to the forums itself.. I'd appreciate to see how else it can be done.

Ectoman
Registered User
Posts: 192
Joined: Sat Dec 15, 2001 3:53 pm
Location: Denver CO
Contact:

Re: PhpBB 3 portals

Post by Ectoman »

Looks like $script_path has been re-introduced. So you could now do this for the top apparently.

Code: Select all

<?php
define('IN_PHPBB', true);
define('IN_SITE', true);
$root_path = '/home/blah/blah/htdocs'; //change to '.' if you want.
$script_path = '/forums/';
$phpbb_root_path = $root_path.$script_path';
$phpEx = 'php';
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>

Ectoman
Registered User
Posts: 192
Joined: Sat Dec 15, 2001 3:53 pm
Location: Denver CO
Contact:

Re: PhpBB 3 portals

Post by Ectoman »

Well.

Not exactly.. all the files still use $phpbb_root_path to generate the links to places in the templates. Perhaps they can all be changed to $script_path? As it is the more logical choice as long as its there now.

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: PhpBB 3 portals

Post by Acyd Burn »

script_path is meant for generating the boards url, furthermore $script_path do not exist. $phpbb_root_path is meant to be relative and should not be set as within the example posted. If the file is within /test for example and your board within /test/phpBB3 you should use $phpbb_root_path = './phpBB3/' and the inner functions to handle redirects, refreshs, building urls and completely.

Anyway, you try to create a solution for a problem which do not exist if done properly. If you are not able to do it then wait for documentation, if you encounter problems/bugs then post it to the bug tracker.

Image

Ectoman
Registered User
Posts: 192
Joined: Sat Dec 15, 2001 3:53 pm
Location: Denver CO
Contact:

Re: PhpBB 3 portals

Post by Ectoman »

LOL.

I encountered the problem and created a solution. (see editing assign_vars) I don't need documentation. These modifications are not supported by phpBB this thread should be locked.

I can't use relative linking when relatively linking to another file which links to a file in another folder. Its just not possible without more scripting the force each file to know where its base file is located.

If you need another example, here it is.

phpbb is located here:

/forums/

Our file is here:

/hello/this/is/a/folder/index.php

Our phpBB code is loaded into a common file.

/includes/common.php

We call the common file from the index in the folders using relative linking..

../../../../../includes/common.php

Now if in the common.php file, I say find phpBB.. its located in "../forums/"... this will not work! It tries to find it in:

/hello/this/is/a/forums/

So direct linking through a server path is required for it to know where it is. That is done easily enough via doing an include to phpBB's common.php using the direct path (and not setting $phpbb_root_path as the server path, but including it via the server path. Once you are in the phpBB common.php file.. it gets lost. It doesn't know where any of the other files it needs to include from there.. such as functions, lang files, sessions and others.

It gets kind of complex to think about it, but you are relatively linking a file that is linking to a file through the server path because it has to, then it has to link to phpbb files which link to several. It gets lost if you arn't using server path linking from then on in.

Now I know you could totally say, thats your own problem. You could easily add to every page you have the information about where the files are relative to phpBB.. or add a peice of code in common that figures out where it is relative to phpBB.

I don't see why the easy and concrete method is used by taking (I assume $script_path) which would be equal to: /forums/ generate all of the links that way. Even when installing the phpBB v3 (plain vanilla)... it tried to generate links (all by itself!) by using the whole server path instead of just the folder. I'm not sure if that bug has bee fixed or what...

I don't feel like Olympus will be as versitile as it could be until a distinction is made between $phpbb_root_path and the folder that phpBB is in.. even as it is in stock configuration phpBB makes all of its links look like this: "./ucp.php?blah" which isn't the best SEO way to link things. It would be much better if all links were automatically generated as: "/forums/ucp.php?blah"

Keep in mind.. my portal is working fine with the modifications I have made. I do not need to post my code its put out there to help those who are interested in expanding their phpBB capabilites to the rest of their site.. everything works the way I have it. It is the only way to do it with the way files are structred in phpBB and my site.

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: PhpBB 3 portals

Post by Acyd Burn »

The session code determines all relevant path information for you, so you do not need to determine them by your own. ;) You simply need to use the in-built functionality. We needed this for our website, so we made sure scripts outside of phpBB are able to be integrated properly.

The template engine is also built in a way to allow custom template path's, even outside of phpBB - no need to change anything.

And yes, i think i will lock this, since modifications are not supported.

Image

Locked