} if (!empty($nmsg['video'])) { $new[] = "video: " . $nmsg['video']; } $diff .= diff($old, $new); /* IMAGEURL HACK - prepend before insert */ /* for diffing and for entry into the db */ $nmsg = image_url_hack_insert($nmsg); /* Add it into the database */ $iid = mid_to_iid($mid); if (!isset($iid)) { err_not_found("message {$mid} has no iid"); exit; } $sql = "update f_messages{$iid} set name = ?, email = ?, flags = ?, subject = ?, " . "message = ?, url = ?, urltext = ?, video = ?, state = ?, " . "changes = CONCAT(changes, 'Edited by ', ?, '/', ?, ' at ', NOW(), ' from ', ?, '\n', ?, '\n') " . "where mid = ?"; db_exec($sql, array($nmsg['name'], $nmsg['email'], $nmsg['flags'], $nmsg['subject'], $nmsg['message'], $nmsg['url'], $nmsg['urltext'], $nmsg['video'], $nmsg['state'], $user->name, $user->aid, $remote_addr, $diff, $mid)); $sql = "replace into f_updates ( fid, mid ) values ( ?, ? )"; db_exec($sql, array($forum['fid'], $mid)); /* update user post counts and f_indexes */ if ($state_changed) { msg_state_changed($forum['fid'], $msg, $nmsg['state']); } if ($track_thread) { track_thread($forum['fid'], $nmsg['tid'], $send_email ? "SendEmail" : ""); } else { untrack_thread($forum['fid'], $nmsg['tid']); } $tpl->set_var("MSG_MID", $mid); } print generate_page('Edit Message', $tpl->parse("CONTENT", "edit")); // vim:sw=2
} if (isset($flags['StateLocked']) && $levels[$state] <= $levels[$msg['state']]) { echo "You cannot change the state of this message anymore\n"; exit; } } else { if ($msg['aid'] != $user->aid) { $flags['StateLocked'] = true; } } if ($state == 'OffTopic' && $user->capable($forum['fid'], 'OffTopic')) { // We'll send the message in 10 minutes db_exec("insert into f_offtopic ( fid, mid, aid ) values ( ?, ?, ? )", array($forum['fid'], $msg['mid'], $msg['aid'])); } else { if ($msg['state'] == 'OffTopic' && $state != 'OffTopic') { // Delete any queued messages db_exec("delete from f_offtopic where fid = ? and mid = ?", array($forum['fid'], $msg['mid'])); } } if (isset($flags)) { foreach ($flags as $k => $v) { $flagset[] = $k; } $flagset = implode(",", $flagset); } else { $flagset = ""; } db_exec("update f_messages{$iid} set " . "changes = CONCAT(changes, 'Changed to ', ?, ' from ', state, ' by ', ?, '/', ?, ' at ', NOW(), '\n'), " . "flags = ?, state = ? where mid = ?", array($state, $user->name, $user->aid, $flagset, $state, $mid)); msg_state_changed($forum['fid'], $msg, $state); header("Location: {$page}"); // vim: sw=2