datadir = 'inc/database/flatfile/'; // Search past default database path if (file_exists('inc/flatfile/' . POSTS_FILE)) { $db->datadir = 'inc/flatfile/'; } if (function_exists('insertPost')) { function migrateAccount($a) { $account = array(); $account[ACCOUNT_ID] = $a['id']; $account[ACCOUNT_USERNAME] = $a['username']; $account[ACCOUNT_PASSWORD] = $a['password']; $account[ACCOUNT_ROLE] = $a['role']; $account[ACCOUNT_LASTACTIVE] = $a['lastactive']; $GLOBALS['db']->insertWithAutoId(ACCOUNTS_FILE, ACCOUNT_ID, $account); } function migrateBan($b) { $ban = array(); $ban[BAN_ID] = $b['id']; $ban[BAN_IP] = $b['ip']; $ban[BAN_TIMESTAMP] = $b['timestamp']; $ban[BAN_EXPIRE] = $b['expire']; $ban[BAN_REASON] = $b['reason']; $GLOBALS['db']->insertWithAutoId(BANS_FILE, BAN_ID, $ban); } function migrateKeyword($k) { $keyword = array(); $keyword[KEYWORD_ID] = $k['id']; $keyword[KEYWORD_TEXT] = $k['text']; $keyword[KEYWORD_ACTION] = $k['action']; $GLOBALS['db']->insertWithAutoId(KEYWORDS_FILE, KEYWORD_ID, $keyword); } function migrateLog($l) { $log = array(); $log[LOG_ID] = $l['id']; $log[LOG_TIMESTAMP] = $l['timestamp']; $log[LOG_ACCOUNT] = $l['account']; $log[LOG_MESSAGE] = $l['message']; $GLOBALS['db']->insertWithAutoId(LOGS_FILE, LOG_ID, $log); } function migratePost($p) { $post = array(); $post[POST_ID] = $p['id']; $post[POST_PARENT] = $p['parent']; $post[POST_TIMESTAMP] = $p['timestamp']; $post[POST_BUMPED] = $p['bumped']; $post[POST_IP] = $p['ip']; $post[POST_NAME] = $p['name']; $post[POST_TRIPCODE] = $p['tripcode']; $post[POST_EMAIL] = $p['email']; $post[POST_NAMEBLOCK] = $p['nameblock']; $post[POST_SUBJECT] = $p['subject']; $post[POST_MESSAGE] = $p['message']; $post[POST_PASSWORD] = $p['password']; $post[POST_FILE] = $p['file']; $post[POST_FILE_HEX] = $p['file_hex']; $post[POST_FILE_ORIGINAL] = $p['file_original']; $post[POST_FILE_SIZE] = $p['file_size']; $post[POST_FILE_SIZE_FORMATTED] = $p['file_size_formatted']; $post[POST_IMAGE_WIDTH] = $p['image_width']; $post[POST_IMAGE_HEIGHT] = $p['image_height']; $post[POST_THUMB] = $p['thumb']; $post[POST_THUMB_WIDTH] = $p['thumb_width']; $post[POST_THUMB_HEIGHT] = $p['thumb_height']; $post[POST_MODERATED] = $p['moderated']; $post[POST_STICKIED] = $p['stickied']; $post[POST_LOCKED] = $p['locked']; $GLOBALS['db']->insertWithAutoId(POSTS_FILE, POST_ID, $post); } function migrateReport($r) { $report = array(); $report[REPORT_ID] = $r['id']; $report[REPORT_IP] = $r['ip']; $report[REPORT_POST] = $r['post']; $GLOBALS['db']->insertWithAutoId(REPORTS_FILE, REPORT_ID, $report); } }