- Timestamp:
- 07/11/12 11:45:10 (12 years ago)
- Location:
- branches/2.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk merged eligible /sandbox/2.4.1-3 6237-6527
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/2.4/expressoMail1_2/inc/class.db_functions.inc.php
r6331 r6754 24 24 include_once(PHPGW_API_INC.'/class.db.inc.php'); 25 25 } 26 include_once('class.dynamic_contacts.inc.php');27 26 28 27 class db_functions … … 248 247 } 249 248 250 //Gera lista de contatos para ser gravado e acessado pelo expresso offline.251 function get_dropdown_contacts_to_cache() {252 return $this->get_dropdown_contacts();253 }254 255 function get_dropdown_contacts(){256 $contacts = $this->get_cc_contacts();257 $groups = $this->get_cc_groups();258 259 if(($contacts) && ($groups))260 $stringDropDownContacts = $contacts . ',' . $groups;261 elseif ((!$contacts) && (!$groups))262 $stringDropDownContacts = '';263 elseif (($contacts) && (!$groups))264 $stringDropDownContacts = $contacts;265 elseif ((!$contacts) && ($groups))266 $stringDropDownContacts = $groups;267 268 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) {269 // Free others requests270 session_write_close();271 $dynamic_contact = new dynamic_contacts();272 $dynamic = $dynamic_contact->dynamic_contact_toString();273 if ($dynamic)274 $stringDropDownContacts .= ($stringDropDownContacts ? ',' : '') . $dynamic;275 }276 return $stringDropDownContacts;277 }278 249 function getUserByEmail($params){ 279 250 // Follow the referral … … 309 280 } 310 281 311 function get_dynamic_contacts()312 {313 // Pesquisa os emails e ultima inserção nos contatos dinamicos.314 if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__))315 {316 return $this->db->Error;317 }318 while($this->db->next_record())319 {320 $result[] = $this->db->row();321 }322 if($result) foreach($result as $item)323 {324 $contacts = unserialize($item['data']);325 }326 if (count($contacts) == 0)327 {328 return null;329 }330 //Sort by email331 function cmp($a, $b) { return strcmp($a["email"], $b["email"]);}332 usort($contacts,"cmp");333 return $contacts;334 }335 function update_contacts($contacts=array())336 {337 338 339 if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__))340 {341 $result['dberr1'] = $this->db->Error;342 }343 $regs = array();344 while($this->db->next_record())345 {346 $regs[] = $this->db->row();347 }348 $old_contatacts = array();349 foreach($regs as $old){350 $old_contatacts = unserialize($old['data']);351 }352 353 foreach($old_contatacts as $i => $v)354 foreach($contacts as $ii => $vv)355 if(trim($v['email']) == trim($vv['email']))356 unset($old_contatacts[$i]);357 358 359 $old_contatacts = array_merge( $old_contatacts , $contacts);360 // Atualiza um email nos contatos dinamicos.361 if(!$this->db->update('phpgw_expressomail_contacts ','data=\''.serialize($old_contatacts).'\'','id_owner ='.$this->user_id,__LINE__,__FILE__))362 {363 return $this->db->Error;364 }365 return $contacts;366 }367 282 function update_preferences($params){ 368 283 $string_serial = urldecode($params['prefe_string']); … … 375 290 else 376 291 return array("success" => true); 377 }378 379 function insert_contact($contact)380 {381 $contacts[] = array( 'timestamp' => time(),382 'email' => $contact );383 384 // Insere um email nos contatos dinamicos.385 $query = 'INSERT INTO phpgw_expressomail_contacts (data, id_owner) ' .386 'values ( \''.serialize($contacts).'\', '.$this->user_id.')';387 388 if(!$this->db->query($query,__LINE__,__FILE__))389 return $this->db->Error;390 return $contacts;391 }392 393 function remove_dynamic_contact($user_id,$line,$file)394 {395 $where = $user_id.' = id_owner';396 $this->db->delete('phpgw_expressomail_contacts',$where,$line,$file);397 292 } 398 293
Note: See TracChangeset
for help on using the changeset viewer.