Module: Virtual Hosting
Posted by Maurice Makaay
|
Module: Virtual Hosting August 05, 2007 05:07AM |
Admin Registered: 22 years ago Posts: 8,532 |
This module implements virtual hosting facilities for Phorum. It extends the vroot functionality of Phorum, so it is possible to bind a certain website hostname to a specific vroot. This way, multiple websites can have their own Phorum vroot on their own site, looking like it were a separate Phorum installation. There are also some extra's to make vroots / virtual hosts more versatile.
The initial development of this module was genrously sponsored by Phorum users MarkFresh and rheo. Thanks a lot guys!
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Edited 5 time(s). Last edit at 02/12/2008 06:24AM by mmakaay.
The initial development of this module was genrously sponsored by Phorum users MarkFresh and rheo. Thanks a lot guys!
Changelog:
----------
2008-02-12 v1.1.5
- Fixed a database upgrade script problem for MySQL servers that
run in strict mode.
2007-08-31 v1.1.4
- Fix suppressing port 443 in admin URLs if the admin is running
inside an HTTPS enabled environment. Thans to yvess for reporting
and fixing the problem.
2007-08-22 v1.1.3
- Fixed database layer bug.
Another "thank you!" to yvess for this one.
2007-08-20 v1.1.2
- Fixed virtual_hosting_db_getvrootbyname().
Thanks to yvess for finding the problem and for supplying the fix.
2007-08-06 v1.1.1
- Fixed a problem in the db layer code, which made the settings
screen fail (only showed a SQL error).
2007-07-11 v1.1.0
- Fixed a bug: when deleting a vroot which still had hostnames linked
to it, the hostnames would not get unlinked. This resulted in
some stale hostnames which could not be deleted through the
interface (thanks to David Scott for reporting the bug).
- Bumped the version number to 1.1.0 to prevent version number
overlapping with the 5.1 version of this module.
2007-07-08 v1.0.2
- Implemented the new phorum_api_user_save_raw() user API function.
2007-07-07 v1.0.1
- Implemented db layer for Phorum 5.2 and made it work with the
strict user API layer, in regard to the "vroot" field that is
added to the user table.
2007-03-08 v1.0.0
- Initial release
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauceEdited 5 time(s). Last edit at 02/12/2008 06:24AM by mmakaay.
|
Re: Module: Virtual Hosting August 20, 2007 04:35AM |
Registered: 19 years ago Posts: 5 |
|
Re: Module: Virtual Hosting August 20, 2007 05:57AM |
Admin Registered: 24 years ago Posts: 9,240 |
|
Re: Module: Virtual Hosting August 20, 2007 06:48AM |
Registered: 19 years ago Posts: 5 |
|
Re: Module: Virtual Hosting August 20, 2007 07:41AM |
Admin Registered: 22 years ago Posts: 8,532 |
I will have to setup a virtual hosting system for this to test it out. Currently, I garbled that setup for testing embedding code. I'll try as soon as possible to see if I missed anything here.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Module: Virtual Hosting August 20, 2007 08:11AM |
Registered: 19 years ago Posts: 5 |
I think I found the problem.
In the file db/mysql/layer.php in the function virtual_hosting_db_getvrootbyname().
There isn't any return value in this function, phorum_db_interact get's called but
nothing is returned. Because of this $vroot is set to NULL and the processing for virtual hosts is stopped at line 66 in virtual_hosting.php.
after I changed this:
to this it worked:
In the file db/mysql/layer.php in the function virtual_hosting_db_getvrootbyname().
There isn't any return value in this function, phorum_db_interact get's called but
nothing is returned. Because of this $vroot is set to NULL and the processing for virtual hosts is stopped at line 66 in virtual_hosting.php.
after I changed this:
function virtual_hosting_db_getvrootbyname($hostname)
{
$PHORUM = $GLOBALS["PHORUM"];
$hostname = strtolower(trim($hostname));
phorum_db_interact(
DB_RETURN_ROW,
"SELECT vroot
FROM {$PHORUM["virtual_hosts_table"]}
WHERE hostname='".phorum_db_interact(DB_RETURN_QUOTED, $hostname)."'"
);
}
to this it worked:
function virtual_hosting_db_getvrootbyname($hostname)
{
$PHORUM = $GLOBALS["PHORUM"];
$hostname = strtolower(trim($hostname));
$vroot_id = phorum_db_interact(
DB_RETURN_ROW,
"SELECT vroot
FROM {$PHORUM["virtual_hosts_table"]}
WHERE hostname='".phorum_db_interact(DB_RETURN_QUOTED, $hostname)."'"
);
return $vroot_id[0];
}
|
Re: Module: Virtual Hosting August 20, 2007 09:52AM |
Admin Registered: 22 years ago Posts: 8,532 |
Good catch. Thanks for debugging. I have put this fix in the package. If you find any more problems, please let me know.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Module: Virtual Hosting August 22, 2007 09:58AM |
Registered: 19 years ago Posts: 5 |
|
Re: Module: Virtual Hosting August 22, 2007 02:28PM |
Admin Registered: 22 years ago Posts: 8,532 |
Thanks. I added the fix to version 1.1.3 of the module.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Module: Virtual Hosting August 31, 2007 09:36AM |
Registered: 19 years ago Posts: 5 |
I found another bug.
If this module is running in a https enviroment, then the port numer :443 get's appended to each url.
I needed to fix it in the file /virtual_hosting.php
changed the line 55, added "&& $_SERVER["SERVER_PORT"] != 443"
If this module is running in a https enviroment, then the port numer :443 get's appended to each url.
I needed to fix it in the file /virtual_hosting.php
changed the line 55, added "&& $_SERVER["SERVER_PORT"] != 443"
(isset($_SERVER["SERVER_PORT"]) && $_SERVER["SERVER_PORT"] != 80 && $_SERVER["SERVER_PORT"] != 443
Your IP address, domain or ISP has been blocked. Please contact the forum administrators.
Sorry, only registered users may post in this forum.
