[ros-diffs] [cfinck] 40193: Temporarily add cookie_domain() to "subsys_layout.php" to avoid including non-existent RosCMS v3 components till we have a complete RosCMS 4 solution for this

cfinck at svn.reactos.org cfinck at svn.reactos.org
Mon Mar 23 23:05:53 CET 2009


Author: cfinck
Date: Tue Mar 24 01:05:52 2009
New Revision: 40193

URL: http://svn.reactos.org/svn/reactos?rev=40193&view=rev
Log:
Temporarily add cookie_domain() to "subsys_layout.php" to avoid including non-existent RosCMS v3 components till we have a complete RosCMS 4 solution for this

Modified:
    branches/danny-web/reactos.org/htdocs/shared/subsys_layout.php

Modified: branches/danny-web/reactos.org/htdocs/shared/subsys_layout.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/shared/subsys_layout.php?rev=40193&r1=40192&r2=40193&view=diff
==============================================================================
--- branches/danny-web/reactos.org/htdocs/shared/subsys_layout.php [iso-8859-1] (original)
+++ branches/danny-web/reactos.org/htdocs/shared/subsys_layout.php [iso-8859-1] Tue Mar 24 01:05:52 2009
@@ -6,8 +6,25 @@
   COPYRIGHT:  Copyright 2008-2009 Colin Finck <colin at reactos.org>
 */
 
-	require_once(ROSCMS_PATH . "inc/utils.php");
-	
+	/*
+	 * This will return the last two components of the server name, with a leading
+	 * dot (i.e. usually .reactos.com or .reactos.org for us). See the PHP docs
+	 * on setcookie() why we need the leading dot.
+	 */
+	function cookie_domain()
+	{
+		/* Server name might be just an IP address */
+		if(preg_match("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#", $_SERVER["SERVER_NAME"]))
+			return $_SERVER["SERVER_NAME"];
+		
+		/* If it' a DNS address, return the domain name along with the suffix */
+		if(preg_match("#(\.[^.]+\.[^.]+$)#", $_SERVER["SERVER_NAME"], $matches))
+			return $matches[1];
+		
+		/* Otherwise return nothing */
+		return "";
+	}
+
 	function GetLanguage()
 	{
 		global $lang;



More information about the Ros-diffs mailing list