// Admin mail links
registerFilter(__FUNCTION__, __LINE__, 'generate_admin_mail_links', 'GENERATE_POOL_MAIL_LINKS');
+
+ // Build mails
+ registerFilter(__FUNCTION__, __LINE__, 'send_build_mail', 'SEND_ADMIN_BUILD_MAIL');
+ registerFilter(__FUNCTION__, __LINE__, 'send_build_mail', 'SEND_MEMBER_BUILD_MAIL');
}
// "Registers" a new filter function
return $filterData;
}
+// Filter for sending "build mail" to admin
+function FILTER_SEND_ADMIN_BUILD_MAIL ($filterData) {
+ // Is the module 'admin'?
+ if (getModule() == 'admin') {
+ // Okay, then call the proper function
+ call_user_func_array('sendAdminBuildMails', $filterData);
+ } // END - if
+
+ // Return data
+ return $filterData;
+}
+
+// Filter for sending "build mail" to member
+function FILTER_SEND_MEMBER_BUILD_MAIL ($filterData) {
+ // Is the module 'login'?
+ if (getModule() == 'login') {
+ // Okay, then call the proper function
+ call_user_func_array('sendMemberBuildMails', $filterData);
+ } // END - if
+
+ // Return data
+ return $filterData;
+}
+
// [EOF]
?>
return $subject;
}
+// Adds a given entry to the database
+function memberAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $columnIndex = NULL) {
+ // Is it a member?
+ if (!isMember()) {
+ // Then abort here
+ return false;
+ } // END - if
+
+ // Set POST data generic userid
+ setPostRequestElement('userid', getMemberId());
+
+ // Call inner function
+ doGenericAddEntries($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $columnIndex);
+
+ // Entry has been added?
+ if ((!SQL_HASZEROAFFECTED()) && ($GLOBALS['__XML_PARSE_RESULT'] === true)) {
+ // Display success message
+ displayMessage('{--MEMBER_ENTRY_ADDED--}');
+ } else {
+ // Display failed message
+ displayMessage('{--MEMBER_ENTRY_NOT_ADDED--}');
+ }
+}
+
+// Edit rows by given id numbers
+function memberEditEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $editNow = array(false), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array()) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ reportBug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array: userIdColumn=' . $userIdColumn);
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ reportBug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array: userIdColumn=' . $userIdColumn);
+ } elseif (!is_array($userIdColumn)) {
+ // $userIdColumn is no array
+ reportBug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array: userIdColumn=' . $userIdColumn);
+ } elseif (!is_array($editNow)) {
+ // $editNow is no array
+ reportBug(__FUNCTION__, __LINE__, 'editNow[]=' . gettype($editNow) . '!=array: userIdColumn=' . $userIdColumn);
+ } // END - if
+
+ // Shall we change here or list for editing?
+ if ($editNow[0] === true) {
+ // Call generic change method
+ $affected = doGenericEditEntriesConfirm($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $editNow, $idColumn, $userIdColumn, $rawUserId, $cacheFiles);
+
+ // Was this fine?
+ if ($affected == countPostSelection($idColumn[0])) {
+ // All deleted
+ displayMessage('{--MEMBER_ALL_ENTRIES_EDITED--}');
+ } else {
+ // Some are still there :(
+ displayMessage(sprintf(getMessage('MEMBER_SOME_ENTRIES_NOT_EDITED'), $affected, countPostSelection($idColumn[0])));
+ }
+ } else {
+ // List for editing
+ memberListBuilder('edit', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ }
+}
+
+// Build a special template list
+function memberListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid')) {
+ // Do this only for logged in member
+ assert(isMember());
+
+ // Call inner (general) function
+ doGenericListBuilder('member', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId);
+}
+
+// ----------------------------------------------------------------------------
+// "Translatation" functions for points_data table
+// ----------------------------------------------------------------------------
+
// Translates generically some data into a target string
function translateGeneric ($messagePrefix, $data) {
// Is the method null or empty?
return $return;
}
-// Translates task type to a human-readable version
-function translateTaskType ($taskType) {
- // Return it
- return translateGeneric('ADMIN_TASK_TYPE', $taskType);
-}
-
-// ----------------------------------------------------------------------------
-// "Translatation" functions for points_data table
-// ----------------------------------------------------------------------------
-
// Translates points subject to human-readable
function translatePointsSubject ($subject) {
// Remove any :x
return translateGeneric('POINTS_NOTIFY_RECIPIENT', $notifyRecipient);
}
+// Translates task type to a human-readable version
+function translateTaskType ($taskType) {
+ // Return it
+ return translateGeneric('ADMIN_TASK_TYPE', $taskType);
+}
+
//-----------------------------------------------------------------------------
// Automatically re-created functions, all taken from user comments on www.php.net
//-----------------------------------------------------------------------------
'ADMIN_SOME_ENTRIES_NOT_DELETED' => "Es wurden <span class=\"data\">%s</span> von <span class=\"data\">%s</span> ausgewählten Einträge gelöscht.",
'ADMIN_ALL_ENTRIES_EDITED' => "Alle ausgewählten Einträge sind geändert.",
'ADMIN_SOME_ENTRIES_NOT_EDITED' => "Es wurden <span class=\"data\">%s</span> von <span class=\"data\">%s</span> ausgewählten Einträge geändert.",
+ 'MEMBER_ALL_ENTRIES_EDITED' => "Alle Ihre Änderungen wurden gespeichert.",
+ 'MEMBER_SOME_ENTRIES_NOT_EDITED' => "Es wurden <span class=\"data\">%s</span> von <span class=\"data\">%s</span> ausgewählten Einträge geändert. Wenn Sie keine neuen Werte eingegeben haben, ist diese Meldung normal.",
'USER_NOT_REGISTERED' => "Anmeldung hat nicht geklappt! :-( Ist unten eine Fehlermeldung eingeblendet? Bitte beim Support melden.",
'ADMIN_SELECTION_BOX_TITLE' => "Mitglied für Aktion auswählen",
'ADMIN_DO_ACTION' => "Aktion ausführen",
// Build a special template list
function adminListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid')) {
- // $tableName and $idColumn must bove be arrays!
- if ((!is_array($tableName)) || (count($tableName) != 1)) {
- // $tableName is no array
- reportBug(__FUNCTION__, __LINE__, 'tableName[]=' . gettype($tableName) . '!=array: userIdColumn=' . $userIdColumn);
- } elseif (!is_array($idColumn)) {
- // $idColumn is no array
- reportBug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array: userIdColumn=' . $userIdColumn);
- } elseif ((!is_array($userIdColumn)) || (count($userIdColumn) != 1)) {
- // $tableName is no array
- reportBug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array: userIdColumn=' . $userIdColumn);
- }
-
- // Init row output
- $OUT = '';
-
- // "Walk" through all entries
- //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'listType=<pre>'.print_r($listType,true).'</pre>,tableName<pre>'.print_r($tableName,true).'</pre>,columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,idColumn=<pre>'.print_r($idColumn,true).'</pre>,userIdColumn=<pre>'.print_r($userIdColumn,true).'</pre>,rawUserId=<pre>'.print_r($rawUserId,true).'</pre>');
- foreach (postRequestElement($idColumn[0]) as $id => $selected) {
- // Secure id number
- $id = bigintval($id);
-
- // Get result from a given column array and table name
- $result = SQL_RESULT_FROM_ARRAY($tableName[0], $columns, $idColumn[0], $id, __FUNCTION__, __LINE__);
-
- // Is there one entry?
- if (SQL_NUMROWS($result) == 1) {
- // Load all data
- $content = SQL_FETCHARRAY($result);
-
- // Filter all data
- foreach ($content as $key => $value) {
- // Search index
- $idx = searchXmlArray($key, $columns, 'column');
-
- // Skip any missing entries
- if ($idx === false) {
- // Skip this one
- //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'key=' . $key . ' - SKIPPED!');
- continue;
- } // END - if
-
- // Is there a userid?
- //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]);
- if ($key == $userIdColumn[0]) {
- // Add it again as raw id
- //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]);
- $content[$userIdColumn[0]] = convertZeroToNull($value);
- $content[$userIdColumn[0] . '_raw'] = $content[$userIdColumn[0]];
- } // END - if
-
- // If the key matches the idColumn variable, we need to temporary remember it
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',idColumn=' . $idColumn[0] . ',value=' . $value);
- if ($key == $idColumn[0]) {
- /*
- * Found, so remember it securely (to make sure only id
- * numbers can pass, don't use alpha-numerical values!)
- */
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ' - set as admin_list_builder_id_value!');
- $GLOBALS['admin_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']]
- );
- }
- } // END - foreach
-
- // Then list it
- $OUT .= loadTemplate(sprintf("admin_%s_%s_row",
- $listType,
- $tableName[0]
- ), true, $content
- );
- } // END - if
-
- // Free the result
- SQL_FREERESULT($result);
- } // END - foreach
-
- // Load master template
- loadTemplate(sprintf("admin_%s_%s",
- $listType,
- $tableName[0]
- ), false, $OUT
- );
+ // Call inner (general) function
+ doGenericListBuilder('admin', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId);
}
// Change status of "build" list
// Shall we change here or list for editing?
if ($editNow[0] === true) {
- // Change them all
- $affected = '0';
- foreach (postRequestElement($idColumn[0]) as $id => $sel) {
- // Prepare content array (new values)
- $content = array();
-
- // Prepare SQL for this row
- $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET",
- SQL_ESCAPE($tableName[0])
- );
-
- // "Walk" through all entries
- foreach (postRequestArray() as $key => $entries) {
- // Skip raw userid which is always invalid
- if ($key == $rawUserId[0]) {
- // 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>');
-
- // Is entries an array?
- if (($key != $idColumn[0]) && (is_array($entries)) && (isset($entries[$id]))) {
- // 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 set!
- $entries[$id] = handleExtraValues($filterFunctions[$key], $entries[$id], $extraValues[$key]);
- }
-
- // 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])
- );
- }
- } elseif (($key != $idColumn[0]) && (!is_array($entries))) {
- // Add normal entries as well!
- $content[$key] = $entries;
- }
- } // END - foreach
-
- // Finish SQL command
- $sql = substr($sql, 0, -1) . " WHERE `" . SQL_ESCAPE($idColumn[0]) . "`=" . bigintval($id) . " LIMIT 1";
-
- // Run this query
- SQL_QUERY($sql, __FUNCTION__, __LINE__);
-
- // Add affected rows
- $affected += SQL_AFFECTEDROWS();
-
- // Load all data from that id
- $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1",
- array(
- $tableName[0],
- $idColumn[0],
- $id
- ), __FUNCTION__, __LINE__);
-
- // Fetch the data and merge it into $content
- $content = merge_array($content, SQL_FETCHARRAY($result));
-
- // Free the result
- SQL_FREERESULT($result);
-
- // Send "build mails" out
- sendAdminBuildMails('edit', $tableName, $content, $id, '', $userIdColumn);
- } // END - foreach
-
- // Delete cache?
- if ((count($cacheFiles) > 0) && (!empty($cacheFiles[0]))) {
- // Delete cache file(s)
- foreach ($cacheFiles as $cacheF) {
- // Skip any empty entries
- if (empty($cache)) {
- // This may cause trouble in loadCacheFile()
- continue;
- } // END - if
-
- // Is the cache file loadable?
- if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
- // Then remove it
- $GLOBALS['cache_instance']->removeCacheFile();
- } // END - if
- } // END - foreach
- } // END - if
+ // Call generic change method
+ $affected = doGenericEditEntriesConfirm($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $editNow, $idColumn, $userIdColumn, $rawUserId, $cacheFiles);
// Was this fine?
if ($affected == countPostSelection($idColumn[0])) {
// Check for 'url_id' element
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isFormSent()=' . intval(isFormSent('add_subid')) . ',ifPostContainsSelections()=' . intval(ifPostContainsSelections()) . ',countRequestPost()=' . countRequestPost());
-if ((countRequestPost() > 0) && (!isFormSent('add_subid')) && ((!ifPostContainsSelections()) || (countRequestPost() == 0))) {
+if ((countRequestPost('id') > 0) && (!isFormSent('add_subid')) && ((!ifPostContainsSelections('id')) || (countRequestPost('id') == 0))) {
// Not found so output message
displayMessage('{--MEMBER_SUBID_NO_SELECTIONS--}');
// Edit or delete button hit?
if (isFormSent('add_subid')) {
// Add new sub id
- showEntriesByXmlCallback('member_add_do_subid');
+ showEntriesByXmlCallback('member_add_do_user_subid');
} elseif (isFormSent('edit')) {
// Show entries for editing
- showEntriesByXmlCallback('member_edit_show_subid');
+ showEntriesByXmlCallback('member_edit_show_user_subid');
// Do not show the list of URLs after this template
$show = false;
} elseif (isFormSent('do_edit')) {
// Change data of entries
- showEntriesByXmlCallback('member_edit_do_subid');
+ showEntriesByXmlCallback('member_edit_do_user_subid');
} elseif (isFormSent('delete')) {
// Show entries for deletion
- showEntriesByXmlCallback('member_delete_show_subid');
+ showEntriesByXmlCallback('member_delete_show_user_subid');
// Do not show the list of URLs after this template
$show = false;
} elseif (isFormSent('do_delete')) {
// Remove entries from database
- showEntriesByXmlCallback('member_delete_do_subid');
+ showEntriesByXmlCallback('member_delete_do_user_subid');
}
// Show entries?
} // END - if
}
-// Adds a given entry to the database
-function memberAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $columnIndex = NULL) {
- // Is it a member?
- if (!isMember()) {
- // Then abort here
- return false;
- } // END - if
+// 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()) {
+ // Change them all
+ $affected = '0';
+ foreach (postRequestElement($idColumn[0]) as $id => $sel) {
+ // Prepare content array (new values)
+ $content = array();
+
+ // Prepare SQL for this row
+ $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET",
+ SQL_ESCAPE($tableName[0])
+ );
- // Set POST data generic userid
- setPostRequestElement('userid', getMemberId());
+ // "Walk" through all entries
+ foreach (postRequestArray() as $key => $entries) {
+ // Skip raw userid which is always invalid
+ if ($key == $rawUserId[0]) {
+ // Continue with next field
+ //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',idColumn[0]=' . $idColumn[0] . ',rawUserId=' . $rawUserId[0]);
+ continue;
+ } // END - if
- // Call inner function
- doGenericAddEntries($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $columnIndex);
+ // Debug message
+ //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',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]))) {
+ // 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 set!
+ $entries[$id] = handleExtraValues($filterFunctions[$key], $entries[$id], $extraValues[$key]);
+ }
- // Entry has been added?
- if ((!SQL_HASZEROAFFECTED()) && ($GLOBALS['__XML_PARSE_RESULT'] === true)) {
- // Display success message
- displayMessage('{--MEMBER_ENTRY_ADDED--}');
- } else {
- // Display failed message
- displayMessage('{--MEMBER_ENTRY_NOT_ADDED--}');
+ // 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])
+ );
+ }
+ } elseif (($key != $idColumn[0]) && (!is_array($entries))) {
+ // Add normal entries as well!
+ $content[$key] = $entries;
+ }
+ } // END - foreach
+
+ // Finish SQL command
+ $sql = substr($sql, 0, -1) . " WHERE `" . SQL_ESCAPE($idColumn[0]) . "`=" . bigintval($id) . " LIMIT 1";
+
+ // Run this query
+ SQL_QUERY($sql, __FUNCTION__, __LINE__);
+
+ // Add affected rows
+ $affected += SQL_AFFECTEDROWS();
+
+ // Load all data from that id
+ $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1",
+ array(
+ $tableName[0],
+ $idColumn[0],
+ $id
+ ), __FUNCTION__, __LINE__);
+
+ // Fetch the data and merge it into $content
+ $content = merge_array($content, SQL_FETCHARRAY($result));
+
+ // Free the result
+ SQL_FREERESULT($result);
+
+ // Prepare filter data array
+ $filterData = array(
+ 'mode' => 'edit',
+ 'table_name' => $tableName,
+ 'content' => $content,
+ 'id' => $id,
+ 'subject' => '',
+ 'userid_column' => $userIdColumn
+ );
+
+ // Send "build mail" out
+ runFilterChain('send_build_mail', $filterData);
+ } // END - foreach
+
+ // Delete cache?
+ if ((count($cacheFiles) > 0) && (!empty($cacheFiles[0]))) {
+ // Delete cache file(s)
+ foreach ($cacheFiles as $cache) {
+ // Skip any empty entries
+ if (empty($cache)) {
+ // This may cause trouble in loadCacheFile()
+ continue;
+ } // END - if
+
+ // Is the cache file loadable?
+ if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
+ // Then remove it
+ $GLOBALS['cache_instance']->removeCacheFile();
+ } // END - if
+ } // END - foreach
+ } // END - if
+
+ // Return affected rows
+ return $affected;
+}
+
+// Build a special template list
+function doGenericListBuilder ($prefix, $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid')) {
+ // $tableName and $idColumn must bove be arrays!
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // $tableName is no array
+ reportBug(__FUNCTION__, __LINE__, 'tableName[]=' . gettype($tableName) . '!=array: userIdColumn=' . $userIdColumn);
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ reportBug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array: userIdColumn=' . $userIdColumn);
+ } elseif ((!is_array($userIdColumn)) || (count($userIdColumn) != 1)) {
+ // $tableName is no array
+ reportBug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array: userIdColumn=' . $userIdColumn);
}
+
+ // Init row output
+ $OUT = '';
+
+ // "Walk" through all entries
+ //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'listType=<pre>'.print_r($listType,true).'</pre>,tableName<pre>'.print_r($tableName,true).'</pre>,columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,idColumn=<pre>'.print_r($idColumn,true).'</pre>,userIdColumn=<pre>'.print_r($userIdColumn,true).'</pre>,rawUserId=<pre>'.print_r($rawUserId,true).'</pre>');
+ foreach (postRequestElement($idColumn[0]) as $id => $selected) {
+ // Secure id number
+ $id = bigintval($id);
+
+ // Get result from a given column array and table name
+ $result = SQL_RESULT_FROM_ARRAY($tableName[0], $columns, $idColumn[0], $id, __FUNCTION__, __LINE__);
+
+ // Is there one entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load all data
+ $content = SQL_FETCHARRAY($result);
+
+ // Filter all data
+ foreach ($content as $key => $value) {
+ // Search index
+ $idx = searchXmlArray($key, $columns, 'column');
+
+ // Skip any missing entries
+ if ($idx === false) {
+ // Skip this one
+ //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'key=' . $key . ' - SKIPPED!');
+ continue;
+ } // END - if
+
+ // Is there a userid?
+ //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]);
+ if ($key == $userIdColumn[0]) {
+ // Add it again as raw id
+ //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]);
+ $content[$userIdColumn[0]] = convertZeroToNull($value);
+ $content[$userIdColumn[0] . '_raw'] = $content[$userIdColumn[0]];
+ } // END - if
+
+ // If the key matches the idColumn variable, we need to temporary remember it
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',idColumn=' . $idColumn[0] . ',value=' . $value);
+ if ($key == $idColumn[0]) {
+ /*
+ * Found, so remember it securely (to make sure only id
+ * numbers can pass, don't use alpha-numerical values!)
+ */
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ' - set as ' . $prefix . '_list_builder_id_value!');
+ $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']]
+ );
+ }
+ } // END - foreach
+
+ // Then list it
+ $OUT .= loadTemplate(sprintf("%s_%s_%s_row",
+ $prefix,
+ $listType,
+ $tableName[0]
+ ), true, $content
+ );
+ } // END - if
+
+ // Free the result
+ SQL_FREERESULT($result);
+ } // END - foreach
+
+ // Load master template
+ loadTemplate(sprintf("%s_%s_%s",
+ $prefix,
+ $listType,
+ $tableName[0]
+ ), false, $OUT
+ );
}
// [EOF]
<tr>
<td class="{%template,ColorSwitch%} bottom right" align="center">
- <input type="checkbox" title="{--ID_SELECT--} $content[id]" class="form_field" name="sel[$content[id]]" value="1" />
+ <input type="checkbox" title="{--ID_SELECT--} $content[id]" class="form_field" name="id[$content[id]]" value="1" />
</td>
<td class="{%template,ColorSwitch%} bottom right">
<div class="tiny">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+This template provides meta data for editing forced ads.
+
+@author Roland Haeder <webmaster@mxchange.org>
+@version 0.2.1-FINAL
+@copyright (c) 2003 - 2009 by Roland Haeder
+@copyright (c) 2009 - 2012 by Mailer Developer Team
+@license GNU GPL 2.0 or any newer version
+@link http://mxchange.org
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301 USA
+//-->
+<member-entry-meta-data>
+ <!--
+ Call-back function which should all following parameter handled over
+ to. This will always be type of string but we like homogene XMLs.
+ //-->
+ <callback-function type="string" value="memberEditEntriesConfirm" />
+ <!--
+ Name of the database table where the entries should be read/write from/to.
+ //-->
+ <database-table name="" type="string" value="user_subids" />
+ <!--
+ The following three lists must have the same count of list entries, else an
+ error may occur.
+ //-->
+ <!--
+ And all column names to read/write, leave this list tag empty for all (*).
+ //-->
+ <database-column-list>
+ <!--
+ A column name list entry. The type is always string, or do you have
+ numerical column names?
+ //-->
+ <database-column-list-entry name="" type="string" table="" value="id" alias="" function="" />
+ <database-column-list-entry name="" type="string" table="" value="userid" alias="" function="" />
+ <database-column-list-entry name="" type="string" table="" value="subid" alias="" function="" />
+ <database-column-list-entry name="added_list" type="string" table="" value="subid_added" alias="subid_added" function="UNIX_TIMESTAMP" />
+ </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>
+ <!--
+ A call-back function list entry
+ //-->
+ <callback-function-list-entry name="" type="string" value="bigintval" />
+ <callback-function-list-entry name="added_list" type="string" value="generateDateTime" />
+ </callback-function-list>
+ <!--
+ Extra parameters (2nd, 3rd, ...) for above call-back functions. If an array
+ is provided, we have more than two parameters to handle over to the
+ call-back function. See function handleExtraValues() for details.
+ //-->
+ <extra-parameter-list>
+ <!--
+ A one-dimensional array with some entries
+ //-->
+ <extra-parameter-list-entry name="" type="array" value="added">
+ <!--
+ Our 'added' array
+ //-->
+ <extra-parameter-added-list>
+ <!--
+ A bool entry in the 'added' array, all other types are added in a
+ similar way.
+ //-->
+ <extra-parameter-added-list-entry name="" type="int" value="2" />
+ </extra-parameter-added-list>
+ </extra-parameter-list-entry>
+ </extra-parameter-list>
+ <!--
+ Columns for converting single time selections into a timestamp
+ //-->
+ <time-columns-list>
+ </time-columns-list>
+ <!--
+ Wether to 'edit/delete/change' (change) the entries (true) or just read them for displaying (false)
+ //-->
+ <enable-modify-entries name="" type="bool" value="false" />
+ <!--
+ The table column which should be taken for the ids (see first parameter).
+ This' type can again only be 'string' (remember why?).
+ //-->
+ <table-id-column name="" type="string" value="id" />
+ <!--
+ The table column which should be taken for user ids
+ This' type can again only be 'string' (remember why?).
+ //-->
+ <table-userid-column name="" type="string" value="userid" />
+ <!--
+ Raw userid column ($key) to skip which is always an invalid (?) entry
+ This' type can again only be 'string' (remember why?).
+ //-->
+ <raw-userid-column-key name="" type="string" value="userid" />
+</member-entry-meta-data>