} foreach ($group_rights as $ii => $right) { if ($right['fid'] == $forum['id']) { $db->insert('forum_rights_group values ("","' . $forum_id . '","' . $right['gid'] . '","' . update_right($right['recht']) . '")'); } } foreach ($threads as $ii => $thread) { if ($thread['forum'] == $forum['id']) { $db->insert('forum values ("","' . $forum_id . '","' . $forum['owner'] . '","","' . update_text($thread['topic']) . '","' . update_text($thread['topic']) . '")'); $thread_id = $db->insert_id; $db->insert('forum_relation values ("' . $forum_id . '","' . $thread_id . '","1")'); $db->insert('forum_relation values ("0","' . $thread_id . '","2")'); $thread_author = 0; foreach ($posts as $iii => $post) { if ($post['thread'] == $thread['id']) { if (!$thread_author) { $thread_author = $post['aid']; $db->update('forum set author="' . $thread_author . '", created="' . $post['datum'] . '", text="' . update_text($post['text']) . '" where id="' . $thread_id . '"'); } else { $db->insert('forum values ("","' . $thread_id . '","' . $post['aid'] . '","' . $post['datum'] . '","Re: ' . update_text($thread['topic']) . '","' . update_text($post['text']) . '")'); $post_id = $db->insert_id; $db->insert('forum_relation values ("' . $thread_id . '","' . $post_id . '","1")'); $db->insert('forum_relation values ("' . $forum_id . '","' . $post_id . '","2")'); $db->insert('forum_relation values ("0","' . $post_id . '","3")'); } } } } } } echo 'Tables updated';
function update_data_array($urls) { global $messages, $error, $text, $added, $modified; $added = array(); $modified = array(); $cleared = false; foreach ($urls as $url) { if (substr($url, 0, 4) == 'http') { $messages[] = sprintf(_('Reading URL %s'), $url); } elseif (isset($_FILES['file']['name'])) { $messages[] = sprintf(_('Reading file %s'), $_FILES['file']['name']); } $data = parse_osm_xml($url); if ($data && count($data) > 0) { if (!$cleared && isset($_REQUEST['replace'])) { clear_data(); $text = ''; $cleared = true; } update_data($data); if ($error) { break; } } } store_base(); if (count($added) + count($modified) > 0) { $text = update_text($text); } }