]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-connect.php
Continued a bit:
[mailer.git] / inc / mysql-connect.php
index b49c5e211d0354a2543507c73b335b2867698f87..1e596c3a8c56b986b07722250d84c044fece132b 100644 (file)
@@ -11,7 +11,7 @@
  * Kurzbeschreibung  : Verbindet zu Ihrer Datenbank                     *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -52,6 +52,7 @@ foreach ( array(
                'language',
                'sql',
                'expression',
+               'encryption',
                'filter',
                'extensions') as $lib) {
 
@@ -120,8 +121,30 @@ if ((!isInstaller()) && (isInstalled())) {
                setConfigEntry('OUTPUT_MODE', 'render');
        } // END - if
 
-       // CFG: DATABASE-TYPE
-       setConfigEntry('_DB_TYPE', 'mysql');
+       // Debug message
+       /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'isAjaxOutputMode()=' . intval(isAjaxOutputMode()) . ',isSessionVariableSet(database_extension)=' . intval(isSessionVariableSet('database_extension')));
+
+       // Is it AJAX call and database_extension is set?
+       if ((isAjaxOutputMode()) && (isSessionVariableSet('database_extension'))) {
+               // Then take it from session
+               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Setting _DB_TYPE from session;database_extension=' . getSession('database_extension'));
+               setConfigEntry('_DB_TYPE', getSession('database_extension'));
+       } elseif (isPhpExtensionLoaded('mysql')) {
+               // Debug message
+               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Setting _DB_TYPE to default (mysql) ...');
+
+               // Set (old) default
+               setConfigEntry('_DB_TYPE', 'mysql');
+       } elseif (isPhpExtensionLoaded('mysqli')) {
+               // Debug message
+               /* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Setting _DB_TYPE to MySQLi ...');
+
+               // Set (old) default
+               setConfigEntry('_DB_TYPE', 'mysqli');
+       } else {
+               // Opps, cannot detect it?
+               reportBug(__FILE__, __LINE__, 'Cannot detect mysql/mysqli. Please fix your setup.');
+       }
 
        // Set link as down
        unsetSqlLinkUp(__FILE__, __LINE__);