3 function uexport_init(&$a) {
9 $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
14 foreach($rr as $k => $v)
19 $r = q("SELECT * FROM `contact` WHERE `uid` = %d ",
24 foreach($rr as $k => $v)
30 $r = q("SELECT * FROM `profile` WHERE `uid` = %d ",
35 foreach($rr as $k => $v)
39 $output = array('user' => $user, 'contact' => $contact, 'profile' => $profile );
41 header("Content-type: application/json");
42 echo json_encode($output);
44 $r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
48 $total = $r[0]['total'];
50 // chunk the output to avoid exhausting memory
52 for($x = 0; $x < $total; $x += 500) {
54 $r = q("SELECT * FROM `item` WHERE `uid` = %d LIMIT %d, %d",
61 foreach($rr as $k => $v)
65 $output = array('item' => $item);
66 echo json_encode($output);