diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-06-03 18:12:18 +1000 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-06-03 18:12:18 +1000 |
| commit | 4488965f91209ea433f69e60ac3bee508ab34e06 (patch) | |
| tree | acef72db02f4fcb3ad02f4aba7a406375d6a1d7c | |
| parent | 0a37976936cb1194bd91d3c6f74dcbb93fa5610a (diff) | |
news
| -rwxr-xr-x | kusabax.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kusabax.php b/kusabax.php index 983bf21e..b2f6322f 100755 --- a/kusabax.php +++ b/kusabax.php @@ -246,6 +246,25 @@ $query->execute() or $log[] = 'Error: ' . db_error($query); } + // News + $k_query = $kusabax->query('SELECT * FROM `' . $kusabaxc['db']['prefix'] . 'front` WHERE `page` = 0'); + while($news = $k_query->fetch()) { + // Check if already exists + $query = prepare("SELECT 1 FROM `news` WHERE `body` = :body AND `time` = :time"); + $query->bindValue(':time', $news['timestamp'], PDO::PARAM_INT); + $query->bindValue(':body', $news['message'], PDO::PARAM_STR); + $query->execute() or error(db_error($query)); + if($query->fetch()) + continue; + + $query = prepare("INSERT INTO `news` VALUES (NULL, :name, :time, :subject, :body)"); + $query->bindValue(':name', $news['poster'], PDO::PARAM_STR); + $query->bindValue(':time', $news['timestamp'], PDO::PARAM_INT); + $query->bindValue(':subject', $news['subject'], PDO::PARAM_STR); + $query->bindValue(':body', $news['message'], PDO::PARAM_STR); + $query->execute() or $log[] = 'Error: ' . db_error($query); + } + $page['body'] = '<div class="ban"><h2>Migrating…</h2><p>'; foreach($log as &$l) { $page['body'] .= $l . '<br/>'; |
