Author: cfinck
Date: Sat Oct 18 05:20:53 2008
New Revision: 36806
URL:
http://svn.reactos.org/svn/reactos?rev=36806&view=rev
Log:
RosCMS changes for the Wiki changes:
- Remove an ugly hack from the Login stuff, add a new not-that-ugly hack to Logout :-)
Wiki needs to know when a user logged out to handle the cache correctly.
- Fix cookie_domain() to also work properly, when $_SERVER["SERVER_NAME"] is an
IP address
Modified:
trunk/web/reactos.org/htdocs/roscms/inc/utils.php
trunk/web/reactos.org/htdocs/roscms/logon/logout.php
trunk/web/reactos.org/htdocs/roscms/logon/subsys_login.php
Modified:
trunk/web/reactos.org/htdocs/roscms/inc/utils.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/roscms/inc/…
==============================================================================
---
trunk/web/reactos.org/htdocs/roscms/inc/utils.php [iso-8859-1] (original)
+++
trunk/web/reactos.org/htdocs/roscms/inc/utils.php [iso-8859-1] Sat Oct 18 05:20:53
2008
@@ -25,23 +25,16 @@
*/
function cookie_domain()
{
- if (isset($_SERVER['SERVER_NAME']))
- {
- if (preg_match('/(\.[^.]+\.[^.]+$)/', $_SERVER['SERVER_NAME'],
$matches))
- {
- $domain = $matches[1];
- }
- else
- {
- $domain = '';
- }
- }
- else
- {
- $domain = '';
- }
-
- return $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 row_exists($table_name, $where)
Modified:
trunk/web/reactos.org/htdocs/roscms/logon/logout.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/roscms/logo…
==============================================================================
---
trunk/web/reactos.org/htdocs/roscms/logon/logout.php [iso-8859-1] (original)
+++
trunk/web/reactos.org/htdocs/roscms/logon/logout.php [iso-8859-1] Sat Oct 18 05:20:53
2008
@@ -40,6 +40,10 @@
"'";
$logout_usr_key_post_list = mysql_query($logout_usr_key_post)
or die("DB error (logout)!");
+
+ // Set the Logout cookie for the Wiki, so the user won't see cached pages
+ // 5 = $wgClockSkewFudge in the Wiki
+ setcookie("wikiLoggedOut", gmdate("YmdHis", time() + 5), time() +
86400, "/", cookie_domain());
}
Modified:
trunk/web/reactos.org/htdocs/roscms/logon/subsys_login.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/roscms/logo…
==============================================================================
---
trunk/web/reactos.org/htdocs/roscms/logon/subsys_login.php [iso-8859-1] (original)
+++
trunk/web/reactos.org/htdocs/roscms/logon/subsys_login.php [iso-8859-1] Sat Oct 18
05:20:53 2008
@@ -101,14 +101,6 @@
{
/* Login session found */
$userid = $row[0];
-
- // For the Wiki, we have to start a session
- if( $subsys == "wiki" )
- {
- define('MEDIAWIKI', '');
- require_once(ROSCMS_PATH . "../wiki/includes/GlobalFunctions.php");
- wfSetupSession();
- }
if (isset($row[1]))
{