+ LOAD_TEMPLATE(sprintf("admin_%s_%s",
+ $listType,
+ $table
+ ), false, $OUT
+ );
+}
+
+// Change status of "build" list
+function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray) {
+ // All valid entries? (We hope so here!)
+ if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (count($statusArray) > 0)) {
+ // "Walk" through all entries
+ foreach ($IDs as $id => $sel) {
+ // Construct SQL query
+ $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET",
+ SQL_ESCAPE($table)
+ );
+
+ // Load data of entry
+ $result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE %s=%s LIMIT 1",
+ array($table, $idColumn, $id), __FUNCTION__, __LINE__);
+
+ // Fetch the data
+ $content = SQL_FETCHARRAY($result);
+
+ // Free the result
+ SQL_FREERESULT($result);
+
+ // Add all status entries (e.g. status column last_updated or so)
+ $newStatus = "UNKNOWN";
+ $oldStatus = "UNKNOWN";
+ $statusColumn = "unknown";
+ foreach ($statusArray as $column => $statusInfo) {
+ // Does the entry exist?
+ if ((isset($content[$column])) && (isset($statusInfo[$content[$column]]))) {
+ // Add these entries for update
+ $sql .= sprintf(" %s='%s',", SQL_ESCAPE($column), SQL_ESCAPE($statusInfo[$content[$column]]));
+
+ // Remember status
+ if ($statusColumn == "unknown") {
+ // Always (!!!) change status column first!
+ $oldStatus = $content[$column];
+ $newStatus = $statusInfo[$oldStatus];
+ $statusColumn = $column;
+ } // END - if
+ } elseif (isset($content[$column])) {
+ // Unfinished!
+ app_die(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}");
+ }
+ } // END - foreach
+
+ // Add other columns as well
+ foreach (REQUEST_POST_ARRAY() as $key => $entries) {
+ // Skip id, raw userid and 'do_$mode'
+ if (!in_array($key, array($idColumn, 'uid_raw', ('do_'.$mode)))) {
+ // Are there brackets () at the end?
+ if (substr($entries[$id], -2, 2) == "()") {
+ // Direct SQL command found
+ $sql .= sprintf(" %s=%s,", SQL_ESCAPE($key), SQL_ESCAPE($entries[$id]));
+ } else {
+ // Add regular entry
+ $sql .= sprintf(" %s='%s',", SQL_ESCAPE($key), SQL_ESCAPE($entries[$id]));
+
+ // Add entry
+ $content[$key] = $entries[$id];
+ }
+ } // END - if
+ } // END - foreach
+
+ // Finish SQL statement
+ $sql = substr($sql, 0, -1) . sprintf(" WHERE `%s`=%s AND `%s`='%s' LIMIT 1",
+ $idColumn,
+ bigintval($id),
+ $statusColumn,
+ $oldStatus
+ );
+
+ // Run the SQL
+ SQL_QUERY($sql, __FUNCTION__, __LINE__);
+
+ // Do we have an URL?
+ if (isset($content['url'])) {
+ // Then add a framekiller test as well
+ $content['frametester'] = FRAMETESTER($content['url']);
+ } // END - if
+
+ // Send "build mails" out
+ ADMIN_SEND_BUILD_MAILS($mode, $table, $content, $id, $statusInfo[$content[$column]]);
+ } // END - foreach
+ } // END - if