Adds support for GoogleApps-only redirections in newsletters.
[platal.git] / include / xnet / session.inc.php
index 3fbeac4..ef6c733 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -23,7 +23,7 @@ class XnetSession
 {
     // {{{ function init
 
-    public static function init() 
+    public static function init()
     {
         global $globals;
 
@@ -35,7 +35,7 @@ class XnetSession
                 $returl = "http://{$_SERVER['SERVER_NAME']}".substr($_SERVER['REQUEST_URI'], 0, $i);
             else
                 $returl = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
-            $url  = "https://www.polytechnique.org/auth-groupex.php";
+            $url  = "https://www.polytechnique.org/auth-groupex";
             $url .= "?session=" . session_id();
             $url .= "&challenge=" . S::v('challenge');
             $url .= "&pass=" . md5(S::v('challenge') . $globals->xnet->secret);
@@ -55,7 +55,7 @@ class XnetSession
             }
             if (is_member()) {
                 $perms->addFlag('groupmember');
-                if ($globals->asso('pub') == 'public') {
+                if ($globals->asso('pub') != 'private') {
                     $perms->addFlag('groupannu');
                 }
             }
@@ -104,11 +104,15 @@ class XnetSession
     // }}}
     // {{{ doAuthX
 
-    public static function doAuthX() 
+    public static function doAuthX()
     {
         global $globals, $page;
 
         if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::i('uid').'1') != Get::v('auth')) {
+            if (!$page) {
+                require_once 'xnet.inc.php';
+                new_skinned_page('platal/index.tpl');
+            }
             $page->kill("Erreur d'authentification avec polytechnique.org !");
         }
 
@@ -159,7 +163,7 @@ class XnetSession
     // {{{ killSuid
 
     public static function killSuid()
-    {   
+    {
         if (!S::has('suid')) {
             return;
         }
@@ -211,7 +215,7 @@ function may_update($force = false, $lose = false)
 /** Get membership informations for the current asso
  * @param force Force membership to be read from database
  * @param lose  Force membership to be false
- */ 
+ */
 function is_member($force = false, $lose = false)
 {
     if (!isset($_SESSION['is_member'])) {