$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))) {
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ür Mitglied ob mit Nickname oder Mitglied-Id einloggen entfernt.");
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));
// 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);
} // END - if
// Return result
+ //* DEBUG: */ debugOutput('[' . __FUNCTION__ . ':' . __LINE__ . '] ' . 'num=' . $num . ',castValue=' . intval($castValue) . ',abortOnMismatch=' . intval($abortOnMismatch) . ',ret=' . $ret . ' - EXIT!');
return $ret;
}
// 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
$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
- 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
$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
$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);
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)));
$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]);
$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;
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,
- `id` DESC",
+ `id` DESC',
__FILE__, __LINE__);
// Are there some entries to display?
$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);
// 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
$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);
$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 {
//* 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) {
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) {
$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) {
// 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 (')
- $SQL .= '`' . $entry . '`=' . $value . ', ';
+ $SQL .= '`' . $entry . '`=' . $value . ',';
} else {
// Strings need ticks (') around them
$SQL .= '`' . $entry . "`='" . SQL_ESCAPE($value) . "', ";
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 (')
- $SQL .= '`' . $entry . '`=' . $value[$multiDimId] . ', ';
+ $SQL .= '`' . $entry . '`=' . $value[$multiDimId] . ',';
} 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
- $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
-function getInsertSqlFromArray ($array, $tableName, $excludedFields = array('ok', 'add', 'do_edit')) {
+function getInsertSqlFromArray ($array, $tableName) {
// Init SQL
$SQL = 'INSERT INTO
`{?_MYSQL_PREFIX?}_' . $tableName . '`
) 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,';
- } elseif ((bigintval($value, true, false) == $value)) {
+ } elseif ('' . bigintval($value, true, false) . '' == '' . $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 {
} // END - foreach
// Finish SQL query
- $SQL .= ')';
+ $SQL = substr($SQL, 0, -1) . ')';
// Return SQL query
return $SQL;
--------------------------------------------------------
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.