2009-03-26, 11:12 PM
2009-03-27, 05:42 AM
This works....
The above works only if the file "testpage.php" is in the same directory as the forum.
When using in another directory...
global.php has at least one "require_once" file and the file paths are always messed up when including "global.php" in any file outside of MyBB's root.
Please, anyone, tell me how to solve this, before I waste a lot more time.
Thank you.
EDIT:
What if I change all the "require_once" file paths in "global.php" to the full path "/home/usename/public_html...etc..." ?
EDIT#2:
int.php has a large number of required files, so what if I change them all to the full file path. Will this work?
What is the better option?
require_once './global.php';
The above works only if the file "testpage.php" is in the same directory as the forum.
When using in another directory...
require_once './mybb/global.php';
... then the file "global.php" does get included (since I changed the file path), but...- Warning: require_once(./inc/init.php) [function.require-once]: failed to open stream: No such file or directory in....
global.php has at least one "require_once" file and the file paths are always messed up when including "global.php" in any file outside of MyBB's root.

Please, anyone, tell me how to solve this, before I waste a lot more time.
Thank you.
EDIT:
What if I change all the "require_once" file paths in "global.php" to the full path "/home/usename/public_html...etc..." ?
EDIT#2:
int.php has a large number of required files, so what if I change them all to the full file path. Will this work?
What is the better option?
2009-03-27, 06:20 AM
Please give us a short info on how your folder structure looks.
If you are in the root folder like /public_html/ and your mybb is located in /public_html/mybb/, while your "outside-mybb-file" is in /public_html/ you need to use the folder path:
In case that does not work I would like to know if you get the same errors using chmod.
On my webspace, it didn't matter if I used chmod or included global.php directly. But maybe that is not common..
If you are in the root folder like /public_html/ and your mybb is located in /public_html/mybb/, while your "outside-mybb-file" is in /public_html/ you need to use the folder path:
require_once 'mybb/global.php';
In case that does not work I would like to know if you get the same errors using chmod.
On my webspace, it didn't matter if I used chmod or included global.php directly. But maybe that is not common..
2009-03-27, 08:33 AM
(2009-03-27, 06:20 AM)No0oB Wrote: [ -> ]Please give us a short info on how your folder structure looks.
If you are in the root folder like /public_html/ and your mybb is located in /public_html/mybb/, while your "outside-mybb-file" is in /public_html/ you need to use the folder path:
[php]require_once 'mybb/global.php';
Yes, that is the way I was trying to use it.
Since the error message mentions, "Warning: require_once(./inc/init.php)...", I'm assuming the code inside 'global.php' was included, and now the system is trying to find "./inc/init.php" in the wrong place.
(2009-03-27, 06:20 AM)No0oB Wrote: [ -> ]In case that does not work I would like to know if you get the same errors using chmod.
On my webspace, it didn't matter if I used chmod or included global.php directly. But maybe that is not common..
I'm not sure exactly what you mean by using chmod for this.
FYI, the problem does happen on more than one host.
2009-03-27, 01:40 PM
What exactly is your folder structure on your webhost?
2009-03-27, 05:38 PM
(2009-03-27, 01:40 PM)No0oB Wrote: [ -> ]What exactly is your folder structure on your webhost?
forum = /public_html/mybb/
testpage.php (site to integrate) = /public_html/
2009-03-27, 06:14 PM
Then your include code needs to be:
If that does not work, try to declare a constant holding your Root Site.
I did that with codeworld.
It looks like the following:
define('IN_MYBB', NULL);
require_once 'mybb/global.php';
require_once('class.MyBBIntegrator.php';
If that does not work, try to declare a constant holding your Root Site.
I did that with codeworld.
It looks like the following:
define('ROOT_DIR', getcwd());
require_once ROOT_DIR . '/mybb/global.php';
require_once ROOT_DIR . '/class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang);
2009-03-28, 02:57 AM
^^^
I might try the constant later.
For now, I got it working this way...
The above works on at least one host.
Thank you, very much for the Integrator class.
I might try the constant later.
For now, I got it working this way...
<?php
define('IN_MYBB', NULL);
chdir('mybb'); // path to MyBB
require_once './global.php';
require_once 'class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang);
?>
The above works on at least one host.
Thank you, very much for the Integrator class.

2009-03-28, 09:29 AM
You would have to chdir back thou....
So your Integration Class is located in the mybb folder?
Maybe that was the reason it didn't work
Little Update: Added a fancy download counter!
Will also add a comment system to enable direct feedback.
Also, in a week or so, I will start enhancing the Integrator. Let's see what's needed.
So your Integration Class is located in the mybb folder?
Maybe that was the reason it didn't work

Little Update: Added a fancy download counter!
Will also add a comment system to enable direct feedback.
Also, in a week or so, I will start enhancing the Integrator. Let's see what's needed.
2009-03-28, 10:02 PM
The ideal solution is to fix global.php et al to make use of the dir_name function in PHP, so we don't have to chdir before including them.