fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6760] bookingfrontend: external logout


From: Sigurd Nes
Subject: [Fmsystem-commits] [6760] bookingfrontend: external logout
Date: Thu, 13 Jan 2011 12:51:40 +0000

Revision: 6760
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6760
Author:   sigurdne
Date:     2011-01-13 12:51:39 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
bookingfrontend: external logout

Modified Paths:
--------------
    trunk/bookingfrontend/logout.php
    trunk/bookingfrontend/templates/base/config.tpl

Modified: trunk/bookingfrontend/logout.php
===================================================================
--- trunk/bookingfrontend/logout.php    2011-01-12 20:26:39 UTC (rev 6759)
+++ trunk/bookingfrontend/logout.php    2011-01-13 12:51:39 UTC (rev 6760)
@@ -21,11 +21,43 @@
 
        $verified = $GLOBALS['phpgw']->session->verify();
        
+       $external_logout = '';
        if ($verified)
        {
+               $config         = 
CreateObject('phpgwapi.config','bookingfrontend');
+               $config->read();
+
+               $external_logout = 
isset($config->config_data['external_logout']) && 
$config->config_data['external_logout'] ? 
$config->config_data['external_logout'] : '';
+//             $external_logout = 
"https://login-vip.bergen.kommune.no/SSO/logout?p_done_url=";//https://www.bergen.kommune.no";
+
                $frontend_user = CreateObject('bookingfrontend.bouser');
                $frontend_user->log_off();
+/*
+               // testing external logout
+               
 
+               $arguments = array('p_done_url' => 
'https://www.bergen.kommune.no');
+               $query = http_build_query($arguments);
+               $auth_url = $_integration_config['auth_url'];
+               $request = 
"https://login-vip.bergen.kommune.no/SSO/logout?{$query}";;
+
+               $aContext = array
+               (
+                       'https' => array
+                       (
+                               'request_fulluri' => true,
+                       ),
+               );
+
+               if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
+               {
+                       $aContext['http']['proxy'] = 
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
+               }
+
+               $cxContext = stream_context_create($aContext);
+               $response = file_get_contents($request, False, $cxContext);
+*/
+
                execMethod('phpgwapi.menu.clear');
                $GLOBALS['phpgw']->hooks->process('logout');
                $GLOBALS['phpgw']->session->destroy($sessionid);
@@ -47,19 +79,36 @@
        
        $redirect = phpgw::get_var('redirect_menuaction', 'string');
        
-       if($redirect) {
+       if($redirect)
+       {
                $matches = array();
                $extra_vars['menuaction']  = $redirect;
-               foreach($_GET as $name => $value) {
-                       if (preg_match('/^redirect_([\w\_\-]+)/', $name, 
$matches) && $matches[1] != 'menuaction') {
+               foreach($_GET as $name => $value)
+               {
+                       if (preg_match('/^redirect_([\w\_\-]+)/', $name, 
$matches) && $matches[1] != 'menuaction')
+                       {
                                $extra_vars[$matches[1]] = 
phpgw::clean_value($value);
                        }
                }
        }
        
-       if (!isset($extra_vars['menuaction'])) {
+       if (!isset($extra_vars['menuaction']))
+       {
                $extra_vars['menuaction'] = 'bookingfrontend.uisearch.index';
        }
 
-       $GLOBALS['phpgw']->redirect_link('/bookingfrontend/', $extra_vars);
+       if(!$external_logout)
+       {
+               $GLOBALS['phpgw']->redirect_link('/bookingfrontend/', 
$extra_vars);
+       }
+       else
+       {
+               $result_redirect = '';
+               if(substr($external_logout,-1) == '=')
+               {
+                       $result_redirect = 
$GLOBALS['phpgw']->link('/bookingfrontend/', $extra_vars, true);
+               }
+               $external_logout_url = "{$external_logout}{$result_redirect}";
+               Header("Location: {$external_logout_url}");
+       }
        exit;

Modified: trunk/bookingfrontend/templates/base/config.tpl
===================================================================
--- trunk/bookingfrontend/templates/base/config.tpl     2011-01-12 20:26:39 UTC 
(rev 6759)
+++ trunk/bookingfrontend/templates/base/config.tpl     2011-01-13 12:51:39 UTC 
(rev 6760)
@@ -81,6 +81,12 @@
                        <td>{lang_google_tracker_id}:</td>
                        <td><input name="newsettings[tracker_id]" 
value="{value_tracker_id}"></td>
                </tr>
+               <tr class="row_off">
+                       <td>{lang_url_to_external_logout}:
+                       <br/> Redirect is computed if url ends with '='
+                       </td>
+                       <td><input name="newsettings[external_logout]" 
value="{value_external_logout}"></td>
+               </tr>
 
 <!-- END body -->
 <!-- BEGIN footer -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]