fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8367] API: url from external sources (email)


From: Sigurd Nes
Subject: [Fmsystem-commits] [8367] API: url from external sources (email)
Date: Mon, 19 Dec 2011 10:42:51 +0000

Revision: 8367
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8367
Author:   sigurdne
Date:     2011-12-19 10:42:51 +0000 (Mon, 19 Dec 2011)
Log Message:
-----------
API: url from external sources (email)

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.phpgw.inc.php
    trunk/phpgwapi/inc/class.sessions.inc.php

Modified: trunk/phpgwapi/inc/class.phpgw.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.phpgw.inc.php      2011-12-19 09:17:07 UTC (rev 
8366)
+++ trunk/phpgwapi/inc/class.phpgw.inc.php      2011-12-19 10:42:51 UTC (rev 
8367)
@@ -174,15 +174,16 @@
                 * will use PHP_SELF. Wrapper to session->link()
                 *
                 * @access public
-                * @param string $string The url the link is for
-                * @param string $extravars     Extra params to be passed to 
the url
-                * @param string $redirect is the resultant link being used in 
a header('Location:' ... redirect?
+                * @param string  $string The url the link is for
+                * @param array   $extravars    Extra params to be passed to 
the url
+                * @param boolean $redirect is the resultant link being used in 
a header('Location:' ... redirect?
+                * @param boolean $external is the resultant link being used as 
external access (i.e url in emails..)
                 * @return string The full url after processing
                 * @see session->link()
                 */
-               public function link($url = '', $extravars = array(), $redirect 
= false)
+               public function link($url = '', $extravars = array(), $redirect 
= false, $external = false)
                {
-                       return $this->session->link($url, $extravars, 
$redirect);
+                       return $this->session->link($url, $extravars, 
$redirect, $external);
                }
 
                /**

Modified: trunk/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.sessions.inc.php   2011-12-19 09:17:07 UTC (rev 
8366)
+++ trunk/phpgwapi/inc/class.sessions.inc.php   2011-12-19 10:42:51 UTC (rev 
8367)
@@ -535,10 +535,11 @@
                * @param string  $url       a url relative to the phpgroupware 
install root
                * @param array   $extravars query string arguements
                * @param boolean $redirect  is this for a redirect link ?
+               * @param boolean $external is the resultant link being used as 
external access (i.e url in emails..)
                *
                * @return string generated url
                */
-               public function link($url, $extravars = array(), 
$redirect=false)
+               public function link($url, $extravars = array(), 
$redirect=false, $external = false)
                {
                        //W3C Compliant in markup       
                        $term = '&'; 
@@ -582,6 +583,14 @@
                                }
                        }
 
+                       if($external)
+                       {
+                               if(substr($url, 0, 4) != 'http')
+                               {
+                                       $url = 
"http://{$GLOBALS['phpgw_info']['server']['hostname']}{$url}";
+                               }
+                       }
+
                        if ( 
isset($GLOBALS['phpgw_info']['server']['enforce_ssl'])
                                && 
$GLOBALS['phpgw_info']['server']['enforce_ssl'])
                        {
@@ -625,29 +634,32 @@
                                }
                        }
 
-                       /* add session params if not using cookies */
-                       if ( 
!isset($GLOBALS['phpgw_info']['server']['usecookies'])
-                               || 
!$GLOBALS['phpgw_info']['server']['usecookies'])
+                       if(!$external)
                        {
-                               if ( is_array($extravars) )
+                               /* add session params if not using cookies */
+                               if ( 
!isset($GLOBALS['phpgw_info']['server']['usecookies'])
+                                       || 
!$GLOBALS['phpgw_info']['server']['usecookies'])
                                {
-                                       $extravars = array_merge($extravars, 
$this->_get_session_vars());
+                                       if ( is_array($extravars) )
+                                       {
+                                               $extravars = 
array_merge($extravars, $this->_get_session_vars());
+                                       }
+                                       else
+                                       {
+                                               $extravars = 
$this->_get_session_vars();
+                                       }
                                }
-                               else
+
+                               //used for repost prevention
+                               $extravars['click_history'] = 
$this->generate_click_history();
+
+                               /* enable easy use of xdebug */
+                               if ( isset($_REQUEST['XDEBUG_PROFILE']) )
                                {
-                                       $extravars = $this->_get_session_vars();
+                                       $extravars['XDEBUG_PROFILE'] = 1;
                                }
                        }
 
-                       //used for repost prevention
-                       $extravars['click_history'] = 
$this->generate_click_history();
-
-                       /* enable easy use of xdebug */
-                       if ( isset($_REQUEST['XDEBUG_PROFILE']) )
-                       {
-                               $extravars['XDEBUG_PROFILE'] = 1;
-                       }
-
                        if ( is_array($extravars) ) //we have something to 
append
                        {
                                $url .= '?' . http_build_query($extravars, 
null, $term);




reply via email to

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