3 SO2::$Page->pageheader();
9 $m = SO2::$DB->query('SELECT topicid, messageid, mtext FROM message_data NATURAL LEFT JOIN messages ORDER BY messageid ASC')->fetchAll(PDO::FETCH_ASSOC);
11 $mtree[array_shift($r)][] = $r;
13 foreach ( $mtree as $topicid => $messages ) {
14 echo "\nTopic $topicid\n";
15 mkdir('data/messages/'.$topicid);
16 foreach ( $messages as $msg ) {
17 echo $msg['messageid'].' ';
18 file_put_contents('data/messages/'.$topicid.'/'.$msg['messageid'], $msg['mtext']);