Fixes and cleanups
authorRoland Häder <roland@mxchange.org>
Sat, 13 Aug 2011 20:04:34 +0000 (20:04 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 13 Aug 2011 20:04:34 +0000 (20:04 +0000)
15 files changed:
inc/extensions-functions.php
inc/extensions/ext-nickname.php
inc/filters.php
inc/functions.php
inc/libs/network_functions.php
inc/loader/load-points_data.php
inc/module-functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-list_links.php
inc/modules/admin/what-list_primera.php
inc/modules/admin/what-list_unconfirmed.php
inc/modules/admin/what-list_wernis.php
inc/referral-functions.php
inc/sql-functions.php
theme/README.txt

index e7e6bce3085bee962e5c0d2925ddb8f408e4b940..4dec81d05fcdf2edb805f58df47f5254fa8c7807 100644 (file)
@@ -1314,7 +1314,7 @@ function isExtensionUpdateRunning ($ext_name, $ignoreDependencies = false) {
                $isRunning = false;
 
                // Walk through whole array
                $isRunning = false;
 
                // Walk through whole array
-               foreach ($GLOBALS['ext_running_updates'] as $ext1=>$depends) {
+               foreach ($GLOBALS['ext_running_updates'] as $ext1 => $depends) {
                        // Is it found?
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext1=' . $ext1 . ',ext_name=' . $ext_name . ',depends=' . print_r($depends, true));
                        if (($ext1 == $ext_name) || ((in_array($ext_name, $depends)) && ($ignoreDependencies === false))) {
                        // Is it found?
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext1=' . $ext1 . ',ext_name=' . $ext_name . ',depends=' . print_r($depends, true));
                        if (($ext1 == $ext_name) || ((in_array($ext_name, $depends)) && ($ignoreDependencies === false))) {
index 1358ecf6f2a931fa2065f9edcef06673a96721c1..3f005580c89087ed7774a7cb9ca903158c487c7d 100644 (file)
@@ -128,7 +128,7 @@ switch (getExtensionMode()) {
                                break;
 
                        case '0.1.1': // SQL queries for v0.1.1
                                break;
 
                        case '0.1.1': // SQL queries for v0.1.1
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP nick_userid");
+                               addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` DROP `nick_userid`');
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Auswahlf&uuml;r Mitglied ob mit Nickname oder Mitglied-Id einloggen entfernt.");
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Auswahlf&uuml;r Mitglied ob mit Nickname oder Mitglied-Id einloggen entfernt.");
index aa3d7d3d9440cad895468e4a0de416a96f4d14c6..92a0174bb59e2b548634eac357a494c6986846eb 100644 (file)
@@ -256,7 +256,7 @@ function FILTER_RUN_SQLS ($filterData) {
        if ((isSqlsValid()) && ((!isset($filterData['dry_run'])) || ($filterData['dry_run'] == false))) {
                // Run SQL commands
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Found ' . countSqls() . ' queries to run.');
        if ((isSqlsValid()) && ((!isset($filterData['dry_run'])) || ($filterData['dry_run'] == false))) {
                // Run SQL commands
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Found ' . countSqls() . ' queries to run.');
-               foreach (getSqls() as $mode=>$sqls) {
+               foreach (getSqls() as $mode => $sqls) {
                        // Debug message
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mode=' . $mode . ',count()=' . count($sqls));
 
                        // Debug message
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mode=' . $mode . ',count()=' . count($sqls));
 
index 28c3beea4cd0169c4f77495969fdc85860d4b19b..546086cb96fbcb436a5f56944717d7c39bfd3563 100644 (file)
@@ -698,6 +698,7 @@ function generateRandomCode ($length, $code, $userid, $extraData = '') {
 
 // Does only allow numbers
 function bigintval ($num, $castValue = true, $abortOnMismatch = true) {
 
 // Does only allow numbers
 function bigintval ($num, $castValue = true, $abortOnMismatch = true) {
+       //* DEBUG: */ debugOutput('[' . __FUNCTION__ . ':' . __LINE__ . '] ' . 'num=' . $num . ',castValue=' . intval($castValue) . ',abortOnMismatch=' . intval($abortOnMismatch) . ' - ENTERED!');
        // Filter all numbers out
        $ret = preg_replace('/[^0123456789]/', '', $num);
 
        // Filter all numbers out
        $ret = preg_replace('/[^0123456789]/', '', $num);
 
@@ -714,6 +715,7 @@ function bigintval ($num, $castValue = true, $abortOnMismatch = true) {
        } // END - if
 
        // Return result
        } // END - if
 
        // Return result
+       //* DEBUG: */ debugOutput('[' . __FUNCTION__ . ':' . __LINE__ . '] ' . 'num=' . $num . ',castValue=' . intval($castValue) . ',abortOnMismatch=' . intval($abortOnMismatch) . ',ret=' . $ret . ' - EXIT!');
        return $ret;
 }
 
        return $ret;
 }
 
index 592ee41febc5161e9405d866df1f79ea32e96163..57e512bbcb597bb20b47dc6531a4d47f55d2e2cf 100644 (file)
@@ -1346,6 +1346,12 @@ function doAdminNetworkProcessNetworkApiConfig () {
        // Add id
        setPostRequestElement('network_id', bigintval(getRequestElement('network')));
 
        // Add id
        setPostRequestElement('network_id', bigintval(getRequestElement('network')));
 
+       // Is network_api_referral_button set?
+       if (postRequestElement('network_api_referral_button') == '') {
+               // Remove empty value to get a NULL for an optional entry
+               unsetPostRequestElement('network_api_referral_button');
+       } // END - if
+
        // Is there already an entry?
        if (isNetworkApiConfigured(getRequestElement('network'))) {
                // Generate SQL query
        // Is there already an entry?
        if (isNetworkApiConfigured(getRequestElement('network'))) {
                // Generate SQL query
index eea02d507cca58f7bc823573cc34d264bcaa4773..2033281d6520a669e864e01902d9998d1179376c 100644 (file)
@@ -61,9 +61,9 @@ if (($GLOBALS['cache_instance']->loadCacheFile('points_data')) && ($GLOBALS['cac
        $pointsData = array();
 
        // Rewrite all to subject
        $pointsData = array();
 
        // Rewrite all to subject
-       foreach ($GLOBALS['cache_array']['points_data']['subject'] as $key=>$subject) {
+       foreach ($GLOBALS['cache_array']['points_data']['subject'] as $key => $subject) {
                // Re-add key with subject
                // Re-add key with subject
-               foreach ($GLOBALS['cache_array']['points_data'] as $key2=>$array) {
+               foreach ($GLOBALS['cache_array']['points_data'] as $key2 => $array) {
                        // Is key2 not 'subject'?
                        if ($key2 != 'subject') {
                                // Then Add it
                        // Is key2 not 'subject'?
                        if ($key2 != 'subject') {
                                // Then Add it
index 37e4664655de0300c4baea75827f2ddcfbe9de9d..8af427efc37fd9f660ecba039b53932c03192842 100644 (file)
@@ -146,7 +146,7 @@ function isModuleRegistered ($module) {
                        $data = SQL_FETCHARRAY($result);
 
                        // Set all entries
                        $data = SQL_FETCHARRAY($result);
 
                        // Set all entries
-                       foreach ($data as $key=>$value) {
+                       foreach ($data as $key => $value) {
                                $GLOBALS['cache_array']['modules'][$key][$module] = $value;
                        } // END - foreach
 
                                $GLOBALS['cache_array']['modules'][$key][$module] = $value;
                        } // END - foreach
 
index 86de3a3778c29ecdcacbe632f61b7b4bd6cc7116..85c2d67250cd46af3b009fa60f8df74a70e3e922 100644 (file)
@@ -1298,7 +1298,7 @@ function adminAddEntries ($tableName, $columns = array(), $filterFunctions = arr
        $sqlValues  = array();
 
        // Add columns and values
        $sqlValues  = array();
 
        // Add columns and values
-       foreach ($columns as $key=>$columnName) {
+       foreach ($columns as $key => $columnName) {
                // Copy entry to final arrays
                $sqlColumns[$key] = $columnName;
                $sqlValues[$key]  = postRequestElement($columnName);
                // Copy entry to final arrays
                $sqlColumns[$key] = $columnName;
                $sqlValues[$key]  = postRequestElement($columnName);
@@ -1372,7 +1372,7 @@ function adminListEntries ($tableTemplate, $rowTemplate, $noEntryMessageId, $tab
        if (count($orderByColumns) > 0) {
                // Add them as well
                $SQL .= ' ORDER BY ';
        if (count($orderByColumns) > 0) {
                // Add them as well
                $SQL .= ' ORDER BY ';
-               foreach ($orderByColumns as $orderByColumn=>$array) {
+               foreach ($orderByColumns as $orderByColumn => $array) {
                        // Get keys (table/alias) and values (sorting itself)
                        $table   = trim(implode('', array_keys($array)));
                        $sorting = trim(implode('', array_keys($array)));
                        // Get keys (table/alias) and values (sorting itself)
                        $table   = trim(implode('', array_keys($array)));
                        $sorting = trim(implode('', array_keys($array)));
@@ -1406,7 +1406,7 @@ function doAdminListEntries ($SQL, $tableTemplate, $noEntryMessageId, $rowTempla
                $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
                        // "Translate" content
                $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
                        // "Translate" content
-                       foreach ($callbackColumns as $columnName=>$callbackFunction) {
+                       foreach ($callbackColumns as $columnName => $callbackFunction) {
                                // Fill the callback arguments
                                $args = array($content[$columnName]);
 
                                // Fill the callback arguments
                                $args = array($content[$columnName]);
 
index cc344e13c26136a1e43380436a6127dffd3f7ae5..0acde7aa1984e9364687c6e7e10031988a531c34 100644 (file)
@@ -118,7 +118,10 @@ if (isGetRequestElementSet('userid')) {
                                                $content = SQL_FETCHARRAY($result_data);
 
                                                // Fix empty subject
                                                $content = SQL_FETCHARRAY($result_data);
 
                                                // Fix empty subject
-                                               if (empty($content['subject'])) $content['subject'] = '{--DEFAULT_SUBJECT_LINE--}';
+                                               if (empty($content['subject'])) {
+                                                       // The subject line is empty so we use the default
+                                                       $content['subject'] = '{--DEFAULT_SUBJECT_LINE--}';
+                                               } // END - if
 
                                                // Prepare data for the row template
                                                $content['link']      = $LINK;
 
                                                // Prepare data for the row template
                                                $content['link']      = $LINK;
index 971e77ac39d00ac8fca01ee8f1a845257d0631a4..502a07c846a638e61debed114a2838ca2082fd48 100644 (file)
@@ -44,13 +44,20 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 addYouAreHereLink('admin', __FILE__);
 
 // Check for entries
 addYouAreHereLink('admin', __FILE__);
 
 // Check for entries
-$result = SQL_QUERY("SELECT
-       `id`,`userid`,`primera_account`,`primera_amount`,`primera_timestamp`,`primera_type`,`primera_api_message`,`primera_api_status`
+$result = SQL_QUERY('SELECT
+       `id`,
+       `userid`,
+       `primera_account`,
+       `primera_amount`,
+       `primera_timestamp`,
+       `primera_type`,
+       `primera_api_message`,
+       `primera_api_status`
 FROM
        `{?_MYSQL_PREFIX?}_user_primera`
 ORDER BY
        `primera_timestamp` DESC,
 FROM
        `{?_MYSQL_PREFIX?}_user_primera`
 ORDER BY
        `primera_timestamp` DESC,
-       `id` DESC",
+       `id` DESC',
        __FILE__, __LINE__);
 
 // Are there some entries to display?
        __FILE__, __LINE__);
 
 // Are there some entries to display?
@@ -62,7 +69,10 @@ if (!SQL_HASZERONUMS($result)) {
                $content['primera_timestamp'] = generateDateTime($content['primera_timestamp'], 2);
 
                // Fix empty message and status
                $content['primera_timestamp'] = generateDateTime($content['primera_timestamp'], 2);
 
                // Fix empty message and status
-               if (empty($content['primera_api_status']))  $content['primera_api_status']  = 'OK';
+               if (empty($content['primera_api_status'])) {
+                       // Needs to be fixed to 'OK'
+                       $content['primera_api_status']  = 'OK';
+               } // END - if
 
                // Append it and switch colors
                $OUT .= loadTemplate('admin_list_primera_row', true, $content);
 
                // Append it and switch colors
                $OUT .= loadTemplate('admin_list_primera_row', true, $content);
index c5903b53f4e17969fe0a207de6b024a65597a716..0b9172531c70229e65399944e60d3ffb454373a4 100644 (file)
@@ -132,7 +132,12 @@ if (($listed === true) && (!empty($sql))) {
                // but it does only show unconfirmed mail links from existing user
                // accounts. So if you have delete one you did not see those links
                $result = SQL_QUERY_ESC("SELECT
                // but it does only show unconfirmed mail links from existing user
                // accounts. So if you have delete one you did not see those links
                $result = SQL_QUERY_ESC("SELECT
-       l.`userid`, u.`status`, u.`surname`, u.`family`, u.`gender`, u.`email`
+       l.`userid`,
+       u.`status`,
+       u.`surname`,
+       u.`family`,
+       u.`gender`,
+       u.`email`
 FROM
        `{?_MYSQL_PREFIX?}_user_links` AS `l`
 LEFT JOIN
 FROM
        `{?_MYSQL_PREFIX?}_user_links` AS `l`
 LEFT JOIN
index 838c5a815f8dff56fb9ca03e41d18a9c4aca97e6..a2ea24fd7c3bc5af1821efc7f73df7736428eef7 100644 (file)
@@ -69,7 +69,10 @@ if (!SQL_HASZERONUMS($result)) {
                $content['wernis_timestamp'] = generateDateTime($content['wernis_timestamp'], 2);
 
                // Fix empty message and status
                $content['wernis_timestamp'] = generateDateTime($content['wernis_timestamp'], 2);
 
                // Fix empty message and status
-               if (empty($content['wernis_api_status']))  $content['wernis_api_status']  = 'OK';
+               if (empty($content['wernis_api_status'])) {
+                       // Needs to be fixed to 'OK'
+                       $content['wernis_api_status']  = 'OK';
+               } // END - if
 
                // Append it and switch colors
                $OUT .= loadTemplate('admin_list_wernis_row', true, $content);
 
                // Append it and switch colors
                $OUT .= loadTemplate('admin_list_wernis_row', true, $content);
index ee2b1a3be26b2ee165f9bb3fdef944ed9b956e8b..c66289a0e36e9c6f074445681d537ab082c52154 100644 (file)
@@ -438,7 +438,7 @@ function getPointsDataArrayFromSubject ($subject) {
                $pointsData = SQL_FETCHARRAY($result);
 
                // Add all entries to our cache array
                $pointsData = SQL_FETCHARRAY($result);
 
                // Add all entries to our cache array
-               foreach ($pointsData as $key=>$value) {
+               foreach ($pointsData as $key => $value) {
                        $GLOBALS['cache_array']['points_data'][$subject][$key] = $value;
                } // END - foreach
        } else {
                        $GLOBALS['cache_array']['points_data'][$subject][$key] = $value;
                } // END - foreach
        } else {
@@ -577,7 +577,7 @@ function addMissingReferralLevels ($userid) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',count()=' . count($GLOBALS['referral_refid'][$userid]));
 
        // Now walk through the array, first levels
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',count()=' . count($GLOBALS['referral_refid'][$userid]));
 
        // Now walk through the array, first levels
-       foreach ($GLOBALS['referral_refid'][$userid] as $level=>$levelArray) {
+       foreach ($GLOBALS['referral_refid'][$userid] as $level => $levelArray) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',count()=' . count($levelArray));
                // Next are the users
                foreach ($levelArray as $refid) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',count()=' . count($levelArray));
                // Next are the users
                foreach ($levelArray as $refid) {
@@ -586,7 +586,7 @@ function addMissingReferralLevels ($userid) {
                        if (isset($GLOBALS['referral_refid'][$refid])) {
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',count()=' . count($GLOBALS['referral_refid'][$refid]));
                                // Okay, then walk through here, too
                        if (isset($GLOBALS['referral_refid'][$refid])) {
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',count()=' . count($GLOBALS['referral_refid'][$refid]));
                                // Okay, then walk through here, too
-                               foreach ($GLOBALS['referral_refid'][$refid] as $refLevel=>$refArray) {
+                               foreach ($GLOBALS['referral_refid'][$refid] as $refLevel => $refArray) {
                                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',refLevel=' . $refLevel . ',count()=' . count($refArray));
                                        // Also walk through this one
                                        foreach ($refArray as $refRefid) {
                                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . makeNullToZero($refid) . ',refLevel=' . $refLevel . ',count()=' . count($refArray));
                                        // Also walk through this one
                                        foreach ($refArray as $refRefid) {
@@ -629,7 +629,7 @@ function flushReferralTableToDatabase ($userid) {
        $executeSql = false;
 
        // Now walk through the array, first levels
        $executeSql = false;
 
        // Now walk through the array, first levels
-       foreach ($GLOBALS['referral_refid'][$userid] as $level=>$levelArray) {
+       foreach ($GLOBALS['referral_refid'][$userid] as $level => $levelArray) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',count()=' . count($levelArray));
                // Next are the users
                foreach ($levelArray as $refid) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',count()=' . count($levelArray));
                // Next are the users
                foreach ($levelArray as $refid) {
index 5ec4bee18cf0ce1fdfc51ba08946e48dc4850b0a..75118871d76f1209baddcd6d62cbff808b1cf8c7 100644 (file)
@@ -141,10 +141,10 @@ function getUpdateSqlFromArray ($array, $tableName, $whereColumn, $whereData, $e
                        // Handle one-dimensional data
                        if (is_null($value)) {
                                // NULL detected
                        // Handle one-dimensional data
                        if (is_null($value)) {
                                // NULL detected
-                               $SQL .= '`' . $entry . '`=NULL, ';
-                       } elseif ((bigintval($value, true, false) === $value) || ($value == 'NOW()') || (substr($value, 0, 1) == '`'))  {
+                               $SQL .= '`' . $entry . '`=NULL,';
+                       } elseif (('' . bigintval($value, true, false) . '' == '' . $value . '') || ($value == 'NOW()') || (substr($value, 0, 1) == '`'))  {
                                // No need for ticks (')
                                // No need for ticks (')
-                               $SQL .= '`' . $entry . '`=' . $value . ', ';
+                               $SQL .= '`' . $entry . '`=' . $value . ',';
                        } else {
                                // Strings need ticks (') around them
                                $SQL .= '`' . $entry . "`='" . SQL_ESCAPE($value) . "', ";
                        } else {
                                // Strings need ticks (') around them
                                $SQL .= '`' . $entry . "`='" . SQL_ESCAPE($value) . "', ";
@@ -154,25 +154,25 @@ function getUpdateSqlFromArray ($array, $tableName, $whereColumn, $whereData, $e
                        if (is_null($value[$multiDimId])) {
                                // NULL detected
                                $SQL .= '`' . $entry . '`=NULL, ';
                        if (is_null($value[$multiDimId])) {
                                // NULL detected
                                $SQL .= '`' . $entry . '`=NULL, ';
-                       } elseif ((bigintval($value[$multiDimId], true, false) === $value[$multiDimId]) || ($value[$multiDimId] == 'NOW()') || (substr($value[$multiDimId], 0, 1) == '`'))  {
+                       } elseif (('' . bigintval($value[$multiDimId], true, false) . '' == '' . $value[$multiDimId] . '') || ($value[$multiDimId] == 'NOW()') || (substr($value[$multiDimId], 0, 1) == '`'))  {
                                // No need for ticks (')
                                // No need for ticks (')
-                               $SQL .= '`' . $entry . '`=' . $value[$multiDimId] . ', ';
+                               $SQL .= '`' . $entry . '`=' . $value[$multiDimId] . ',';
                        } else {
                                // Strings need ticks (') around them
                        } else {
                                // Strings need ticks (') around them
-                               $SQL .= '`' . $entry . "`='" . SQL_ESCAPE($value[$multiDimId]) . "', ";
+                               $SQL .= '`' . $entry . "`='" . SQL_ESCAPE($value[$multiDimId]) . "',";
                        }
                }
        } // END - foreach
 
        // Remove last 2 chars and finish query
                        }
                }
        } // END - foreach
 
        // Remove last 2 chars and finish query
-       $SQL = substr($SQL, 0, -2) . ' WHERE `' . $whereColumn . '`=' . $whereData . ' LIMIT 1';
+       $SQL = substr($SQL, 0, -1) . ' WHERE `' . $whereColumn . '`=' . $whereData . ' LIMIT 1';
 
        // Return SQL query
        return $SQL;
 }
 
 // "Getter" for an "INSERT INTO" SQL query
 
        // Return SQL query
        return $SQL;
 }
 
 // "Getter" for an "INSERT INTO" SQL query
-function getInsertSqlFromArray ($array, $tableName, $excludedFields = array('ok', 'add', 'do_edit')) {
+function getInsertSqlFromArray ($array, $tableName) {
        // Init SQL
        $SQL = 'INSERT INTO
 `{?_MYSQL_PREFIX?}_' . $tableName . '`
        // Init SQL
        $SQL = 'INSERT INTO
 `{?_MYSQL_PREFIX?}_' . $tableName . '`
@@ -181,15 +181,18 @@ function getInsertSqlFromArray ($array, $tableName, $excludedFields = array('ok'
 ) VALUES (';
 
        // Walk through all entries
 ) VALUES (';
 
        // Walk through all entries
-       foreach (postRequestArray() as $key=>$value) {
+       foreach (postRequestArray() as $key => $value) {
+               // Log debug message
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',key=' . $key . ',value=' . $value);
+
                // Add all entries
                if (is_null($value)) {
                        // Add NULL
                        $SQL .= 'NULL,';
                // Add all entries
                if (is_null($value)) {
                        // Add NULL
                        $SQL .= 'NULL,';
-               } elseif ((bigintval($value, true, false) == $value)) {
+               } elseif ('' . bigintval($value, true, false) . '' == '' . $value . '') {
                        // Number detected, no need for ticks (')
                        $SQL .= bigintval($value) . ',';
                        // Number detected, no need for ticks (')
                        $SQL .= bigintval($value) . ',';
-               } elseif ('' . (float)$value . '' == $value) {
+               } elseif ('' . (float) $value . '' == '' . $value . '') {
                        // Float number detected
                        $SQL .= sprintf('%01.5f', $value);
                } else {
                        // Float number detected
                        $SQL .= sprintf('%01.5f', $value);
                } else {
@@ -199,7 +202,7 @@ function getInsertSqlFromArray ($array, $tableName, $excludedFields = array('ok'
        } // END - foreach
 
        // Finish SQL query
        } // END - foreach
 
        // Finish SQL query
-       $SQL .= ')';
+       $SQL = substr($SQL, 0, -1) . ')';
 
        // Return SQL query
        return $SQL;
 
        // Return SQL query
        return $SQL;
index b27ff83d5cde98dc20636f552211b5a4c53f0139..b986e6781417b48aa8fbf02de2e8e69ead0ecefc 100644 (file)
@@ -2,4 +2,4 @@ Please read these notes before creating your own design:
 --------------------------------------------------------
 
 Design names all lower-case, a-z, numbers, dash and underscore. Spaces in the
 --------------------------------------------------------
 
 Design names all lower-case, a-z, numbers, dash and underscore. Spaces in the
-name are not spported.
+name are not spported and might fail.