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
*
|
Rev | Line | |
---|
[6019] | 1 | <?php |
---|
| 2 | |
---|
[6148] | 3 | class ContactPictureResource extends CatalogAdapter { |
---|
[6019] | 4 | public function post($request){ |
---|
| 5 | // to Receive POST Params (use $this->params) |
---|
| 6 | parent::post($request); |
---|
| 7 | |
---|
[6274] | 8 | if($this-> isLoggedIn()) |
---|
[6019] | 9 | { |
---|
| 10 | $contact = array(); |
---|
[6274] | 11 | $contactID = $this->getParam('contactID'); |
---|
[7855] | 12 | |
---|
[6019] | 13 | // User Contact |
---|
[7855] | 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 | |
---|
[6019] | 34 | // Global Catalog |
---|
| 35 | elseif($this->getParam('contactType') == 2){ |
---|
[6274] | 36 | if(!$contactID){ |
---|
| 37 | $contactID = $GLOBALS['phpgw_info']['user']['account_dn']; |
---|
| 38 | } |
---|
| 39 | $photo = $this->getUserLdapPhoto(urldecode($contactID)); |
---|
[6019] | 40 | $contact[] = array( |
---|
[6274] | 41 | 'contactID' => $contactID, |
---|
[6019] | 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.