<?php require_once 'thread.inc'; if (!isset($forum)) { echo "Invalid forum\n"; exit; } $page = $_REQUEST['page']; $tid = $_REQUEST['tid']; $time = $_REQUEST['time']; if (!$user->valid() || !is_numeric($tid)) { header("Location: {$page}"); exit; } $iid = tid_to_iid($tid); if (!isset($iid)) { echo "Invalid thread!\n"; exit; } if (!$user->is_valid_token($_REQUEST['token'])) { err_not_found("Invalid token"); } if (!is_numeric($time)) { err_not_found("Invalid timestamp"); } track_thread($forum['fid'], $tid, '', $time); Header("Location: {$page}"); // vim: sw=2
} 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