]>
src.bluestatic.org Git - bugdar.git/blob - docs/update_history.php
5 die('Remove die notice!');
8 require_once('./global.php');
12 $history = $db->query("SELECT * FROM " . TABLE_PREFIX
. "history");
13 while ($log = $db->fetch_array($history))
16 if (preg_match('#custom_field([0-9]+?)#i', $log['field'], $matches))
18 $db->query("UPDATE " . TABLE_PREFIX
. "history SET field = 'custom.field{$matches[1]}' WHERE historyid = $log[historyid]");
20 else if (preg_match('#comment ([0-9]+?) (hidden|text)#i', $log['field'], $matches))
22 $db->query("UPDATE " . TABLE_PREFIX
. "history SET field = 'comment.{$matches[2]}', commentid = {$matches[1]} WHERE historyid = $log[historyid]");
24 else if ($log['attachmentid'] != 0)
26 $db->query("UPDATE " . TABLE_PREFIX
. "history SET field = 'attachment.{$log['field']}' WHERE historyid = $log[historyid]");
28 else if (!preg_match('#^(comment|attachment)?\.#', $log['field']))
30 foreach (array('original', 'changed') AS $array)
32 if (preg_match('# \(id: ([0-9]+?)\)$#i', $log["$array"], $matches))
34 $db->query("UPDATE
" . TABLE_PREFIX . "history SET
$array = {$matches
[1]} WHERE historyid
= $log[historyid
]");
36 else if (preg_match('#user ?id:? ([0-9]+?)#i', $log["$array"], $matches))
38 $db->query("UPDATE " . TABLE_PREFIX
. "history SET $array = {$matches[1]} WHERE historyid = $log[historyid]");
40 $db->query("UPDATE " . TABLE_PREFIX
. "history SET field = '.{$log['field']}' WHERE historyid = $log[historyid]");