Wrong url in Admin->Calendar->Categories

jeff_ross wrote on Friday, May 16, 2008:

The Admin->Calendar page builds links that throw a 404 because the full url it builds fails to recognize that we use https.

The link it builds is:

http://wcfm.internal/openemr/interface/main/calendar/index.php?module=PostCalendar&type=admin&func=categories

and it should be

https://wcfm.internal/openemr/interface/main/calendar/index.php?module=PostCalendar&type=admin&func=categories

This appears to be because HTTP_SERVER_VARS is and has been for sometime deprecated.

To fix this, here’s a diff -u patch to openemr/interface/main/calendar/includes/pnApi.php

— pnAPI.old   Fri May 16 09:07:19 2008
+++ pnAPI.php   Fri May 16 09:10:59 2008
@@ -1069,7 +1069,8 @@
         $server = $HTTP_SERVER_VARS[‘HTTP_HOST’];
     }
     // IIS sets HTTPS=off
-    if (isset($HTTP_SERVER_VARS[‘HTTPS’]) && $HTTP_SERVER_VARS[‘HTTPS’] != ‘off’) {
+    if ( (isset($HTTP_SERVER_VARS[‘HTTPS’]) && $HTTP_SERVER_VARS[‘HTTPS’] != ‘off’) ||
+                        (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == ‘on’) )  {
         $proto = ‘https://’;
     } else {
         $proto = ‘http://’;

Thanks,

Jeff