blob: d8f9315932aacce78bc5ce4c8a72ab3ef849e329 (
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
|
<?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;
}
$output = array('user' => $user, 'contact' => $contact, 'profile' => $profile );
header("Content-type: text/json");
echo str_replace('\\/','/',json_encode($output));
killme();
}
|