Function getSession() does now only use secureString() if no database
authorRoland Haeder <roland@mxchange.org>
Thu, 17 Apr 2014 21:38:15 +0000 (23:38 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 17 Apr 2014 21:38:15 +0000 (23:38 +0200)
connection is there. This saves some "expensive" calls to the EL-code
functions.

Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/session-functions.php

index 5421c1f..954d233 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Sitzungsrelevante Funktionen                     *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
@@ -100,7 +95,13 @@ function getSession ($var) {
        // Is the variable there?
        if (isSessionVariableSet($var)) {
                // Then  get it secured!
-               $value = sqlEscapeString($GLOBALS['_SESSION'][$var]);
+               if ((isInstaller()) || (!isSqlLinkUp())) {
+                       // Secure string without escaping (and compiling)
+                       $value = secureString($GLOBALS['_SESSION'][$var]);
+               } else {
+                       // Escape string with SQL driver
+                       $value = sqlEscapeString($GLOBALS['_SESSION'][$var]);
+               }
        } // END - if
 
        // Return the value