More stuff for mysql3->mysql switch.
authorRoland Haeder <roland@mxchange.org>
Thu, 17 Apr 2014 21:16:29 +0000 (23:16 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 17 Apr 2014 21:24:51 +0000 (23:24 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
16 files changed:
DOCS/de/SECURITY.txt
DOCS/en/SECURITY.txt
inc/ajax-functions.php
inc/ajax/ajax_
inc/ajax/ajax_admin.php
inc/ajax/ajax_installer.php
inc/classes/cachesystem.class.php
inc/config-local.php.dist
inc/db/lib-mysql.php
inc/db/lib-mysqli.php
inc/expression-functions.php
inc/filter-functions.php
inc/filters.php
inc/functions.php
inc/load_config.php
inc/mysql-connect.php

index ccf07b9ba1f002314ef6b6d34a30601fbc7942bc..2ec6f6452866e2e5f876f3bf8537b16a35985c6d 100644 (file)
@@ -125,7 +125,7 @@ Bis zur Version 0.2.0-pre10 mit Patch-Level 485 und aelter war es fuer einen
 entfernten Angreifer theoretisch moeglich, SQL-Befehle einzuschleusen und auch
 Attacken auf die Variable $PHP_SELF durchzufueheren. Seit Patch 486 und 487
 (laden Sie sich am Besten immer die aktuellsten Patches herunter!) sind nun
-entsprechende Zeilen aus der inc/db/lib-mysql3.php (Funktion sqlQueryEscaped)
+entsprechende Zeilen aus der inc/db/lib-mysql.php (Funktion sqlQueryEscaped)
 entfernt und sollten nicht mehr angreifbar sein. Der generierten SQL-Befehl
 wurde vor der Ausfuehrung nochmals "uebersetzt", also alle
 sicherheitsgefaehrdenen Zeichen wieder eingebaut. Zudem existiert im Script
index e0cea8967adb51890430bbc08acba2b6768cf152..2aa1ea32b131c1df601b950a368684dc640a45ef 100644 (file)
@@ -122,7 +122,7 @@ Bis zur Version 0.2.0-pre10 mit Patch-Level 485 und aelter war es fuer einen
 entfernten Angreifer theoretisch moeglich, SQL-Befehle einzuschleusen und auch
 Attacken auf die Variable $PHP_SELF durchzufueheren. Seit Patch 486 und 487
 (laden Sie sich am Besten immer die aktuellsten Patches herunter!) sind nun
-entsprechende Zeilen aus der inc/db/lib-mysql3.php (Funktion sqlQueryEscaped)
+entsprechende Zeilen aus der inc/db/lib-mysql.php (Funktion sqlQueryEscaped)
 entfernt sollten nicht mehr angreifbar sein. Der generierten SQL-Befehl wurde
 vor der Ausfuehrung nochmals "uebersetzt", also alle sicherheitsgefaehrdenen
 Zeichen wieder eingebaut. Zudem existiert im Script
index d3736e0f03043caddaca465a74056c03c9cc6915..90e48a1a023669253d21f4606865a5ce905ae23f 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : AJAX-bezogene 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                      *
index de592ac950702c8615e148b4765ccc5eabd534b5..a76ebc502e52d19bd01c1c12e402823cd1df4d6b 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : AJAX-Bibliothek fuer Adminmenu                   *
  * -------------------------------------------------------------------- *
- * $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                      *
index 98af1a46247b525f3fb94ec158fe376267f30321..e09f2dffa9ffce61c412081c06c18a6616a324ac 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : AJAX-Bibliothek fuer Adminmenu                   *
  * -------------------------------------------------------------------- *
- * $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                      *
index 5e6bf0d664c04a4c94d9d2b48caef3a3920ed4b6..eea4629ee956909843db01033d9a79a452daf530 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : AJAX-bezogene Funktionen fuer Installer          *
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -50,7 +45,7 @@ if (!defined('__SECURITY')) {
 // Establish a database link
 function establishAjaxInstallerDatabaseLink () {
        // This requires some session data
-       if (!isSessionDataSet(array('mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine'))) {
+       if (!isSessionDataSet(array('mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine', 'database_extension'))) {
                // Some required session data is not set
                reportBug(__FUNCTION__, __LINE__, 'Required session data for this step not found.');
        } // END - if
@@ -84,6 +79,7 @@ function establishAjaxInstallerDatabaseLink () {
 
        // Set type, prefix from POST data and database name for later queries
        setConfigEntry('_TABLE_TYPE'  , getSession('mysql_engine'));
+       setConfigEntry('_DB_TYPE'     , getSession('database_extension'));
        setConfigEntry('_MYSQL_PREFIX', getSession('mysql_prefix'));
        setConfigEntry('__DB_NAME'    , getSession('mysql_dbase'));
 }
@@ -324,7 +320,7 @@ function doAjaxInstallerSaveChanges () {
                        (isInstallerDataValid($saveStatus, $key, $value))
                &&
                        // And can it be stored in session?
-                       (setSession($key, $value))
+                       (setSessionCompiled($key, $value))
                );
 
                // Save the overall status for below final check
@@ -363,31 +359,31 @@ function doAjaxPrepareInstallerBaseData () {
        // Is 'base_path' not set?
        if (!isSessionVariableSet('base_path')) {
                // Then set it from PATH
-               setSession('base_path', getPath());
+               setSessionCompiled('base_path', getPath());
        } // END - if
 
        // Is 'base_url' not set?
        if (!isSessionVariableSet('base_url')) {
                // Then set it from URL
-               setSession('base_url', getUrl());
+               setSessionCompiled('base_url', getUrl());
        } // END - if
 
        // Is 'main_title' not set?
        if (!isSessionVariableSet('main_title')) {
                // Then set it from default main title
-               setSession('main_title', compileRawCode(getMessage('DEFAULT_MAIN_TITLE')));
+               setSessionCompiled('main_title', compileRawCode(getMessage('DEFAULT_MAIN_TITLE')));
        } // END - if
 
        // Is 'slogan' not set?
        if (!isSessionVariableSet('slogan')) {
                // Then set it from default slogan
-               setSession('slogan', compileRawCode(getMessage('DEFAULT_SLOGAN')));
+               setSessionCompiled('slogan', compileRawCode(getMessage('DEFAULT_SLOGAN')));
        } // END - if
 
        // Is 'webmaster' not set?
        if (!isSessionVariableSet('webmaster')) {
                // Then set it from default webmaster email address
-               setSession('webmaster', '{--DEFAULT_WEBMASTER--}');
+               setSessionCompiled('webmaster', '{--DEFAULT_WEBMASTER--}');
        } // END - if
 }
 
@@ -396,43 +392,49 @@ function doAjaxPrepareInstallerDatabaseConfig () {
        // Is 'mysql_host' not set?
        if (!isSessionVariableSet('mysql_host')) {
                // Then set it directly
-               setSession('mysql_host', 'localhost');
+               setSessionCompiled('mysql_host', 'localhost');
        } // END - if
 
        // Is 'mysql_dbase' not set?
        if (!isSessionVariableSet('mysql_dbase')) {
                // Then set it directly
-               setSession('mysql_dbase', 'your_database');
+               setSessionCompiled('mysql_dbase', 'your_database');
        } // END - if
 
        // Is 'mysql_prefix' not set?
        if (!isSessionVariableSet('mysql_prefix')) {
                // Then set it directly
-               setSession('mysql_prefix', 'mailer');
+               setSessionCompiled('mysql_prefix', 'mailer');
        } // END - if
 
        // Is 'mysql_login' not set?
        if (!isSessionVariableSet('mysql_login')) {
                // Then set it directly
-               setSession('mysql_login', 'your_login');
+               setSessionCompiled('mysql_login', 'your_login');
        } // END - if
 
        // Is 'mysql_dbase' not set?
        if (!isSessionVariableSet('mysql_password1')) {
                // Then set it directly
-               setSession('mysql_password1', '');
+               setSessionCompiled('mysql_password1', '');
        } // END - if
 
        // Is 'mysql_password2' not set?
        if (!isSessionVariableSet('mysql_password2')) {
                // Then set it directly
-               setSession('mysql_password2', '');
+               setSessionCompiled('mysql_password2', '');
        } // END - if
 
        // Is 'mysql_engine' not set?
        if (!isSessionVariableSet('mysql_engine')) {
                // Then set it directly
-               setSession('mysql_engine', 'MyISAM');
+               setSessionCompiled('mysql_engine', 'MyISAM');
+       } // END - if
+
+       // Is 'mysql_engine' not set?
+       if (!isSessionVariableSet('database_extension')) {
+               // Then set it directly
+               setSessionCompiled('database_extension', 'mysqli');
        } // END - if
 }
 
@@ -446,25 +448,25 @@ function doAjaxPrepareInstallerOtherConfig () {
        // Is 'output_mode' not set?
        if (!isSessionVariableSet('output_mode')) {
                // Then set it directly
-               setSession('output_mode', 'render');
+               setSessionCompiled('output_mode', 'render');
        } // END - if
 
        // Is 'warn_no_pass' not set?
        if (!isSessionVariableSet('warn_no_pass')) {
                // Then set it directly
-               setSession('warn_no_pass', 'Y');
+               setSessionCompiled('warn_no_pass', 'Y');
        } // END - if
 
        // Is 'write_footer' not set?
        if (!isSessionVariableSet('write_footer')) {
                // Then set it directly
-               setSession('write_footer', 'Y');
+               setSessionCompiled('write_footer', 'Y');
        } // END - if
 
        // Is 'enable_backlink' not set?
        if (!isSessionVariableSet('enable_backlink')) {
                // Then set it directly
-               setSession('enable_backlink', 'Y');
+               setSessionCompiled('enable_backlink', 'Y');
        } // END - if
 }
 
@@ -476,10 +478,10 @@ function doAjaxPrepareInstallerExtensions () {
                 * At least ext-admins, ext-sql_patches and ext-task should be installed
                 * (ext-sql_patches is a must!)
                 */
-               setSession('extensions', 'admins:sql_patches:task');
+               setSessionCompiled('extensions', 'admins:sql_patches:task');
        } elseif (strpos(getSession('extensions'), 'sql_patches') === FALSE) {
                // Add missing ext-sql_patches
-               setSession('extensions', getSession('extensions') . ':sql_patches');
+               setSessionCompiled('extensions', getSession('extensions') . ':sql_patches');
        }
 }
 
@@ -488,25 +490,25 @@ function doAjaxPrepareInstallerFirstAdmin () {
        // Is 'admin_login' set?
        if (!isSessionVariableSet('admin_login')) {
                // Set it
-               setSession('admin_login', 'admin');
+               setSessionCompiled('admin_login', 'admin');
        } // END - if
 
        // Is 'admin_email' set?
        if (!isSessionVariableSet('admin_email')) {
                // Set it
-               setSession('admin_email', getSession('webmaster'));
+               setSessionCompiled('admin_email', getSession('webmaster'));
        } // END - if
 
        // Is 'admin_password1' set?
        if (!isSessionVariableSet('admin_password1')) {
                // Set it
-               setSession('admin_password1', '');
+               setSessionCompiled('admin_password1', '');
        } // END - if
 
        // Is 'admin_password2' set?
        if (!isSessionVariableSet('admin_password2')) {
                // Set it
-               setSession('admin_password2', '');
+               setSessionCompiled('admin_password2', '');
        } // END - if
 }
 
@@ -683,7 +685,7 @@ function doAjaxInstallerStepInstallExtensions () {
 // Call-back function to write local configuration file
 function doAjaxInstallerStepWriteLocalConfig () {
        // Is all set?
-       if (!isSessionDataSet(array('base_path', 'base_url', 'main_title', 'slogan', 'webmaster', 'mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine', 'output_mode', 'warn_no_pass', 'write_footer', 'enable_backlink'))) {
+       if (!isSessionDataSet(array('base_path', 'base_url', 'main_title', 'slogan', 'webmaster', 'mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine', 'database_extension', 'output_mode', 'warn_no_pass', 'write_footer', 'enable_backlink'))) {
                // Some required session data is not set
                reportBug(__FUNCTION__, __LINE__, 'Required session data for this step not found.');
        } elseif (isInstalled()) {
@@ -713,6 +715,7 @@ function doAjaxInstallerStepWriteLocalConfig () {
                getSession('mysql_password1'),
                getSession('mysql_prefix'),
                getSession('mysql_engine'),
+               getSession('database_extension'),
                getSession('smtp_host'),
                getSession('smtp_user'),
                getSession('smtp_password1')
index a5ea7261d17157cb62921364226888ab37f7c4fe..f66a1e3a80c3e310d76a7e5725924068a6052eec 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : CacheSystem-Klasse                               *
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -198,9 +193,6 @@ class CacheSystem {
                                } elseif ($this->name == 'refsystem') {
                                        // Referral system
                                        $GLOBALS['cache_array']['refsystem'][$k][$data['id']] = $v;
-                               } elseif ($this->name == 'revision') {
-                                       // Revision data
-                                       $GLOBALS['cache_array']['revision'][$k][0] = $v;
                                } elseif ($this->name == 'themes') {
                                        // Themes
                                        if ($k == 'theme_path') {
index bed4e0e40494ba863a054babd52ac4abfe6bafd2..67c790a71881d1b91420ef08aec918cd8a8f5e4f 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Lokale Konfiguration                             *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
@@ -75,7 +70,7 @@ setConfigEntry('_MYSQL_PREFIX', 'mxchange');
 setConfigEntry('_TABLE_TYPE', 'MyISAM');
 
 // CFG: DATABASE-TYPE
-setConfigEntry('_DB_TYPE', 'mysql3');
+setConfigEntry('_DB_TYPE', 'mysql');
 
 // CFG: BACKLINK (Enable backlink to mxchange.org in footer? rel=external is set!)
 setConfigEntry('ENABLE_BACKLINK', 'Y');
index fd86300e36f564c9617c005197002a3a793df0bd..082e4c87a13d548d13b94c5b90a7f0d407a18f32 100644 (file)
@@ -4,16 +4,11 @@
  * ===================                          Last change: 08/29/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * File              : lib-mysql3.php                                   *
+ * File              : lib-mysql.php                                    *
  * -------------------------------------------------------------------- *
- * Short description : Database layer for MySQL 3/4/5 server            *
+ * Short description : Database layer for PHP 5.4 and older             *
  * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Datenbankschicht fuer MySQL 3/4/5 Server         *
- * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
+ * Kurzbeschreibung  : Datenbankschicht fuer PHP 5.4 und aelter         *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
@@ -93,7 +88,7 @@ function sqlQuery ($sqlString, $file, $line, $enableCodes = TRUE) {
        // Run SQL command
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . basename($file) . ',line=' . $line . ',sql=' . $GLOBALS['last_sql']);
        $result = mysql_query($GLOBALS['last_sql'], getSqlLink())
-               or sqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysql_error()=' . mysql_error() . ',last_query=' . $GLOBALS['last_sql']);
+               or logSqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysql_error()=' . mysql_error() . ',last_query=' . $GLOBALS['last_sql']);
        //* DEBUG: */ logDebugMessage($file, $line, 'sql=' . $GLOBALS['last_sql'] . ',affected=' . sqlAffectedRows() . ',numRows='.(isValidSqlLink($result) ? sqlNumRows($result) : gettype($result)));
 
        // Calculate query time
@@ -212,7 +207,7 @@ function sqlResult ($resource, $row, $field = '0') {
 // SQL connect
 function sqlConnectToDatabase ($host, $login, $password, $file, $line) {
        // Try to connect
-       $linkResource = mysql_connect($host, $login, $password) or sqlError($file, $line,  mysql_error());
+       $linkResource = mysql_connect($host, $login, $password) or logSqlError($file, $line,  mysql_error());
 
        // Set the link resource
        if (isValidSqlLink($linkResource)) {
@@ -248,7 +243,7 @@ function sqlSelectDatabase ($dbName, $file, $line) {
 
        // Return the result
        //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'Selecting database ' . $dbName);
-       return mysql_select_db($dbName, getSqlLink()) or sqlError($file, $line,  mysql_error());
+       return mysql_select_db($dbName, getSqlLink()) or logSqlError($file, $line,  mysql_error());
 }
 
 // SQL close link
@@ -261,7 +256,7 @@ function sqlCloseLink ($file, $line) {
        } // END - if
 
        // Close database link and forget the link
-       $close = mysql_close(getSqlLink()) or sqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysql_error());
+       $close = mysql_close(getSqlLink()) or logSqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysql_error());
 
        // Close link in this layer
        unsetSqlLinkUp(__FUNCTION__, __LINE__);
@@ -353,40 +348,10 @@ function sqlEscapeString ($str, $secureString = TRUE, $strip = TRUE) {
        return $GLOBALS['sql_escapes']['' . $str . ''];
 }
 
-// Log SQL errors to debug.log in installation phase or call reportBug()
-function sqlError ($file, $line, $message) {
+// Set SQL error in global array
+function setSqlError ($file, $line, $message) {
        // Remember plain error in last_sql_error
        $GLOBALS['last_sql_error'] = mysql_error();
-
-       // Is login set?
-       if (!empty($GLOBALS['mysql']['login'])) {
-               // Secure login name in message
-               $message = str_replace($GLOBALS['mysql']['login'], '***', $message);
-       } // END - if
-
-       // Is database password set?
-       if (!empty($GLOBALS['mysql']['password'])) {
-               // Secure password in message
-               $message = str_replace($GLOBALS['mysql']['password'], '***', $message);
-       } // END - if
-
-       // Is database name set?
-       if (!empty($GLOBALS['mysql']['dbase'])) {
-               // Secure database name in message
-               $message = str_replace($GLOBALS['mysql']['dbase'], '***', $message);
-       } // END - if
-
-       // Is there installation phase?
-       if (isInstaller()) {
-               /*
-                * In installation phase, we don't want SQL errors abort e.g. connection
-                * tests, so just log it away.
-                */
-               logDebugMessage($file, $line, $message);
-       } else {
-               // Regular mode, then call reportBug()
-               reportBug($file, $line, $message);
-       }
 }
 
 // Checks whether given link is a valid SQL link
index 56f104cf367dd75fc9a8d851434667339434a92c..4ff03a5a372b26d339653ebe79c01c3e30617fa3 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Datenbankschicht fuer MySQL 3/4/5 Server (MySQLi)*
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -95,7 +90,7 @@ function sqlQuery ($sqlString, $file, $line, $enableCodes = TRUE) {
        // Run SQL command
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . basename($file) . ',line=' . $line . ',sql=' . $GLOBALS['last_sql']);
        $result = mysqli_query(getSqlLink(), $GLOBALS['last_sql'])
-               or sqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysqli_error()=' . mysqli_error(getSqlLink()) . ',last_query=' . $GLOBALS['last_sql']);
+               or logSqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysqli_error()=' . mysqli_error(getSqlLink()) . ',last_query=' . $GLOBALS['last_sql']);
        //* DEBUG: */ logDebugMessage($file, $line, 'sql=' . $GLOBALS['last_sql'] . ',affected=' . sqlAffectedRows() . ',numRows='.(isValidSqlLink($result) ? sqlNumRows($result) : gettype($result)));
 
        // Calculate query time
@@ -199,7 +194,7 @@ function sqlResult ($resource, $row, $field = '0') {
 // SQL connect
 function sqlConnectToDatabase ($host, $login, $password, $file, $line) {
        // Try to connect
-       $linkResource = mysqli_connect($host, $login, $password) or sqlError($file, $line,  mysqli_error(getSqlLink()));
+       $linkResource = mysqli_connect($host, $login, $password) or logSqlError($file, $line,  mysqli_error(getSqlLink()));
 
        // Set the link resource
        if ($linkResource instanceof mysqli) {
@@ -241,7 +236,7 @@ function sqlSelectDatabase ($dbName, $file, $line) {
 
        // Return the result
        //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'Selecting database ' . $dbName);
-       return mysqli_select_db(getSqlLink(), $dbName) or sqlError($file, $line,  mysqli_error(getSqlLink()));
+       return mysqli_select_db(getSqlLink(), $dbName) or logSqlError($file, $line,  mysqli_error(getSqlLink()));
 }
 
 // SQL close link
@@ -254,7 +249,7 @@ function sqlCloseLink ($file, $line) {
        } // END - if
 
        // Close database link and forget the link
-       $close = mysqli_close(getSqlLink()) or sqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysqli_error(getSqlLink()));
+       $close = mysqli_close(getSqlLink()) or logSqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysqli_error(getSqlLink()));
 
        // Close link in this layer
        unsetSqlLinkUp(__FUNCTION__, __LINE__);
@@ -343,40 +338,10 @@ function sqlEscapeString ($str, $secureString = TRUE, $strip = TRUE) {
        return $GLOBALS['sql_escapes']['' . $str . ''];
 }
 
-// Log SQL errors to debug.log in installation phase or call reportBug()
-function sqlError ($file, $line, $message) {
+// Set SQL error in global array
+function setSqlError ($file, $line, $message) {
        // Remember plain error in last_sql_error
        $GLOBALS['last_sql_error'] = mysqli_error(getSqlLink());
-
-       // Is login set?
-       if (!empty($GLOBALS['mysql']['login'])) {
-               // Secure login name in message
-               $message = str_replace($GLOBALS['mysql']['login'], '***', $message);
-       } // END - if
-
-       // Is database password set?
-       if (!empty($GLOBALS['mysql']['password'])) {
-               // Secure password in message
-               $message = str_replace($GLOBALS['mysql']['password'], '***', $message);
-       } // END - if
-
-       // Is database name set?
-       if (!empty($GLOBALS['mysql']['dbase'])) {
-               // Secure database name in message
-               $message = str_replace($GLOBALS['mysql']['dbase'], '***', $message);
-       } // END - if
-
-       // Is there installation phase?
-       if (isInstaller()) {
-               /*
-                * In installation phase, we don't want SQL errors abort e.g. connection
-                * tests, so just log it away.
-                */
-               logDebugMessage($file, $line, $message);
-       } else {
-               // Regular mode, then call reportBug()
-               reportBug($file, $line, $message);
-       }
 }
 
 // Checks whether given link is a valid SQL link
index e25a28fd3f204ce60b1fce41b7e0d50eb7ec8f73..3ccafa59c634c474b578c0922f1df45e72bcbfa3 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Expression-Callback-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                      *
@@ -157,7 +152,7 @@ function doExpressionExt ($data) {
        } // END - if
 
        // Generate replacer
-       $replacer = sprintf('&amp;ext=%s&amp;ver=%s&amp;rev={?CURRENT_REPOSITORY_REVISION?}', $data['matches'][4][$data['key']], $replacer);
+       $replacer = sprintf('&amp;ext=%s&amp;ver=%s', $data['matches'][4][$data['key']], $replacer);
 
        // Replace it and insert parameter for GET request
        $code = replaceExpressionCode($data, $replacer);
index dc97d8ec41393402a6c01c6688394ea1b9273ef4..c8e74588e557eda94cd2b8fa00c2b1af6c793def 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Funktionen fuer Filter-System                    *
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -110,7 +105,6 @@ ORDER BY
        registerFilter(__FUNCTION__, __LINE__, 'init', 'INIT_SESSION');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'SET_CURRENT_DATE');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'INIT_RANDOM_NUMBER');
-       registerFilter(__FUNCTION__, __LINE__, 'init', 'CHECK_REPOSITORY_REVISION');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_HOURLY_RESET');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_DAILY_RESET');
        registerFilter(__FUNCTION__, __LINE__, 'init', 'RUN_WEEKLY_RESET');
index 15f5c00d4622b5ce1ee73de52d3dc7d393db777f..5b3c05c5f22881e64f1e4b9eec831bbbe2ad0921 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Allgemeine Filter                                *
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -807,22 +802,6 @@ function FILTER_TRIGGER_SENDING_POOL () {
        unset($GLOBALS['pool_cnt']);
 }
 
-// Filter for checking and updating SVN revision
-function FILTER_CHECK_REPOSITORY_REVISION () {
-       // Only execute this filter if installed and all config entries are there
-       if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) {
-               return;
-       } // END - if
-
-       // Check for patch level differences between database and current hard-coded
-       if ((getCurrentRepositoryRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURRENT_REPOSITORY_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
-               // Update database and CONFIG array
-               updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrentRepositoryRevision(), 'UNIX_TIMESTAMP()'));
-               setConfigEntry('patch_level', getCurrentRepositoryRevision());
-               setConfigEntry('patch_ctime', time());
-       } // END - if
-}
-
 // Filter for running hourly reset
 function FILTER_RUN_HOURLY_RESET () {
        // Only execute this filter if installed
@@ -901,7 +880,7 @@ function FILTER_RUN_YEARLY_RESET () {
 // Filter for loading more runtime includes (not for installation)
 function FILTER_LOAD_RUNTIME_INCLUDES () {
        // Load more includes
-       foreach (array('databases', 'session', 'versions') as $inc) {
+       foreach (array('databases', 'session') as $inc) {
                // Load the include
                loadIncludeOnce('inc/' . $inc . '.php');
        } // END - foreach
@@ -1031,8 +1010,8 @@ function FILTER_HANDLE_FATAL_ERRORS () {
                'corr' => $CORR
        );
 
-       // Load footer
-       loadIncludeOnce('inc/header.php');
+       // Load header
+       loadPageHeader();
 
        // Load main template
        loadTemplate('fatal_errors', FALSE, $content);
@@ -1041,7 +1020,7 @@ function FILTER_HANDLE_FATAL_ERRORS () {
        initFatalMessages();
 
        // Load footer
-       loadIncludeOnce('inc/footer.php');
+       loadPageFooter();
 
        // Abort here
        doShutdown();
index 4f37ac1a92079a5d9ae6a39ed39301fc4d8391a9..f55c9a396a70d70b13db32e2ce2794b95f016a56 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Viele Nicht-Datenbank-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                      *
@@ -474,9 +469,9 @@ function redirectToUrl ($url, $allowSpider = TRUE) {
                sendRawRedirect(doFinalCompilation(str_replace('&amp;', '&', $url), FALSE));
        } else {
                // Output error message
-               loadInclude('inc/header.php');
+               loadPageHeader();
                loadTemplate('redirect_url', FALSE, str_replace('&amp;', '&', $url));
-               loadInclude('inc/footer.php');
+               loadPageFooter();
        }
 
        // Shut the mailer down here
@@ -551,7 +546,7 @@ function generateRandomCode ($length, $code, $userid, $extraData = '') {
        if (isConfigEntrySet('file_hash')) {
                $keys .= getEncryptSeparator() . getFileHash();
        } // END - if
-       $keys .= getEncryptSeparator() . getDateFromRepository();
+
        if (isConfigEntrySet('master_salt')) {
                $keys .= getEncryptSeparator() . getMasterSalt();
        } // END - if
@@ -780,7 +775,7 @@ function generateHash ($plainText, $salt = '', $hash = TRUE) {
                $server = $_SERVER['PHP_SELF'] . getEncryptSeparator() . detectUserAgent() . getEncryptSeparator() . getenv('SERVER_SOFTWARE') . getEncryptSeparator() . detectRealIpAddress() . getEncryptSeparator() . detectRemoteAddr();
 
                // Build key string
-               $keys = getSiteKey() . getEncryptSeparator() . getDateKey() . getEncryptSeparator() . getFileHash() . getEncryptSeparator() . getDateFromRepository() . getEncryptSeparator() . getMasterSalt();
+               $keys = getSiteKey() . getEncryptSeparator() . getDateKey() . getEncryptSeparator() . getFileHash() . getEncryptSeparator() . getMasterSalt();
 
                // Is the secret_key config entry set?
                if (isConfigEntrySet('secret_key')) {
@@ -1801,12 +1796,12 @@ function isExtraTitleSet () {
  *
  * @param      $baseDir                        Relative base directory to PATH to scan from
  * @param      $prefix                         Prefix for all positive matches (which files should be found)
- * @param      $fileIncludeDirs        whether to include directories in the final output array
- * @param      $addBaseDir                     whether to add $baseDir to all array entries
+ * @param      $fileIncludeDirs        Whether to include directories in the final output array
+ * @param      $addBaseDir                     Whether to add $baseDir to all array entries
  * @param      $excludeArray           Excluded files and directories, these must be full files names, e.g. 'what-' will exclude all files named 'what-' but won't exclude 'what-foo.php'
  * @param      $extension                      File extension for all positive matches
  * @param      $excludePattern         Regular expression to exclude more files (preg_match())
- * @param      $recursive                      whether to scan recursively
+ * @param      $recursive                      Whether to scan recursively
  * @param      $suffix                         Suffix for positive matches ($extension will be appended, too)
  * @param      $withPrefixSuffix       Whether to include prefix/suffix in found entries
  * @return     $foundMatches           All found positive matches for above criteria
@@ -2114,43 +2109,6 @@ function isSpider () {
        return ((isInStringIgnoreCase('spider', $userAgent)) || (isInStringIgnoreCase('slurp', $userAgent)) || (isInStringIgnoreCase('bot', $userAgent)) || (isInStringIgnoreCase('archiver', $userAgent)));
 }
 
-// Function to search for the last modified file
-function searchDirsRecursive ($dir, &$last_changed, $lookFor = 'Date') {
-       // Get dir as array
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dir=' . $dir);
-       // Does it match what we are looking for? (We skip a lot files already!)
-       // RegexPattern to exclude  ., .., .revision,  .svn, debug.log or .cache in the filenames
-       $excludePattern = '@(\.revision|\.svn|debug\.log|\.cache|config\.php)$@';
-
-       $ds = getArrayFromDirectory($dir, '', FALSE, TRUE, array(), '.php', $excludePattern);
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count(ds)='.count($ds));
-
-       // Walk through all entries
-       foreach ($ds as $d) {
-               // Generate proper FQFN
-               $FQFN = str_replace('//', '/', getPath() . $dir . '/' . $d);
-
-               // Is it a file and readable?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dir=' . $dir . ',d=' . $d);
-               if (isFileReadable($FQFN)) {
-                       // $FQFN is a readable file so extract the requested data from it
-                       $check = extractRevisionInfoFromFile($FQFN, $lookFor);
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'File: ' . $d . ' found. check=' . $check);
-
-                       // Is the file more recent?
-                       if ((!isset($last_changed[$lookFor])) || ($last_changed[$lookFor] < $check)) {
-                               // This file is newer as the file before
-                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'NEWER!');
-                               $last_changed['path_name'] = $FQFN;
-                               $last_changed[$lookFor] = $check;
-                       } // END - if
-               } else {
-                       // Not readable
-                       /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'File: ' . $d . ' not readable or directory.');
-               }
-       } // END - foreach
-}
-
 // Handles the braces [] of a field (e.g. value of 'name' attribute)
 function handleFieldWithBraces ($field) {
        // Are there braces [] at the end?
@@ -2937,5 +2895,31 @@ function isThemeReadable ($theme) {
        return $GLOBALS[__FUNCTION__][$theme];
 }
 
+// Checks whether a given PHP extension is loaded or can be loaded at runtime
+//
+// Supported OS: Windows, Linux, (Mac?)
+function isPhpExtensionLoaded ($extension) {
+       // Is the extension loaded?
+       if (extension_loaded($extension)) {
+               // All fine
+               return TRUE;
+       } // END - if
+
+       // Try to load the extension
+       return loadLibrary($extension);
+}
+
+// Loads given library (aka. PHP extension)
+// Credits: shaunspiller at spammenot-gmail dot com ( http://de.php.net/dl#88566 )
+function loadLibrary ($n, $f = NULL) {
+       return extension_loaded($n) or dl(((PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '') . ($f ? $f : $n) . '.' . PHP_SHLIB_SUFFIX);
+}
+
+// "Translates" given PHP extension name into a readable version
+function translatePhpExtension ($extension) {
+       // Return the language element
+       return '{--PHP_EXTENSION_' . strtoupper($extension) . '--}';
+}
+
 // [EOF]
 ?>
index ee94c6f58243ff1bfd12a142f7fc107cfa0ae0d1..2ba4333af51adda359ff91655ed3ff9e2ff5b049 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Lader fuer Konfiguration                         *
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -43,7 +38,7 @@ if (!defined('__SECURITY')) {
 // Set some config entries which is required for installation phase
 setConfigEntry('OUTPUT_MODE' , 'render');
 setConfigEntry('WRITE_FOOTER', 'Y');
-setConfigEntry('_DB_TYPE'    , 'mysql3');
+setConfigEntry('_DB_TYPE'    , 'mysql');
 
 // Mark configuration as NOT loaded which is the default
 $GLOBALS['config_local_loaded'] = FALSE;
index 5cd6a3cf45277990ba93d498c8da49ef1fe61e85..4a6361853e92a1480f7e6a8076da478874657d1a 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Verbindet zu Ihrer Datenbank                     *
  * -------------------------------------------------------------------- *
- * $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                      *
@@ -58,7 +53,6 @@ foreach ( array(
                'sql',
                'expression',
                'filter',
-               'revision',
                'extensions') as $lib) {
 
        // Add it
@@ -97,9 +91,6 @@ if (!isset($GLOBALS['__header_sent'])) {
 // Init fatal messages
 initFatalMessages();
 
-// Init repository data sub-system
-initRepositoryData();
-
 // Enable HTML templates by default
 enableTemplateHtml();
 
@@ -130,7 +121,7 @@ if ((!isInstaller()) && (isInstalled())) {
        } // END - if
 
        // CFG: DATABASE-TYPE
-       setConfigEntry('_DB_TYPE', 'mysql3');
+       setConfigEntry('_DB_TYPE', 'mysql');
 
        // Set link as down
        unsetSqlLinkUp(__FILE__, __LINE__);
@@ -142,7 +133,7 @@ if ((!isInstaller()) && (isInstalled())) {
        initMessages();
 
        // Include more
-       foreach (array('databases', 'session', 'versions', 'install-functions', 'load_config', 'load_cache') as $inc) {
+       foreach (array('databases', 'session', 'install-functions', 'load_config', 'load_cache') as $inc) {
                // Load include file
                loadIncludeOnce('inc/' . $inc . '.php');
        } // END - foreach