1

Topic: install.php omits HTTP port when creating the base URL

OK this is a very small thing, but my development environment uses port-based rather than name-based virtual hosts. So I have sites like http://localhost:8001 etc. When I ran install.php I noticed it missed off the port, ie. just giving http://localhost/forums instead of http://localhost:8001/forums.

Here's a patch if you want one:

--- upload/install.php  2005-11-01 00:31:04.000000000 +0000
+++ temp/install.php  2005-11-13 17:37:04.000000000 +0000
@@ -228,7 +228,7 @@
                                        <legend>Enter the Base URL of your PunBB installation</legend>
                                        <div class="infldset">
                                                <p>The URL (without trailing slash) of your PunBB forum (example: http://forum.myhost.com or http://myhost.com/~myuser). This <strong>must</strong> be correct or administrators and moderators will not be able to submit any forms. Please note that the preset value below is just an educated guess by PunBB.</p>
-                                               <label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label>
+                                               <label><strong>Base URL</strong><br /><input type="text" name="req_base_url" value="http://<?php echo preg_replace('/:80$/', '', $_SERVER['HTTP_HOST']).str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label>
                                        </div>
                                </fieldset>
                        </div>

I'm new to PunBB - and to submitting patches - so just yell if I'm not going about it the right way, or if the above fails to work...

Re: install.php omits HTTP port when creating the base URL

Thanks, I'll include it in 1.3.

"Programming is like sex: one mistake and you have to support it for the rest of your life."