]> git.mxchange.org Git - friendica.git/blob - mod/uexport.php
remove items from export - too much memory consumed, will have to stream items,photos
[friendica.git] / mod / uexport.php
1 <?php
2
3 function uexport_init(&$a) {
4
5         if(! local_user())
6                 killme();
7
8         $user = array();
9         $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
10                 local_user()
11         );
12         if(count($r)) {
13                 foreach($r as $rr)
14                         foreach($rr as $k => $v)
15                                 $user[$k] = $v;
16
17         }
18         $contact = array();
19         $r = q("SELECT * FROM `contact` WHERE `uid` = %d ",
20                 local_user()
21         );
22         if(count($r)) {
23                 foreach($r as $rr)
24                         foreach($rr as $k => $v)
25                                 $contact[][$k] = $v;
26
27         }
28
29         $profile = array();
30         $r = q("SELECT * FROM `profile` WHERE `uid` = %d ",
31                 local_user()
32         );
33         if(count($r)) {
34                 foreach($r as $rr)
35                         foreach($rr as $k => $v)
36                                 $profile[][$k] = $v;
37         }
38
39         $output = array('user' => $user, 'contact' => $contact, 'profile' => $profile );
40
41         header("Content-type: text/json");
42         echo str_replace('\\/','/',json_encode($output));
43
44         killme();
45
46 }