Firefox PHP

Module: Virtual Hosting

Posted by Maurice Makaay 
All files from this thread

File Name File Size   Posted by Date  
virtual_hosting-1.1.5.tar.gz 9.3 KB open | download Maurice Makaay 02/12/2008 Read message
virtual_hosting-1.1.5.zip 14.1 KB open | download Maurice Makaay 02/12/2008 Read message
phorum-search-forums.jpg 22.3 KB open | download flip3 06/28/2009 Read message
Module: Virtual Hosting
August 05, 2007 06:07AM
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!

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 sauce



Edited 5 time(s). Last edit at 02/12/2008 07:24AM by mmakaay.
Attachments:
open | download - virtual_hosting-1.1.5.tar.gz (9.3 KB)
open | download - virtual_hosting-1.1.5.zip (14.1 KB)
Re: Module: Virtual Hosting
August 20, 2007 05:35AM
I couldn't get it to work with 5.2-alpha and 5.2-svn, it works with 5.1 (Version 1.0.1).
It always shows the default forums, not the ones in the vroot folder.

Anyway thanks for this module.

Does anybody got it working in 5.2?

Yves
Re: Module: Virtual Hosting
August 20, 2007 06:57AM
why would maurice post a version 1.1.1 for Phorum-5.2 while you are trying 1.0.1 with 5.2? ;)
Ýou should really use the version posted here.


Thomas Seifert
Re: Module: Virtual Hosting
August 20, 2007 07:48AM
I use version 1.1.1 for Phorum-5.2, I only wanted to say that I don't have problems with
version 1.0.1 under Phorum-5.1.x.

Perhaps my post was not clear enough, english is not my native language, so sorry for the irritation.
Re: Module: Virtual Hosting
August 20, 2007 08:41AM
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
Re: Module: Virtual Hosting
August 20, 2007 09:11AM
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:

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 10:52AM
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
Re: Module: Virtual Hosting
August 22, 2007 10:58AM
I found a bug in layer.php.

I replaced the line 168 in db/mysql/layer.php:

$return = @unserialize($rec);

with

$return = @unserialize($rec[0]);

without this fix the "General Settings overrides" are always displayed empty, because $return is "false" and not the settings array.
Re: Module: Virtual Hosting
August 22, 2007 03:28PM
Thanks. I added the fix to version 1.1.3 of the module.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Virtual Hosting
August 31, 2007 10:36AM
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"
 (isset($_SERVER["SERVER_PORT"]) && $_SERVER["SERVER_PORT"] != 80 && $_SERVER["SERVER_PORT"] != 443
Sorry, only registered users may post in this forum.

Click here to login