FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » virtual hosts support
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: virtual hosts support [message #26583 is a reply to message #5238] Wed, 27 July 2005 21:45 Go to previous messageGo to previous message
Anonymous   Canada
OK, cool. Those are the same files I modified.

I added this to the beginning of core.inc:

/* virtual support */
if (isset($_SERVER['HTTP_HOST'])) {
....$domain = explode('.', $_SERVER['HTTP_HOST']);
....$count = count($domain) - 1;
# strip the dot name
....$GOBALS['FORUM_SITE'] = stripslashes($domain[$count-1] . '.' . $domain[$count]);
....require($DATA_DIR."sites/".$GOBALS['FORUM_SITE']);
}

Actually, I think it would be smarter to add a $GLOBALS['VIRTUAL_SITESDIR'] variable to $GLOBALS.php, then have this core.inc snippet check to see if the variable is set before deciding to do anything special. compiler.inc could check the same VIRTUAL_SITESDIR and decide whether to automatically build themes with FULL_ROOT static or dynamic.

In the sites directory, for each virtual site I created a $GLOBALS replacement file containing something like this:

<?php
$GLOBALS['WWW_ROOT'] = "http://forum.mysite.com/";
$GLOBALS['DATA_DIR'] = "/var/www/mysite.com/FUDforum/";
$GLOBALS['ERROR_PATH'] = $GLOBALS['DATA_DIR'] . "errors/";
$GLOBALS['MSG_STORE_DIR'] = $GLOBALS['DATA_DIR'] . "messages/";
$GLOBALS['TMP'] = $GLOBALS['DATA_DIR'] . "tmp/";
$GLOBALS['FILE_STORE'] = $GLOBALS['DATA_DIR'] . "files/";
$GLOBALS['FORUM_SETTINGS_PATH'] = $GLOBALS['DATA_DIR'] . "cache/";

$GLOBALS['COOKIE_DOMAIN'] = "forum.mysite.com";

$GLOBALS['DBHOST_USER'] = "xxxx";
$GLOBALS['DBHOST_PASSWORD'] = "xxxx";
$GLOBALS['DBHOST_DBNAME'] = "mysite.com";
etc...
?>

I can redirect the MYSQL to a different DB for each site. Including the compiler.inc tweak, this makes the forum work across virtual sites. With caveats. I still haven't crossed the avatar/smileys bridge yet. For now I'm happy to just leave these non-modify for the virtual forums.

I have to create the individual virtual site directories, and virtual site DBs. Is there an easy way to regenerate the default tables in a new database without writing new code?

The admin tool updates the main GLOBALS.php file directly. This would be far easier to deal with if some or all of this information were stored in a table as well, but for now I'll settle with some kind of control over what the admin tool can do. For instance I don't want virtual site admins to be messing with Database Settings. What's the easiest way to remove admin options? Are they dynamically included or is the admin page set in stone?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: dont show catagories if they are invisible
Next Topic: default forum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri May 17 08:24:40 GMT 2024

Total time taken to generate the page: 0.05781 seconds