$cnt = 0; $newStatus = "Y";
if ((is_array($IDs)) && (count($IDs) > 0)) {
// "Walk" all through and count them
- foreach ($IDs as $id=>$selected) {
+ foreach ($IDs as $id => $selected) {
// Secure the ID number
$id = bigintval($id);
if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) {
// Shall we change here or list for editing?
if ($editNow) {
- // Change them
- die("EDIT!");
+ // Change them all
+ $affected = 0;
+ foreach ($IDs as $id => $sel) {
+ // Prepare content array (new values)
+ $content = array();
+
+ // Prepare SQL for this row
+ $SQL = "UPDATE "._MYSQL_PREFIX."_".$table." SET";
+ foreach ($_POST as $key => $entries) {
+ // Skip raw userid which is always invalid
+ if ($key == "uid_raw") {
+ // Continue with next field
+ continue;
+ } // END - if
+
+ // Is entries an array?
+ if (($key != $idColumn) && (is_array($entries)) && (isset($entries[$id]))) {
+ // Add this entry to content
+ $content[$key] = $entries[$id];
+
+ // Send data through the filter function if found
+ if ((isset($filterFunctions[$key])) && (isset($extraValues[$key]))) {
+ // Filter function set!
+ $entries[$id] = HANDLE_EXTRA_VALUES($filterFunctions[$key], $entries[$id], $extraValues[$key]);
+ } // END - if
+
+ // Then add this value
+ $SQL .= sprintf(" %s='%s',",
+ SQL_ESCAPE($key),
+ SQL_ESCAPE($entries[$id])
+ );
+ } elseif (($key != $idColumn) && (!is_array($entries))) {
+ // Add normal entries as well!
+ $content[$key] = $entries;
+ }
+
+ // Do we have an URL?
+ if ($key == "url") {
+ // Then add a framekiller test as well
+ $content['frametester'] = FRAMETESTER($content[$key]);
+ } // END - if
+ }
+ $SQL = substr($SQL, 0, -1) . " WHERE ".$idColumn."=".$id." LIMIT 1";
+
+ // Run this query
+ SQL_QUERY($SQL, __FILE__, __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($table, $idColumn, $id), __FILE__, __LINE__);
+
+ // Fetch the data
+ global $DATA;
+ $DATA = SQL_FETCHARRAY($result);
+
+ // Free the result
+ SQL_FREERESULT($result);
+
+ // Is a raw user id set?
+ if ((isset($_POST['uid_raw'][$id])) && ($_POST['uid_raw'][$id] > 0)) {
+ // Generate subject
+ $eval = "\$subject = MEMBER_EDIT_".strtoupper($table)."_SUBJECT;";
+ eval($eval);
+
+ // Load email template
+ $mail = LOAD_EMAIL_TEMPLATE("member_edit_".$table, $content);
+
+ // Send email out
+ SEND_EMAIL($_POST['uid_raw'][$id], $subject, $mail);
+ } // END - if
+
+ // Generate subject
+ $eval = "\$subject = ADMIN_EDIT_".strtoupper($table)."_SUBJECT;";
+ eval($eval);
+
+ // Send admin notification out
+ SEND_ADMIN_NOTIFICATION($subject, "admin_edit_".$table, $content, $_POST['uid_raw'][$id]);
+ } // END - foreach
+
+ // Was this fine?
+ if ($affected == count($IDs)) {
+ // All deleted
+ LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ALL_ENTRIES_EDITED);
+ } else {
+ // Some are still there :(
+ LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_SOME_ENTRIES_NOT_EDITED, $affected, count($IDs)));
+ }
} else {
// List for editing
ADMIN_BUILD_LIST("edit", $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);