blob: d8141534a474b87940ed9165532d5f46db5da04c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?php
function uexport_init(&$a) {
if(! local_user())
killme();
$user = array();
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
local_user()
);
if(count($r)) {
foreach($r as $rr)
foreach($rr as $k => $v)
$user[$k] = $v;
}
$contact = array();
$r = q("SELECT * FROM `contact` WHERE `uid` = %d ",
local_user()
);
if(count($r)) {
foreach($r as $rr)
foreach($rr as $k => $v)
$contact[][$k] = $v;
}
$profile = array();
$r = q("SELECT * FROM `profile` WHERE `uid` = %d ",
local_user()
);
if(count($r)) {
foreach($r as $rr)
foreach($rr as $k => $v)
$profile[][$k] = $v;
}
$item = array();
$r = q("SELECT * FROM `item` WHERE `uid` = %d ",
local_user()
);
if(count($r)) {
foreach($r as $rr)
foreach($rr as $k => $v)
$item[][$k] = $v;
}
$output = array('user' => $user, 'contact' => $contact, 'profile' => $profile, 'item' => $item );
header("Content-type: text/json");
echo str_replace('\\/','/',json_encode($output));
killme();
}
|