Changeset 896
- Timestamp:
- 05/21/09 15:54:21 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/class.db_im.inc.php
r697 r896 137 137 } 138 138 139 public final function getHostsJabber() 140 { 141 $return = ""; 142 143 if( $this->db ) 144 { 145 $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';"; 146 147 if($this->db->query($query)) 148 { 149 while($this->db->next_record()) 150 $result[] = $this->db->row(); 151 } 152 153 if( count($result) > 0 ) 154 $return = $result[0]['config_value']; 155 } 156 157 return $return; 158 } 159 139 160 public final function getPreferences() 140 161 { … … 152 173 153 174 return "openWindowJabberit:true;openWindowJabberitPopUp:false;flagAwayIM:5"; 154 //return "openWindowJabberit:true;openWindowJabberitPopUp:false";155 175 } 156 176 … … 313 333 } 314 334 335 return false; 336 } 337 338 public final function setHostJabber($pParam) 339 { 340 $organization = $pParam['organization']; 341 $hostJabber = $pParam['hostJabber']; 342 343 if( $this->db ) 344 { 345 $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';"; 346 347 if($this->db->query($query)) 348 { 349 350 if ( $this->db->query($query) ) 351 { 352 while($this->db->next_record()) 353 $result[] = $this->db->row(); 354 } 355 356 if( count($result) == 0 ) 357 { 358 $confHostJabber = strtoupper($organization).":".$hostJabber; 359 $return = "<return><confServer ou='".strtoupper($organization)."' serverName='".$hostJabber."'>".$confHostJabber."</confServer></return>"; 360 $query = "INSERT INTO phpgw_config(config_app,config_name, config_value) VALUES('phpgwapi','map_org_realm_jabberit','".serialize($confHostJabber)."')"; 361 $_SESSION['debug']['gravar'] = $confHostJabber; 362 $this->db->query($query); 363 } 364 else 365 { 366 $confHostJabber = unserialize($result[0]['config_value']); 367 $OrgHosts = explode(";", $confHostJabber); 368 $stringSearch = strtoupper($organization).":".$hostJabber; 369 $FoundString = array_search($stringSearch, $OrgHosts); 370 371 if( $FoundString === false) 372 $confHostJabber .= ";" . $stringSearch; 373 374 $items = explode(";", $confHostJabber); 375 natcasesort($items); 376 377 $return = "<return>"; 378 foreach($items as $tmp) 379 { 380 $aux = explode(":",$tmp); 381 $return .= "<confServer ou='".$aux[0]."' serverName='".$aux[1]."'>".$tmp."</confServer>"; 382 } 383 $return .= "</return>"; 384 385 $query = "UPDATE phpgw_config SET config_value = '".serialize($confHostJabber)."' WHERE config_name = 'map_org_realm_jabberit';"; 386 $this->db->query($query); 387 } 388 389 return $return; 390 } 391 } 392 315 393 return false; 316 394 } … … 473 551 return false; 474 552 } 475 553 554 public final function removeAttributesLdap($pOrg) 555 { 556 $organization = $pOrg['org']; 557 558 if( $this->db ) 559 { 560 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'"; 561 562 if ( $this->db->query($query) ) 563 { 564 while( $this->db->next_record() ) 565 $result[] = $this->db->row(); 566 567 if( count($result) > 0 ) 568 $attributesOrg = $result[0]['config_value']; 569 } 570 571 $attributesOrg = explode(",", $attributesOrg); 572 $newValue = ""; 573 foreach($attributesOrg as $tmp) 574 { 575 $attr = explode(";",$tmp); 576 577 if( strtolower(trim($attr[0])) != strtolower(trim($organization))) 578 { 579 $newValue .= $attr[0] . ";" . $attr[1] . ","; 580 } 581 } 582 583 $newValue = substr($newValue, 0,(strlen($newValue) -1 )); 584 585 if( trim($newValue) != "") 586 $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'attributes_org_ldap_jabberit'"; 587 else 588 $query = "DELETE from phpgw_config where config_name = 'attributes_org_ldap_jabberit'"; 589 590 if( $this->db->query($query)) 591 return true; 592 else 593 return false; 594 } 595 return false; 596 } 597 598 public final function removeHostsJabber($pItem) 599 { 600 $query = "SELECT * FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 'map_org_realm_jabberit';"; 601 602 if( $this->db ) 603 { 604 if($this->db->query($query)) 605 { 606 while($this->db->next_record()) 607 $result[] = $this->db->row(); 608 609 if( count($result) > 0 ) 610 { 611 $confHostsOrgs = unserialize($result[0]['config_value']); 612 $confHostsOrgs = explode(";", $confHostsOrgs); 613 $foundValue = array_search($pItem['item'], $confHostsOrgs); 614 615 if( $foundValue !== false ) 616 array_splice($confHostsOrgs, $foundValue, 1); 617 618 if(count($confHostsOrgs) > 0 ) 619 { 620 foreach( $confHostsOrgs as $values ) 621 $stringHostsOrgs .= $values . ";"; 622 623 $stringHostsOrgs = substr($stringHostsOrgs, 0, strlen($stringHostsOrgs) -1 ); 624 $query = "UPDATE phpgw_config SET config_value = '".serialize($stringHostsOrgs)."' WHERE config_name = 'map_org_realm_jabberit';"; 625 } 626 else 627 $query = "DELETE FROM phpgw_config WHERE config_name = 'map_org_realm_jabberit';"; 628 629 if( $this->db->query($query) ) 630 return "true"; 631 } 632 } 633 } 634 return "false"; 635 } 636 476 637 public final function removeOuGroupsLocked($pGroup) 477 638 { … … 532 693 } 533 694 534 public final function removeAttributesLdap($pOrg) 535 { 536 $organization = $pOrg['org']; 537 538 if( $this->db ) 539 { 540 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'attributes_org_ldap_jabberit'"; 695 public final function removeParticipantsExternal($pOrganization) 696 { 697 698 $organization = $pOrganization['participants']; 699 700 if( $this->db ) 701 { 702 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'conf_organization_jabberit'"; 541 703 542 704 if ( $this->db->query($query) ) … … 546 708 547 709 if( count($result) > 0 ) 548 $ attributesOrg= $result[0]['config_value'];549 } 550 551 $ attributesOrg = explode(",", $attributesOrg);710 $valueDB = $result[0]['config_value']; 711 } 712 713 $OrgDB = explode(",", $valueDB); 552 714 $newValue = ""; 553 foreach($attributesOrg as $tmp) 554 { 555 $attr = explode(";",$tmp); 556 557 if( strtolower(trim($attr[0])) != strtolower(trim($organization))) 558 { 559 $newValue .= $attr[0] . ";" . $attr[1] . ","; 560 } 715 716 foreach($OrgDB as $tmp) 717 { 718 if( strtolower(trim($tmp)) != strtolower(trim($organization))) 719 $newValue .= $tmp . ","; 561 720 } 562 721 … … 564 723 565 724 if( trim($newValue) != "") 566 $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = ' attributes_org_ldap_jabberit'";567 else 568 $query = "DELETE from phpgw_config where config_name = ' attributes_org_ldap_jabberit'";725 $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'conf_organization_jabberit'"; 726 else 727 $query = "DELETE from phpgw_config where config_name = 'conf_organization_jabberit'"; 569 728 570 729 if( $this->db->query($query)) … … 575 734 return false; 576 735 } 577 578 public final function removeParticipantsExternal($pOrganization)579 {580 581 $organization = $pOrganization['participants'];582 583 if( $this->db )584 {585 $query = "SELECT * from phpgw_config WHERE config_app = 'phpgwapi' and config_name = 'conf_organization_jabberit'";586 587 if ( $this->db->query($query) )588 {589 while( $this->db->next_record() )590 $result[] = $this->db->row();591 592 if( count($result) > 0 )593 $valueDB = $result[0]['config_value'];594 }595 596 $OrgDB = explode(",", $valueDB);597 $newValue = "";598 599 foreach($OrgDB as $tmp)600 {601 if( strtolower(trim($tmp)) != strtolower(trim($organization)))602 $newValue .= $tmp . ",";603 }604 605 $newValue = substr($newValue, 0,(strlen($newValue) -1 ));606 607 if( trim($newValue) != "")608 $query = "UPDATE phpgw_config SET config_value = '".$newValue."' WHERE config_app = 'phpgwapi' AND config_name = 'conf_organization_jabberit'";609 else610 $query = "DELETE from phpgw_config where config_name = 'conf_organization_jabberit'";611 612 if( $this->db->query($query))613 return true;614 else615 return false;616 }617 return false;618 }619 736 } 620 737 ?>
Note: See TracChangeset
for help on using the changeset viewer.