./inc/daily/daily_birthday.php:99: // @TODO 4 is hard-coded here, should we move it out in config?
./inc/email-functions.php:109: * @TODO Rewrite this to an extension 'smtp'
./inc/email-functions.php:227:// @TODO $rawUserId is currently unused
-./inc/expression-functions.php:170:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
+./inc/expression-functions.php:173:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
./inc/expression-functions.php:46: // @TODO is escapeQuotes() enougth for strings with single/double quotes?
./inc/extensions/ext-html_mail.php:136: // @TODO Move these arrays into config
./inc/extensions/ext-menu.php:52: // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => (edit|add)_(admin|guest|member)_menu
./inc/filter/bonus_filter.php:56: // @TODO This query isn't right, it will only update if the user was for a longer time away!
./inc/filter/cache_filter.php:94: // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
./inc/filter/forced_filter.php:73: // @TODO This part is unfinished
-./inc/filters.php:1292: // @TODO No banner found, output some default banner
-./inc/functions.php:1090: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1176: // @TODO Are these convertions still required?
-./inc/functions.php:1197:// @TODO Rewrite this function to use readFromFile() and writeToFile()
-./inc/functions.php:1733: // @TODO Find a way to cache this
-./inc/functions.php:1838: // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2042: // @TODO Rename column data_type to e.g. mail_status
+./inc/filters.php:1295: // @TODO No banner found, output some default banner
+./inc/functions.php:1089: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
+./inc/functions.php:1175: // @TODO Are these convertions still required?
+./inc/functions.php:1196:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1780: // @TODO Find a way to cache this
+./inc/functions.php:1885: // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2095: // @TODO Rename column data_type to e.g. mail_status
./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
./inc/header.php:66:// @TODO Find a way to not use direct module comparison
./inc/install-functions.php:91: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0);
./inc/mysql-manager.php:1461: // @TODO Rewrite this to a filter
./inc/mysql-manager.php:1767: // @TODO Rewrite this to a filter
./inc/mysql-manager.php:1964: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
-./inc/mysql-manager.php:2098: // @TODO Used generic 'userid' here
+./inc/mysql-manager.php:2067: // @TODO Used generic 'userid' here
./inc/mysql-manager.php:398: // @TODO Try to rewrite this to one or more functions
./inc/mysql-manager.php:44:// @TODO Can we cache this?
./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter
./inc/revision-functions.php:168:// @TODO This function does also set and get in 'cache_array'
-./inc/template-functions.php:1126: // @TODO Deprecate this thing
./inc/template-functions.php:1137: // @TODO Deprecate this thing
-./inc/template-functions.php:1244: // @TODO This can be easily moved out after the merge from EL branch to this is complete
-./inc/template-functions.php:1293: // @TODO Add a little more infos here
-./inc/template-functions.php:1668:// @TODO Lame description for this function
-./inc/template-functions.php:1690: // @TODO Move this in a filter
-./inc/template-functions.php:197: * @TODO On some pages this is buggy
-./inc/template-functions.php:2293: // @TODO Is this needed for e.g. $GLOBALS['template_content'] ? $this->setRawTemplateData($compactedContent);
-./inc/template-functions.php:285: // @TODO Remove these sanity checks if all is fine
-./inc/template-functions.php:617:// @TODO $simple/$constants are deprecated
-./inc/template-functions.php:715: // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
-./inc/wrapper-functions.php:3017: // @TODO Find a way to not use direct module comparison
-./inc/wrapper-functions.php:494:// @TODO Do some more sanity check here
+./inc/template-functions.php:1148: // @TODO Deprecate this thing
+./inc/template-functions.php:1255: // @TODO This can be easily moved out after the merge from EL branch to this is complete
+./inc/template-functions.php:1304: // @TODO Add a little more infos here
+./inc/template-functions.php:1679:// @TODO Lame description for this function
+./inc/template-functions.php:1701: // @TODO Move this in a filter
+./inc/template-functions.php:203: * @TODO On some pages this is buggy
+./inc/template-functions.php:2304: // @TODO Is this needed for e.g. $GLOBALS['template_content'] ? $this->setRawTemplateData($compactedContent);
+./inc/template-functions.php:291: // @TODO Remove these sanity checks if all is fine
+./inc/template-functions.php:628:// @TODO $simple/$constants are deprecated
+./inc/template-functions.php:726: // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
+./inc/wrapper-functions.php:3037: // @TODO Find a way to not use direct module comparison
+./inc/wrapper-functions.php:506:// @TODO Do some more sanity check here
./inc/xml-functions.php:239: // @TODO Handle characters
./mailid.php:102: // @TODO Rewrite this to a filter
./mailid.php:145: // @TODO Rewrite this to a filter
}
}
+// Handles the XML node 'extra-parameter-waiting-list'
+function doXmlExtraParameterWaitingList ($resource, $attributes) {
+ // There should be no attributes
+ if (count($attributes) > 0) {
+ // Please don't add any attributes to foo-list nodes
+ reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
+ } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['waiting_list'])) {
+ // This list should be created already
+ reportBug(__FUNCTION__, __LINE__, 'waiting_list should be already created.');
+ }
+}
+
// Handles the XML node 'extra-parameter-member-list-entry'
function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
// There are three attributes, by default
addXmlValueToCallbackAttributes('extra_list', $attributes, 'reload_list');
}
+// Handles the XML node 'extra-parameter-waiting-list-entry'
+function doXmlExtraParameterWaitingListEntry ($resource, $attributes) {
+ // There are three attributes, by default
+ if (count($attributes) != 3) {
+ // Not the right count
+ reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
+ } elseif (!isset($attributes['NAME'])) {
+ // 'NAME' not found
+ reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
+ } elseif (!isset($attributes['TYPE'])) {
+ // 'TYPE' not found
+ reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
+ } elseif (!isInvalidXmlType($attributes['TYPE'])) {
+ // No valid type
+ reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
+ } elseif (!isset($attributes['VALUE'])) {
+ // 'VALUE' not found
+ reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
+ } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
+ // Not valid/verifyable
+ reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
+ } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['waiting_list'])) {
+ // doXmlCallbackFunction is missing
+ reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/waiting-list not included around this node. Please fix your XML.');
+ }
+
+ // Add the entry to the list
+ addXmlValueToCallbackAttributes('extra_list', $attributes, 'waiting_list');
+}
+
// Handles the XML node 'extra-parameter-added-list'
function doXmlExtraParameterAddedList ($resource, $attributes) {
// There should be no attributes
return FALSE;
} // END - if
- // Init array for escaped data with SQL string
+ // Init array for escape'd data with SQL string
$dataSecured = array(
'__sql_string' => $sqlString
);
$replacer = "{DQUOTE} . encodeUrl('" . $data['matches'][4][$data['key']] . "', " . $data['output_mode'] . ') . {DQUOTE}';
// Debug log
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'replacer=' . $replacer . ',callback=' . $data['callback']);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'replacer=' . $replacer . ',callback=' . $data['callback'] . ',output_mode=' . $data['output_mode']);
// Replace it
$code = replaceExpressionCode($data, $replacer);
// Replace it and insert parameter for GET request
$code = replaceExpressionCode($data, $replacer);
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'code=' . $code . ',replacer=' . $replacer . ',key=' . $data['key'] . ',callback=' . $data['callback']);
+
// Return replaced code
return $code;
}
return $ret;
}
+// Tries to determine if call-back functions and/or extra values shall be parsed
+function doHandleExtraValues ($filterFunctions, $extraValues, $key, $entries, $userIdColumn, $search) {
+ // Debug message
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',entries=' . $entries . ',userIdColumn=' . $userIdColumn[0] . ',search=' . $search . ',filterFunctions=' . print_r($filterFunctions, TRUE) . ',extraValues=' . print_r($extraValues, TRUE));
+
+ // Send data through the filter function if found
+ if ($key == $userIdColumn[0]) {
+ // Is the userid, we have to process it with convertZeroToNull()
+ $entries = convertZeroToNull($entries);
+ } elseif ((!empty($filterFunctions[$key])) && (isset($extraValues[$key]))) {
+ // Debug mode enabled?
+ if (isDebugModeEnabled()) {
+ // Then log it
+ /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',extraValues=' . $extraValues[$key] . ',key=' . $key . ',id=' . $id . ',entries[' . gettype($entries) . ']=' . $entries . ' - BEFORE!');
+ } // END - if
+
+ // Filter function + extra value set
+ $entries = handleExtraValues($filterFunctions[$key], $entries, $extraValues[$key]);
+
+ // Debug mode enabled?
+ if (isDebugModeEnabled()) {
+ // Then log it
+ /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',extraValues=' . $extraValues[$key] . ',key=' . $key . ',id=' . $id . ',entries[' . gettype($entries) . ']=' . $entries . ' - AFTER!');
+ } // END - if
+ } elseif (!empty($filterFunctions[$search])) {
+ // Debug mode enabled?
+ if (isDebugModeEnabled()) {
+ // Then log it
+ /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',key=' . $key . ',search=' . $search . ',entries[' . gettype($entries) . ']=' . $entries . ' - BEFORE!');
+ } // END - if
+
+ // Handle extra values
+ $entries = handleExtraValues($filterFunctions[$search], $entries, NULL);
+
+ // Debug mode enabled?
+ if (isDebugModeEnabled()) {
+ // Then log it
+ /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',key=' . $key . ',search=' . $search . ',entries[' . gettype($entries) . ']=' . $entries . ' - AFTER!');
+ } // END - if
+
+ // Make sure entries is not bool, then something went wrong
+ assert(!is_bool($entries));
+ }
+
+ // Return value
+ return $entries;
+}
+
// Converts timestamp selections into a timestamp
function convertSelectionsToEpocheTime (array &$postData, array &$content, &$id, &$skip) {
// Init test variable
$separator = '?';
} // END - if
- // Add it to URL
+ // Is the session id set?
if (session_id() != '') {
+ // Then add it to URL
$url .= $separator . session_name() . '=' . session_id();
} // END - if
} // END - if
$url = '{?URL?}/' . $url;
} // END - if
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'url=' . $url . ',isHtmlOutputMode()=' . intval(isHtmlOutputMode()) . ',outputMode=' . $outputMode);
+
// Is there to decode entities?
if ((!isHtmlOutputMode()) || ($outputMode != '0')) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'url=' . $url . ' - BEFORE DECODING');
// Decode them for e.g. JavaScript parts
$url = decodeEntities($url);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'url=' . $url . ' - AFTER DECODING');
} // END - if
// Debug log
'ADMIN_ENTER_SURFBAR_LIMIT_NOTICE' => "(0 = Unbegrenzt)",
'ADMIN_SELECT_SURFBAR_WAITING' => "Verweildauer:",
'ADMIN_SELECT_SURFBAR_RELOAD' => "Reloadzeit:",
+ 'ADMIN_CHANGE_SURFBAR_FIXED_RELOAD' => "Neue Reloadzeit einstellen:",
+ 'ADMIN_CHANGE_SURFBAR_FIXED_WAITING' => "Neue Verweildauer einstellen:",
'ADMIN_SURFBAR_URLS_404' => "Es konnten keine URLs in der Surfbar gefunden werden.",
'ADMIN_SURFBAR_ACTIONS_404' => "Es konnten keine Mitglieder-Aktionen in der Surfbar gefunden werden.",
'ADMIN_SURFBAR_REWARD' => "Vergütung",
'ADMIN_SURFBAR_VIEWS_TOTAL' => "Gesamtaufrufe",
'ADMIN_SURFBAR_STATUS' => "URL-Status",
'ADMIN_SURFBAR_REGISTERED' => "URL aufgenommen",
+ 'ADMIN_SURFBAR_FIXED_RELOAD' => "Feste Reloadsperre",
+ 'ADMIN_SURFBAR_FIXED_WAITING' => "Fester Mindestauffenthalt",
'ADMIN_SURFBAR_LAST_LOCKED' => "Zuletzt gesperrt",
'ADMIN_SURFBAR_LOCK_REASON' => "Sperrgrund",
'ADMIN_SURFBAR_UNLOCK_DONE' => "Freischaltung ausgewählter URL(s) vollständig. :-)",
// If the column is 'url_id' there can be only one entry
$limit = '';
if ($column == 'url_id') {
- $limit = "LIMIT 1";
+ $limit = 'LIMIT 1';
} // END - if
// Look up the record
updateInsertSurfbarStatisticsRecord();
// Simply store the salt from cache away in database...
- SQL_QUERY_ESC("UPDATE
+ SQL_QUERY("UPDATE
`{?_MYSQL_PREFIX?}_surfbar_salts`
SET
`salts_last_salt`='{%pipe,getSurfbarSalt%}'
// Get fixed reload lock
$fixed = getSurfbarFixedWaitingTime();
- // Is the fixed reload time set?
+ // Is the URL's fixed waiting time set?
if ($fixed > 0) {
// Return it
return $fixed;
} // END - if
// Static time is default
- $time = getConfig('surfbar_static_time');
+ $time = getSurfbarStaticTime();
// Which payment model do we have?
if (getSurfbarPaymentModel() == 'DYNAMIC') {
$skip = FALSE;
// Now, walk through all entries and prepare them for saving
- //* BUG: */ reportBug(__FUNCTION__, __LINE__, '<pre>'.print_r(postRequestArray(),true).'</pre>');
+ //* BUG: */ reportBug(__FUNCTION__, __LINE__, '<pre>'.print_r(postRequestArray(), TRUE).'</pre>');
foreach ($postData as $id => $val) {
// Process only formular field but not submit buttons ;)
if ($id == 'ok') {
}
// Put all HTML code into $GLOBALS['sponsor_output']!
-// E.g.: $GLOBALS['sponsor_output'] = loadTemplate('sponsor_template', true);
+// E.g.: $GLOBALS['sponsor_output'] = loadTemplate('sponsor_template', TRUE);
// [EOF]
?>
$sqlColumns[$key] = SQL_ESCAPE($columnName);
$sqlValues[$key] = SQL_ESCAPE(postRequestElement($columnName));
- // Send data through the filter function if found
- if ((isset($filterFunctions[$key])) && (isset($extraValues[$key . '_list']))) {
- // Debug mode enabled?
- if (isDebugModeEnabled()) {
- // Then log it
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
- } // END - if
-
- // Filter function set, so run it
- $sqlValues[$key] = call_user_func_array($filterFunctions[$key], merge_array(array($columnName), $extraValues[$key . '_list']));
-
- // Debug mode enabled?
- if (isDebugModeEnabled()) {
- // Then log it
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
- } // END - if
- } elseif (isset($filterFunctions[$key])) {
- // Debug mode enabled?
- if (isDebugModeEnabled()) {
- // Then log it
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - BEFORE!');
- } // END - if
-
- // Run through an extra filter
- $sqlValues[$key] = handleExtraValues($filterFunctions[$key], $sqlValues[$key], NULL);
-
- // Debug mode enabled?
- if (isDebugModeEnabled()) {
- // Then log it
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key] . ' - AFTER!');
- } // END - if
-
- }
+ // Try to handle call-back functions and/or extra values on the list
+ $sqlValues[$key] = doHandleExtraValues($filterFunctions, $extraValues, $key . '_list', $sqlValues[$key], $userIdColumn, key(search_array($columns, 'column', $key)));
// Is the value not a number?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sqlValues[' . $key . '][' . gettype($sqlValues[$key]) . ']=' . $sqlValues[$key]);
// Edit rows by given id numbers
function doGenericEditEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $editNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array(), $subject = '') {
+ // Is there "time columns"?
+ if (count($timeColumns) > 0) {
+ // Then "walk" through all entries
+ foreach ($timeColumns as $column) {
+ // Convert all (possible) selections
+ convertSelectionsToEpocheTimeInPostData($column . '_ye');
+ } // END - foreach
+ } // END - if
+
// Change them all
$affected = '0';
foreach (postRequestElement($idColumn[0]) as $id => $sel) {
// "Walk" through all entries
foreach (postRequestArray() as $key => $entries) {
// Skip raw userid which is always invalid
- if ($key == $rawUserId[0]) {
+ if (($key == $rawUserId[0]) || ($key == 'do_edit')) {
// Continue with next field
//* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',idColumn[0]=' . $idColumn[0] . ',rawUserId=' . $rawUserId[0]);
continue;
} // END - if
// Debug message
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',idColumn[0]=' . $idColumn[0] . ',entries=<pre>'.print_r($entries,TRUE).'</pre>');
+ /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',id=' . $id . ',idColumn[0]=' . $idColumn[0] . ',entries=<pre>'.print_r($entries,TRUE).'</pre>');
// Is entries an array?
if (($key != $idColumn[0]) && (is_array($entries)) && (isset($entries[$id]))) {
- //die($key.'/'.$id.'=<pre>'.print_r($columns,TRUE).'</pre><pre>'.print_r($filterFunctions,TRUE).'</pre>');
// Search for the right array index
$search = key(search_array($columns, 'column', $key));
// Add this entry to content
$content[$key] = $entries[$id];
- // Send data through the filter function if found
- if ($key == $userIdColumn[0]) {
- // Is the userid, we have to process it with convertZeroToNull()
- $entries[$id] = convertZeroToNull($entries[$id]);
- } elseif ((isset($filterFunctions[$key])) && (isset($extraValues[$key]))) {
- // Filter function + extra value set
- $entries[$id] = handleExtraValues($filterFunctions[$key], $entries[$id], $extraValues[$key]);
- } elseif (isset($filterFunctions[$search])) {
- // Debug mode enabled?
- if (isDebugModeEnabled()) {
- // Then log it
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',key=' . $key . ',id=' . $id . ',entries[' . gettype($entries[$id]) . ']=' . $entries[$id] . ' - BEFORE!');
- } // END - if
-
- // Handle extra values
- $entries[$id] = handleExtraValues($filterFunctions[$search], $entries[$id], NULL);
-
- // Debug mode enabled?
- if (isDebugModeEnabled()) {
- // Then log it
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',key=' . $key . ',id=' . $id . ',entries[' . gettype($entries[$id]) . ']=' . $entries[$id] . ' - AFTER!');
- } // END - if
-
- // Make sure entries[id] is not bool, then something went wrong
- assert(!is_bool($entries[$id]));
- }
+ // Debug message
+ //* BUG: */ die($key.'/'.$id.'/'.$search.'=<pre>'.print_r($columns,TRUE).'</pre><pre>'.print_r($filterFunctions,TRUE).'</pre>');
- // Is the value NULL?
- if ($entries[$id] == 'NULL') {
- // Add it directly
- $sql .= sprintf(' `%s`=NULL,',
- SQL_ESCAPE($key)
- );
- } else {
- // Else add the value covered
- $sql .= sprintf(" `%s`='%s',",
- SQL_ESCAPE($key),
- SQL_ESCAPE($entries[$id])
- );
- }
+ // Handle possible call-back functions and/or extra values
+ $entries[$id] = doHandleExtraValues($filterFunctions, $extraValues, $key, $entries[$id], $userIdColumn, $search);
+
+ // Add key/value pair to SQL string
+ $sql .= addKeyValueSql($key, $entries[$id]);
} elseif (($key != $idColumn[0]) && (!is_array($entries))) {
- // Add normal entries as well!
- $content[$key] = $entries;
+ // Search for it
+ $search = key(search_array($columns, 'column', $key));
+ //* BUG: */ die($key.'/<pre>'.print_r($search, TRUE).'</pre>=<pre>'.print_r($columns, TRUE).'</pre>');
+
+ // Debug message
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',entries[' . gettype($entries) . ']=' . $entries . ',search=' . $search . ' - BEFORE!');
+
+ // Add normal entries as well
+ $content[$key] = $entries;
+
+ // Handle possible call-back functions and/or extra values
+ $entries = doHandleExtraValues($filterFunctions, $extraValues, $key, $entries, $userIdColumn, $search);
+
+ // Debug message
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',entries[' . gettype($entries) . ']=' . $entries . ',search=' . $search . ' - AFTER!');
+
+ // Add key/value pair to SQL string
+ $sql .= addKeyValueSql($key, $entries);
}
} // END - foreach
$sql .= " LIMIT 1";
// Run this query
+ //* BUG: */ die($sql.'<pre>'.print_r(postRequestArray(), TRUE).'</pre>');
SQL_QUERY($sql, __FUNCTION__, __LINE__);
// Add affected rows
} // END - if
// Delete them all
- //* BUG: */ die($sql.'<br /><pre>'.print_r($tableName,TRUE).'</pre><pre>'.print_r($columns,TRUE).'</pre><pre>'.print_r($filterFunctions,TRUE).'</pre><pre>'.print_r($extraValues,TRUE).'</pre><pre>'.print_r($deleteNow,TRUE).'</pre><pre>'.print_r($idColumn,TRUE).'</pre>');
+ //* BUG: */ die($sql.'<pre>'.print_r($tableName,TRUE).'</pre><pre>'.print_r($columns,TRUE).'</pre><pre>'.print_r($filterFunctions,TRUE).'</pre><pre>'.print_r($extraValues,TRUE).'</pre><pre>'.print_r($deleteNow,TRUE).'</pre><pre>'.print_r($idColumn,TRUE).'</pre>');
$idList = '';
foreach (postRequestElement($idColumn[0]) as $id => $sel) {
// Is id zero?
$GLOBALS[$prefix . '_list_builder_id_value'] = bigintval($value);
} // END - if
- // Is there a call-back function and extra-value pair?
- if ((isset($filterFunctions[$idx])) && (isset($extraValues[$idx]))) {
- // Handle the call in external function
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value);
- $content[$key] = handleExtraValues(
- $filterFunctions[$idx],
- $value,
- $extraValues[$idx]
- );
- } elseif ((isset($columns[$idx]['name'])) && (isset($filterFunctions[$columns[$idx]['name']])) && (isset($extraValues[$columns[$idx]['name']]))) {
- // Handle the call in external function
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',fucntion=' . $filterFunctions[$columns[$idx]['name']] . ',value=' . $value);
- $content[$key] = handleExtraValues(
- $filterFunctions[$columns[$idx]['name']],
- $value,
- $extraValues[$columns[$idx]['name']]
- );
- }
+ // Try to handle call-back functions and/or extra values
+ $content[$key] = doHandleExtraValues($filterFunctions, $extraValues, $idx, $content[$key], $userIdColumn, $idx);
} // END - foreach
// Then list it
return $listed;
}
+// Adds key/value pair to a working SQL string together
+function addKeyValueSql ($key, $value) {
+ // Init SQL
+ $sql = '';
+
+ // Is it NULL?
+ if (($value == 'NULL') || (is_null($value))) {
+ // Add key with NULL
+ $sql .= sprintf(' `%s`=NULL,',
+ SQL_ESCAPE($key)
+ );
+ } elseif ((is_double($value)) || (is_float($value)) || (is_int($value))) {
+ // Is a number, so addd it directly
+ $sql .= sprintf(" `%s`=%s,",
+ SQL_ESCAPE($key),
+ $value
+ );
+ } else {
+ // Else add the value escape'd
+ $sql .= sprintf(" `%s`='%s',",
+ SQL_ESCAPE($key),
+ SQL_ESCAPE($value)
+ );
+ }
+
+ // Return SQL string
+ return $sql;
+}
+
// [EOF]
?>
addPageHeaderFooter();
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '__output(length)=' . strlen($GLOBALS['__output']) . ' - After addPageHeaderFooter() call.');
- // Do the final compilation
- $GLOBALS['__output'] = compileUriCode(doFinalCompilation($GLOBALS['__output']));
+ // Do the final (general) compilation
+ $GLOBALS['__output'] = doFinalCompilation($GLOBALS['__output']);
+
+ // Is the output mode not HTML?
+ if (!isHtmlOutputMode()) {
+ // Then remove entities
+ $GLOBALS['__output'] = compileUriCode($GLOBALS['__output']);
+ } // END - if
// Extension 'rewrite' installed?
if ((isExtensionActive('rewrite')) && (!isCssOutputMode())) {
$code = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
// Prepare eval() command
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileCode(escapeQuotes($code), FALSE, TRUE, TRUE, $compileCode) . '";';
} elseif (substr($template, 0, 3) == 'js_') {
// JavaScripts don't like entities, dollar signs and timings
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
} else {
// Prepare eval() command, other output doesn't like entities, maybe
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
}
} elseif (isHtmlOutputMode()) {
// Add surrounding HTML comments to help finding bugs faster
$ret = '<!-- Template ' . $template . ' - Start //-->' . $GLOBALS['template_content']['html'][$template] . '<!-- Template ' . $template . ' - End //-->';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = "' . getColorSwitchCode($template) . compileRawCode(escapeQuotes($ret), FALSE, TRUE, TRUE, $compileCode) . '";';
} else {
// JavaScript again
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Reached!');
$GLOBALS['template_eval']['html'][$template] = '$ret = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($GLOBALS['template_content']['html'][$template]), FALSE, TRUE, TRUE, $compileCode) . '");';
} // END - if
} elseif ((isAdmin()) || ((isInstalling()) && (!isInstalled()))) {
$str = str_replace(array("\\'", '"', "\\\\"), array(chr(39), "\\\"", chr(92)), $str);
}
- // Return the escaped string
+ // Return the escape'd string
return $str;
}
}
// Merges an array together but only if both are arrays
-function merge_array ($array1, $array2) {
+function merge_array ($array1, $array2, $keepIndex = FALSE) {
// Are both an array?
if ((!is_array($array1)) && (!is_array($array2))) {
// Both are not arrays
reportBug(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
}
- // Merge both together
- return array_merge($array1, $array2);
+ // Maintain index of array2?
+ if ($keepIndex === TRUE) {
+ // Keep index of array2, array_merge() rewrites $key=2 to $key=0 ! :(
+ foreach ($array2 as $key => $value) {
+ // Add it
+ $array1[$key] = $value;
+ } // END - foreach
+
+ // Return it
+ return $array1;
+ } else {
+ // Merge both together normally
+ return array_merge($array1, $array2);
+ }
}
// Check if given FQFN is a readable file
* Searches a multi-dimensional array (as used in many places) for given
* key/value pair as taken from user comments from PHP documentation website.
*
- * @param $array An array with one or more dimensions
- * @param $key Key to look for
- * @param $valur Value to look for
- * @return $results Resulted array or empty array if $array is no array
+ * @param $array An array with one or more dimensions
+ * @param $key Key to look for
+ * @param $value Value to look for
+ * @param $parentIndex Parent index (ONLY INTERNAL USE!)
+ * @return $results Resulted array or empty array if $array is no array
* @author sunelbe<at>gmail<dot>com
* @link http://de.php.net/manual/en/function.array-search.php#110120
*/
-function search_array ($array, $key, $value) {
+function search_array ($array, $key, $value, $parentIndex = NULL) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'array(' . count($array) . ')=' . print_r($array, TRUE) . ',key=' . $key . ',value=' . $value . ',parentIndex[' . gettype($parentIndex) . '=' . $parentIndex . ' - ENTERED!');
// Init array result
$results = array();
// Is $array really an array?
if (is_array($array)) {
- // Does key and value match?
- if (isset($array[$key]) && $array[$key] == $value) {
- // Then add it as result
- $results[] = $array;
- } // END - if
-
// Search for whole array
- foreach ($array as $subArray) {
- // Search recursive and merge again
- $results = merge_array($results, search_array($subArray, $key, $value));
+ foreach ($array as $idx => $dummy) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',value=' . $value . ',idx=' . $idx);
+ // Is dummy an array?
+ if (is_array($dummy)) {
+ // Then search again
+ $subResult = search_array($dummy, $key, $value, $idx);
+ //* DEBUG: */ print 'subResult=<pre>' . print_r($subResult, TRUE).'</pre>';
+
+ // And merge both
+ $results = merge_array($results, $subResult, TRUE);
+ } elseif ((isset($array[$key])) && ($array[$key] == $value)) {
+ // Is found, so add it
+ $results[$parentIndex] = $array;
+ }
} // END - foreach
} // END - if
// Return resulting array
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'results(' . count($results) . ')=' . print_r($results, TRUE) . ' - EXIT!');
return $results;
}
assert(isset($columnArray[$childKey]));
// Now is it what we are looking for?
- if ($columnArray[$childKey] == $value) {
+ if ($columnArray[$childKey] === $value) {
// Remember this match
$return = $key;
<form accept-charset="UTF-8" action="{%url=modules.php?module=admin&what=list_surfbar_urls%}" method="post">
<table border="0" cellspacing="0" cellpadding="0" class="table dashed">
<tr>
- <td align="center" colspan="2" class="table_header">
+ <td align="center" colspan="2" class="table_header bottom">
<strong>{--ADMIN_SURFBAR_EDIT_URLS_TITLE--}</strong>
</td>
</tr>
-<tr>
- <td class="header_column bottom right" align="center"><strong>{--_USERID--}</strong></td>
- <td class="header_column bottom" align="center"><strong>{--ADMIN_TEST_URL--}</strong></td>
-</tr>
$content
<tr>
<td class="table_footer" colspan="2">
<tr>
<td align="center" class="bottom right {%template,ColorSwitch%}">
+ <legend for="url_userid">{--_USERID--}</legend>
<input type="hidden" name="url_id[$content[url_id]]" value="1" />
<input type="hidden" name="url_userid[$content[url_id]]" value="{%pipe,convertZeroToNull=$content[url_userid_raw]%}" />
$content[url_userid]
</td>
<td align="center" class="bottom right {%template,ColorSwitch%}">
+ <legend for="url">{--ADMIN_TEST_URL--}</legend>
<input type="text" class="form_field" name="url[$content[url_id]]" size="20" maxlength="255" value="$content[url]" />
</td>
</tr>
+
+<tr>
+ <td align="center" class="bottom right {%template,ColorSwitch%}">
+ <legend for="url_fixed_reload">{--ADMIN_CHANGE_SURFBAR_FIXED_RELOAD--}</legend>
+ $content[url_fixed_reload]
+ </td>
+ <td align="center" class="bottom right {%template,ColorSwitch%}">
+ <legend for="url_fixed_waiting">{--ADMIN_CHANGE_SURFBAR_FIXED_RELOAD--}</legend>
+ $content[url_fixed_waiting]
+ </td>
+</tr>
<form accept-charset="UTF-8" action="{%url=modules.php?module=admin&what=list_surfbar_urls%}" method="post">
<table border="0" cellspacing="0" cellpadding="0" class="table dashed" width="800">
<tr>
- <td align="center" colspan="8" class="table_header">
+ <td align="center" colspan="10" class="table_header">
<strong>{--ADMIN_SURFBAR_LIST_URLS_TITLE--}</strong>
</td>
</tr>
<td class="header_column bottom right" align="center"><strong>{--ADMIN_SURFBAR_VIEWS_TOTAL--}</strong></td>
<td class="header_column bottom right" align="center"><strong>{--ADMIN_SURFBAR_STATUS--}</strong></td>
<td class="header_column bottom right" align="center"><strong>{--ADMIN_SURFBAR_REGISTERED--}</strong></td>
+ <td class="header_column bottom right" align="center"><strong>{--ADMIN_SURFBAR_FIXED_RELOAD--}</strong></td>
+ <td class="header_column bottom right" align="center"><strong>{--ADMIN_SURFBAR_FIXED_WAITING--}</strong></td>
<td class="header_column bottom right" align="center"><strong>{--ADMIN_SURFBAR_LAST_LOCKED--}</strong></td>
<td class="header_column bottom" align="center"><strong>{--ADMIN_SURFBAR_LOCK_REASON--}</strong></td>
</tr>
$content
<tr>
- <td class="table_footer" colspan="8">
+ <td class="table_footer" colspan="10">
<input type="reset" class="form_reset" value="{--UNDO_SELECTIONS--}" />
<input type="submit" class="form_submit" name="edit" value="{--ADMIN_SURFBAR_EDIT_URL_SUBMIT--}" />
- <input type="submit" class="form_delete" name="lock" value="{--ADMIN_SURFBAR_UNLOCK_URL_SUBMIT--}" />
+ <input type="submit" class="form_submit" name="lock" value="{--ADMIN_SURFBAR_UNLOCK_URL_SUBMIT--}" />
<input type="submit" class="form_submit" name="undelete" value="{--ADMIN_SURFBAR_UNDELETE_URL_SUBMIT--}" />
<input type="submit" class="form_delete" name="delete" value="{--ADMIN_SURFBAR_DELETE_URL_SUBMIT--}" />
</td>
<td align="center" class="bottom right {%template,ColorSwitch%}">
$content[url_registered]
</td>
+ <td align="center" class="bottom right {%template,ColorSwitch%}">
+ {%pipe,createFancyTime=$content[url_fixed_reload]%}
+ </td>
+ <td align="center" class="bottom right {%template,ColorSwitch%}">
+ {%pipe,createFancyTime=$content[url_fixed_waiting]%}
+ </td>
<td align="center" class="bottom right {%template,ColorSwitch%}">
$content[url_last_locked]
</td>
And all column names to read/write, leave this list tag empty for all (*).
//-->
<database-column-list>
+ <database-column-list-entry name="" type="string" table="" value="url_userid" alias="" function="" />
+ <database-column-list-entry name="" type="string" table="" value="url" alias="" function="" />
+ <database-column-list-entry name="" type="string" table="" value="url_fixed_reload" alias="" function="" />
+ <database-column-list-entry name="" type="string" table="" value="url_fixed_waiting" alias="" function="" />
</database-column-list>
<!--
"Filter" call-back functions to call back for piping the fetched data
through (can be left empty, no call-back function will be called)
//-->
<callback-function-list>
+ <callback-function-list-entry name="" type="string" value="" />
+ <callback-function-list-entry name="" type="string" value="" />
+ <callback-function-list-entry name="" type="string" value="bigintval" />
+ <callback-function-list-entry name="" type="string" value="bigintval" />
</callback-function-list>
<!--
Extra parameters (2nd, 3rd, ...) for above call-back functions. If an array
Columns for converting single time selections into a timestamp
//-->
<time-columns-list>
+ <time-columns-list-entry name="" type="string" value="url_fixed_reload" />
+ <time-columns-list-entry name="" type="string" value="url_fixed_waiting" />
</time-columns-list>
<!--
Wether to 'edit/delete/change' (change) the entries (true) or just read them for displaying (false)
<database-column-list-entry name="" type="string" table="" value="url_id" alias="" function="" />
<database-column-list-entry name="member_list" type="string" table="" value="url_userid" alias="" function="" />
<database-column-list-entry name="" type="string" table="" value="url" alias="" function="" />
+ <database-column-list-entry name="reload_list" type="string" table="" value="url_fixed_reload" alias="" function="" />
+ <database-column-list-entry name="waiting_list" type="string" table="" value="url_fixed_waiting" alias="" function="" />
</database-column-list>
<!--
"Filter" call-back functions to call back for piping the fetched data
<callback-function-list-entry name="" type="string" value="bigintval" />
<callback-function-list-entry name="member_list" type="string" value="addMemberSelectionBox" />
<callback-function-list-entry name="" type="string" value="" />
+ <callback-function-list-entry name="reload_list" type="string" value="createTimeSelections" />
+ <callback-function-list-entry name="waiting_list" type="string" value="createTimeSelections" />
</callback-function-list>
<!--
Extra parameters (2nd, 3rd, ...) for above call-back functions. If an array
Dummy entry
//-->
<extra-parameter-list-entry name="" type="string" value="" />
+ <!--
+ A one-dimensional array with some entries
+ //-->
+ <extra-parameter-list-entry name="" type="array" value="reload">
+ <!--
+ Our 'reload' array
+ //-->
+ <extra-parameter-reload-list>
+ <!--
+ A bool entry in the 'reload' array, all other types are added in a
+ similar way.
+ //-->
+ <extra-parameter-reload-list-entry name="" type="string" value="url_fixed_reload" />
+ <extra-parameter-reload-list-entry name="" type="string" value="WDhms" />
+ </extra-parameter-reload-list>
+ </extra-parameter-list-entry>
+ <!--
+ A one-dimensional array with some entries
+ //-->
+ <extra-parameter-list-entry name="" type="array" value="waiting">
+ <!--
+ Our 'waiting' array
+ //-->
+ <extra-parameter-waiting-list>
+ <!--
+ A bool entry in the 'waiting' array, all other types are added in a
+ similar way.
+ //-->
+ <extra-parameter-waiting-list-entry name="" type="string" value="url_fixed_waiting" />
+ <extra-parameter-waiting-list-entry name="" type="string" value="ms" />
+ </extra-parameter-waiting-list>
+ </extra-parameter-list-entry>
</extra-parameter-list>
<!--
Columns for converting single time selections into a timestamp
<select-data-from-list-entry type="string" table="" value="url_views_total" alias="" function="" />
<select-data-from-list-entry type="string" table="" value="url_status" alias="" function="" />
<select-data-from-list-entry type="string" table="" value="url_registered" alias="url_registered" function="UNIX_TIMESTAMP" />
+ <select-data-from-list-entry type="string" table="" value="url_fixed_reload" alias="" function="" />
+ <select-data-from-list-entry type="string" table="" value="url_fixed_waiting" alias="" function="" />
<select-data-from-list-entry type="string" table="" value="url_last_locked" alias="url_last_locked" function="UNIX_TIMESTAMP" />
<select-data-from-list-entry type="string" table="" value="url_lock_reason" alias="" function="" />
</select-data-from-list>