fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16531] fix webserver urls


From: sigurdne
Subject: [Fmsystem-commits] [16531] fix webserver urls
Date: Tue, 4 Apr 2017 04:02:59 -0400 (EDT)

Revision: 16531
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16531
Author:   sigurdne
Date:     2017-04-04 04:02:59 -0400 (Tue, 04 Apr 2017)
Log Message:
-----------
fix webserver urls

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.common.inc.php

Modified: trunk/phpgwapi/inc/class.common.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.common.inc.php     2017-04-04 04:16:05 UTC (rev 
16530)
+++ trunk/phpgwapi/inc/class.common.inc.php     2017-04-04 08:02:59 UTC (rev 
16531)
@@ -35,6 +35,27 @@
                */
                public $output = array();
 
+               protected $webserver_url;
+
+               public function __construct()
+               {
+                       $webserver_url = 
$GLOBALS['phpgw_info']['server']['webserver_url'];
+                       if($GLOBALS['phpgw_info']['server']['webserver_url'] == 
'/')
+                       {
+                               if 
(!empty($GLOBALS['phpgw_info']['server']['enforce_ssl']))
+                               {
+                                       $webserver_url = 
"https://{$GLOBALS['phpgw_info']['server']['hostname']}";
+                               }
+                               else
+                               {
+                                       $webserver_url = 
"http://{$GLOBALS['phpgw_info']['server']['hostname']}";
+                               }
+                       }
+
+                       $this->webserver_url = $webserver_url;
+
+               }
+
                /**
                * This function compares for major versions only
                *
@@ -792,11 +813,11 @@
 
                        if ($this->is_image_dir($imagedir))
                        {
-                               return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
+                               return 
$this->webserver_url.'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
                        }
                        elseif ($this->is_image_dir ($imagedir_default))
                        {
-                               return 
$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$appname.'/templates/base/images';
+                               return 
$this->webserver_url.'/'.$appname.'/templates/base/images';
                        }
                        else
                        {
@@ -814,6 +835,24 @@
                */
                public static function find_image($module, $image)
                {
+                       static $webserver_url = null;
+
+                       if(!$webserver_url)
+                       {
+                               $webserver_url = 
$GLOBALS['phpgw_info']['server']['webserver_url'];
+                               
if($GLOBALS['phpgw_info']['server']['webserver_url'] == '/')
+                               {
+                                       if 
(!empty($GLOBALS['phpgw_info']['server']['enforce_ssl']))
+                                       {
+                                               $webserver_url = 
"https://{$GLOBALS['phpgw_info']['server']['hostname']}";
+                                       }
+                                       else
+                                       {
+                                               $webserver_url = 
"http://{$GLOBALS['phpgw_info']['server']['hostname']}";
+                                       }
+                               }
+                       }
+
                        static $found_files = null;
                        if ( !isset($found_files[$module]) || 
is_array($found_files[$module]) )
                        {
@@ -852,7 +891,7 @@
                                {
                                        if ( 
isset($found_files[$module]["{$image}{$ext}"]) )
                                        {
-                                               return 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}{$found_files[$module]["{$image}{$ext}"]}/{$image}{$ext}";
+                                               return 
"{$webserver_url}{$found_files[$module]["{$image}{$ext}"]}/{$image}{$ext}";
                                        }
                                }
                        }




reply via email to

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