Revision 7855,
1.6 KB
checked in by alexandrecorreia, 11 years ago
(diff) |
Ticket #2507 - Correções dentro da API do webservice do expresso
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | class ContactPictureResource extends CatalogAdapter { |
---|
4 | public function post($request){ |
---|
5 | // to Receive POST Params (use $this->params) |
---|
6 | parent::post($request); |
---|
7 | |
---|
8 | if($this-> isLoggedIn()) |
---|
9 | { |
---|
10 | $contact = array(); |
---|
11 | $contactID = $this->getParam('contactID'); |
---|
12 | |
---|
13 | // User Contact |
---|
14 | if($this->getParam('contactType') == 1 && $contactID != null){ |
---|
15 | |
---|
16 | $query = "select A.id_contact, A.photo from phpgw_cc_contact A where A.id_contact= ? and A.id_owner = ? "; |
---|
17 | |
---|
18 | $result = $this->getDb()->Link_ID->query($query, array($contactID,$this->getUserId())); |
---|
19 | |
---|
20 | if ($result) { |
---|
21 | |
---|
22 | while($row = $result->fetchRow()) { |
---|
23 | if($row['photo'] != null) { |
---|
24 | $contact[] = array( |
---|
25 | 'contactID' => $row['id_contact'], |
---|
26 | 'contactImagePicture' => ($row['photo'] != null ? base64_encode($row['photo']) : "") |
---|
27 | ); |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | } |
---|
32 | } |
---|
33 | |
---|
34 | // Global Catalog |
---|
35 | elseif($this->getParam('contactType') == 2){ |
---|
36 | if(!$contactID){ |
---|
37 | $contactID = $GLOBALS['phpgw_info']['user']['account_dn']; |
---|
38 | } |
---|
39 | $photo = $this->getUserLdapPhoto(urldecode($contactID)); |
---|
40 | $contact[] = array( |
---|
41 | 'contactID' => $contactID, |
---|
42 | 'contactImagePicture' => ($photo != null ? base64_encode($photo[0]) : "") |
---|
43 | ); |
---|
44 | |
---|
45 | } |
---|
46 | $result = array ('contacts' => $contact); |
---|
47 | $this->setResult($result); |
---|
48 | } |
---|
49 | //to Send Response (JSON RPC format) |
---|
50 | return $this->getResponse(); |
---|
51 | } |
---|
52 | |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.