Changeset 64
- Timestamp:
- 09/05/07 11:18:58 (17 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 12 deleted
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/docs/change_log.txt
r63 r64 91 91 - Criado aba Informações Corporativas, com os campo employeeNumber, cpf, rg, rgUf 92 92 - Melhorado classe user.inc.php. 93 94 20/08/2007 95 - Criado maneira de esconder abas de gerentes que não podem acessa-las. 96 - Criado maneira de obter o nextID number de outro Banco de Dados. 97 - Criado possibilidade de copiar um gerente. 98 99 21/08/2007 100 - Adicionado suporte para o gerente administrar 1 ou mais OU's. -
trunk/expressoAdmin1_2/inc/class.bocomputers.inc.php
r27 r64 19 19 20 20 var $so; 21 var $db_functions; 21 22 var $functions; 22 23 … … 25 26 $this->so = CreateObject('expressoAdmin1_2.socomputers'); 26 27 $this->functions = $this->so->functions; 28 $this->db_functions = CreateObject('expressoAdmin1_2.db_functions'); 27 29 } 28 30 29 31 function create_computer() 30 32 { 31 if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], ' add_groups'))33 if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'create_computers')) 32 34 { 33 $_POST['error_messages'] = "O arquivo binário /home/expressolivre/mkntpwd não exite.";34 ExecMethod('expressoAdmin1_2.uiaccounts.add_computer');35 35 return false; 36 36 } … … 39 39 $c->read_repository(); 40 40 $current_config = $c->config_data; 41 // Leio o ID a ser usado na criação do objecto. 42 $next_id = ($this->db_functions->get_next_id('accounts')); 41 43 42 // Pega ID do BD e incrementa de 1. 43 $id = (($this->functions->get_next_id()) + 1); 44 if ((!is_numeric($next_id['id'])) || (!$next_id['status'])) 45 { 46 47 $return['status'] = false; 48 $return['msg'] = "Problemas obtendo ID do usuário.\n" . $id['msg']; 49 return $return; 50 } 51 else 52 { 53 $id = $next_id['id']; 54 } 55 // Incrementa o id no BD. 56 //$this->functions->increment_id($id,'accounts'); 44 57 45 58 // Cria array para incluir no LDAP … … 83 96 return false; 84 97 } 85 86 // Incrementa o id no BD.87 $this->functions->increment_id($id,'accounts');88 98 89 99 // Volta para o ListGroups … … 163 173 function delete_computer() 164 174 { 165 //_debug_array($_POST);166 167 175 //Delete from ldap. 168 176 if (!$this->so->delete_computer_ldap($_POST['computer_dn'])) -
trunk/expressoAdmin1_2/inc/class.bomanagers.inc.php
r63 r64 26 26 } 27 27 28 //Recebe valores do POST 29 $manager = array( 30 'lid' => $_POST['manager_lid'], 31 'context' => $_POST['context'], 32 33 'add_users' => $_POST['add_users'], 34 'edit_users' => $_POST['edit_users'], 35 'delete_users' => $_POST['delete_users'], 36 'rename_users' => $_POST['rename_users'], 37 'view_users' => $_POST['view_users'], 38 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'], 39 'add_groups' => $_POST['add_groups'], 40 'edit_groups' => $_POST['edit_groups'], 41 'delete_groups' => $_POST['delete_groups'], 42 'edit_email_groups' => $_POST['edit_email_groups'], 43 'change_users_password' => $_POST['change_users_password'], 44 'change_users_quote' => $_POST['change_users_quote'], 45 'set_user_default_password' => $_POST['set_user_default_password'], 46 'empty_user_inbox' => $_POST['empty_user_inbox'], 47 'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'], 48 'edit_sambadomains' => $_POST['edit_sambadomains'], 49 'add_email_lists' => $_POST['add_maillists'], 50 'edit_email_lists' => $_POST['edit_maillists'], 51 'delete_email_lists' => $_POST['delete_maillists'], 52 'create_sectors' => $_POST['create_sectors'], 53 'edit_sectors' => $_POST['edit_sectors'], 54 'delete_sectors' => $_POST['delete_sectors'], 55 'view_global_sessions' => $_POST['view_global_sessions'], 56 'view_logs' => $_POST['view_logs'], 57 'create_computers' => $_POST['create_computers'], 58 'edit_computers' => $_POST['edit_computers'], 59 'delete_computers' => $_POST['delete_computers'], 60 61 'apps' => $_POST['applications_list'] 62 ); 63 64 // Soma os niveis de acesso criando uma ACL 65 $acl = 0; 66 $acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] + $manager['manipulate_corporative_information']; 67 $acl = $acl + $manager['add_groups'] + $manager['edit_groups'] + $manager['delete_groups'] + $manager['edit_email_groups']; 68 $acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] + $manager['empty_user_inbox']; 69 $acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains']; 70 $acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists']; 71 $acl = $acl + $manager['create_sectors'] + $manager['edit_sectors'] + $manager['delete_sectors'] + $manager['view_global_sessions']; 72 $acl = $acl + $manager['create_computers'] + $manager['edit_computers'] + $manager['delete_computers']; 73 $acl = $acl + $manager['view_logs']; 74 75 //Escrevre no Banco 28 //Escrevre no Banco a ACL do gerente 76 29 $sql = "INSERT INTO phpgw_expressoadmin (manager_lid, context, acl) " 77 . "VALUES('" . $ manager['lid'] . "','" . $manager['context'] . "','" . $acl. "')";30 . "VALUES('" . $_POST['manager_lid'] . "','" . $_POST['context'] . "','" . $this->make_manager_acl($_POST) . "')"; 78 31 $GLOBALS['phpgw']->db->query($sql); 79 32 80 33 //Escrevre no Banco as aplicações que o gerente tem direito de disponibilizar aos seus usuarios. 81 foreach($ manager['apps'] as $app=>$value)34 foreach($_POST['applications_list'] as $app=>$value) 82 35 { 83 36 $sql = "INSERT INTO phpgw_expressoadmin_apps (manager_lid, context, app) " 84 . "VALUES('" . $ manager['lid'] . "','" . $manager['context'] . "','" . $app . "')";37 . "VALUES('" . $_POST['manager_lid'] . "','" . $_POST['context'] . "','" . $app . "')"; 85 38 $GLOBALS['phpgw']->db->query($sql); 86 39 } … … 99 52 return False; 100 53 } 101 102 //recebe valores do POST103 $manager = array(104 'old_lid' => $_POST['old_manager_lid'],105 'old_context' => $_POST['old_context'],106 'lid' => $_POST['manager_lid'],107 'context' => $_POST['context'],108 54 109 'add_users' => $_POST['add_users'], 110 'edit_users' => $_POST['edit_users'], 111 'delete_users' => $_POST['delete_users'], 112 'rename_users' => $_POST['rename_users'], 113 'view_users' => $_POST['view_users'], 114 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'], 115 'add_groups' => $_POST['add_groups'], 116 'edit_groups' => $_POST['edit_groups'], 117 'delete_groups' => $_POST['delete_groups'], 118 'edit_email_groups' => $_POST['edit_email_groups'], 119 'change_users_password' => $_POST['change_users_password'], 120 'change_users_quote' => $_POST['change_users_quote'], 121 'set_user_default_password' => $_POST['set_user_default_password'], 122 'empty_user_inbox' => $_POST['empty_user_inbox'], 123 'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'], 124 'edit_sambadomains' => $_POST['edit_sambadomains'], 125 'add_email_lists' => $_POST['add_maillists'], 126 'edit_email_lists' => $_POST['edit_maillists'], 127 'delete_email_lists' => $_POST['delete_maillists'], 128 'create_sectors' => $_POST['create_sectors'], 129 'edit_sectors' => $_POST['edit_sectors'], 130 'delete_sectors' => $_POST['delete_sectors'], 131 'view_global_sessions' => $_POST['view_global_sessions'], 132 'view_logs' => $_POST['view_logs'], 133 'create_computers' => $_POST['create_computers'], 134 'edit_computers' => $_POST['edit_computers'], 135 'delete_computers' => $_POST['delete_computers'], 55 //Executa update na tabela para atualizar ACL 56 $sql = "UPDATE phpgw_expressoadmin SET manager_lid = '".$_POST['manager_lid'] 57 . "',context = '".$_POST['context'] 58 . "',acl = '" . $this->make_manager_acl($_POST) 59 . "' WHERE manager_lid = '" . $_POST['old_manager_lid']."' AND context = '" . $_POST['old_context'] ."'"; 60 $GLOBALS['phpgw']->db->query($sql); 136 61 137 'apps' => $_POST['applications_list']138 );139 140 // Soma os niveis de acesso criando uma ACL141 $acl = 0;142 $acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] + $manager['manipulate_corporative_information'];143 $acl = $acl + $manager['add_groups'] + $manager['edit_groups'] + $manager['delete_groups'] + $manager['edit_email_groups'];144 $acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] + $manager['empty_user_inbox'];145 $acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains'];146 $acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists'];147 $acl = $acl + $manager['create_sectors'] + $manager['edit_sectors'] + $manager['delete_sectors'] + $manager['view_global_sessions'];148 $acl = $acl + $manager['create_computers'] + $manager['edit_computers'] + $manager['delete_computers'];149 $acl = $acl + $manager['view_logs'];150 151 //Executa update na tabela152 $sql = "UPDATE phpgw_expressoadmin SET manager_lid = '".$manager['lid']153 . "',context = '".$manager['context']154 . "',acl = '".$acl155 . "' WHERE manager_lid = '".$manager['old_lid']."' AND context = '" . $manager['old_context'] ."'";156 $GLOBALS['phpgw']->db->query($sql);157 62 158 63 //Deleta as aplicações e adiciona as novas. 159 64 //Deleta 160 65 $sql = "DELETE FROM phpgw_expressoadmin_apps WHERE " 161 . "manager_lid = '".$manager['old_lid']."' AND " 162 . "context = '".$manager['old_context']."'"; 163 $GLOBALS['phpgw']->db->query($sql); 66 . "manager_lid = '" . $_POST['old_manager_lid']."' AND " 67 . "context = '" . $_POST['old_context']."'"; 68 $GLOBALS['phpgw']->db->query($sql); 69 164 70 // Adiciona 165 if (count($ manager['apps']))71 if (count($_POST['applications_list'])) 166 72 { 167 foreach($ manager['apps'] as $app=>$value)73 foreach($_POST['applications_list'] as $app=>$value) 168 74 { 169 75 $sql = "INSERT INTO phpgw_expressoadmin_apps (manager_lid, context, app) " 170 . "VALUES('" . $ manager['lid'] . "','" . $manager['context'] . "','" . $app . "')";76 . "VALUES('" . $_POST['manager_lid'] . "','" . $_POST['context'] . "','" . $app . "')"; 171 77 $GLOBALS['phpgw']->db->query($sql); 172 78 } … … 176 82 ExecMethod('expressoAdmin1_2.uimanagers.list_managers'); 177 83 return True; 178 } 84 } 85 86 function make_manager_acl($array_post) 87 { 88 $total_manager_acl = 0; 89 foreach ($array_post as $atribute=>$value) 90 { 91 $acl = strstr($atribute, 'acl_'); 92 93 if ($acl !== false) 94 { 95 $total_manager_acl += $value; 96 } 97 } 98 return $total_manager_acl; 99 } 179 100 } 180 101 ?> -
trunk/expressoAdmin1_2/inc/class.bosectors.inc.php
r32 r64 53 53 if (!$this->so->write_ldap($dn, $sector_info)) 54 54 { 55 $_POST['error_messages'] = lang('Error in OpenLDAP recording. ');55 $_POST['error_messages'] = lang('Error in OpenLDAP recording.aa'); 56 56 ExecMethod('expressoAdmin1_2.uisectors.add_sector'); 57 57 return false; -
trunk/expressoAdmin1_2/inc/class.db_functions.inc.php
r32 r64 9 9 var $user_id; 10 10 11 function db_functions() {12 11 function db_functions() 12 { 13 13 if (is_array($_SESSION['phpgw_info']['expresso']['server'])) 14 14 $GLOBALS['phpgw_info']['server'] = $_SESSION['phpgw_info']['expresso']['server']; … … 38 38 return $result; 39 39 } 40 41 /* 42 function get_sectors($params) 43 { 44 $organization = strtolower($params['organization']); 45 46 $result = array(); 47 // Pesquisa no BD os nomes setores no tabela phpgw_expressoadmin_sectors. 48 $query = "SELECT sector FROM phpgw_expressoadmin_sectors WHERE organization='$organization' ORDER by sector ASC"; 49 50 if (!$this->db->query($query)) 51 return 'Erro em get_sectors:' . pg_last_error(); 52 53 while($this->db->next_record()) 54 $result[] = $this->db->row(); 55 56 return $result; 57 } 58 */ 59 60 function get_next_id() 61 { 40 41 function copy_manager($params) 42 { 43 $manager = $params['manager']; 44 $new_manager = $params['new_manager']; 45 $manager_info = $this->read_acl($manager); 46 47 //Escrevre no Banco a ACL do gerente 48 $sql = "INSERT INTO phpgw_expressoadmin (manager_lid, context, acl) " 49 . "VALUES('" . $new_manager . "','" . $manager_info[0]['context'] . "','" . $manager_info[0]['acl'] . "')"; 50 51 if (!$this->db->query($sql)) 52 { 53 echo 'Erro em copy_manager:' . pg_last_error(); 54 return false; 55 } 56 57 //Pesquisa no Banco e pega os valores dos apps. 58 $sql = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '" . $manager_info[0]['manager_lid'] . "' AND context = '" . $manager_info[0]['context'] . "'"; 59 $this->db->query($sql); 60 while($this->db->next_record()) 61 { 62 $aplications[] = $this->db->row(); 63 } 64 65 //Escrevre no Banco as aplicações que o gerente tem direito de disponibilizar aos seus usuarios. 66 for ($i=0; $i<count($aplications); $i++) 67 { 68 $sql = "INSERT INTO phpgw_expressoadmin_apps (manager_lid, context, app) " 69 . "VALUES('" . $new_manager . "','" . $manager_info[0]['context'] . "','" . $aplications[$i]['app'] . "')"; 70 if (!$this->db->query($sql)) 71 { 72 echo 'Erro adicionando aplicacão para o novo gerente:' . pg_last_error(); 73 return false; 74 } 75 } 76 return true; 77 } 78 79 function get_next_id($type) 80 { 81 $return['status'] = true; 82 83 $current_config = $_SESSION['phpgw_info']['expresso']['expressoAdmin']; 84 85 if ($current_config['expressoAdmin_nextid_db_host'] != '') 86 { 87 $this->db->disconnect(); 88 $host = $current_config['expressoAdmin_nextid_db_host']; 89 $port = $current_config['expressoAdmin_nextid_db_port']; 90 $name = $current_config['expressoAdmin_nextid_db_name']; 91 $user = $current_config['expressoAdmin_nextid_db_user']; 92 $pass = $current_config['expressoAdmin_nextid_db_password']; 93 94 $db = new db(); 95 $db->Halt_On_Error = 'no'; 96 $db->connect($name, $host, $port, $user, $pass, 'pgsql'); 97 } 98 else 99 { 100 $db = $this->db; 101 } 102 62 103 // Busco o ID dos accounts 63 $query_accounts = "SELECT id FROM phpgw_nextid WHERE appname = 'accounts'"; 64 if (!$this->db->query($query_accounts)) 65 return 'Erro em get_next_id:' . pg_last_error(); 66 while($this->db->next_record()) 67 $result_accounts[] = $this->db->row(); 68 $accounts_id = $result_accounts[0]['id']; 104 $query_accounts_nextid = "SELECT id FROM phpgw_nextid WHERE appname = 'accounts'"; 105 if (!$db->query($query_accounts_nextid)) 106 { 107 $return['status'] = false; 108 $return['msg'] = "Problemas executando a query accounts no Banco de Dados."; 109 $db->disconnect(); 110 return $return; 111 } 112 else 113 { 114 $accounts_nextid = $db->Query_ID->fields[0]; 115 } 69 116 70 117 // Busco o ID dos groups 71 118 $query_groups = "SELECT id FROM phpgw_nextid WHERE appname = 'groups'"; 72 if (!$this->db->query($query_groups)) 73 return 'Erro em get_next_id:' . pg_last_error(); 74 while($this->db->next_record()) 75 $result_groups[] = $this->db->row(); 76 $groups_id = $result_groups[0]['id']; 77 78 //Retorna o maior dos ID's 79 if ($accounts_id >= $groups_id) 80 return $accounts_id; 81 else 82 return $groups_id; 83 } 84 119 if (!$db->query($query_groups)) 120 { 121 $return['status'] = false; 122 $return['msg'] = "Problemas executando a query groups no Banco de Dados."; 123 $db->disconnect(); 124 return $return; 125 } 126 else 127 { 128 $groups_nextid = $db->Query_ID->fields[0]; 129 } 130 131 //RetornO o maior dos ID's incrementado de 1 132 if ($accounts_nextid >= $groups_nextid) 133 $id = $accounts_nextid; 134 else 135 $id = $groups_nextid; 136 $return['id'] = (int)($id + 1); 137 138 139 // Atualizo o BD 140 $query_update_id = "UPDATE phpgw_nextid set id = '" . $return['id'] . "' WHERE appname = '" . $type . "'"; 141 if (!$db->query($query_update_id)) 142 { 143 $return['status'] = false; 144 $return['msg'] = "Problemas executando a query update id no Banco de Dados."; 145 } 146 $db->disconnect(); 147 return $return; 148 } 149 150 /* 85 151 function increment_id($id, $type) 86 152 { 153 $current_config = $_SESSION['phpgw_info']['expresso']['expressoAdmin']; 154 if ($current_config['expressoAdmin_nextid_db_host'] != '') 155 { 156 $this->db->disconnect(); 157 $host = $current_config['expressoAdmin_nextid_db_host']; 158 $port = $current_config['expressoAdmin_nextid_db_port']; 159 $name = $current_config['expressoAdmin_nextid_db_name']; 160 $user = $current_config['expressoAdmin_nextid_db_user']; 161 $pass = $current_config['expressoAdmin_nextid_db_pass']; 162 163 $db = new db(); 164 $db->Halt_On_Error = 'no'; 165 $db->connect($name, $host, $port, $user, $pass, 'pgsql'); 166 } 167 else 168 { 169 $db = $this->db; 170 } 171 87 172 $sql = "UPDATE phpgw_nextid set id = '".$id."' WHERE appname = '" . $type . "'"; 88 if (!$this->db->query($sql)) 173 if (!$db->query($sql)) 174 { 175 $db->disconnect(); 89 176 return 'Erro em increment_id:' . pg_last_error(); 90 else 177 } 178 else 179 { 180 $db->disconnect(); 91 181 return true; 92 } 182 } 183 } 184 */ 93 185 94 186 function add_user2group($gidnumber, $uidnumber) … … 558 650 return; 559 651 } 652 653 function test_db_connection($params) 654 { 655 $host = $params['host']; 656 $port = $params['port']; 657 $name = $params['name']; 658 $user = $params['user']; 659 $pass = $params['pass']; 660 661 $con_string = "host=$host port=$port dbname=$name user=$user password=$pass"; 662 if ($db = pg_connect($con_string)) 663 { 664 pg_close($db); 665 $result['status'] = true; 666 } 667 else 668 { 669 $result['status'] = false; 670 } 671 672 return $result; 673 } 560 674 } 561 675 ?> -
trunk/expressoAdmin1_2/inc/class.functions.inc.php
r63 r64 11 11 12 12 include_once('class.db_functions.inc.php'); 13 include_once(PHPGW_API_INC.'/class.config.inc.php'); 13 14 14 15 class functions 15 16 { 16 17 17 var $public_functions = array 18 18 ( … … 27 27 var $nextmatchs; 28 28 var $sectors_list = array(); 29 var $current_config; 29 30 30 31 function functions() 31 32 { 32 33 $this->db_functions = new db_functions; 34 $GLOBALS['phpgw']->db = $this->db_functions->db; 35 36 //$c = CreateObject('phpgwapi.config','expressoAdmin1_2'); 37 $c = new config; 38 $c->read_repository(); 39 $this->current_config = $c->config_data; 33 40 } 34 41 … … 37 44 { 38 45 $acl = $this->read_acl($account_lid); 39 $array_acl = $this->make_array_acl($acl[ 0][acl]);46 $array_acl = $this->make_array_acl($acl['acl']); 40 47 41 48 //What access ?? In the IF, verify if have access. … … 43 50 { 44 51 case list_users: 45 if ($array_acl[a dd_users] || $array_acl[edit_users] || $array_acl[delete_users] || $array_acl[change_users_password] || $array_acl[change_users_quote] || $array_acl[edit_sambausers_attributes] || $array_acl[view_users])52 if ($array_acl[acl_add_users] || $array_acl[acl_edit_users] || $array_acl[acl_delete_users] || $array_acl[acl_change_users_password] || $array_acl[acl_change_users_quote] || $array_acl[acl_edit_sambausers_attributes] || $array_acl[acl_view_users] || $array_acl[acl_manipulate_corporative_information]) 46 53 return true; 47 54 break; 48 55 case add_users: 49 if ($array_acl[a dd_users])56 if ($array_acl[acl_add_users]) 50 57 return true; 51 58 break; 52 59 case edit_users: 53 if ($array_acl[ edit_users])60 if ($array_acl[acl_edit_users]) 54 61 return true; 55 62 break; 56 63 case delete_users: 57 if ($array_acl[ delete_users])64 if ($array_acl[acl_delete_users]) 58 65 return true; 59 66 break; 60 67 case rename_users: 61 if ($array_acl[ rename_users])68 if ($array_acl[acl_rename_users]) 62 69 return true; 63 70 break; 64 71 case view_users: 65 if ($array_acl[ view_users])72 if ($array_acl[acl_view_users]) 66 73 return true; 67 74 break; 68 75 case manipulate_corporative_information: 69 if ($array_acl[ manipulate_corporative_information])76 if ($array_acl[acl_manipulate_corporative_information]) 70 77 return true; 71 78 break; 72 79 case change_users_password: 73 if ($array_acl[ change_users_password])80 if ($array_acl[acl_change_users_password]) 74 81 return true; 75 82 break; 76 83 case change_users_quote: 77 if ($array_acl[ change_users_quote])84 if ($array_acl[acl_change_users_quote]) 78 85 return true; 79 86 break; 80 87 case set_user_default_password: 81 if ($array_acl[ set_user_default_password])88 if ($array_acl[acl_set_user_default_password]) 82 89 return true; 83 90 break; 84 91 case empty_user_inbox: 85 if (($array_acl[ empty_user_inbox]) && ($array_acl[edit_users]))92 if (($array_acl[acl_empty_user_inbox]) && ($array_acl[acl_edit_users])) 86 93 return true; 87 94 break; 88 95 case edit_sambausers_attributes: 89 if ($array_acl[ edit_sambausers_attributes])96 if ($array_acl[acl_edit_sambausers_attributes]) 90 97 return true; 91 98 break; 92 99 case edit_sambadomains: 93 if ($array_acl[ edit_sambadomains])100 if ($array_acl[acl_edit_sambadomains]) 94 101 return true; 95 102 break; 96 103 97 104 case list_groups: 98 if ($array_acl[a dd_groups] || $array_acl[edit_groups] || $array_acl[delete_groups])105 if ($array_acl[acl_add_groups] || $array_acl[acl_edit_groups] || $array_acl[acl_delete_groups]) 99 106 return true; 100 107 break; 101 108 case add_groups: 102 if ($array_acl[a dd_groups])109 if ($array_acl[acl_add_groups]) 103 110 return true; 104 111 break; 105 112 case edit_groups: 106 if ($array_acl[ edit_groups])113 if ($array_acl[acl_edit_groups]) 107 114 return true; 108 115 break; 109 116 case delete_groups: 110 if ($array_acl[ delete_groups])117 if ($array_acl[acl_delete_groups]) 111 118 return true; 112 119 break; 113 120 case edit_email_groups: 114 if ($array_acl[ edit_email_groups])121 if ($array_acl[acl_edit_email_groups]) 115 122 return true; 116 123 break; 117 124 118 125 case list_maillists: 119 if ($array_acl[a dd_maillists] || $array_acl[edit_maillists] || $array_acl[delete_maillists])126 if ($array_acl[acl_add_maillists] || $array_acl[acl_edit_maillists] || $array_acl[acl_delete_maillists]) 120 127 return true; 121 128 break; 122 129 case add_maillists: 123 if ($array_acl[a dd_maillists])130 if ($array_acl[acl_add_maillists]) 124 131 return true; 125 132 break; 126 133 case edit_maillists: 127 if ($array_acl[ edit_maillists])134 if ($array_acl[acl_edit_maillists]) 128 135 return true; 129 136 break; 130 137 case delete_maillists: 131 if ($array_acl[ delete_maillists])138 if ($array_acl[acl_delete_maillists]) 132 139 return true; 133 140 break; 134 141 135 142 case list_sectors: 136 if ($array_acl[ create_sectors] || $array_acl[edit_sectors] || $array_acl[delete_sectors])143 if ($array_acl[acl_create_sectors] || $array_acl[acl_edit_sectors] || $array_acl[acl_delete_sectors]) 137 144 return true; 138 145 break; 139 146 case create_sectors: 140 if ($array_acl[ create_sectors])147 if ($array_acl[acl_create_sectors]) 141 148 return true; 142 149 break; 143 150 case edit_sectors: 144 if ($array_acl[ edit_sectors])151 if ($array_acl[acl_edit_sectors]) 145 152 return true; 146 153 break; 147 154 case delete_sectors: 148 if ($array_acl[ delete_sectors])155 if ($array_acl[acl_delete_sectors]) 149 156 return true; 150 157 break; 151 158 152 159 case view_global_sessions: 153 if ($array_acl[ view_global_sessions])160 if ($array_acl[acl_view_global_sessions]) 154 161 return true; 155 162 break; 156 163 157 164 case list_computers: 158 if ($array_acl[ create_computers] || $array_acl[edit_computers] || $array_acl[delete_computers])165 if ($array_acl[acl_create_computers] || $array_acl[acl_edit_computers] || $array_acl[acl_delete_computers]) 159 166 return true; 160 167 break; 161 168 case create_computers: 162 if ($array_acl[ create_computers])169 if ($array_acl[acl_create_computers]) 163 170 return true; 164 171 break; 165 172 case edit_computers: 166 if ($array_acl[ edit_computers])173 if ($array_acl[acl_edit_computers]) 167 174 return true; 168 175 break; 169 176 case delete_computers: 170 if ($array_acl[ delete_computers])177 if ($array_acl[acl_delete_computers]) 171 178 return true; 172 179 break; 173 180 174 181 case view_logs: 175 if ($array_acl[view_logs]) 182 if ($array_acl[acl_view_logs]) 183 return true; 184 break; 185 186 case display_groups: 187 if ( $array_acl[acl_edit_users] || $array_acl[acl_view_users] || ($array_acl[acl_edit_sambausers_attributes] && ($this->current_config['expressoAdmin_samba_support'] == 'true')) ) 188 return true; 189 break; 190 case display_emailconfig: 191 if ($array_acl[acl_edit_users] || $array_acl[acl_view_users]) 192 return true; 193 break; 194 case display_applications: 195 if ($array_acl[acl_edit_users] || $array_acl[acl_view_users]) 196 return true; 197 break; 198 case display_emaillists: 199 if ($array_acl[acl_edit_users] || $array_acl[acl_view_users]) 176 200 return true; 177 201 break; … … 180 204 return false; 181 205 } 182 183 206 return false; 184 207 } … … 187 210 function read_acl($account_lid) 188 211 { 189 $result = $this->db_functions->read_acl($account_lid); 190 $context_array = ldap_explode_dn($result[0]['context'], 1); 191 $result[0]['context_display'] = ldap_dn2ufn ( $result[0]['context'] ); 212 $acl = $this->db_functions->read_acl($account_lid); 213 214 $result['acl'] = $acl[0]['acl']; 215 $result['manager_lid'] = $acl[0]['manager_lid']; 216 $result['raw_context'] = $acl[0]['context']; 217 218 $all_contexts = split("%", $acl[0]['context']); 219 foreach ($all_contexts as $index=>$context) 220 { 221 $result['contexts'][] = $context; 222 $result['contexts_display'][] = str_replace(", ", ".", ldap_dn2ufn( $context )); 223 } 224 192 225 return $result; 193 226 } 194 227 195 228 // Make a array read humam 196 // Last acl: 33.554.432, 67.108.864, 134.217.728, 134.217.728, 268.435.456229 // Last acl: 268435456, 536870912 197 230 function make_array_acl($acl) 198 231 { 199 $array_acl['a dd_users'] = $acl & 1;200 $array_acl[' edit_users'] = $acl & 2;201 $array_acl[' delete_users'] = $acl & 4;202 $array_acl[' rename_users'] = $acl & 8388608;203 $array_acl[' view_users'] = $acl & 33554432;204 $array_acl[' manipulate_corporative_information'] = $acl & 268435456;205 $array_acl['a dd_groups'] = $acl & 16;206 $array_acl[' edit_groups'] = $acl & 32;207 $array_acl[' delete_groups'] = $acl & 64;208 $array_acl[' edit_email_groups'] = $acl & 67108864;209 $array_acl[' change_users_password'] = $acl & 128;210 $array_acl[' change_users_quote'] = $acl & 262144;211 $array_acl[' set_user_default_password'] = $acl & 524288;212 $array_acl[' empty_user_inbox'] = $acl & 134217728;213 $array_acl[' edit_sambausers_attributes'] = $acl & 32768;214 $array_acl[' edit_sambadomains'] = $acl & 16777216;215 $array_acl['a dd_maillists'] = $acl & 256;216 $array_acl[' edit_maillists'] = $acl & 512;217 $array_acl[' delete_maillists'] = $acl & 1024;218 $array_acl[' create_sectors'] = $acl & 4096;219 $array_acl[' edit_sectors'] = $acl & 8192;220 $array_acl[' delete_sectors'] = $acl & 16384;221 $array_acl[' view_global_sessions'] = $acl & 65536;222 $array_acl[' view_logs'] = $acl & 131072;223 $array_acl[' create_computers'] = $acl & 1048576;224 $array_acl[' edit_computers'] = $acl & 2097152;225 $array_acl[' delete_computers'] = $acl & 4194304;232 $array_acl['acl_add_users'] = $acl & 1; 233 $array_acl['acl_edit_users'] = $acl & 2; 234 $array_acl['acl_delete_users'] = $acl & 4; 235 $array_acl['acl_rename_users'] = $acl & 8388608; 236 $array_acl['acl_view_users'] = $acl & 33554432; 237 $array_acl['acl_manipulate_corporative_information'] = $acl & 268435456; 238 $array_acl['acl_add_groups'] = $acl & 16; 239 $array_acl['acl_edit_groups'] = $acl & 32; 240 $array_acl['acl_delete_groups'] = $acl & 64; 241 $array_acl['acl_edit_email_groups'] = $acl & 67108864; 242 $array_acl['acl_change_users_password'] = $acl & 128; 243 $array_acl['acl_change_users_quote'] = $acl & 262144; 244 $array_acl['acl_set_user_default_password'] = $acl & 524288; 245 $array_acl['acl_empty_user_inbox'] = $acl & 134217728; 246 $array_acl['acl_edit_sambausers_attributes'] = $acl & 32768; 247 $array_acl['acl_edit_sambadomains'] = $acl & 16777216; 248 $array_acl['acl_add_maillists'] = $acl & 256; 249 $array_acl['acl_edit_maillists'] = $acl & 512; 250 $array_acl['acl_delete_maillists'] = $acl & 1024; 251 $array_acl['acl_create_sectors'] = $acl & 4096; 252 $array_acl['acl_edit_sectors'] = $acl & 8192; 253 $array_acl['acl_delete_sectors'] = $acl & 16384; 254 $array_acl['acl_view_global_sessions'] = $acl & 65536; 255 $array_acl['acl_view_logs'] = $acl & 131072; 256 $array_acl['acl_create_computers'] = $acl & 1048576; 257 $array_acl['acl_edit_computers'] = $acl & 2097152; 258 $array_acl['acl_delete_computers'] = $acl & 4194304; 226 259 return $array_acl; 227 260 } 228 261 229 function get_list($type, $query, $context )262 function get_list($type, $query, $contexts) 230 263 { 231 264 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; … … 238 271 if ($type == 'accounts') 239 272 { 240 241 273 $justthese = array("uidnumber", "uid", "cn", "mail"); 242 274 $filter="(&(phpgwAccountType=u)(|(uid=*".$query."*)(sn=*".$query."*)(cn=*".$query."*)(givenName=*".$query."*)(mail=$query*)(mailAlternateAddress=$query*)))"; 243 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 244 ldap_sort($ldap_conn, $search, "uid"); 245 $info = ldap_get_entries($ldap_conn, $search); 275 276 $tmp = array(); 277 foreach ($contexts as $index=>$context) 278 { 279 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 280 $info = ldap_get_entries($ldap_conn, $search); 281 282 for ($i=0; $i < $info['count']; $i++) 283 { 284 $tmp[$info[$i]['uid'][0]]['account_id'] = $info[$i]['uidnumber'][0]; 285 $tmp[$info[$i]['uid'][0]]['account_lid'] = $info[$i]['uid'][0]; 286 $tmp[$info[$i]['uid'][0]]['account_cn'] = $info[$i]['cn'][0]; 287 $tmp[$info[$i]['uid'][0]]['account_mail']= $info[$i]['mail'][0]; 288 $sort[] = $info[$i]['uid'][0]; 289 } 290 } 246 291 ldap_close($ldap_conn); 247 292 248 $i = 0; 293 if (count($sort)) 294 { 295 natcasesort($sort); 296 foreach ($sort as $user_uid) 297 $return[$user_uid] = $tmp[$user_uid]; 298 } 299 300 return $return; 301 } 302 elseif($type == 'groups') 303 { 304 $filter="(&(phpgwAccountType=g)(cn=*$query*))"; 305 $justthese = array("gidnumber", "cn", "description"); 306 249 307 $tmp = array(); 250 for ($i=0; $i < $info['count']; $i++) 251 { 252 $tmp[$i][account_id] = $info[$i]['uidnumber'][0]; 253 $tmp[$i][account_lid] = $info[$i]['uid'][0]; 254 $tmp[$i][account_cn] = $info[$i]['cn'][0]; 255 $tmp[$i][account_mail] = $info[$i]['mail'][0]; 256 } 257 return $tmp; 258 } 259 elseif($type == 'groups') 260 { 261 $filter="(&(phpgwAccountType=g)(cn=*".$query."*))"; 262 $justthese = array("gidnumber", "cn", "description"); 263 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 264 ldap_sort($ldap_conn, $search, "cn"); 265 $info = ldap_get_entries($ldap_conn, $search); 308 foreach ($contexts as $index=>$context) 309 { 310 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 311 $info = ldap_get_entries($ldap_conn, $search); 312 for ($i=0; $i < $info['count']; $i++) 313 { 314 $tmp[$info[$i]['cn'][0]]['cn']= $info[$i]['cn'][0]; 315 $tmp[$info[$i]['cn'][0]]['description']= $info[$i]['description'][0]; 316 $tmp[$info[$i]['cn'][0]]['gidnumber']= $info[$i]['gidnumber'][0]; 317 $sort[] = $info[$i]['cn'][0]; 318 } 319 } 266 320 ldap_close($ldap_conn); 267 321 268 $i = 0; 269 $tmp = array(); 270 for ($i=0; $i < $info['count']; $i++) 271 { 272 $tmp[$i][cn] = $info[$i][cn][0]; 273 $tmp[$i][description] = $info[$i][description][0]; 274 $tmp[$i][gidnumber] = $info[$i][gidnumber][0]; 275 } 276 return $tmp; 322 natcasesort($sort); 323 foreach ($sort as $group_cn) 324 $return[$group_cn] = $tmp[$group_cn]; 325 326 return $return; 277 327 } 278 328 elseif($type == 'maillists') … … 280 330 $filter="(&(phpgwAccountType=l)(|(cn=*".$query."*)(uid=*".$query."*)(mail=*".$query."*)))"; 281 331 $justthese = array("uidnumber", "cn", "uid", "mail"); 282 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 283 ldap_sort($ldap_conn, $search, "uid"); 284 $info = ldap_get_entries($ldap_conn, $search); 332 333 $tmp = array(); 334 foreach ($contexts as $index=>$context) 335 { 336 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 337 $info = ldap_get_entries($ldap_conn, $search); 338 339 for ($i=0; $i < $info['count']; $i++) 340 { 341 $tmp[$info[$i]['uid'][0]]['uid'] = $info[$i]['uid'][0]; 342 $tmp[$info[$i]['uid'][0]]['name'] = $info[$i]['cn'][0]; 343 $tmp[$info[$i]['uid'][0]]['uidnumber'] = $info[$i]['uidnumber'][0]; 344 $tmp[$info[$i]['uid'][0]]['email'] = $info[$i]['mail'][0]; 345 $sort[] = $info[$i]['uid'][0]; 346 } 347 } 285 348 ldap_close($ldap_conn); 286 349 287 $i = 0; 288 $tmp = array(); 289 for ($i=0; $i < $info['count']; $i++) 290 { 291 $tmp[$i]['uid'] = $info[$i]['uid'][0]; 292 $tmp[$i]['name'] = $info[$i]['cn'][0]; 293 $tmp[$i]['uidnumber'] = $info[$i]['uidnumber'][0]; 294 $tmp[$i]['email'] = $info[$i]['mail'][0]; 295 } 296 return $tmp; 350 natcasesort($sort); 351 foreach ($sort as $maillist_uid) 352 $return[$maillist_uid] = $tmp[$maillist_uid]; 353 354 return $return; 297 355 } 298 356 elseif($type == 'computers') … … 300 358 $filter="(&(objectClass=sambaSAMAccount)(|(sambaAcctFlags=[W ])(sambaAcctFlags=[DW ])(sambaAcctFlags=[I ])(sambaAcctFlags=[S ]))(cn=*".$query."*))"; 301 359 $justthese = array("cn","uidNumber","description"); 302 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 303 ldap_sort($ldap_conn, $search, "cn"); 304 $info = ldap_get_entries($ldap_conn, $search); 360 361 $tmp = array(); 362 foreach ($contexts as $index=>$context) 363 { 364 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 365 $info = ldap_get_entries($ldap_conn, $search); 366 for ($i=0; $i < $info['count']; $i++) 367 { 368 $tmp[$info[$i]['cn'][0]]['cn'] = $info[$i]['cn'][0]; 369 $tmp[$info[$i]['cn'][0]]['uidNumber'] = $info[$i]['uidnumber'][0]; 370 $tmp[$info[$i]['cn'][0]]['description'] = utf8_decode($info[$i]['description'][0]); 371 $sort[] = $info[$i]['cn'][0]; 372 } 373 374 } 305 375 ldap_close($ldap_conn); 306 $tmp = array(); 307 for ($i=0; $i < $info['count']; $i++) 308 { 309 $tmp[$i]['cn'] = $info[$i]['cn'][0]; 310 $tmp[$i]['uidNumber'] = $info[$i]['uidnumber'][0]; 311 $tmp[$i]['description'] = utf8_decode($info[$i]['description'][0]); 312 } 313 return $tmp; 314 } 315 } 316 317 //Criado nova função bem mais eficiente! 318 /* 319 function get_organizations($context, $selected='') 320 { 321 //echo $selected; 322 323 $first_sector_ufn = ldap_dn2ufn($context); 324 $first_sector_string = split(",", $first_sector_ufn); 325 326 $s = CreateObject('phpgwapi.sector_search_ldap'); 327 $sectors_info = $s->sector_search($context); 328 329 $sector_select = ""; 330 $sector_select .= "<option value='" .$context . "'"; 331 $sector_select .= ">".strtoupper($first_sector_string[0])."</option>\n"; 332 333 foreach($sectors_info as $sector) 334 { 335 if ($sector->sector_level == 1) 336 { 337 $sector->sector_name = '+ '.$sector->sector_name; 338 } 339 else 340 { 341 $sector_space = ''; 342 for ($i=1; $i < $sector->sector_level; $i++) 343 $sector_space = '---'.$sector_space; 344 $sector->sector_name = $sector_space.' '.$sector->sector_name; 345 } 346 $sector_select .= '<option value="' . strtolower($sector->sector_context) . '"'; 347 348 if (trim(strtolower($sector->sector_context)) == $selected) 349 $sector_select .= ' selected>' . $sector->sector_name . "</option>\n"; 350 else 351 $sector_select .= '>' . $sector->sector_name . "</option>\n"; 352 } 353 //$sector_select .= "</select>"; 354 return $sector_select; 355 } 356 */ 357 358 /* 359 function get_organizations($context, $selected='', $show_invisible_ou=false) 360 { 361 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 362 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 363 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 364 365 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 366 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 367 ldap_bind($ldap_conn,$dn,$passwd); 368 369 $justthese = array("dn"); 370 $filter = $show_invisible_ou ? "(ou=*)" : "(& (ou=*) (!(phpgwAccountVisible=-1)) )"; 371 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 372 373 ldap_sort($ldap_conn, $search, "ou"); 374 $info = ldap_get_entries($ldap_conn, $search); 375 ldap_close($ldap_conn); 376 377 // Retiro o count do array info e inverto o array para ordenação. 378 for ($i=0; $i<$info["count"]; $i++) 379 { 380 $dn = $info[$i]["dn"]; 381 382 // Necessário, pq em uma busca com ldapsearch ou=*, traz tb o próprio ou. 383 if (strtolower($dn) == $context) 384 continue; 385 386 $array_dn = ldap_explode_dn ( $dn, 1 ); 387 388 $array_dn_reverse = array_reverse ( $array_dn, true ); 389 390 array_pop ( $array_dn_reverse ); 391 392 $inverted_dn[$dn] = implode ( ".", $array_dn_reverse ); 393 } 394 395 // Ordenação 396 natcasesort($inverted_dn); 397 398 // Construção do select 399 $level = 0; 400 foreach ($inverted_dn as $dn=>$invert_ufn) 401 { 402 $display = ''; 403 404 $array_dn_reverse = explode ( ".", $invert_ufn ); 405 $array_dn = array_reverse ( $array_dn_reverse, true ); 406 407 $level = count( $array_dn ) - 4; 408 409 if ($level == 0) 410 $display .= '+'; 411 else { 412 for ($i=0; $i<$level; $i++) 413 $display .= '---'; 414 } 415 416 reset ( $array_dn ); 417 $display .= ' ' . (current ( $array_dn ) ); 418 419 $dn = trim(strtolower($dn)); 420 if ( $dn == $selected ) 421 $select = ' selected'; 422 else 423 $select = ''; 424 $options .= "<option value='$dn'$select>$display</option>"; 425 } 426 427 // Cria a primeira entrada na combo 428 $first_sector_ufn = ldap_dn2ufn($context); 429 $first_sector_string = split(",", $first_sector_ufn); 430 $options = "<option value='$context'>" . strtoupper($first_sector_string[0]) . "</option>" . $options; 431 432 return $options; 433 } 434 */ 376 377 natcasesort($sort); 378 foreach ($sort as $computer_cn) 379 $return[$computer_cn] = $tmp[$computer_cn]; 380 381 return $return; 382 } 383 } 435 384 436 385 function get_organizations($context, $selected='', $referral=false, $show_invisible_ou=true) … … 448 397 } 449 398 450 /*451 function get_sectors($context, $selected='')452 {453 $query = "SELECT sector FROM phpgw_expressoadmin_sectors WHERE organization = '" . $context . "'";454 $GLOBALS['phpgw']->db->query($query);455 while($GLOBALS['phpgw']->db->next_record())456 {457 $query_result[] = $GLOBALS['phpgw']->db->row();458 }459 460 if (count($query_result) > 0)461 {462 foreach ($query_result as $index=>$tmp)463 {464 $sector = $tmp['sector'];465 if ($sector == $selected)466 $sector_options .= "<option value='$sector' selected>$sector</option>";467 else468 $sector_options .= "<option value='$sector'>$sector</option>";469 }470 return $sector_options;471 }472 else473 return false;474 }475 */476 477 399 // Get list of all levels, this function is used for sectors module. 478 /* 479 function get_sectors_list($context) 480 { 481 $connection = $GLOBALS['phpgw']->common->ldapConnect(); 482 ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3); 483 ldap_set_option($connection, LDAP_OPT_REFERRALS, 0); 484 485 if ($connection) 486 { 487 $bind=ldap_bind($connection); 488 $filter="ou=*"; 489 $justthese = array("ou"); 490 $search=ldap_list($connection, $context, $filter, $justthese); 491 ldap_sort($connection, $search, "ou"); 492 $info = ldap_get_entries($connection, $search); 493 for ($i=0; $i<$info["count"]; $i++) 494 { 495 $this->level++; 496 $next_context[$i] = 'ou='.$info[$i]["ou"][0].','.$context; 497 $obj = new sectors_object($info[$i]["ou"][0], $next_context[$i], $this->level, 'False'); 498 array_push($this->sectors_list, $obj); 499 $this->get_sectors_list($next_context[$i]); 500 } 501 } 502 ldap_close($connection); 503 $this->level--; 504 return $this->sectors_list; 505 } 506 */ 507 508 // Get list of all levels, this function is used for sectors module. 509 function get_sectors_list($context, $selected='', $referral=false ,$show_invisible_ou=false) 510 { 400 function get_sectors_list($contexts) 401 { 402 $a_sectors = array(); 403 511 404 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 512 405 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; … … 514 407 515 408 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 516 517 if ($referral) 518 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 1); 519 else 520 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 521 409 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 522 410 ldap_bind($ldap_conn,$dn,$passwd); 523 411 524 412 $justthese = array("dn"); 525 413 $filter = "(ou=*)"; 526 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 414 415 foreach ($contexts as $context) 416 { 417 $search=ldap_search($ldap_conn, $context, $filter, $justthese); 418 $info = ldap_get_entries($ldap_conn, $search); 419 for ($i=0; $i<$info["count"]; $i++) 420 { 421 $a_sectors[] = $info[$i]['dn']; 422 } 423 } 527 424 528 ldap_sort($ldap_conn, $search, "ou");529 $info = ldap_get_entries($ldap_conn, $search);530 425 ldap_close($ldap_conn); 531 426 532 427 // Retiro o count do array info e inverto o array para ordenação. 533 for ($i=0; $i<$info["count"]; $i++)428 foreach ($a_sectors as $context) 534 429 { 535 $dn = $info[$i]["dn"]; 536 537 // Necessário, pq em uma busca com ldapsearch ou=*, traz tb o próprio ou. 538 if (strtolower($dn) == $context) 430 // Necessário, pq em uma busca com ldapsearch ou=*, traz tb o próprio ou. 431 /* 432 if (strtolower($dn) == $contexts[0]) 539 433 continue; 540 541 $array_dn = ldap_explode_dn ( $dn, 1 ); 434 */ 435 436 $array_dn = ldap_explode_dn ( $context, 1 ); 542 437 543 438 $array_dn_reverse = array_reverse ( $array_dn, true ); … … 546 441 array_pop ( $array_dn_reverse ); 547 442 548 $inverted_dn[$ dn] = implode ( "#", $array_dn_reverse );443 $inverted_dn[$context] = implode ( "#", $array_dn_reverse ); 549 444 } 550 445 … … 637 532 } 638 533 639 function increment_id($id, $type) 640 { 641 $sql = "UPDATE phpgw_nextid set id = '".$id."' WHERE appname = '" . $type . "'"; 642 $GLOBALS['phpgw']->db->query($sql); 643 } 644 645 function make_list_app($account_lid, $context, $user_applications, $disabled='') 534 function make_list_app($account_lid, $user_applications='', $disabled='') 646 535 { 647 536 // create list of ALL available apps … … 649 538 650 539 // create list of available apps for the user 651 $query = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '".$account_lid."' AND context = '".$context."'";540 $query = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '".$account_lid."'"; 652 541 $GLOBALS['phpgw']->db->query($query); 653 542 while($GLOBALS['phpgw']->db->next_record()) -
trunk/expressoAdmin1_2/inc/class.group.inc.php
r46 r64 54 54 $array_tmp = array_unique($params['members']); 55 55 $params['members'] = $array_tmp; 56 56 57 // Leio o ID a ser usado na criação do objecto. 58 $next_id = ($this->db_functions->get_next_id('groups')); 59 if ((!is_numeric($next_id['id'])) || (!$next_id['status'])) 60 { 61 $return['status'] = false; 62 $return['msg'] = "Problemas obtendo ID do usuário.\n" . $id['msg']; 63 return $return; 64 } 65 else 66 { 67 $id = $next_id['id']; 68 } 57 69 // Pega ID do BD e incrementa de 1. 58 $id = (($this->db_functions->get_next_id()) + 1); 59 70 //$id = (($this->db_functions->get_next_id()) + 1); 60 71 // Incrementa o id no BD. 61 $this->db_functions->increment_id($id,'groups');72 //$this->db_functions->increment_id($id,'groups'); 62 73 63 74 // Cria array para incluir no LDAP … … 400 411 401 412 402 function get_info($gidnumber , $context)403 { 404 $group_info_ldap = $this->ldap_functions->get_group_info($gidnumber , $context);413 function get_info($gidnumber) 414 { 415 $group_info_ldap = $this->ldap_functions->get_group_info($gidnumber); 405 416 $group_info_db = $this->db_functions->get_group_info($gidnumber); 406 417 -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r63 r64 10 10 var $current_config; 11 11 var $functions; 12 var $manager_contexts; 12 13 13 14 function ldap_functions(){ … … 16 17 $common = new common(); 17 18 $this->ldap = $common->ldapConnect(); 19 18 20 $this->functions = new functions; 21 $manager_acl = $this->functions->read_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid']); 22 $this->manager_contexts = $manager_acl['contexts']; 19 23 } 20 24 21 25 function validate_fields($params) 22 26 { 27 /* ldap connection following referals and using Contac Center config*/ 28 if (is_array($_SESSION['phpgw_info']['expresso']['cc_ldap_server'])) 29 { 30 $ldap_connection = ldap_connect($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['host']); 31 if ($ldap_connection) 32 { 33 ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 34 ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 35 if ( ($GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['acc'] != '') && ($GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['pw'] != '') ) 36 ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['acc'], $GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['pw']); 37 $context = $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['dn']; 38 } 39 else 40 { 41 $result['status'] = false; 42 $result['msg'] = 'Falha na conexao com o ldap.'; 43 return $result; 44 } 45 } 46 else 47 { 48 $ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 49 ldap_set_option($ldap_connection,LDAP_OPT_PROTOCOL_VERSION,3); 50 ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 51 ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw']); 52 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 53 } 54 23 55 $result['status'] = true; 56 24 57 $params = unserialize($params['attributes']); 25 58 $type = $params['type']; 26 $context = $GLOBALS['phpgw_info']['server']['ldap_context'];27 59 $uid = $params['uid']; 28 60 $mail = $params['mail']; … … 38 70 if (($type == 'create_user') || ($type == 'rename_user')) 39 71 { 40 // UID 41 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uid=$uid))"; 72 //UID 73 if (($type == 'rename_user') && ($this->current_config['expressoAdmin_prefix_org'] == 'true')) 74 { 75 //Obtenho UID sem a organização. Na criação o uid já vem sem a organização 76 $tmp_uid_without_org = split("-", $params['uid']); 77 $tmp_reverse_uid_without_org = array_reverse($tmp_uid_without_org); 78 array_pop($tmp_reverse_uid_without_org); 79 $uid_without_org = implode("-", $tmp_reverse_uid_without_org); 80 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|(uid=$uid)(uid=$uid_without_org)))"; 81 } 82 else 83 { 84 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uid=$uid))"; 85 } 42 86 $justthese = array("uid"); 43 $search = ldap_search($ this->ldap, $context, $filter, $justthese);44 $count_entries = ldap_count_entries($ this->ldap,$search);87 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 88 $count_entries = ldap_count_entries($ldap_connection,$search); 45 89 if ($count_entries > 0) 46 90 { 47 91 $result['status'] = false; 48 $result['msg'] = 'LOGIN já est a sendo usado.';92 $result['msg'] = 'LOGIN já está sendo utilizado.'; 49 93 return $result; 50 94 } … … 53 97 $filter = "(&(phpgwAccountType=g)(cn=$uid))"; 54 98 $justthese = array("cn"); 55 $search = ldap_search($ this->ldap, $context, $filter, $justthese);56 $count_entries = ldap_count_entries($ this->ldap,$search);99 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 100 $count_entries = ldap_count_entries($ldap_connection,$search); 57 101 if ($count_entries > 0) 58 102 { … … 61 105 return $result; 62 106 } 63 64 // UID em outras organizações 65 //Quando tento retirar as organizações pelo expressoAdmin dá este erro. 66 $filter = "(ou=*)"; 67 $justthese = array("ou"); 68 $search = ldap_list($this->ldap, $context, $filter, $justthese); 69 $entries = ldap_get_entries($this->ldap,$search); 70 foreach ($entries as $index=>$org) 71 { 72 $organization = $org['ou'][0]; 73 $organization = strtolower($organization); 107 108 109 // UID em outras organizações, pesquiso apenas na maquina local e se utilizar prefix_org 110 if ($this->current_config['expressoAdmin_prefix_org'] == 'true') 111 { 112 $ldap_connection2 = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 113 ldap_set_option($ldap_connection2,LDAP_OPT_PROTOCOL_VERSION,3); 114 ldap_set_option($ldap_connection2, LDAP_OPT_REFERRALS, false); 115 ldap_bind($ldap_connection2, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw']); 116 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 74 117 75 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uid=$organization-$uid))"; 76 $justthese = array("uid"); 77 $search = ldap_search($this->ldap, $context, $filter, $justthese); 78 $count_entries = ldap_count_entries($this->ldap,$search); 79 if ($count_entries > 0) 118 //Obtenho UID sem a organização 119 /* 120 $tmp_uid_without_org = split("-", $params['uid']); 121 if (count($tmp_uid_without_org) < 2) 80 122 { 81 123 $result['status'] = false; 82 $result['msg'] = ' LOGIN já esta sendo usado por outro usuário em outraorganização.';124 $result['msg'] = 'Novo login sem organização.'; 83 125 return $result; 84 126 } 127 $tmp_reverse_uid_without_org = array_reverse($tmp_uid_without_org); 128 array_pop($tmp_reverse_uid_without_org); 129 $uid_without_org = implode("-", $tmp_reverse_uid_without_org); 130 */ 131 132 $filter = "(ou=*)"; 133 $justthese = array("ou"); 134 $search = ldap_list($ldap_connection2, $context, $filter, $justthese); 135 $entries = ldap_get_entries($ldap_connection2 ,$search); 136 137 foreach ($entries as $index=>$org) 138 { 139 $organization = $org['ou'][0]; 140 $organization = strtolower($organization); 141 142 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uid=$organization-$uid))"; 143 144 $justthese = array("uid"); 145 $search = ldap_search($ldap_connection2, $context, $filter, $justthese); 146 $count_entries = ldap_count_entries($ldap_connection2,$search); 147 if ($count_entries > 0) 148 { 149 $result['status'] = false; 150 $result['msg'] = 'LOGIN já esta sendo usado por outro usuário em outra organização.'; 151 ldap_close($ldap_connection2); 152 return $result; 153 } 154 } 155 ldap_close($ldap_connection2); 85 156 } 86 157 } … … 94 165 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|(mail=$mail)(mailalternateaddress=$mail)))"; 95 166 $justthese = array("mail", "uid"); 96 $search = ldap_search($ this->ldap, $context, $filter, $justthese);97 $entries = ldap_get_entries($ this->ldap,$search);167 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 168 $entries = ldap_get_entries($ldap_connection,$search); 98 169 if ($entries['count'] == 1){ 99 170 if ($entries[0]['uid'][0] != $uid){ 100 171 $result['status'] = false; 101 172 $result['msg'] = 'E-MAIL está sendo usado por 1 usuário: ' . $entries[0]['uid'][0]; 102 //ldap_close($ this->ldap);173 //ldap_close($ldap_connection); 103 174 return $result; 104 175 } … … 106 177 else if ($entries['count'] > 1){ 107 178 $result['status'] = false; 108 $result['msg'] = 'E-MAIL está sendo usado por de2 ou mais usuários.';109 //ldap_close($ this->ldap);179 $result['msg'] = 'E-MAIL está sendo usado por 2 ou mais usuários.'; 180 //ldap_close($ldap_connection); 110 181 return $result; 111 182 } … … 114 185 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|(mail=$mailalternateaddress)(mailalternateaddress=$mailalternateaddress)))"; 115 186 $justthese = array("mail", "uid"); 116 $search = ldap_search($ this->ldap, $context, $filter, $justthese);117 $entries = ldap_get_entries($ this->ldap,$search);187 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 188 $entries = ldap_get_entries($ldap_connection,$search); 118 189 if ($entries['count'] == 1){ 119 190 if ($entries[0]['uid'][0] != $uid){ 120 191 $result['status'] = false; 121 192 $result['msg'] = "E-MAIL alternativo está sendo usado por 1 usuário: " . $entries[0]['uid'][0]; 122 //ldap_close($ this->ldap);193 //ldap_close($ldap_connection); 123 194 return $result; 124 195 } … … 135 206 function validate_fields_group($params) 136 207 { 137 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 208 /* ldap connection following referals and using Contac Center config*/ 209 if (is_array($_SESSION['phpgw_info']['expresso']['cc_ldap_server'])) 210 { 211 $ldap_connection = ldap_connect($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['host']); 212 if ($ldap_connection) 213 { 214 ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 215 ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 216 if ( ($GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['acc'] != '') && ($GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['pw'] != '') ) 217 ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['acc'], $GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['pw']); 218 $context = $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['dn']; 219 } 220 else 221 { 222 $result['status'] = false; 223 $result['msg'] = 'Falha na conexao com o ldap.'; 224 return $result; 225 } 226 } 227 else 228 { 229 $ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 230 ldap_set_option($ldap_connection,LDAP_OPT_PROTOCOL_VERSION,3); 231 ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 232 ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw']); 233 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 234 } 235 138 236 $cn = $params['cn']; 139 237 $result['status'] = true; … … 149 247 $filter = "(&(phpgwAccountType=g)(cn=$cn))"; 150 248 $justthese = array("cn"); 151 $search = ldap_search($ this->ldap, $context, $filter, $justthese);152 $count_entries = ldap_count_entries($ this->ldap,$search);249 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 250 $count_entries = ldap_count_entries($ldap_connection,$search); 153 251 if ($count_entries > 0) 154 252 { … … 161 259 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uid=$cn))"; 162 260 $justthese = array("uid"); 163 $search = ldap_search($ this->ldap, $context, $filter, $justthese);164 $count_entries = ldap_count_entries($ this->ldap,$search);261 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 262 $count_entries = ldap_count_entries($ldap_connection,$search); 165 263 if ($count_entries > 0) 166 264 { … … 175 273 function validate_fields_maillist($params) 176 274 { 177 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 275 /* ldap connection following referals and using Contac Center config*/ 276 if (is_array($_SESSION['phpgw_info']['expresso']['cc_ldap_server'])) 277 { 278 $ldap_connection = ldap_connect($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['host']); 279 if ($ldap_connection) 280 { 281 ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); 282 ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 283 if ( ($GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['acc'] != '') && ($GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['pw'] != '') ) 284 ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['acc'], $GLOBALS['phpgw_info']['expresso']['cc_ldap_server']['pw']); 285 $context = $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['dn']; 286 } 287 else 288 { 289 $result['status'] = false; 290 $result['msg'] = 'Falha na conexao com o ldap.'; 291 return $result; 292 } 293 } 294 else 295 { 296 $ldap_connection = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 297 ldap_set_option($ldap_connection,LDAP_OPT_PROTOCOL_VERSION,3); 298 ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, true); 299 ldap_bind($ldap_connection, $GLOBALS['phpgw_info']['server']['ldap_root_dn'], $GLOBALS['phpgw_info']['server']['ldap_root_pw']); 300 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 301 } 302 178 303 $uid = $params['uid']; 179 304 $mail = $params['mail']; … … 190 315 $filter = "(&(phpgwAccountType=l)(uid=$uid))"; 191 316 $justthese = array("uid"); 192 $search = ldap_search($ this->ldap, $context, $filter, $justthese);193 $count_entries = ldap_count_entries($ this->ldap,$search);317 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 318 $count_entries = ldap_count_entries($ldap_connection,$search); 194 319 if ($count_entries > 0) 195 320 { … … 203 328 $filter = "(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|(mail=$mail)(mailalternateaddress=$mail)))"; 204 329 $justthese = array("mail"); 205 $search = ldap_search($ this->ldap, $context, $filter, $justthese);206 $count_entries = ldap_count_entries($ this->ldap,$search);330 $search = ldap_search($ldap_connection, $context, $filter, $justthese); 331 $count_entries = ldap_count_entries($ldap_connection,$search); 207 332 if ($count_entries > 0) 208 333 { … … 610 735 } 611 736 612 function get_user_info($uidnumber, $context) 613 { 614 $filter="(&(phpgwAccountType=u)(uidNumber=".$uidnumber."))"; 615 $search = ldap_search($this->ldap, $context, $filter); 616 $entry = ldap_get_entries($this->ldap, $search); 617 618 //Pega o dn do setor do usuario. 619 $entry[0]['dn'] = strtolower($entry[0]['dn']); 620 $sector_dn_array = explode(",", $entry[0]['dn']); 621 for($i=1; $i<count($sector_dn_array); $i++) 622 $sector_dn .= $sector_dn_array[$i] . ','; 623 //Retira ultimo pipe. 624 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 625 626 $result['context'] = $sector_dn; 627 $result['uid'] = $entry[0]['uid'][0]; 628 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 629 $result['gidnumber'] = $entry[0]['gidnumber'][0]; 630 $result['departmentnumber'] = $entry[0]['departmentnumber'][0]; 631 $result['givenname'] = $entry[0]['givenname'][0]; 632 $result['sn'] = $entry[0]['sn'][0]; 633 $result['telephonenumber'] = $entry[0]['telephonenumber'][0]; 634 $result['phpgwaccountstatus'] = $entry[0]['phpgwaccountstatus'][0]; 635 $result['phpgwaccountvisible'] = $entry[0]['phpgwaccountvisible'][0]; 636 $result['accountstatus'] = $entry[0]['accountstatus'][0]; 637 $result['mail'] = $entry[0]['mail'][0]; 638 $result['mailalternateaddress'] = $entry[0]['mailalternateaddress'][0]; 639 $result['mailforwardingaddress']= $entry[0]['mailforwardingaddress'][0]; 640 $result['deliverymode'] = $entry[0]['deliverymode'][0]; 641 $result['userPasswordRFC2617'] = $entry[0]['userpasswordrfc2617'][0]; 642 643 //Photo 644 if ($entry[0]['jpegphoto']['count'] == 1) 645 $result['photo_exist'] = 'true'; 646 647 // Samba 648 for ($i=0; $i<$entry[0]['objectclass']['count']; $i++) 649 { 650 if ($entry[0]['objectclass'][$i] == 'sambaSamAccount') 651 $result['sambaUser'] = true; 652 } 653 if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($result['sambaUser'])) 654 { 655 $result['sambaaccflags'] = $entry[0]['sambaacctflags'][0]; 656 $result['sambalogonscript'] = $entry[0]['sambalogonscript'][0]; 657 $result['homedirectory'] = $entry[0]['homedirectory'][0]; 658 $a_tmp = explode("-", $entry[0]['sambasid'][0]); 659 array_pop($a_tmp); 660 $result['sambasid'] = implode("-", $a_tmp); 661 } 662 663 // Verifica o acesso do gerente aos atributos corporativos 664 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 665 { 666 $result['corporative_information_employeenumber']= $entry[0]['employeenumber'][0]; 667 $result['corporative_information_cpf'] = $entry[0]['cpf'][0]; 668 $result['corporative_information_rg'] = $entry[0]['rg'][0]; 669 $result['corporative_information_rguf'] = $entry[0]['rguf'][0]; 670 } 671 672 // MailLists 737 function get_user_info($uidnumber) 738 { 739 foreach ($this->manager_contexts as $index=>$context) 740 { 741 $filter="(&(phpgwAccountType=u)(uidNumber=".$uidnumber."))"; 742 $search = ldap_search($this->ldap, $context, $filter); 743 $entry = ldap_get_entries($this->ldap, $search); 744 745 if ($entry['count']) 746 { 747 //Pega o dn do setor do usuario. 748 $entry[0]['dn'] = strtolower($entry[0]['dn']); 749 $sector_dn_array = explode(",", $entry[0]['dn']); 750 for($i=1; $i<count($sector_dn_array); $i++) 751 $sector_dn .= $sector_dn_array[$i] . ','; 752 //Retira ultimo pipe. 753 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 754 755 $result['context'] = $sector_dn; 756 $result['uid'] = $entry[0]['uid'][0]; 757 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 758 $result['gidnumber'] = $entry[0]['gidnumber'][0]; 759 $result['departmentnumber'] = $entry[0]['departmentnumber'][0]; 760 $result['givenname'] = $entry[0]['givenname'][0]; 761 $result['sn'] = $entry[0]['sn'][0]; 762 $result['telephonenumber'] = $entry[0]['telephonenumber'][0]; 763 $result['phpgwaccountstatus'] = $entry[0]['phpgwaccountstatus'][0]; 764 $result['phpgwaccountvisible'] = $entry[0]['phpgwaccountvisible'][0]; 765 $result['accountstatus'] = $entry[0]['accountstatus'][0]; 766 $result['mail'] = $entry[0]['mail'][0]; 767 $result['mailalternateaddress'] = $entry[0]['mailalternateaddress'][0]; 768 $result['mailforwardingaddress']= $entry[0]['mailforwardingaddress'][0]; 769 $result['deliverymode'] = $entry[0]['deliverymode'][0]; 770 $result['userPasswordRFC2617'] = $entry[0]['userpasswordrfc2617'][0]; 771 772 //Photo 773 if ($entry[0]['jpegphoto']['count'] == 1) 774 $result['photo_exist'] = 'true'; 775 776 // Samba 777 for ($i=0; $i<$entry[0]['objectclass']['count']; $i++) 778 { 779 if ($entry[0]['objectclass'][$i] == 'sambaSamAccount') 780 $result['sambaUser'] = true; 781 } 782 if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($result['sambaUser'])) 783 { 784 $result['sambaaccflags'] = $entry[0]['sambaacctflags'][0]; 785 $result['sambalogonscript'] = $entry[0]['sambalogonscript'][0]; 786 $result['homedirectory'] = $entry[0]['homedirectory'][0]; 787 $a_tmp = explode("-", $entry[0]['sambasid'][0]); 788 array_pop($a_tmp); 789 $result['sambasid'] = implode("-", $a_tmp); 790 } 791 792 // Verifica o acesso do gerente aos atributos corporativos 793 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 794 { 795 $result['corporative_information_employeenumber']= $entry[0]['employeenumber'][0]; 796 $result['corporative_information_cpf'] = $entry[0]['cpf'][0]; 797 $result['corporative_information_rg'] = $entry[0]['rg'][0]; 798 $result['corporative_information_rguf'] = $entry[0]['rguf'][0]; 799 } 800 801 // MailLists 802 $result['maillists_info'] = $this->get_user_maillists($result['mail']); 803 foreach ($result['maillists_info'] as $maillist) 804 { 805 $result['maillists'][] = $maillist['uidnumber']; 806 } 807 808 // Groups 809 $justthese = array("gidnumber","cn"); 810 $filter="(&(phpgwAccountType=g)(memberuid=".$result['uid']."))"; 811 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 812 ldap_sort($this->ldap, $search, "cn"); 813 $entries = ldap_get_entries($this->ldap, $search); 814 for ($i=0; $i<$entries['count']; $i++) 815 { 816 $result['groups_ldap'][ $entries[$i]['gidnumber'][0] ] = $entries[$i]['cn'][0]; 817 } 818 } 819 } 820 return $result; 821 } 822 823 function get_user_maillists($mail) 824 { 825 $result = array(); 826 827 //Mostra somente os mailists dos contextos do gerente 673 828 $justthese = array("uid","mail","uidnumber"); 674 $filter="(&(phpgwAccountType=l)(mailforwardingaddress=".$result['mail']."))"; 675 $search = ldap_search($this->ldap, $context, $filter, $justthese); 676 ldap_sort($this->ldap, $search, "uid"); 677 $entries = ldap_get_entries($this->ldap, $search); 678 for ($i=0; $i<$entries['count']; $i++) 829 $filter="(&(phpgwAccountType=l)(mailforwardingaddress=$mail))"; 830 831 foreach ($this->manager_contexts as $index=>$context) 832 { 833 $search = ldap_search($this->ldap, $context, $filter, $justthese); 834 //ldap_sort($this->ldap, $search, "uid"); 835 $entries = ldap_get_entries($this->ldap, $search); 836 837 for ($i=0; $i<$entries['count']; $i++) 838 { 839 $result[ $entries[$i]['uid'][0] ]['uidnumber'] = $entries[$i]['uidnumber'][0]; 840 $result[ $entries[$i]['uid'][0] ]['uid'] = $entries[$i]['uid'][0]; 841 $result[ $entries[$i]['uid'][0] ]['mail'] = $entries[$i]['mail'][0]; 842 843 $a_tmp[] = $entries[$i]['uid'][0]; 844 } 845 } 846 847 natcasesort($a_tmp); 848 849 foreach ($a_tmp as $uid) 679 850 { 680 $result['maillists_info'][$i]['uidnumber'] = $entries[$i]['uidnumber'][0]; 681 $result['maillists_info'][$i]['uid'] = $entries[$i]['uid'][0]; 682 $result['maillists_info'][$i]['mail'] = $entries[$i]['mail'][0]; 683 $result['maillists'][] = $entries[$i]['uidnumber'][0]; 851 $return[$uid]['uidnumber'] = $result[$uid]['uidnumber']; 852 $return[$uid]['uid'] = $result[$uid]['uid']; 853 $return[$uid]['mail'] = $result[$uid]['mail']; 684 854 } 685 686 // Groups 687 $justthese = array("gidnumber","cn"); 688 $filter="(&(phpgwAccountType=g)(memberuid=".$result['uid']."))"; 689 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 690 ldap_sort($this->ldap, $search, "cn"); 691 $entries = ldap_get_entries($this->ldap, $search); 692 for ($i=0; $i<$entries['count']; $i++) 693 { 694 $result['groups_ldap'][ $entries[$i]['gidnumber'][0] ] = $entries[$i]['cn'][0]; 695 } 696 697 return $result; 698 } 699 700 function get_group_info($gidnumber, $context) 701 { 702 $filter="(&(phpgwAccountType=g)(gidNumber=".$gidnumber."))"; 703 $search = ldap_search($this->ldap, $context, $filter); 704 $entry = ldap_get_entries($this->ldap, $search); 705 706 //Pega o dn do setor do grupo. 707 $entry[0]['dn'] = strtolower($entry[0]['dn']); 708 $sector_dn_array = explode(",", $entry[0]['dn']); 709 for($i=1; $i<count($sector_dn_array); $i++) 710 $sector_dn .= $sector_dn_array[$i] . ','; 711 //Retira ultimo pipe. 712 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 713 714 $result['context'] = $sector_dn; 715 $result['cn'] = $entry[0]['cn'][0]; 716 $result['description'] = $entry[0]['description'][0]; 717 $result['gidnumber'] = $entry[0]['gidnumber'][0]; 718 $result['phpgwaccountvisible'] = $entry[0]['phpgwaccountvisible'][0]; 719 $result['email'] = $entry[0]['mail'][0]; 720 721 //MemberUid 722 for ($i=0; $i<$entry[0]['memberuid']['count']; $i++) 723 { 724 $justthese = array("cn","uid","uidnumber"); 725 726 // Montagem dinamica do filtro 727 $filter="(&(phpgwAccountType=u)(|"; 728 for ($k=0; (($k<10) && ($i<$entry[0]['memberuid']['count'])); $k++) 729 { 730 $filter .= "(uid=".$entry[0]['memberuid'][$i].")"; 731 $i++; 732 } 733 $i--; 734 $filter .= "))"; 735 736 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 737 $user_entry = ldap_get_entries($this->ldap, $search); 738 739 for ($j=0; $j<$user_entry['count']; $j++) 740 { 741 $result['memberuid_info'][$user_entry[$j]['uid'][0]]['cn'] = $user_entry[$j]['cn'][0]; 742 $result['memberuid_info'][$user_entry[$j]['uid'][0]]['uidnumber'] = $user_entry[$j]['uidnumber'][0]; 743 $result['memberuid_info'][$user_entry[$j]['uid'][0]]['type'] = 'u'; 744 } 745 } 746 747 // Retira o count do array 748 array_shift($entry[0]['memberuid']); 749 750 // Checamos e-mails que não fazem parte do expresso. 751 // Criamos um array temporario 752 $tmp_array = array(); 753 foreach ($result['memberuid_info'] as $uid => $user_data) 754 { 755 $tmp_array[] = $uid; 756 } 757 758 // Vemos a diferença 759 $array_diff = array_diff($entry[0]['memberuid'], $tmp_array); 760 761 // Incluimos no resultado 762 foreach ($array_diff as $index=>$uid) 763 { 764 $result['memberuid_info'][$uid]['cn'] = $uid; 765 } 766 767 // Samba 768 for ($i=0; $i<$entry[0]['objectclass']['count']; $i++) 769 { 770 if ($entry[0]['objectclass'][$i] == 'sambaGroupMapping') 771 $result['sambaGroup'] = true; 772 773 $a_tmp = explode("-", $entry[0]['sambasid'][0]); 774 array_pop($a_tmp); 775 $result['sambasid'] = implode("-", $a_tmp); 776 } 777 778 return $result; 855 return $return; 856 } 857 858 function get_group_info($gidnumber) 859 { 860 foreach ($this->manager_contexts as $index=>$context) 861 { 862 $filter="(&(phpgwAccountType=g)(gidNumber=".$gidnumber."))"; 863 $search = ldap_search($this->ldap, $context, $filter); 864 $entry = ldap_get_entries($this->ldap, $search); 865 866 if ($entry['count']) 867 { 868 //Pega o dn do setor do grupo. 869 $entry[0]['dn'] = strtolower($entry[0]['dn']); 870 $sector_dn_array = explode(",", $entry[0]['dn']); 871 for($i=1; $i<count($sector_dn_array); $i++) 872 $sector_dn .= $sector_dn_array[$i] . ','; 873 //Retira ultimo pipe. 874 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 875 876 $result['context'] = $sector_dn; 877 $result['cn'] = $entry[0]['cn'][0]; 878 $result['description'] = $entry[0]['description'][0]; 879 $result['gidnumber'] = $entry[0]['gidnumber'][0]; 880 $result['phpgwaccountvisible'] = $entry[0]['phpgwaccountvisible'][0]; 881 $result['email'] = $entry[0]['mail'][0]; 882 883 //MemberUid 884 for ($i=0; $i<$entry[0]['memberuid']['count']; $i++) 885 { 886 $justthese = array("cn","uid","uidnumber"); 887 888 // Montagem dinamica do filtro 889 $filter="(&(phpgwAccountType=u)(|"; 890 for ($k=0; (($k<10) && ($i<$entry[0]['memberuid']['count'])); $k++) 891 { 892 $filter .= "(uid=".$entry[0]['memberuid'][$i].")"; 893 $i++; 894 } 895 $i--; 896 $filter .= "))"; 897 898 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 899 $user_entry = ldap_get_entries($this->ldap, $search); 900 901 for ($j=0; $j<$user_entry['count']; $j++) 902 { 903 $result['memberuid_info'][$user_entry[$j]['uid'][0]]['cn'] = $user_entry[$j]['cn'][0]; 904 $result['memberuid_info'][$user_entry[$j]['uid'][0]]['uidnumber'] = $user_entry[$j]['uidnumber'][0]; 905 $result['memberuid_info'][$user_entry[$j]['uid'][0]]['type'] = 'u'; 906 } 907 } 908 909 // Retira o count do array 910 array_shift($entry[0]['memberuid']); 911 912 // Checamos e-mails que não fazem parte do expresso. 913 // Criamos um array temporario 914 $tmp_array = array(); 915 foreach ($result['memberuid_info'] as $uid => $user_data) 916 { 917 $tmp_array[] = $uid; 918 } 919 920 // Vemos a diferença 921 $array_diff = array_diff($entry[0]['memberuid'], $tmp_array); 922 923 // Incluimos no resultado 924 foreach ($array_diff as $index=>$uid) 925 { 926 $result['memberuid_info'][$uid]['cn'] = $uid; 927 } 928 929 // Samba 930 for ($i=0; $i<$entry[0]['objectclass']['count']; $i++) 931 { 932 if ($entry[0]['objectclass'][$i] == 'sambaGroupMapping') 933 $result['sambaGroup'] = true; 934 935 $a_tmp = explode("-", $entry[0]['sambasid'][0]); 936 array_pop($a_tmp); 937 $result['sambasid'] = implode("-", $a_tmp); 938 } 939 return $result; 940 } 941 } 779 942 } 780 943 781 function get_maillist_info($uidnumber, $context) 782 { 783 $filter="(&(phpgwAccountType=l)(uidNumber=".$uidnumber."))"; 784 $search = ldap_search($this->ldap, $context, $filter); 785 $entry = ldap_get_entries($this->ldap, $search); 786 787 //Pega o dn do setor do usuario. 788 $entry[0]['dn'] = strtolower($entry[0]['dn']); 789 $sector_dn_array = explode(",", $entry[0]['dn']); 790 for($i=1; $i<count($sector_dn_array); $i++) 791 $sector_dn .= $sector_dn_array[$i] . ','; 792 //Retira ultimo pipe. 793 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 794 795 $result['context'] = $sector_dn; 796 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 797 $result['uid'] = $entry[0]['uid'][0]; 798 $result['cn'] = $entry[0]['cn'][0]; 799 $result['mail'] = $entry[0]['mail'][0]; 800 $result['accountStatus'] = $entry[0]['accountstatus'][0]; 801 $result['phpgwAccountVisible'] = $entry[0]['phpgwaccountvisible'][0]; 802 803 //Members 804 for ($i=0; $i<$entry[0]['mailforwardingaddress']['count']; $i++) 805 { 806 $justthese = array("cn", "uidnumber", "uid", "phpgwaccounttype", "mail"); 944 function get_maillist_info($uidnumber) 945 { 946 foreach ($this->manager_contexts as $index=>$context) 947 { 948 $filter="(&(phpgwAccountType=l)(uidNumber=".$uidnumber."))"; 949 $search = ldap_search($this->ldap, $context, $filter); 950 $entry = ldap_get_entries($this->ldap, $search); 951 952 if ($entry['count']) 953 { 954 //Pega o dn do setor do usuario. 955 $entry[0]['dn'] = strtolower($entry[0]['dn']); 956 $sector_dn_array = explode(",", $entry[0]['dn']); 957 for($i=1; $i<count($sector_dn_array); $i++) 958 $sector_dn .= $sector_dn_array[$i] . ','; 959 //Retira ultimo pipe. 960 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 961 962 $result['context'] = $sector_dn; 963 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 964 $result['uid'] = $entry[0]['uid'][0]; 965 $result['cn'] = $entry[0]['cn'][0]; 966 $result['mail'] = $entry[0]['mail'][0]; 967 $result['accountStatus'] = $entry[0]['accountstatus'][0]; 968 $result['phpgwAccountVisible'] = $entry[0]['phpgwaccountvisible'][0]; 969 970 //Members 971 for ($i=0; $i<$entry[0]['mailforwardingaddress']['count']; $i++) 972 { 973 $justthese = array("cn", "uidnumber", "uid", "phpgwaccounttype", "mail"); 807 974 808 // Montagem dinamica do filtro809 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|";810 for ($k=0; (($k<10) && ($i<$entry[0]['mailforwardingaddress']['count'])); $k++)811 {812 $filter .= "(mail=".$entry[0]['mailforwardingaddress'][$i].")";813 $i++;814 }815 $i--;816 $filter .= "))";975 // Montagem dinamica do filtro 976 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|"; 977 for ($k=0; (($k<10) && ($i<$entry[0]['mailforwardingaddress']['count'])); $k++) 978 { 979 $filter .= "(mail=".$entry[0]['mailforwardingaddress'][$i].")"; 980 $i++; 981 } 982 $i--; 983 $filter .= "))"; 817 984 818 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);819 $user_entry = ldap_get_entries($this->ldap, $search);985 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 986 $user_entry = ldap_get_entries($this->ldap, $search); 820 987 821 for ($j=0; $j<$user_entry['count']; $j++) 822 { 823 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['uid'] = $user_entry[$j]['uid'][0]; 824 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['cn'] = $user_entry[$j]['cn'][0]; 825 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['type'] = $user_entry[$j]['phpgwaccounttype'][0]; 826 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['mail'] = $user_entry[$j]['mail'][0]; 827 $result['members'][] = $user_entry[$j]['uidnumber'][0]; 828 } 829 } 830 831 // Retira o count do array 832 array_shift($entry[0]['mailforwardingaddress']); 833 834 // Checamos e-mails que não fazem parte do expresso. 835 // Criamos um array temporario 836 $tmp_array = array(); 837 foreach ($result['members_info'] as $uid => $user_data) 838 { 839 $tmp_array[] = $user_data['mail']; 840 } 841 842 // Vemos a diferença 843 $array_diff = array_diff($entry[0]['mailforwardingaddress'], $tmp_array); 844 845 // Incluimos no resultado 846 foreach ($array_diff as $index=>$mailforwardingaddress) 847 { 848 $result['members_info'][$mailforwardingaddress]['uid'] = $mailforwardingaddress; 849 $result['members_info'][$mailforwardingaddress]['cn'] = 'E-Mail nao encontrado'; 850 $result['members_info'][$mailforwardingaddress]['mailforwardingaddress'] = $mailforwardingaddress; 851 $result['members'][] = $mailforwardingaddress; 852 } 853 return $result; 988 for ($j=0; $j<$user_entry['count']; $j++) 989 { 990 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['uid'] = $user_entry[$j]['uid'][0]; 991 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['cn'] = $user_entry[$j]['cn'][0]; 992 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['type'] = $user_entry[$j]['phpgwaccounttype'][0]; 993 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['mail'] = $user_entry[$j]['mail'][0]; 994 $result['members'][] = $user_entry[$j]['uidnumber'][0]; 995 } 996 } 997 998 // Retira o count do array 999 array_shift($entry[0]['mailforwardingaddress']); 1000 1001 // Checamos e-mails que não fazem parte do expresso. 1002 // Criamos um array temporario 1003 $tmp_array = array(); 1004 foreach ($result['members_info'] as $uid => $user_data) 1005 { 1006 $tmp_array[] = $user_data['mail']; 1007 } 1008 1009 // Vemos a diferença 1010 $array_diff = array_diff($entry[0]['mailforwardingaddress'], $tmp_array); 1011 1012 // Incluimos no resultado 1013 foreach ($array_diff as $index=>$mailforwardingaddress) 1014 { 1015 $result['members_info'][$mailforwardingaddress]['uid'] = $mailforwardingaddress; 1016 $result['members_info'][$mailforwardingaddress]['cn'] = 'E-Mail nao encontrado'; 1017 $result['members_info'][$mailforwardingaddress]['mailforwardingaddress'] = $mailforwardingaddress; 1018 $result['members'][] = $mailforwardingaddress; 1019 } 1020 return $result; 1021 } 1022 } 854 1023 } 855 1024 856 function get_maillist_scl_info($uidnumber, $context) 857 { 858 $filter="(&(phpgwAccountType=l)(uidNumber=".$uidnumber."))"; 859 $search = ldap_search($this->ldap, $context, $filter); 860 $entry = ldap_get_entries($this->ldap, $search); 861 862 //Pega o dn do setor do usuario. 863 $entry[0]['dn'] = strtolower($entry[0]['dn']); 864 $sector_dn_array = explode(",", $entry[0]['dn']); 865 for($i=1; $i<count($sector_dn_array); $i++) 866 $sector_dn .= $sector_dn_array[$i] . ','; 867 //Retira ultimo pipe. 868 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 869 870 $result['dn'] = $entry[0]['dn']; 871 $result['context'] = $sector_dn; 872 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 873 $result['uid'] = $entry[0]['uid'][0]; 874 $result['cn'] = $entry[0]['cn'][0]; 875 $result['mail'] = $entry[0]['mail'][0]; 876 $result['accountStatus'] = $entry[0]['accountstatus'][0]; 877 $result['phpgwAccountVisible'] = $entry[0]['phpgwaccountvisible'][0]; 878 $result['accountRestrictive'] = $entry[0]['accountrestrictive'][0]; 879 $result['participantCanSendMail'] = $entry[0]['participantcansendmail'][0]; 880 881 //Senders 882 for ($i=0; $i<$entry[0]['mailsenderaddress']['count']; $i++) 883 { 884 $justthese = array("cn", "uidnumber", "uid", "mail"); 885 $filter="(&(phpgwAccountType=u)(mail=".$entry[0]['mailsenderaddress'][$i]."))"; 886 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 887 $user_entry = ldap_get_entries($this->ldap, $search); 888 889 $result['senders_info'][$user_entry[0]['uidnumber'][0]]['uid'] = $user_entry[0]['uid'][0]; 890 $result['senders_info'][$user_entry[0]['uidnumber'][0]]['cn'] = $user_entry[0]['cn'][0]; 891 $result['senders_info'][$user_entry[0]['uidnumber'][0]]['mail'] = $user_entry[0]['mail'][0]; 892 $result['members'][] = $user_entry[0]['uidnumber'][0]; 893 } 894 895 return $result; 1025 function get_maillist_scl_info($uidnumber) 1026 { 1027 foreach ($this->manager_contexts as $index=>$context) 1028 { 1029 $filter="(&(phpgwAccountType=l)(uidNumber=$uidnumber))"; 1030 $search = ldap_search($this->ldap, $context, $filter); 1031 $entry = ldap_get_entries($this->ldap, $search); 1032 1033 if ($entry['count']) 1034 { 1035 //Pega o dn do setor do usuario. 1036 $entry[0]['dn'] = strtolower($entry[0]['dn']); 1037 $sector_dn_array = explode(",", $entry[0]['dn']); 1038 for($i=1; $i<count($sector_dn_array); $i++) 1039 $sector_dn .= $sector_dn_array[$i] . ','; 1040 //Retira ultimo pipe. 1041 $sector_dn = substr($sector_dn,0,(strlen($sector_dn) - 1)); 1042 1043 $result['dn'] = $entry[0]['dn']; 1044 $result['context'] = $sector_dn; 1045 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 1046 $result['uid'] = $entry[0]['uid'][0]; 1047 $result['cn'] = $entry[0]['cn'][0]; 1048 $result['mail'] = $entry[0]['mail'][0]; 1049 $result['accountStatus'] = $entry[0]['accountstatus'][0]; 1050 $result['phpgwAccountVisible'] = $entry[0]['phpgwaccountvisible'][0]; 1051 $result['accountRestrictive'] = $entry[0]['accountrestrictive'][0]; 1052 $result['participantCanSendMail'] = $entry[0]['participantcansendmail'][0]; 1053 1054 //Senders 1055 for ($i=0; $i<$entry[0]['mailsenderaddress']['count']; $i++) 1056 { 1057 $justthese = array("cn", "uidnumber", "uid", "mail"); 1058 $filter="(&(phpgwAccountType=u)(mail=".$entry[0]['mailsenderaddress'][$i]."))"; 1059 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 1060 $user_entry = ldap_get_entries($this->ldap, $search); 1061 1062 $result['senders_info'][$user_entry[0]['uidnumber'][0]]['uid'] = $user_entry[0]['uid'][0]; 1063 $result['senders_info'][$user_entry[0]['uidnumber'][0]]['cn'] = $user_entry[0]['cn'][0]; 1064 $result['senders_info'][$user_entry[0]['uidnumber'][0]]['mail'] = $user_entry[0]['mail'][0]; 1065 $result['members'][] = $user_entry[0]['uidnumber'][0]; 1066 } 1067 return $result; 1068 } 1069 } 896 1070 } 897 1071 … … 909 1083 } 910 1084 911 function gidnumbers2cn($gidnumbers , $context)1085 function gidnumbers2cn($gidnumbers) 912 1086 { 913 1087 $result = array(); … … 927 1101 $result['groups_info'][$i]['cn'] = $entry[0]['cn'][0]; 928 1102 $result['groups_info'][$i]['gidnumber'] = $gidnumber; 929 930 if (!strpos(strtolower($entry[0]['dn']), strtolower($context))) 931 $result['groups_info'][$i]['group_disabled'] = 'true'; 932 else 933 $result['groups_info'][$i]['group_disabled'] = 'false'; 934 1103 1104 /* o gerente pode excluir um grupo de um usuario onde este grupo esta em outra OU ? */ 1105 /* é o mesmo que o manager editar um grupo de outra OU */ 1106 $result['groups_info'][$i]['group_disabled'] = 'true'; 1107 foreach ($this->manager_contexts as $index=>$context) 1108 { 1109 if (strpos(strtolower($entry[0]['dn']), strtolower($context))) 1110 { 1111 $result['groups_info'][$i]['group_disabled'] = 'false'; 1112 } 1113 } 1114 935 1115 $i++; 936 1116 } … … 1025 1205 function delete_user($user_info) 1026 1206 { 1207 // Verifica acesso do gerente (OU) ao tentar deletar um usuário. 1208 $manager_access = false; 1209 foreach ($this->manager_contexts as $index=>$context) 1210 { 1211 if ( (strpos(strtolower($user_info['context']), strtolower($context))) || (strtolower($user_info['context']) == strtolower($context)) ) 1212 { 1213 $manager_access = true; 1214 break; 1215 } 1216 } 1217 if (!$manager_access) 1218 { 1219 $return['status'] = false; 1220 $return['msg'] .= 'Você não tem acesso para deletar este usuário.'; 1221 return $return; 1222 } 1223 1027 1224 $return['status'] = true; 1028 1225 … … 1120 1317 } 1121 1318 1319 function check_access_to_renamed($uid) 1320 { 1321 $justthese = array("dn"); 1322 $filter="(&(phpgwAccountType=u)(uid=$uid))"; 1323 1324 foreach ($this->manager_contexts as $index=>$context) 1325 { 1326 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1327 $entry = ldap_get_entries($this->ldap, $search); 1328 if ($entry['count']) 1329 return true; 1330 } 1331 return false; 1332 } 1122 1333 1123 1334 function rename_uid($uid, $new_uid) … … 1191 1402 return $return; 1192 1403 } 1193 /* 1194 function rename_departmentnumber($old_dp, $new_dp) 1195 { 1196 $return['status'] = true; 1197 1198 $justthese = array("dn"); 1199 $filter="(&(phpgwAccountType=u)(departmentnumber=".$old_dp."))"; 1200 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 1201 $entry = ldap_get_entries($this->ldap, $search); 1202 1203 for ($i=0; $i<=$entry['count']; $i++) 1204 { 1205 $dn = strtolower($entry[$i]['dn']); 1206 $ldap_mod_replace = array(); 1207 $ldap_mod_replace['departmentnumber'] = $new_dp; 1208 @ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace); 1209 //if (!@ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace)) 1210 //{ 1211 // $return['status'] = false; 1212 // $return['msg'] .= 'Erro em ldap_funcitons->rename_departmentnumber: ' . ldap_error($this->ldap); 1213 //} 1214 } 1215 return $return; 1216 } 1217 */ 1218 /* 1219 function get_sambadomains($context) 1220 { 1221 $return['status'] = true; 1222 $return['sambaDomains'] = array(); 1223 1224 $justthese = array("sambaSID","sambaDomainName"); 1225 $filter="(objectClass=sambaDomain)"; 1226 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1227 $entry = ldap_get_entries($this->ldap, $search); 1228 1229 for ($i=0; $i<$entry['count']; $i++) 1230 { 1231 $return['sambaDomains'][$i]['samba_domain_sid'] = $entry[$i]['sambasid'][0]; 1232 $return['sambaDomains'][$i]['samba_domain_name'] = $entry[$i]['sambadomainname'][0]; 1233 $return['sambaDomains'][$i]['samba_domain_dn'] = $entry[$i]['dn']; 1234 } 1235 1236 return $return; 1237 } 1238 */ 1239 function exist_sambadomains($context, $sambaDomainName) 1404 1405 function exist_sambadomains($contexts, $sambaDomainName) 1240 1406 { 1241 1407 $justthese = array("dn"); 1242 1408 $filter="(&(objectClass=sambaDomain)(sambaDomainName=$sambaDomainName))"; 1243 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1244 $entry = ldap_get_entries($this->ldap, $search); 1409 1410 foreach ($contexts as $index=>$context) 1411 { 1412 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1413 $entry = ldap_get_entries($this->ldap, $search); 1245 1414 1246 if ($entry['count'])1247 return true;1248 else1249 1415 if ($entry['count']) 1416 return true; 1417 } 1418 return false; 1250 1419 } 1251 1420 -
trunk/expressoAdmin1_2/inc/class.maillist.inc.php
r23 r64 55 55 $params['members'] = $array_tmp; 56 56 57 // Leio o ID a ser usado na criação do objecto. 58 $next_id = ($this->db_functions->get_next_id('accounts')); 59 if ((!is_numeric($next_id['id'])) || (!$next_id['status'])) 60 { 61 $return['status'] = false; 62 $return['msg'] = "Problemas obtendo ID do usuário.\n" . $id['msg']; 63 return $return; 64 } 65 else 66 { 67 $id = $next_id['id']; 68 } 57 69 // Pega ID do BD e incrementa de 1. 58 $id = (($this->db_functions->get_next_id()) + 1); 59 70 //$id = (($this->db_functions->get_next_id()) + 1); 60 71 // Incrementa o id no BD. 61 $this->db_functions->increment_id($id,'accounts');72 //$this->db_functions->increment_id($id,'accounts'); 62 73 63 74 // Cria array para incluir no LDAP … … 382 393 } 383 394 384 function get_info($uidnumber , $context)385 { 386 $maillist_info_ldap = $this->ldap_functions->get_maillist_info($uidnumber , $context);395 function get_info($uidnumber) 396 { 397 $maillist_info_ldap = $this->ldap_functions->get_maillist_info($uidnumber); 387 398 return $maillist_info_ldap; 388 399 } 389 400 390 function get_scl_info($uidnumber , $context)391 { 392 $maillist_info_ldap = $this->ldap_functions->get_maillist_scl_info($uidnumber , $context);401 function get_scl_info($uidnumber) 402 { 403 $maillist_info_ldap = $this->ldap_functions->get_maillist_scl_info($uidnumber); 393 404 return $maillist_info_ldap; 394 405 } -
trunk/expressoAdmin1_2/inc/class.socomputers.inc.php
r27 r64 47 47 } 48 48 49 function get_computer_data($uidnumber , $manager_context)49 function get_computer_data($uidnumber) 50 50 { 51 $manager_acl = $this->functions->read_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid']); 52 $manager_contexts = $manager_acl['contexts']; 51 53 $connection = $GLOBALS['phpgw']->common->ldapConnect(); 52 $search = ldap_search($connection, $manager_context, "uidNumber=" . $uidnumber);53 $result = ldap_get_entries($connection, $search);54 54 55 // Recupera o DN 56 $computer_data['dn'] = $result[0]['dn']; 55 foreach ($manager_contexts as $index=>$context) 56 { 57 $search = ldap_search($connection, $context, "uidNumber=$uidnumber"); 58 $result = ldap_get_entries($connection, $search); 57 59 58 //Recupera o Nome do Computador (CN) 59 $computer_data['computer_cn'] = $result[0]['cn'][0]; 60 if ($result['count']) 61 { 62 // Recupera o DN 63 $computer_data['dn'] = $result[0]['dn']; 64 65 //Recupera o Nome do Computador (CN) 66 $computer_data['computer_cn'] = $result[0]['cn'][0]; 60 67 61 //Recupera a flag SAMBA62 $computer_data['sambaAcctFlags'] = $result[0]['sambaacctflags'][0];68 //Recupera a flag SAMBA 69 $computer_data['sambaAcctFlags'] = $result[0]['sambaacctflags'][0]; 63 70 64 // Recupera a descrição65 $computer_data['computer_description'] = utf8_decode($result[0]['description'][0]);71 // Recupera a descrição 72 $computer_data['computer_description'] = utf8_decode($result[0]['description'][0]); 66 73 67 // Recupera o contexto do email_list68 $tmp = explode(",", $computer_data['dn']);69 for ($i = 1; $i < count($tmp); $i++)70 $computer_data['context'] .= $tmp[$i] . ',';71 $computer_data['context'] = substr($computer_data['context'],0,(strlen($computer_data['context']) - 1));74 // Recupera o contexto do email_list 75 $tmp = explode(",", $computer_data['dn']); 76 for ($i = 1; $i < count($tmp); $i++) 77 $computer_data['context'] .= $tmp[$i] . ','; 78 $computer_data['context'] = substr($computer_data['context'],0,(strlen($computer_data['context']) - 1)); 72 79 73 $a_tmp = explode("-", $result[0]['sambasid'][0]);74 array_pop($a_tmp);75 $computer_data['sambasid'] = implode("-", $a_tmp);80 $a_tmp = explode("-", $result[0]['sambasid'][0]); 81 array_pop($a_tmp); 82 $computer_data['sambasid'] = implode("-", $a_tmp); 76 83 77 return $computer_data; 84 return $computer_data; 85 } 86 } 78 87 } 79 88 -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r63 r64 55 55 { 56 56 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 57 $tmp = $this->functions->read_acl($account_lid); 58 $context = $tmp[0]['context']; 59 $context_display = $tmp[0]['context_display']; 57 $acl = $this->functions->read_acl($account_lid); 58 $raw_context = $acl['raw_context']; 59 $contexts = $acl['contexts']; 60 foreach ($acl['contexts_display'] as $index=>$tmp_context) 61 { 62 $context_display .= '<br>'.$tmp_context; 63 } 60 64 61 65 // Verifica se o administrador tem acesso. … … 94 98 95 99 'create_user_disabled' => $this->functions->check_acl($account_lid,'add_users') ? '' : 'disabled', 96 'context' => $ context,100 'context' => $raw_context, 97 101 'context_display' => $context_display, 98 102 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'], … … 107 111 'lang_search' => lang('Search'), 108 112 'lang_back' => lang('back'), 109 'lang_context ' => lang('Context')113 'lang_contexts' => lang('Contexts') 110 114 111 115 ); … … 118 122 if ($GLOBALS['query'] != '') 119 123 { 120 $account_info = $this->functions->get_list('accounts', $GLOBALS['query'], $context );124 $account_info = $this->functions->get_list('accounts', $GLOBALS['query'], $contexts); 121 125 } 122 126 … … 131 135 ($this->functions->check_acl($account_lid,'change_users_password')) || 132 136 ($this->functions->check_acl($account_lid,'edit_sambausers_attributes')) || 133 ($this->functions->check_acl($account_lid,'change_users_quote'))) 137 ($this->functions->check_acl($account_lid,'change_users_quote')) || 138 ($this->functions->check_acl($account_lid,'manipulate_corporative_information')) 139 ) 134 140 $can_edit = True; 135 141 elseif ($this->functions->check_acl($account_lid,'view_users')) … … 159 165 160 166 if ($can_rename) 161 $p->set_var('row_rename',"<a href='#' onClick='javascript:rename_user(\"".$account['account_lid']."\",\"".$account['account_id']."\" ,\"".$context."\");'>Renomear</a>");167 $p->set_var('row_rename',"<a href='#' onClick='javascript:rename_user(\"".$account['account_lid']."\",\"".$account['account_id']."\");'>Renomear</a>"); 162 168 else 163 169 $p->set_var('row_rename',' '); … … 165 171 if ($can_delete) 166 172 { 167 $p->set_var('row_delete',"<a href='#' onClick='javascript:delete_user(\"".$account['account_lid']."\",\"".$account['account_id']."\" ,\"".$context."\");'>Excluir</a>");173 $p->set_var('row_delete',"<a href='#' onClick='javascript:delete_user(\"".$account['account_lid']."\",\"".$account['account_id']."\");'>Excluir</a>"); 168 174 } 169 175 else … … 179 185 { 180 186 $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); 187 181 188 $GLOBALS['phpgw']->js->set_onload('get_available_groups(document.forms[0].context.value);'); 182 189 $GLOBALS['phpgw']->js->set_onload('get_available_maillists(document.forms[0].context.value);'); 183 190 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 184 191 $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_user\');'); 185 192 186 193 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 187 $tmp = $this->functions->read_acl($manager_lid); 188 $manager_context = $tmp[0]['context']; 194 $acl = $this->functions->read_acl($manager_lid); 195 196 $manager_contexts = $acl['contexts']; 197 189 198 // Verifica se tem acesso a este modulo 190 199 if (!$this->functions->check_acl($manager_lid,'add_users')) … … 206 215 207 216 // Pega combo das organizações e seleciona, caso seja um post, o setor que o usuario selecionou. 208 $sectors = $this->functions->get_organizations($manager_context); 217 foreach ($manager_contexts as $index=>$context) 218 $sectors .= $this->functions->get_organizations($context); 209 219 210 220 // Chama funcao para criar lista de aplicativos disponiveis. 211 //$app_list['applications_list'] = $_POST['applications_list']; 212 $applications_list = $this->functions->make_list_app($manager_lid, $manager_context, $app_list); 221 $applications_list = $this->functions->make_list_app($manager_lid); 213 222 214 223 // Cria combo de dominio samba … … 222 231 { 223 232 // So mostra os sambaDomainName do contexto do manager 224 if ($this->ldap_functions->exist_sambadomains($manager_context , $a_sambadomain['samba_domain_name']))233 if ($this->ldap_functions->exist_sambadomains($manager_contexts, $a_sambadomain['samba_domain_name'])) 225 234 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 226 235 } … … 233 242 'row_off' => "#EEEEEE", 234 243 'color_bg1' => "#E8F0F0", 235 'manager_context' => $manager_context,244 //'manager_context' => $manager_context, 236 245 'type' => 'create_user', 237 246 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), 238 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : ' display:none',247 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'none', 239 248 'disabled_access_button'=> 'disabled', 240 249 … … 313 322 314 323 //SAMBA ABA 315 'display_samba_suport' => $this->functions->check_acl($manager_lid,'edit_sambausers_attributes') ? '' : 'none',316 324 'lang_samba_config' => lang('Samba Config'), 317 325 'lang_use_attrs_samba' => lang('Use samba attributes'), … … 340 348 { 341 349 $manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 342 $tmp = $this->functions->read_acl($manager_account_lid); 343 $manager_context = $tmp[0]['context']; 350 $acl = $this->functions->read_acl($manager_account_lid); 351 $raw_context = $acl['raw_context']; 352 $contexts = $acl['contexts']; 344 353 $alert_warning = ''; 345 354 … … 351 360 (!$this->functions->check_acl($manager_account_lid,'change_users_password')) && 352 361 (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) && 353 (!$this->functions->check_acl($manager_account_lid,'view_users')) 362 (!$this->functions->check_acl($manager_account_lid,'view_users')) && 363 (!$this->functions->check_acl($manager_account_lid,'manipulate_corporative_information')) 354 364 ) 355 365 { … … 387 397 388 398 // GET all infomations about the user. 389 $user_info = $this->user->get_user_info($_GET['account_id'] , $manager_context);399 $user_info = $this->user->get_user_info($_GET['account_id']); 390 400 391 401 // JavaScript … … 408 418 409 419 // ORGANIZATIONS 410 $orgs = $this->functions->get_organizations($manager_context, $user_info['context']); 420 foreach ($contexts as $index=>$context) 421 $orgs .= $this->functions->get_organizations($context, $user_info['context']); 411 422 412 423 // GROUPS. … … 473 484 if (count($user_info['maillists_info']) > 0) 474 485 { 475 476 486 foreach ($user_info['maillists_info'] as $maillist) 477 487 { … … 487 497 // APPS. 488 498 if ($disabled == 'disabled') 489 $apps = $this->functions->make_list_app($manager_account_lid, $ manager_context, $user_info['apps'], 'disabled');499 $apps = $this->functions->make_list_app($manager_account_lid, $user_info['apps'], 'disabled'); 490 500 else 491 $apps = $this->functions->make_list_app($manager_account_lid, $ manager_context, $user_info['apps']);501 $apps = $this->functions->make_list_app($manager_account_lid, $user_info['apps']); 492 502 493 503 //PHOTO 494 504 if ($user_info['photo_exist']) 495 505 { 496 $photo_bin = "./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_photo&uidNumber=".$_GET['account_id'] ."&manager_context=$manager_context";506 $photo_bin = "./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_photo&uidNumber=".$_GET['account_id']; 497 507 } 498 508 else … … 521 531 if ($alert_warning != '') 522 532 $alert_warning = "alert('". $alert_warning ."')"; 523 524 533 $var = Array( 525 534 'uidnumber' => $_GET['account_id'], 526 'manager_context' => $manager_context,527 535 'type' => 'edit_user', 528 536 'photo_exist' => $user_info['photo_exist'], … … 535 543 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.validate_user_data_edit'), 536 544 'back_url' => './index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users', 537 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none',538 545 'disabled' => $disabled, 539 546 'disabled_password' => $disabled_password, 540 547 'disabled_samba' => $disabled_samba, 541 548 'changequote_disabled' => $disabled_quote, 549 550 // Display ABAS 551 'display_corporative_information'=> $this->functions->check_acl($manager_account_lid,'manipulate_corporative_information') ? '' : 'none', 552 'display_applications' => $this->functions->check_acl($manager_account_lid,'display_applications') ? '' : 'none', 553 'display_emaillists' => $this->functions->check_acl($manager_account_lid,'display_emaillists') ? '' : 'none', 554 'display_groups' => $this->functions->check_acl($manager_account_lid,'display_groups') ? '' : 'none', 555 'display_emailconfig' => $this->functions->check_acl($manager_account_lid,'display_emailconfig') ? '' : 'none', 542 556 543 557 // First ABA … … 583 597 584 598 // Corporative Information 585 'display_corporative_information'=> $this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes') ? '' : 'none',586 599 'lang_employeenumber' => lang('Employee number'), 587 600 'lang_cpf' => lang('cpf'), … … 594 607 595 608 //MAIL 596 'disabled_quota_used' 597 'lang_activeemailaccount' 598 'lang_email' 599 'lang_aliasemail' 600 'lang_forwardingemail' 601 'lang_email_quota' 602 'lang_onlyforwarding' 603 'lang_email_quota_used' 609 'disabled_quota_used' => 'disabled', 610 'lang_activeemailaccount' => lang('Active email account'), 611 'lang_email' => lang('E-mail'), 612 'lang_aliasemail' => lang('Alias email'), 613 'lang_forwardingemail' => lang('Forwarding email'), 614 'lang_email_quota' => lang('Email quota in MB'), 615 'lang_onlyforwarding' => lang('Only forwarding'), 616 'lang_email_quota_used' => lang('Quota used in MB'), 604 617 605 618 'accountstatus_checked' => $user_info['accountstatus'] == 'active' ? 'CHECKED' : '', … … 651 664 ); 652 665 $t->set_var($var); 666 667 // Devo mostrar aba SAMBA ?? 668 if ( ($this->current_config['expressoAdmin_samba_support'] == 'true') && ($this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) ) 669 $t->set_var('display_samba_suport', ''); 670 else 671 $t->set_var('display_samba_suport', 'none'); 672 653 673 $t->pfp('out','body'); 654 674 } … … 705 725 { 706 726 $uidNumber = $_GET['uidNumber']; 707 $manager_context = $_GET['manager_context']; 708 $photo = $this->get_photo($uidNumber, $manager_context); 727 $photo = $this->get_photo($uidNumber); 709 728 710 729 if ($photo) … … 722 741 } 723 742 724 function get_photo($uidNumber , $manager_context)743 function get_photo($uidNumber) 725 744 { 726 745 $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); … … 728 747 $justthese = array("jpegphoto"); 729 748 730 $search = ldap_search($ldap_conn, $ manager_context, $filter, $justthese);749 $search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 731 750 $entry = ldap_first_entry($ldap_conn, $search); 732 751 $jpeg_data = ldap_get_values_len($ldap_conn, $entry, "jpegphoto"); -
trunk/expressoAdmin1_2/inc/class.uicomputers.inc.php
r27 r64 35 35 $this->so = $this->bo->so; 36 36 $this->functions = $this->bo->functions; 37 $this->db_functions = CreateObject('expressoAdmin1_2.db_functions');37 $this->db_functions = $this->bo->db_functions; 38 38 39 39 $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); … … 44 44 function list_computers() 45 45 { 46 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 47 $acl = $this->functions->read_acl($account_lid); 48 $context = $acl[0]['context']; 49 $context_display = $acl[0]['context_display']; 46 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 47 $manager_acl = $this->functions->read_acl($manager_lid); 48 $manager_contexts = $manager_acl['contexts']; 49 foreach ($manager_acl['contexts_display'] as $index=>$tmp_context) 50 { 51 $context_display .= '<br>'.$tmp_context; 52 } 50 53 51 54 // Verifica se tem acesso a este modulo 52 if (!$this->functions->check_acl($ account_lid,'list_computers'))55 if (!$this->functions->check_acl($manager_lid,'list_computers')) 53 56 { 54 57 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 80 83 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 81 84 'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uicomputers.add_computer'), 82 'add_computers_disabled' => $this->functions->check_acl($ account_lid,'create_computers') ? '' : 'display:none',85 'add_computers_disabled' => $this->functions->check_acl($manager_lid,'create_computers') ? '' : 'display:none', 83 86 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), 84 87 'lang_back' => lang('Back'), 85 //'context' => $context,86 88 'context_display' => $context_display, 87 89 'lang_computers_uid' => lang('Computer UID'), … … 101 103 if ($GLOBALS['query'] != '') 102 104 { 103 $computers_info = $this->functions->get_list('computers', $GLOBALS['query'], $ context);105 $computers_info = $this->functions->get_list('computers', $GLOBALS['query'], $manager_contexts); 104 106 } 105 107 … … 111 113 else if (count($computers_info)) 112 114 { 113 if ($this->functions->check_acl($ account_lid,'edit_computers'))115 if ($this->functions->check_acl($manager_lid,'edit_computers')) 114 116 { 115 117 $can_edit = True; 116 118 } 117 if ($this->functions->check_acl($ account_lid,'delete_computers'))119 if ($this->functions->check_acl($manager_lid,'delete_computers')) 118 120 { 119 121 $can_delete = True; … … 157 159 function add_computer() 158 160 { 159 //_debug_array($_POST); 160 161 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 162 $acl = $this->functions->read_acl($account_lid); 163 $context = $acl[0]['context']; 161 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 162 $manager_acl = $this->functions->read_acl($manager_lid); 163 $manager_contexts = $manager_acl['contexts']; 164 164 165 165 // Verifica se tem acesso a este modulo 166 if (!$this->functions->check_acl($ account_lid,'create_computers'))166 if (!$this->functions->check_acl($manager_lid,'create_computers')) 167 167 { 168 168 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 191 191 } 192 192 193 // Pega combo das organizações e seleciona um dos setores em caso de um erro na validaçao dos dados.194 $sectors = $this->functions->get_organizations($context, trim(strtolower($_POST['sector_context'])));193 foreach ($manager_contexts as $index=>$context) 194 $sectors .= $this->functions->get_organizations($context); 195 195 196 196 // Cria combo de dominio samba … … 271 271 function validade_computers_data_add() 272 272 { 273 //_debug_array($_POST);274 275 273 if (($_POST['sambaAcctFlags'] == '[I ]') && ($_POST['computer_password'] == '')) 276 274 { … … 304 302 function edit_computer() 305 303 { 306 $ account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];307 $ acl = $this->functions->read_acl($account_lid);308 $manager_context = $acl[0]['context'];304 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 305 $manager_acl = $this->functions->read_acl($manager_lid); 306 $manager_contexts = $manager_acl['contexts']; 309 307 310 308 // Verifica se tem acesso a este modulo 311 if (!$this->functions->check_acl($ account_lid,'edit_computers'))309 if (!$this->functions->check_acl($manager_lid,'edit_computers')) 312 310 { 313 311 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); 314 312 } 315 313 314 // Set o header 316 315 unset($GLOBALS['phpgw_info']['flags']['noheader']); 317 316 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); … … 327 326 { 328 327 $uidnumber = $_GET['uidnumber']; 329 $computer_data = $this->so->get_computer_data($uidnumber, $manager_context); 330 331 // Pega combo das organizações e seleciona um dos setores em caso de um erro na validaçao dos dados. 332 $sectors = $this->functions->get_organizations($manager_context, trim(strtolower($computer_data['context']))); 328 $computer_data = $this->so->get_computer_data($uidnumber); 329 330 // Gera combo sectors 331 foreach ($manager_contexts as $index=>$context) 332 $sectors .= $this->functions->get_organizations($context, trim(strtolower($computer_data['context']))); 333 333 334 334 // Cria combo de dominios do samba … … 411 411 { 412 412 // Pega combo das organizações e seleciona um dos setores em caso de um erro na validaçao dos dados. 413 $sectors = $this->functions->get_organizations($manager_context, trim(strtolower($_POST['sector_context']))); 413 foreach ($manager_contexts as $index=>$context) 414 $sectors .= $this->functions->get_organizations($context, trim(strtolower($_POST['sector_context']))); 415 //$sectors = $this->functions->get_organizations($manager_contexts); 414 416 415 417 // Cria combo de dominios do samba -
trunk/expressoAdmin1_2/inc/class.uigroups.inc.php
r46 r64 14 14 var $public_functions = array 15 15 ( 16 'list_groups' 17 'add_groups' 18 'edit_groups' 19 'css' 16 'list_groups' => True, 17 'add_groups' => True, 18 'edit_groups' => True, 19 'css' => True 20 20 ); 21 21 … … 50 50 { 51 51 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 52 $acl = $this->functions->read_acl($account_lid); 53 $context = $acl[0]['context']; 54 $context_display = $acl[0]['context_display']; 52 $manager_acl = $this->functions->read_acl($account_lid); 53 $raw_context = $acl['raw_context']; 54 $contexts = $manager_acl['contexts']; 55 foreach ($manager_acl['contexts_display'] as $index=>$tmp_context) 56 { 57 $context_display .= '<br>'.$tmp_context; 58 } 55 59 56 60 // Verifica se tem acesso a este modulo … … 85 89 'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.add_groups'), 86 90 'add_group_disabled' => $this->functions->check_acl($account_lid,'add_groups') ? '' : 'disabled', 87 'context' => $context,91 //'context' => $context, 88 92 'context_display' => $context_display, 89 93 'lang_groups_names' => lang('Groups Names'), … … 104 108 if ($GLOBALS['query'] != '') 105 109 { 106 $groups_info = $this->functions->get_list('groups', $GLOBALS['query'], $context );110 $groups_info = $this->functions->get_list('groups', $GLOBALS['query'], $contexts); 107 111 } 108 112 $total = count($groups_info); … … 144 148 if ($can_delete) 145 149 { 146 $p->set_var('delete_link',"<a href='#' onClick='javascript:delete_group(\"".$group['cn']."\",\"".$group['gidnumber']."\" ,\"".$context."\");'>Excluir</a>");150 $p->set_var('delete_link',"<a href='#' onClick='javascript:delete_group(\"".$group['cn']."\",\"".$group['gidnumber']."\");'>Excluir</a>"); 147 151 } 148 152 else … … 174 178 $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_group\');'); 175 179 176 $ account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];177 $ acl = $this->functions->read_acl($account_lid);178 $manager_context = $acl[0]['context'];180 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 181 $manager_acl = $this->functions->read_acl($manager_lid); 182 $manager_contexts = $manager_acl['contexts']; 179 183 180 184 // Verifica se tem acesso a este modulo 181 if (!$this->functions->check_acl($ account_lid,'add_groups'))185 if (!$this->functions->check_acl($manager_lid,'add_groups')) 182 186 { 183 187 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 194 198 195 199 // Pega combo das organizações e seleciona um dos setores em caso de um erro na validaçao dos dados. 196 $combo_manager_org = $this->functions->get_organizations($manager_context, trim(strtolower($group_info['context']))); 200 //$combo_manager_org = $this->functions->get_organizations($manager_context, trim(strtolower($group_info['context']))); 201 foreach ($manager_contexts as $index=>$context) 202 $combo_manager_org .= $this->functions->get_organizations($context, trim(strtolower($group_info['context']))); 197 203 $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], trim(strtolower($group_info['context']))); 198 204 199 205 // Chama funcao para criar lista de aplicativos disponiveis. 200 $apps = $this->functions->make_list_app($ account_lid, $manager_context, '');206 $apps = $this->functions->make_list_app($manager_lid); 201 207 202 208 // Cria combo de dominio samba … … 210 216 { 211 217 // So mostra os sambaDomainName do contexto do manager 212 if ($this->ldap_functions->exist_sambadomains($manager_context , $a_sambadomain['samba_domain_name']))218 if ($this->ldap_functions->exist_sambadomains($manager_contexts, $a_sambadomain['samba_domain_name'])) 213 219 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 214 220 } … … 244 250 'disabled_samba' => 'disabled', 245 251 'display_samba_options' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : '"display:none"', 246 'disable_email_groups' => $this->functions->check_acl($ account_lid,'edit_email_groups') ? '' : 'disabled',252 'disable_email_groups' => $this->functions->check_acl($manager_lid,'edit_email_groups') ? '' : 'disabled', 247 253 'sambadomainname_options' => $sambadomainname_options, 248 254 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.list_groups'), … … 258 264 { 259 265 $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); 260 261 $ account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];262 $ acl = $this->functions->read_acl($account_lid);263 $manager_context = $acl[0]['context'];264 266 267 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 268 $manager_acl = $this->functions->read_acl($manager_lid); 269 $manager_contexts = $manager_acl['contexts']; 270 265 271 // Verifica se tem acesso a este modulo 266 if (!$this->functions->check_acl($ account_lid,'edit_groups'))272 if (!$this->functions->check_acl($manager_lid,'edit_groups')) 267 273 { 268 274 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 270 276 271 277 // GET all infomations about the group. 272 $group_info = $this->group->get_info($_GET['gidnumber'] , $manager_context);278 $group_info = $this->group->get_info($_GET['gidnumber']); 273 279 274 280 unset($GLOBALS['phpgw_info']['flags']['noheader']); … … 282 288 283 289 // Pega combo das organizações e seleciona a org do grupo. 284 $combo_manager_org = $this->functions->get_organizations($manager_context, trim(strtolower($group_info['context']))); 290 //$combo_manager_org = $this->functions->get_organizations($manager_context, trim(strtolower($group_info['context']))); 291 foreach ($manager_contexts as $index=>$context) 292 $combo_manager_org .= $this->functions->get_organizations($context, trim(strtolower($group_info['context']))); 285 293 $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], trim(strtolower($group_info['context']))); 286 294 … … 315 323 316 324 // Chama funcao para criar lista de aplicativos disponiveis. 317 $apps = $this->functions->make_list_app($ account_lid, $manager_context, $group_info['apps']);325 $apps = $this->functions->make_list_app($manager_lid, $group_info['apps']); 318 326 319 327 // Cria combo de dominios do samba … … 352 360 'lang_all_users' => lang('Select users from all sub-organizations'), 353 361 'gidnumber' => $group_info['gidnumber'], 354 'manager_context' => $manager_context,362 //'manager_context' => $manager_context, 355 363 'cn' => $group_info['cn'], 356 364 'user_count' => $user_count, … … 360 368 'use_attrs_samba_checked' => $group_info['sambaGroup'] ? 'CHECKED' : '', 361 369 'disabled_samba' => $group_info['sambaGroup'] ? '' : 'disabled', 362 'disable_email_groups' => $this->functions->check_acl($ account_lid,'edit_email_groups') ? '' : 'disabled',370 'disable_email_groups' => $this->functions->check_acl($manager_lid,'edit_email_groups') ? '' : 'disabled', 363 371 'sambadomainname_options' => $sambadomainname_options, 364 372 'phpgwaccountvisible_checked' => $group_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', -
trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php
r24 r64 45 45 function list_maillists() 46 46 { 47 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 48 $acl = $this->functions->read_acl($account_lid); 49 $context = $acl[0]['context']; 50 $context_display = $acl[0]['context_display']; 47 48 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 49 $manager_acl = $this->functions->read_acl($manager_lid); 50 $manager_contexts = $manager_acl['contexts']; 51 foreach ($manager_acl['contexts_display'] as $index=>$tmp_context) 52 { 53 $context_display .= '<br>'.$tmp_context; 54 } 51 55 52 56 // Verifica se tem acesso a este modulo 53 if (!$this->functions->check_acl($ account_lid,'list_maillists'))57 if (!$this->functions->check_acl($manager_lid,'list_maillists')) 54 58 { 55 59 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 80 84 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), 81 85 'add_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.add_maillists'), 82 'add_email_lists_disabled' => $this->functions->check_acl($account_lid,'add_maillists') ? '' : 'disabled', 83 'context' => $context, 86 'add_email_lists_disabled' => $this->functions->check_acl($manager_lid,'add_maillists') ? '' : 'disabled', 84 87 'context_display' => $context_display, 85 88 'lang_email_lists_uid' => lang('Email Lists Logins'), … … 103 106 if ($GLOBALS['query'] != '') 104 107 { 105 $maillists_info = $this->functions->get_list('maillists', $GLOBALS['query'], $ context);108 $maillists_info = $this->functions->get_list('maillists', $GLOBALS['query'], $manager_contexts); 106 109 } 107 110 $total = count($maillists_info); … … 114 117 else if ($total) 115 118 { 116 if ($this->functions->check_acl($ account_lid,'edit_maillists'))119 if ($this->functions->check_acl($manager_lid,'edit_maillists')) 117 120 { 118 121 $can_edit = True; 119 122 } 120 if ($this->functions->check_acl($ account_lid,'delete_maillists'))123 if ($this->functions->check_acl($manager_lid,'delete_maillists')) 121 124 { 122 125 $can_delete = True; … … 147 150 if ($can_delete) 148 151 { 149 $p->set_var('delete_link',"<a href='#' onClick='javascript:delete_maillist(\"".$maillist['uid']."\",\"".$maillist['uidnumber']."\" ,\"".$context."\");'>Excluir</a>");152 $p->set_var('delete_link',"<a href='#' onClick='javascript:delete_maillist(\"".$maillist['uid']."\",\"".$maillist['uidnumber']."\");'>Excluir</a>"); 150 153 } 151 154 else … … 163 166 { 164 167 $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); 165 166 $ account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];167 $ acl = $this->functions->read_acl($account_lid);168 $ context = $acl[0]['context'];169 168 169 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 170 $manager_acl = $this->functions->read_acl($manager_lid); 171 $manager_contexts = $manager_acl['contexts']; 172 170 173 // Verifica se tem acesso a este modulo 171 if (!$this->functions->check_acl($ account_lid,'add_maillists'))174 if (!$this->functions->check_acl($manager_lid,'add_maillists')) 172 175 { 173 176 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 184 187 185 188 // Pega combo das organizações. 186 $org = $this->functions->get_organizations($context, ''); 189 foreach ($manager_contexts as $index=>$context) 190 $sectors .= $this->functions->get_organizations($context); 187 191 188 192 // Seta variaveis utilizadas pelo tpl. … … 206 210 'lang_all_users' => lang('Show users from all sub-organizations'), 207 211 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), 208 'combo_org' => $ org,212 'combo_org' => $sectors 209 213 ); 210 214 $p->set_var($var); … … 213 217 } 214 218 215 216 219 function edit_maillists() 217 220 { 218 221 $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); 219 220 $ account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];221 $ acl = $this->functions->read_acl($account_lid);222 $manager_context = $acl[0]['context'];223 222 223 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 224 $manager_acl = $this->functions->read_acl($manager_lid); 225 $manager_contexts = $manager_acl['contexts']; 226 224 227 // Verifica se tem acesso a este modulo 225 if (!$this->functions->check_acl($ account_lid,'edit_maillists'))228 if (!$this->functions->check_acl($manager_lid,'edit_maillists')) 226 229 { 227 230 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 229 232 230 233 // GET all infomations about the group. 231 $maillist_info = $this->maillist->get_info($_GET['uidnumber'], $manager_context); 232 //_debug_array($maillist_info); 234 $maillist_info = $this->maillist->get_info($_GET['uidnumber']); 233 235 234 236 unset($GLOBALS['phpgw_info']['flags']['noheader']); … … 242 244 243 245 // Pega combo das organizações e seleciona a org da lista. 244 $org = $this->functions->get_organizations($manager_context, trim(strtolower($maillist_info['context']))); 246 foreach ($manager_contexts as $index=>$context) 247 $sectors .= $this->functions->get_organizations($context, trim(strtolower($maillist_info['context'])) ); 245 248 246 249 // Usuarios da lista. … … 301 304 'lang_all_users' => lang('Select users from all sub-organizations'), 302 305 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), 303 'combo_org' => $org, 304 'manager_context' => $manager_context, 306 'combo_org' => $sectors, 305 307 'uidnumber' => $_GET['uidnumber'], 306 308 'uid' => $maillist_info['uid'], … … 320 322 $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); 321 323 322 $ account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];323 $ acl = $this->functions->read_acl($account_lid);324 $manager_context = $acl[0]['context'];325 324 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 325 $manager_acl = $this->functions->read_acl($manager_lid); 326 $manager_contexts = $manager_acl['contexts']; 327 326 328 // Verifica se tem acesso a este modulo 327 if (!$this->functions->check_acl($ account_lid,'edit_maillists'))329 if (!$this->functions->check_acl($manager_lid,'edit_maillists')) 328 330 { 329 331 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 331 333 332 334 // GET all infomations about the group. 333 $maillist_info = $this->maillist->get_scl_info($_GET['uidnumber'], $manager_context); 334 //_debug_array($maillist_info); 335 $maillist_info = $this->maillist->get_scl_info($_GET['uidnumber']); 335 336 336 337 unset($GLOBALS['phpgw_info']['flags']['noheader']); … … 344 345 345 346 // Pega combo das organizações e seleciona a org da lista. 346 $org = $this->functions->get_organizations($manager_context, trim(strtolower($maillist_info['context']))); 347 // $org = $this->functions->get_organizations($manager_context, trim(strtolower($maillist_info['context']))); 348 foreach ($manager_contexts as $index=>$context) 349 $sectors .= $this->functions->get_organizations($context, trim(strtolower($maillist_info['context'])) ); 347 350 348 351 // Usuarios de senders. … … 378 381 'lang_all_users' => lang('Show users from all sub-organizations'), 379 382 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), 380 'combo_org' => $org, 381 'manager_context' => $manager_context, 383 'combo_org' => $sectors, 382 384 'uidnumber' => $_GET['uidnumber'], 383 385 'uid' => $maillist_info['uid'], -
trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php
r63 r64 18 18 'delete_managers' => True, 19 19 'edit_managers' => True, 20 'copy_managers' => True, 20 21 'validate' => True 21 22 ); … … 30 31 $c->read_repository(); 31 32 $this->config = $c->config_data; 33 34 if(!@is_object($GLOBALS['phpgw']->js)) 35 { 36 $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); 37 } 38 $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao 39 $GLOBALS['phpgw']->js->validate_file('jscode','managers','expressoAdmin1_2'); 32 40 } 33 41 … … 60 68 $p->set_block('managers','row','row'); 61 69 $p->set_block('managers','row_empty','row_empty'); 70 $tpl_vars = $p->get_undefined('body'); 62 71 63 72 $var = Array( 64 73 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.add_managers'), 65 74 'tr_color' => '#DDDDDD', 66 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 67 'lang_add_manager' => lang('Add Manager'), 68 'lang_manager_lid' => lang('Manager LID'), 69 'lang_manager_cn' => lang('Manager name'), 70 'lang_context' => lang('Context'), 71 'lang_edit' => lang('Edit'), 72 'lang_delete' => lang('Delete') 75 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'] 73 76 ); 74 77 75 // le do banco de dados para pegar os administradors. 78 // Cria dinamicamente os langs 79 foreach ($tpl_vars as $atribute) 80 { 81 $lang = strstr($atribute, 'lang_'); 82 if($lang !== false) 83 { 84 $p->set_var($atribute, $this->make_lang($atribute)); 85 } 86 } 87 88 // Le BD para pegar os administradors. 76 89 $query = 'SELECT manager_lid,context FROM phpgw_expressoadmin ORDER by manager_lid'; 77 90 $GLOBALS['phpgw']->db->query($query); … … 87 100 foreach($managers as $array_managers) 88 101 { 102 $managers_context = ""; 103 $a_managers_context = split("%", $array_managers['context']); 104 105 foreach ($a_managers_context as $context) 106 { 107 $managers_context .= "$context<br>"; 108 } 109 89 110 $filter="(&(phpgwAccountType=u)(uid=".$array_managers['manager_lid']."))"; 90 111 $ldap_search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); … … 92 113 $p->set_var('manager_lid', $array_managers[manager_lid]); 93 114 $p->set_var('manager_cn', $ldap_result[0]['cn'][0] == '' ? '<font color=red>NAO ENCONTRADO NO LDAP</font>' : $ldap_result[0]['cn'][0]); 94 $p->set_var('context', $ array_managers[context]);115 $p->set_var('context', $managers_context); 95 116 $p->set_var('link_edit',$this->row_action('edit','edit_managers',$array_managers[manager_lid],$array_managers[context])); 96 117 $p->set_var('link_delete',$this->row_action('delete','delete_managers',$array_managers[manager_lid],$array_managers[context])); 118 $p->set_var('link_copy',"<a href='#' onClick='javascript:copy_manager(\"".$array_managers['manager_lid']."\");'>Copiar</a>"); 97 119 $p->fp('rows','row',True); 98 120 } … … 116 138 $p->set_file(array('managers' => 'managers_form.tpl')); 117 139 $p->set_block('managers','form','form'); 140 $tpl_vars = $p->get_undefined('form'); 118 141 119 142 // Imprime o NavBar … … 122 145 $GLOBALS['phpgw']->common->phpgw_header(); 123 146 147 // Seta variaveis javascript necessárias 148 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 149 $scripts_java = '<script type="text/javascript" src="'.$webserver_url.'/expressoAdmin1_2/js/jscode/expressoadmin.js"></script>'; 150 151 // App, create list of available apps 152 $applications_list = $this->make_app_list(); 153 154 $input_context_fields = '<input type="text" size=60></input><br>'; 155 156 // Seta variaveis que estao no TPL 157 $var = Array( 158 'scripts_java' => $scripts_java, 159 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 160 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 161 'type' => "add", 162 'color_bg1' => "#E8F0F0", 163 'color_bg2' => "#D3DCE3", 164 'color_font1' => "#DDDDDD", 165 'color_font2' => "#EEEEEE", 166 'input_context_fields' => $input_context_fields, 167 'error_messages' => $_POST['error_messages'] == '' ? '' : '<script language="JavaScript">alert("'.$_POST['error_messages'].'");</script>', 168 'manager_lid' => $_POST['manager_lid'], 169 'context' => $_POST['context'], 170 'app_list' => $applications_list 171 ); 172 $p->set_var($var); 173 174 // Cria dinamicamente os langs e seta acls 175 foreach ($tpl_vars as $atribute) 176 { 177 $acl = strstr($atribute, 'acl_'); 178 $lang = strstr($atribute, 'lang_'); 179 // Recuperar os valores das ACLS 180 if ($acl !== false) 181 { 182 $p->set_var($atribute, $_POST[$atribute] != '' ? 'checked' : ''); 183 } 184 // Setar os langs do tpl. 185 elseif($lang !== false) 186 { 187 $p->set_var($atribute, $this->make_lang($atribute)); 188 } 189 } 190 191 echo $p->fp('out','form'); 192 } 193 194 function delete_managers() 195 { 196 // Criar uma verificação e jogar a query para o BO. 197 $context = $_GET['context']; 198 $manager_lid = $_GET['manager_lid']; 199 200 $query = "DELETE FROM phpgw_expressoadmin WHERE manager_lid = '".$manager_lid."' AND context = '" . $context ."'"; 201 $GLOBALS['phpgw']->db->query($query); 202 203 // Remove Gerente da tabela dos apps 204 $query = "DELETE FROM phpgw_expressoadmin_apps WHERE " 205 . "manager_lid = '".$manager_lid."' AND " 206 . "context = '".$context."'"; 207 $GLOBALS['phpgw']->db->query($query); 208 209 // Remove Gerente na ACL do expressoadmin 210 $accounts = CreateObject('phpgwapi.accounts'); 211 $manager_id = $accounts->name2id($_GET['manager_lid']); 212 $sql = "DELETE FROM phpgw_acl WHERE acl_appname = 'expressoadmin' AND acl_account = '" . $manager_id . "'"; 213 $GLOBALS['phpgw']->db->query($sql); 214 215 ExecMethod('expressoAdmin1_2.uimanagers.list_managers'); 216 } 217 218 function edit_managers() 219 { 220 // Caso nao seja admin, sai. 221 if ($GLOBALS['phpgw']->acl->check('group_access',1,'admin')) 222 { 223 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php')); 224 } 225 226 // Verifica se eh a primeira entrada, ai eu tenho o get, senao pego o post. 227 if ($_GET['manager_lid'] != '') 228 { 229 $first_time = true; 230 $_POST['manager_lid'] = $_GET['manager_lid']; 231 $_POST['context'] = $_GET['context']; 232 $old_manager_lid = $_GET['manager_lid']; 233 $old_context = $_GET['context']; 234 } 235 elseif ($_POST['manager_lid'] != '') 236 { 237 $first_time = false; 238 $old_manager_lid = $_POST['old_manager_lid']; 239 $old_context = $_POST['old_context']; 240 } 241 242 if ($first_time) 243 { 244 //Pego ACL do gerente 245 $manager = $this->functions->read_acl($_GET['manager_lid']); 246 //Cria vetor da ACL 247 $manager_acl = $this->functions->make_array_acl($manager['acl']); 248 249 //Pesquisa no Banco e pega os valores dos apps. 250 $query = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '" . $_GET['manager_lid'] . "' AND context = '" . $_GET['context'] . "'"; 251 $GLOBALS['phpgw']->db->query($query); 252 $i=0; 253 $manager[0]['apps'] = array(); 254 while($GLOBALS['phpgw']->db->next_record()) 255 { 256 $tmp[$i] = $GLOBALS['phpgw']->db->row(); 257 $_POST['applications_list'][$tmp[$i]['app']] = 1; 258 $manager[0]['apps'][$tmp[$i]['app']] = 1; 259 $i++; 260 } 261 } 262 263 // Seta o template 264 $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 265 $p->set_file(array('managers' => 'managers_form.tpl')); 266 $p->set_block('managers','form','form'); 267 $tpl_vars = $p->get_undefined('form'); 268 269 // Imprime o NavBar 270 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 271 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Managers'); 272 $GLOBALS['phpgw']->common->phpgw_header(); 273 124 274 // Seta variaveis javas necessárias 125 275 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 126 $scripts_java = ''; 127 $scripts_java .= '<script type="text/javascript" src="'.$webserver_url.'/expressoAdmin1_2/js/jscode/expressoadmin.js"></script>'; 128 276 $scripts_java = '<script type="text/javascript" src="'.$webserver_url.'/expressoAdmin1_2/js/jscode/expressoadmin.js"></script>'; 277 129 278 // App, create list of available apps 279 $applications_list = $this->make_app_list($manager[0]['apps']); 280 281 $a_context = split("%", $_POST['context']); 282 foreach ($a_context as $context) 283 $input_context_fields .= '<input type="text" value="'.$context.'" size=60></input><br>'; 284 285 $var = Array( 286 'scripts_java' => $scripts_java, 287 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 288 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 289 'color_bg1' => "#E8F0F0", 290 'color_bg2' => "#D3DCE3", 291 'color_font1' => "#DDDDDD", 292 'color_font2' => "#EEEEEE", 293 'type' => "edit", 294 'error_messages'=> $_POST['error_messages'] == '' ? '' : '<script language="JavaScript1.3">alert("'.$_POST['error_messages'].'");</script>', 295 'manager_lid' => $_POST['manager_lid'], 296 'context' => $_POST['context'], 297 298 'input_context_fields' => $input_context_fields, 299 300 // Para o update no banco, preciso saber oq foi alterado e para que. 301 // Talvez so o manager e o contexto. 302 'old_manager_lid' => $old_manager_lid, 303 'old_context' => $old_context, 304 'app_list' => $applications_list 305 ); 306 $p->set_var($var); 307 308 // Cria dinamicamente os langs e seta acls 309 foreach ($tpl_vars as $atribute) 310 { 311 $acl = strstr($atribute, 'acl_'); 312 $lang = strstr($atribute, 'lang_'); 313 // Recuperar os valores das ACLS 314 if ($acl !== false) 315 { 316 if ($first_time) 317 $p->set_var($atribute, $manager_acl[$atribute] != '' ? 'checked' : ''); 318 else 319 $p->set_var($atribute, $_POST[$atribute] != '' ? 'checked' : ''); 320 } 321 // Setar os langs do tpl. 322 elseif($lang !== false) 323 { 324 $p->set_var($atribute, $this->make_lang($atribute)); 325 } 326 } 327 328 echo $p->fp('out','form'); 329 } 330 331 function validate() 332 { 333 $accounts = CreateObject('phpgwapi.accounts'); 334 $errors = array(); 335 336 // verifica se o manager existe. caso retorne 1 existe e eh uma conta de usuario. 337 $manager_lid_exists = $accounts->exists($_POST['manager_lid']); 338 if ($manager_lid_exists != 1) 339 { 340 $_POST['error_messages'] = lang("Manager LID don't exist."); 341 if ($_POST['type'] == 'add') 342 $this->add_managers(); 343 elseif ($_POST['type'] == 'edit') 344 $this->edit_managers(); 345 return; 346 } 347 348 // Verifica se o contexto existe. 349 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 350 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 351 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 352 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 353 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 354 ldap_bind($ldap_conn,$dn,$passwd); 355 356 $contexts = split("%", $_POST['context']); 357 358 foreach ($contexts as $index=>$context) 359 { 360 $sr=@ldap_list($ldap_conn, $context, "cn=*"); 361 if (!$sr) 362 { 363 $_POST['error_messages'] = lang("Context don't exist") . ": $context"; 364 ldap_close($ldap_conn); 365 if ($_POST['type'] == 'add') 366 $this->add_managers(); 367 elseif ($_POST['type'] == 'edit') 368 $this->edit_managers(); 369 return; 370 } 371 } 372 373 if ($_POST['type'] == 'add') 374 { 375 //Verifica se ja existe o manager com aquele contexto cadastrado 376 $query = "SELECT manager_lid FROM phpgw_expressoadmin WHERE manager_lid = '" . $_POST['manager_lid'] . "' AND context = '" . $_POST['context'] . "'"; 377 $GLOBALS['phpgw']->db->query($query); 378 $num_registros = 0; 379 while($GLOBALS['phpgw']->db->next_record()) 380 { 381 $tmp[] = $GLOBALS['phpgw']->db->row(); 382 $num_registros++; 383 } 384 if ($num_registros != 0) 385 { 386 $_POST['error_messages'] = lang('Este Gerente, neste contexto já exite !!'); 387 $this->add_managers(); 388 return; 389 } 390 } 391 392 if ($_POST['type'] == 'add') 393 ExecMethod('expressoAdmin1_2.bomanagers.add_managers'); 394 elseif ($_POST['type'] == 'edit') 395 ExecMethod('expressoAdmin1_2.bomanagers.edit_managers'); 396 397 return true; 398 } 399 400 function copy_managers() 401 { 402 403 404 405 /* 406 echo '<pre>'; 407 print_r($_GET); 408 $manager_lid = $_GET['manager_lid']; 409 410 //Pego ACL do gerente 411 $manager = $this->functions->read_acl($manager_lid); 412 //Cria vetor da ACL 413 $manager_acl = $this->functions->make_array_acl($manager[0]['acl']); 414 415 //Pesquisa no Banco e pega os valores dos apps. 416 $query = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '" . $manager_lid . "' AND context = '" . $_GET['context'] . "'"; 417 $GLOBALS['phpgw']->db->query($query); 418 $i=0; 419 $manager[0]['apps'] = array(); 420 while($GLOBALS['phpgw']->db->next_record()) 421 { 422 $tmp[$i] = $GLOBALS['phpgw']->db->row(); 423 $_POST['applications_list'][$tmp[$i]['app']] = 1; 424 $manager[0]['apps'][$tmp[$i]['app']] = 1; 425 $i++; 426 } 427 428 print_r($manager); 429 430 */ 431 } 432 433 function make_lang($ram_lang) 434 { 435 $a_lang = split("_", $ram_lang); 436 $a_lang_reverse = array_reverse ( $a_lang, true ); 437 //Retira o lang do array. 438 array_pop ( $a_lang_reverse ); 439 $a_lang = array_reverse ( $a_lang_reverse, true ); 440 $a_new_lang = implode ( " ", $a_lang ); 441 return lang($a_new_lang); 442 } 443 444 function make_app_list($manager_app_list) 445 { 130 446 $this->nextmatchs = createobject('phpgwapi.nextmatchs'); 131 447 $apps = CreateObject('phpgwapi.applications',$_account_id); 132 448 $db_perms = $apps->read_account_specific(); 133 449 $availableApps = $GLOBALS['phpgw_info']['apps']; 450 134 451 uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);')); 135 452 136 453 // Loop para criar dinamicamente uma tabela com 3 colunas, cada coluna com um aplicativo e um check box. 137 454 $applications_list = ''; … … 141 458 $total_apps = count($availableApps); 142 459 $i = 0; 460 143 461 foreach($availableApps as $app => $data) 144 462 { … … 146 464 if (($i +1) % 3 == 1) 147 465 { 148 if ($ _POST['applications_list'][$app] == 1)466 if ($manager_app_list[$app] == 1) 149 467 $checked = 'checked'; 150 468 else … … 159 477 if (($i +1) % 3 == 2) 160 478 { 161 if ($ _POST['applications_list'][$app] == 1)479 if ($manager_app_list[$app] == 1) 162 480 $checked = 'checked'; 163 481 else … … 172 490 if (($i +1) % 3 == 0) 173 491 { 174 if ($ _POST['applications_list'][$app] == 1)492 if ($manager_app_list[$app] == 1) 175 493 $checked = 'checked'; 176 494 else … … 184 502 $i++; 185 503 } 186 187 // Seta variaveis que estao no TPL 188 $var = Array( 189 'scripts_java' => $scripts_java, 190 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 191 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 192 193 'type' => "add", 194 'color_bg1' => "#E8F0F0", 195 'color_bg2' => "#D3DCE3", 196 'color_font1' => "#DDDDDD", 197 'color_font2' => "#EEEEEE", 198 'lang_back' => lang('Back'), 199 'lang_add_save_manager' => lang('Add Manager'), 200 'lang_manager_lid' => lang('Manager LID'), 201 'lang_context' => lang('Context'), 202 'lang_type_access' => lang('Tipo de acessos'), 203 'lang_add_users' => lang('Add users'), 204 'lang_edit_users' => lang('Edit users'), 205 'lang_delete_users' => lang('Delete users'), 206 'lang_view_users' => lang('View user'), 207 'lang_rename_user' => lang('Rename users'), 208 'lang_view_user' => lang('View users'), 209 'lang_manipulate_corporative_information' => lang('Manipulate corporative information'), 210 'lang_add_groups' => lang('Add groups'), 211 'lang_edit_groups' => lang('Edit groups'), 212 'lang_delete_groups' => lang('Delete groups'), 213 'lang_edit_email_attribute_from_the_groups' => lang('Edit email attribute from the groups'), 214 'lang_change_user_password' => lang('Change users password'), 215 'lang_change_users_quote' => lang('Change users quote'), 216 'lang_set_user_default_password'=> lang('Set default users password'), 217 'lang_empty_user_inbox' => lang('Empty user inbox'), 218 'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'), 219 'lang_edit_sambadomains' => lang('Edit SAMBA domains'), 220 'lang_add_email_lists' => lang('Add email lists'), 221 'lang_edit_email_lists' => lang('Edit email lists'), 222 'lang_delete_email_lists' => lang('Delete email lists'), 223 'lang_view_email_lists' => lang('View email lists'), 224 'lang_create_orgs' => lang('Create Organizations'), 225 'lang_edit_orgs' => lang('Edit Organizations'), 226 'lang_delete_orgs' => lang('Delete Organizations'), 227 'lang_view_global_sessions' => lang('View sessions (global)'), 228 'lang_view_logs' => lang('View logs'), 229 'lang_create_computers' => lang('Create computers'), 230 'lang_edit_computers' => lang('Edit computers'), 231 'lang_delete_computers' => lang('Delete computers'), 232 'error_messages' => $_POST['error_messages'] == '' ? '' : '<script language="JavaScript1.3">alert("'.$_POST['error_messages'].'");</script>', 233 'manager_lid' => $_POST['manager_lid'], 234 'context' => $_POST['context'], 235 'add_users' => $_POST['add_users'] != '' ? 'checked' : '', 236 'edit_users' => $_POST['edit_users'] != '' ? 'checked' : '', 237 'view_users' => $_POST['view_users'] != '' ? 'checked' : '', 238 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '', 239 'delete_users' => $_POST['delete_users'] != '' ? 'checked' : '', 240 'add_groups' => $_POST['add_groups'] != '' ? 'checked' : '', 241 'edit_groups' => $_POST['edit_groups'] != '' ? 'checked' : '', 242 'delete_groups' => $_POST['delete_groups'] != '' ? 'checked' : '', 243 'change_users_password' => $_POST['change_users_password'] != '' ? 'checked' : '', 244 'change_users_quote' => $_POST['change_users_quote'] != '' ? 'checked' : '', 245 'set_user_default_password' => $_POST['set_user_default_password'] != '' ? 'checked' : '', 246 'edit_sambausers_attributes' => $_POST['edit_sambausers_attributes'] != '' ? 'checked' : '', 247 'edit_sambadomains' => $_POST['edit_sambadomains'] != '' ? 'checked' : '', 248 'add_maillists' => $_POST['add_maillists'] != '' ? 'checked' : '', 249 'edit_maillists' => $_POST['edit_maillists'] != '' ? 'checked' : '', 250 'delete_maillists' => $_POST['delete_maillists'] != '' ? 'checked' : '', 251 'create_sectors' => $_POST['create_sectors'] != '' ? 'checked' : '', 252 'edit_sectors' => $_POST['edit_sectors'] != '' ? 'checked' : '', 253 'delete_sectors' => $_POST['delete_sectors'] != '' ? 'checked' : '', 254 'view_global_sessions' => $_POST['view_global_sessions'] != '' ? 'checked' : '', 255 'view_logs' => $_POST['view_logs'] != '' ? 'checked' : '', 256 257 'app_list' => $applications_list 258 ); 259 $p->set_var($var); 260 echo $p->fp('out','form'); 261 } 262 263 function delete_managers() 264 { 265 // Criar uma verificação e jogar a query para o BO. 266 $context = $_GET['context']; 267 $manager_lid = $_GET['manager_lid']; 268 269 $query = "DELETE FROM phpgw_expressoadmin WHERE manager_lid = '".$manager_lid."' AND context = '" . $context ."'"; 270 $GLOBALS['phpgw']->db->query($query); 271 272 // Remove Gerente da tabela dos apps 273 $query = "DELETE FROM phpgw_expressoadmin_apps WHERE " 274 . "manager_lid = '".$manager_lid."' AND " 275 . "context = '".$context."'"; 276 $GLOBALS['phpgw']->db->query($query); 277 278 // Remove Gerente na ACL do expressoadmin 279 $accounts = CreateObject('phpgwapi.accounts'); 280 $manager_id = $accounts->name2id($_GET['manager_lid']); 281 $sql = "DELETE FROM phpgw_acl WHERE acl_appname = 'expressoadmin' AND acl_account = '" . $manager_id . "'"; 282 $GLOBALS['phpgw']->db->query($sql); 283 284 ExecMethod('expressoAdmin1_2.uimanagers.list_managers'); 285 } 286 287 function edit_managers() 288 { 289 // Caso nao seja admin, sai. 290 if ($GLOBALS['phpgw']->acl->check('group_access',1,'admin')) 291 { 292 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php')); 293 } 294 295 // Verifica se eh a primeira entrada, ai eu tenho o get, senao pego o post. 296 if ($_GET['manager_lid'] != '') 297 { 298 $_POST['manager_lid'] = $_GET['manager_lid']; 299 $_POST['context'] = $_GET['context']; 300 $old_manager_lid = $_GET['manager_lid']; 301 $old_context = $_GET['context']; 302 $first_time = true; 303 } 304 elseif ($_POST['manager_lid'] != '') 305 { 306 $old_manager_lid = $_POST['old_manager_lid']; 307 $old_context = $_POST['old_context']; 308 $first_time = false; 309 } 310 311 if ($first_time) 312 { 313 //Pesquisa no Banco e pega os valores da ACL 314 $query = "SELECT * FROM phpgw_expressoadmin WHERE manager_lid = '" . $_GET['manager_lid'] . "' AND context = '" . $_GET['context'] . "'"; 315 $GLOBALS['phpgw']->db->query($query); 316 while($GLOBALS['phpgw']->db->next_record()) 317 { 318 $manager[] = $GLOBALS['phpgw']->db->row(); 319 } 320 321 //Pesquisa no Banco e pega os valores dos apps. 322 $query = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '" . $_GET['manager_lid'] . "' AND context = '" . $_GET['context'] . "'"; 323 $GLOBALS['phpgw']->db->query($query); 324 $i=0; 325 $manager[0]['apps'] = array(); 326 while($GLOBALS['phpgw']->db->next_record()) 327 { 328 $tmp[$i] = $GLOBALS['phpgw']->db->row(); 329 $_POST['applications_list'][$tmp[$i]['app']] = 1; 330 $manager[0]['apps'][$tmp[$i]['app']] = 1; 331 $i++; 332 } 333 334 //Cria vetor da ACL 335 $acl = $this->functions->make_array_acl($manager[0]['acl']); 336 $_POST['add_users'] = $acl['add_users']; 337 $_POST['edit_users'] = $acl['edit_users']; 338 $_POST['delete_users'] = $acl['delete_users']; 339 $_POST['rename_users'] = $acl['rename_users']; 340 $_POST['view_users'] = $acl['view_users']; 341 $_POST['manipulate_corporative_information'] = $acl['manipulate_corporative_information']; 342 $_POST['add_groups'] = $acl['add_groups']; 343 $_POST['edit_groups'] = $acl['edit_groups']; 344 $_POST['delete_groups'] = $acl['delete_groups']; 345 $_POST['edit_email_groups'] = $acl['edit_email_groups']; 346 $_POST['change_users_password'] = $acl['change_users_password']; 347 $_POST['change_users_quote'] = $acl['change_users_quote']; 348 $_POST['set_user_default_password'] = $acl['set_user_default_password']; 349 $_POST['empty_user_inbox'] = $acl['empty_user_inbox']; 350 $_POST['edit_sambausers_attributes'] = $acl['edit_sambausers_attributes']; 351 $_POST['edit_sambadomains'] = $acl['edit_sambadomains']; 352 $_POST['add_maillists'] = $acl['add_maillists']; 353 $_POST['edit_maillists'] = $acl['edit_maillists']; 354 $_POST['delete_maillists'] = $acl['delete_maillists']; 355 $_POST['create_sectors'] = $acl['create_sectors']; 356 $_POST['edit_sectors'] = $acl['edit_sectors']; 357 $_POST['delete_sectors'] = $acl['delete_sectors']; 358 $_POST['create_computers'] = $acl['create_computers']; 359 $_POST['edit_computers'] = $acl['edit_computers']; 360 $_POST['delete_computers'] = $acl['delete_computers']; 361 $_POST['view_global_sessions'] = $acl['view_global_sessions']; 362 $_POST['view_logs'] = $acl['view_logs']; 363 } 364 365 // Seta o template 366 $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 367 //$accounts = CreateObject('phpgwapi.accounts'); 368 $p->set_file(array('managers' => 'managers_form.tpl')); 369 $p->set_block('managers','form','form'); 370 371 // Imprime o NavBar 372 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 373 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Managers'); 374 $GLOBALS['phpgw']->common->phpgw_header(); 375 376 // Seta variaveis javas necessárias 377 $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; 378 $scripts_java = ''; 379 $scripts_java .= '<script type="text/javascript" src="'.$webserver_url.'/expressoAdmin1_2/js/jscode/expressoadmin.js"></script>'; 380 381 // App, create list of available apps 382 $this->nextmatchs = createobject('phpgwapi.nextmatchs'); 383 $apps = CreateObject('phpgwapi.applications',$_account_id); 384 $db_perms = $apps->read_account_specific(); 385 $availableApps = $GLOBALS['phpgw_info']['apps']; 386 387 uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);')); 388 389 // Loop para criar dinamicamente uma tabela com 3 colunas, cada coluna com um aplicativo e um check box. 390 $applications_list = ''; 391 $app_col1 = ''; 392 $app_col2 = ''; 393 $app_col3 = ''; 394 $total_apps = count($availableApps); 395 $i = 0; 396 397 foreach($availableApps as $app => $data) 398 { 399 // 1 coluna 400 if (($i +1) % 3 == 1) 401 { 402 if ($_POST['applications_list'][$app] == 1) 403 $checked = 'checked'; 404 else 405 $checked = ''; 406 $app_col1 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='applications_list[%s]' value='1' %s %s></td>\n", 407 $data['title'],$app,$checked, $disabled); 408 409 if ($i == ($total_apps-1)) 410 $applications_list .= sprintf('<tr bgcolor="%s">%s</tr>',$this->nextmatchs->alternate_row_color(), $app_col1); 411 } 412 // 2 coluna 413 if (($i +1) % 3 == 2) 414 { 415 if ($_POST['applications_list'][$app] == 1) 416 $checked = 'checked'; 417 else 418 $checked = ''; 419 $app_col2 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='applications_list[%s]' value='1' %s %s></td>\n", 420 $data['title'],$app,$checked, $disabled); 421 422 if ($i == ($total_apps-1)) 423 $applications_list .= sprintf('<tr bgcolor="%s">%s%s</tr>',$this->nextmatchs->alternate_row_color(), $app_col1,$app_col2); 424 } 425 // 3 coluna 426 if (($i +1) % 3 == 0) 427 { 428 if ($_POST['applications_list'][$app] == 1) 429 $checked = 'checked'; 430 else 431 $checked = ''; 432 $app_col3 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='applications_list[%s]' value='1' %s %s></td>\n", 433 $data['title'],$app,$checked, $disabled); 434 435 // Cria nova linha 436 $applications_list .= sprintf('<tr bgcolor="%s">%s%s%s</tr>',$this->nextmatchs->alternate_row_color(), $app_col1, $app_col2, $app_col3); 437 } 438 $i++; 439 } 440 441 $var = Array( 442 'scripts_java' => $scripts_java, 443 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 444 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 445 'color_bg1' => "#E8F0F0", 446 'color_bg2' => "#D3DCE3", 447 'color_font1' => "#DDDDDD", 448 'color_font2' => "#EEEEEE", 449 'type' => "edit", 450 'lang_back' => lang('Back'), 451 'lang_add_save_manager' => lang('Save'), 452 'lang_manager_lid' => lang('Manager LID'), 453 'lang_context' => lang('Contexto'), 454 'lang_type_access' => lang('Tipo de acessos'), 455 'lang_add_users' => lang('Add users'), 456 'lang_edit_users' => lang('Edit users'), 457 'lang_delete_users' => lang('Delete users'), 458 'lang_view_users' => lang('View users'), 459 'lang_rename_user' => lang('Rename users'), 460 'lang_view_user' => lang('View users'), 461 'lang_manipulate_corporative_information' => lang('Manipulate corporative information'), 462 'lang_add_groups' => lang('Add groups'), 463 'lang_edit_groups' => lang('Edit groups'), 464 'lang_delete_groups' => lang('Delete groups'), 465 'lang_edit_email_attribute_from_the_groups' => lang('Edit email attribute from the groups'), 466 'lang_change_user_password' => lang('Change users password'), 467 'lang_change_users_quote' => lang('Change users quote'), 468 'lang_set_user_default_password'=> lang('Set default user password'), 469 'lang_empty_user_inbox' => lang('Empty user inbox'), 470 'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'), 471 'lang_edit_sambadomains' => lang('Edit SAMBA domains'), 472 'lang_add_email_lists' => lang('Add email lists'), 473 'lang_edit_email_lists' => lang('Edit email lists'), 474 'lang_delete_email_lists' => lang('Delete email lists'), 475 'lang_view_email_lists' => lang('View email lists'), 476 'lang_create_orgs' => lang('Create Organizations'), 477 'lang_edit_orgs' => lang('Edit Organizations'), 478 'lang_delete_orgs' => lang('Delete Organizations'), 479 'lang_view_sessions' => lang('View sessions (local)'), 480 'lang_view_global_sessions' => lang('View sessions (global)'), 481 'lang_view_logs' => lang('View Logs'), 482 'lang_create_computers' => lang('Create computers'), 483 'lang_edit_computers' => lang('Edit computers'), 484 'lang_delete_computers' => lang('Delete computers'), 485 'error_messages' => $_POST['error_messages'] == '' ? '' : '<script language="JavaScript1.3">alert("'.$_POST['error_messages'].'");</script>', 486 'manager_lid' => $_POST['manager_lid'], 487 'context' => $_POST['context'], 488 'add_users' => $_POST['add_users'] != '' ? 'checked' : '', 489 'edit_users' => $_POST['edit_users'] != '' ? 'checked' : '', 490 'delete_users' => $_POST['delete_users'] != '' ? 'checked' : '', 491 'rename_users' => $_POST['rename_users'] != '' ? 'checked' : '', 492 'view_users' => $_POST['view_users'] != '' ? 'checked' : '', 493 'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '', 494 'add_groups' => $_POST['add_groups'] != '' ? 'checked' : '', 495 'edit_groups' => $_POST['edit_groups'] != '' ? 'checked' : '', 496 'delete_groups' => $_POST['delete_groups'] != '' ? 'checked' : '', 497 'edit_email_groups' => $_POST['edit_email_groups'] != '' ? 'checked' : '', 498 'change_users_password' => $_POST['change_users_password'] != '' ? 'checked' : '', 499 'change_users_quote' => $_POST['change_users_quote'] != '' ? 'checked' : '', 500 'set_user_default_password' => $_POST['set_user_default_password'] != '' ? 'checked' : '', 501 'empty_user_inbox' => $_POST['empty_user_inbox'] != '' ? 'checked' : '', 502 'edit_sambausers_attributes' => $_POST['edit_sambausers_attributes'] != '' ? 'checked' : '', 503 'edit_sambadomains' => $_POST['edit_sambadomains'] != '' ? 'checked' : '', 504 'add_maillists' => $_POST['add_maillists'] != '' ? 'checked' : '', 505 'edit_maillists' => $_POST['edit_maillists'] != '' ? 'checked' : '', 506 'delete_maillists' => $_POST['delete_maillists'] != '' ? 'checked' : '', 507 'create_sectors' => $_POST['create_sectors'] != '' ? 'checked' : '', 508 'edit_sectors' => $_POST['edit_sectors'] != '' ? 'checked' : '', 509 'delete_sectors' => $_POST['delete_sectors'] != '' ? 'checked' : '', 510 'create_computers' => $_POST['create_computers'] != '' ? 'checked' : '', 511 'edit_computers' => $_POST['edit_computers'] != '' ? 'checked' : '', 512 'delete_computers' => $_POST['delete_computers'] != '' ? 'checked' : '', 513 'view_sessions' => $_POST['view_sessions'] != '' ? 'checked' : '', 514 'view_global_sessions' => $_POST['view_global_sessions'] != '' ? 'checked' : '', 515 'view_logs' => $_POST['view_logs'] != '' ? 'checked' : '', 516 517 // Para o update no banco, preciso saber oq foi alterado e para que. 518 // Talvez so o manager e o contexto. 519 'old_manager_lid' => $old_manager_lid, 520 'old_context' => $old_context, 521 'app_list' => $applications_list 522 ); 523 $p->set_var($var); 524 echo $p->fp('out','form'); 525 } 526 527 function validate() 528 { 529 $accounts = CreateObject('phpgwapi.accounts'); 530 $errors = array(); 531 532 // verifica se o manager existe. caso retorne 1 existe e eh uma conta de usuario. 533 $manager_lid_exists = $accounts->exists($_POST['manager_lid']); 534 if ($manager_lid_exists != 1) 535 { 536 $_POST['error_messages'] = lang("Manager LID don't exist."); 537 if ($_POST['type'] == 'add') 538 $this->add_managers(); 539 elseif ($_POST['type'] == 'edit') 540 $this->edit_managers(); 541 return; 542 } 543 544 // Verifica se o contexto existe. 545 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 546 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 547 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 548 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 549 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 550 ldap_bind($ldap_conn,$dn,$passwd); 551 552 $sr=@ldap_list($ldap_conn, $_POST['context'], "cn=*"); 553 if (!$sr) 554 { 555 $_POST['error_messages'] = lang("Context don't exist."); 556 ldap_close($ldap_conn); 557 if ($_POST['type'] == 'add') 558 $this->add_managers(); 559 elseif ($_POST['type'] == 'edit') 560 $this->edit_managers(); 561 return; 562 } 563 564 if ($_POST['type'] == 'add') 565 { 566 //Verifica se ja existe o manager com aquele contexto cadastrado 567 $query = "SELECT manager_lid FROM phpgw_expressoadmin WHERE manager_lid = '" . $_POST['manager_lid'] . "' AND context = '" . $_POST['context'] . "'"; 568 $GLOBALS['phpgw']->db->query($query); 569 $num_registros = 0; 570 while($GLOBALS['phpgw']->db->next_record()) 571 { 572 $tmp[] = $GLOBALS['phpgw']->db->row(); 573 $num_registros++; 574 } 575 if ($num_registros != 0) 576 { 577 $_POST['error_messages'] = lang('Este Gerente, neste contexto já exite !!'); 578 $this->add_managers(); 579 return; 580 } 581 } 582 583 if ($_POST['type'] == 'add') 584 ExecMethod('expressoAdmin1_2.bomanagers.add_managers'); 585 elseif ($_POST['type'] == 'edit') 586 ExecMethod('expressoAdmin1_2.bomanagers.edit_managers'); 587 588 return true; 504 return $applications_list; 589 505 } 590 506 } -
trunk/expressoAdmin1_2/inc/class.uisectors.inc.php
r46 r64 37 37 function list_sectors() 38 38 { 39 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 40 $tmp = $this->functions->read_acl($account_lid); 41 $manager_context = $tmp[0]['context']; 42 $context_display = $tmp[0]['context_display']; 43 39 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 40 $acl = $this->functions->read_acl($manager_lid); 41 $contexts = $acl['contexts']; 42 foreach ($acl['contexts_display'] as $index=>$tmp_context) 43 { 44 $context_display .= '<br>'.$tmp_context; 45 } 46 44 47 // Verifica se o administrador tem acesso. 45 if (!$this->functions->check_acl($ account_lid,'list_sectors'))48 if (!$this->functions->check_acl($manager_lid,'list_sectors')) 46 49 { 47 50 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 60 63 $p->set_block('sectors','row_empty','row_empty'); 61 64 62 //$sectors_info = $this->functions->get_sectors_list($manager_context); 63 //_debug_array($sectors_info); 64 $sectors_info = $this->functions->get_sectors_list($manager_context); 65 $sectors_info = $this->functions->get_sectors_list($contexts); 65 66 66 67 $var = Array( 67 68 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 68 69 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), 69 'context' => $manager_context,70 70 'context_display' => $context_display, 71 71 'lang_context' => lang('context'), … … 85 85 else 86 86 { 87 if ($this->functions->check_acl($ account_lid,'edit_sectors'))87 if ($this->functions->check_acl($manager_lid,'edit_sectors')) 88 88 { 89 89 $can_edit = True; 90 90 } 91 91 92 if ($this->functions->check_acl($ account_lid,'delete_sectors'))92 if ($this->functions->check_acl($manager_lid,'delete_sectors')) 93 93 { 94 94 $can_delete = True; … … 146 146 //_debug_array($_GET); 147 147 //_debug_array($_POST); 148 149 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 150 $acl = $this->functions->read_acl($account_lid); 151 $manager_context = $acl[0]['context']; 148 149 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 150 $acl = $this->functions->read_acl($manager_lid); 152 151 153 152 $context = $_GET['context']; 154 153 155 154 // Verifica se tem acesso a este modulo 156 if (!$this->functions->check_acl($ account_lid,'create_sectors'))155 if (!$this->functions->check_acl($manager_lid,'create_sectors')) 157 156 { 158 157 $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); … … 173 172 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'), 174 173 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 175 'context' => $context == '' ? $ manager_context: $context,174 'context' => $context == '' ? $GLOBALS['phpgw_info']['server']['ldap_context'] : $context, 176 175 'sector' => $_POST['sector'], 177 176 'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', -
trunk/expressoAdmin1_2/inc/class.user.inc.php
r63 r64 51 51 } 52 52 53 // Pega ID do BD e incrementa de 1. 54 $id = (($this->db_functions->get_next_id()) + 1); 55 53 // Leio o ID a ser usado na criação do objecto. 54 $next_id = ($this->db_functions->get_next_id('accounts')); 55 if ((!is_numeric($next_id['id'])) || (!$next_id['status'])) 56 { 57 $return['status'] = false; 58 $return['msg'] = "Problemas obtendo ID do usuário.\n" . $id['msg']; 59 return $return; 60 } 61 else 62 { 63 $id = $next_id['id']; 64 } 56 65 // Incrementa o id no BD. 57 $this->db_functions->increment_id($id,'accounts');66 //$this->db_functions->increment_id($id,'accounts'); 58 67 59 68 // Cria array para incluir no LDAP … … 155 164 foreach ($params as $atribute=>$value) 156 165 { 157 $pos = str rpos($atribute, 'corporative_information_');166 $pos = strstr($atribute, 'corporative_information_'); 158 167 if ($pos !== false) 159 168 { … … 259 268 $return['status'] = true; 260 269 261 $old_values = $this->get_user_info($new_values['uidnumber'], $new_values['manager_context']); 270 $old_values = $this->get_user_info($new_values['uidnumber']); 271 262 272 $dn = 'uid=' . $old_values['uid'] . ',' . strtolower($old_values['context']); 263 264 273 $diff = array_diff($new_values, $old_values); 265 274 266 275 $manager_account_lid = $_SESSION['phpgw_session']['session_lid']; 267 276 if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && 268 277 (!$this->functions->check_acl($manager_account_lid,'change_users_password')) && 269 (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) 278 (!$this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes')) && 279 (!$this->functions->check_acl($manager_account_lid,'manipulate_corporative_information')) 270 280 ) 271 281 { … … 368 378 // REPLACE, ADD & REMOVE COPORATIVEs ATRIBUTES 369 379 // Verifica o acesso do gerente aos atributos corporativos 370 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) 380 381 if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) || 382 ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information')) ) 371 383 { 372 384 foreach ($new_values as $atribute=>$value) 373 385 { 374 $pos = str rpos($atribute, 'corporative_information_');386 $pos = strstr($atribute, 'corporative_information_'); 375 387 if ($pos !== false) 376 388 { … … 504 516 if (($old_values['accountstatus'] == '') && ($new_values['accountstatus'] != '')) 505 517 { 518 echo '<pre>'; 519 print_r($old_values); 506 520 $ldap_add['accountstatus'] = 'active'; 507 521 $this->db_functions->write_log("ativado conta de email do usuario",'',$dn,'',''); … … 634 648 } 635 649 } 650 636 651 if (count($remove_groups)>0) 637 652 { 638 653 foreach($remove_groups as $gidnumber) 639 654 { 655 echo $gidnumber; 656 640 657 foreach($old_values['groups_info'] as $group) 641 658 { … … 676 693 if (count($ldap_add)) 677 694 { 678 695 print_r($ldap_add); 679 696 $result = $this->ldap_functions->add_user_attributes($dn, $ldap_add); 680 697 if (!$result['status']) … … 707 724 if (!$old_values['maillists']) 708 725 $old_values['maillists'] = array(); 709 726 710 727 $add_maillists = array_diff($new_values['maillists'], $old_values['maillists']); 711 728 $remove_maillists = array_diff($old_values['maillists'], $new_values['maillists']); … … 719 736 } 720 737 } 738 721 739 if (count($remove_maillists)>0) 722 740 { … … 776 794 } 777 795 778 function get_user_info($uidnumber , $context)796 function get_user_info($uidnumber) 779 797 { 780 $user_info_ldap = $this->ldap_functions->get_user_info($uidnumber , $context);798 $user_info_ldap = $this->ldap_functions->get_user_info($uidnumber); 781 799 $user_info_db1 = $this->db_functions->get_user_info($uidnumber); 782 $user_info_db2 = $this->ldap_functions->gidnumbers2cn($user_info_db1['groups'] , $context);800 $user_info_db2 = $this->ldap_functions->gidnumbers2cn($user_info_db1['groups']); 783 801 $user_info_imap = $this->imap_functions->get_user_info($user_info_ldap['uid']); 784 802 $user_info = array_merge($user_info_ldap, $user_info_db1, $user_info_db2, $user_info_imap); … … 837 855 { 838 856 $uidnumber = $params['uidnumber']; 839 $context = $params['context']; 840 $user_info = $this->get_user_info($uidnumber, $context); 857 $user_info = $this->get_user_info($uidnumber); 841 858 842 859 //LDAP … … 847 864 $return['msg'] .= $result_ldap['msg']; 848 865 } 849 850 //DB 851 $result_db = $this->db_functions->delete_user($user_info); 852 if (!$result_db['status']) 853 { 854 $return['status'] = false; 855 $return['msg'] .= $result_ldap['msg']; 856 } 857 858 //IMAP 859 $result_imap = $this->imap_functions->delete_user($user_info['uid']); 860 if (!$result_imap['status']) 861 { 862 $return['status'] = false; 863 $return['msg'] .= $result_ldap['msg']; 864 } 865 866 $this->db_functions->write_log('deletado usuario','',$user_info['uid'],'',''); 866 else 867 { 868 //DB 869 $result_db = $this->db_functions->delete_user($user_info); 870 if (!$result_db['status']) 871 { 872 $return['status'] = false; 873 $return['msg'] .= $result_ldap['msg']; 874 } 875 876 //IMAP 877 $result_imap = $this->imap_functions->delete_user($user_info['uid']); 878 if (!$result_imap['status']) 879 { 880 $return['status'] = false; 881 $return['msg'] .= $result_ldap['msg']; 882 } 883 $this->db_functions->write_log('deletado usuario','',$user_info['uid'],'',''); 884 } 867 885 } 868 886 … … 874 892 { 875 893 $return['status'] = true; 894 895 // Verifica acesso do gerente (OU) ao tentar renomear um usuário. 896 if ( ! $this->ldap_functions->check_access_to_renamed($params['uid']) ) 897 { 898 $return['status'] = false; 899 $return['msg'] .= 'Você não tem acesso para deletar este usuário.'; 900 return $return; 901 } 876 902 877 903 // Verifica o acesso do gerente … … 880 906 $uid = $params['uid']; 881 907 $new_uid = $params['new_uid']; 882 $context = $params['context'];883 908 $defaultUserPassword = '{md5}'.base64_encode(pack("H*",md5($this->current_config['expressoAdmin_defaultUserPassword']))); 884 909 $defaultUserPassword_plain = $this->current_config['expressoAdmin_defaultUserPassword']; … … 974 999 975 1000 $return['exec_return'] = ""; 976 return $return;977 1001 } 978 1002 else … … 981 1005 $return['msg'] .= "A renomeação de usuários só permitida com o cyrus versão 2.2 ou superior,"; 982 1006 $return['msg'] .= "\ne com a opção 'allowusermoves: yes' configurado no imapd.conf."; 983 return $return;984 1007 } 985 986 /********************* 987 * 988 * RENOMEAÇÃO APENAS PARA CYRUS 2.2 OU SUPERIOR 989 * 990 *********************/ 991 /* 992 //Verifica se o binario para renomeacao existe. 993 if (!is_file('/home/expressolivre/imapsync')) 994 { 995 $return['status'] = false; 996 $return['msg'] .= "O arquivo binário /home/expressolivre/imapsync não existe.\\nEle é necessário para a renomeação das caixas postais.\\nInforme o administrador ExpressoLivre sobre isto."; 997 } 998 999 // Seta senha default 1000 $user_password = $this->ldap_functions->set_user_password($uid, $defaultUserPassword); 1001 1002 // Renomeia UID no openldap 1003 $result = $this->ldap_functions->rename_uid($uid, $new_uid); 1004 $new_dn = $result['new_dn']; 1005 1006 if (!$result['status']) 1007 { 1008 $return['status'] = false; 1009 $return['msg'] .= "Erro ao renomear usuário no LDAP. Processo abortado."; 1010 return $return; 1011 } 1012 1013 // Pega a cota do usuario 1014 $quota = $this->imap_functions->get_user_info($uid); 1015 $quota_limit = $quota['mailquota']; 1016 if ($quota_limit == '-1') 1017 $quota_limit = '40960'; 1018 1019 //Cria a nova caixa postal 1020 $this->imap_functions->create($new_uid, $quota_limit); 1021 1022 // Realiza a cópia das mensagens de uma caixa para outra. 1023 $exec_return = array(); 1024 $exec_result = exec("/home/expressolivre/imapsync " . 1025 "--host1 localhost " . 1026 "--user1 " . $uid . ' ' . 1027 "--password1 $defaultUserPassword_plain " . 1028 "--host2 localhost " . 1029 "--user2 " . $new_uid . ' ' . 1030 "--password2 $defaultUserPassword_plain " . 1031 "--syncinternaldates --exclude user.*", $exec_return, $exec_result); 1032 1033 $reg_total = count($exec_return); 1034 1035 for ($i=$reg_total; $i>($reg_total-9); $i--) 1036 $return['exec_return'] .= $exec_return[$i] . "\n"; 1037 1038 //SIEVE 1039 if ($sieve_enable == 'yes') 1040 { 1041 include_once('sieve-php.lib.php'); 1042 1043 $sieve_uid = new sieve("$sieve_server", "$sieve_port", "$uid", "$defaultUserPassword_plain", '', "PLAIN"); 1044 $sieve_new_uid = new sieve("$sieve_server", "$sieve_port", "$new_uid", "$defaultUserPassword_plain", '', "PLAIN"); 1045 1046 if (!$sieve_uid->sieve_login()) 1047 { 1048 $return['status'] = false; 1049 $return['msg'] .= "\nNão foi possível fazer login no sieve:$uid"; 1050 } 1051 elseif (!$sieve_new_uid->sieve_login()) 1052 { 1053 $return['status'] = false; 1054 $return['msg'] .= "\nNão foi possível fazer login no sieve:$new_uid"; 1055 } 1056 else 1057 { 1058 $sieve_uid->sieve_listscripts(); 1059 $uid_active_script=$sieve_uid->response["ACTIVE"]; 1060 if(isset($uid_active_script)) 1061 { 1062 $i=0; 1063 $activescript=""; 1064 if($sieve_uid->sieve_getscript($uid_active_script)) 1065 { 1066 if(is_array($sieve_uid->response)) 1067 { 1068 foreach($sieve_uid->response as $result) 1069 { 1070 $activescript .= $result; 1071 } 1072 } 1073 } 1074 1075 $new_script_name = $new_uid; 1076 if ($sieve_new_uid->sieve_sendscript($new_script_name,$activescript)) 1077 { 1078 $sieve_new_uid->sieve_setactivescript($new_script_name); 1079 $return['exec_return'] .= "Script SIEVE transferido com êxito.\n"; 1080 } 1081 else 1082 { 1083 $return['status'] = false; 1084 $return['msg'] .= "Problemas na transferência do script Sieve.\\n"; 1085 } 1086 } 1087 else 1088 $return['exec_return'] .= "\n2"; 1089 } 1090 $sieve_uid->sieve_logout(); 1091 $sieve_new_uid->sieve_logout(); 1092 } 1093 else 1094 $return['exec_return'] .= "\n1"; 1095 1096 if ($exec_result) 1097 { 1098 // Deleta caixa-postal antiga 1099 $result = $this->imap_functions->delete_user($uid); 1100 if (!$result['status']) 1101 { 1102 $return['status'] = false; 1103 $return['msg'] .= $result['msg']; 1104 } 1105 } 1106 else 1107 { 1108 $return['status'] = false; 1109 $return['msg'] .= "Problemas ao executar o imapsinc. Caixa postal $uid não excluida."; 1110 } 1111 1112 // Retorna senha do usuário 1113 $this->ldap_functions->set_user_password($uid, $user_password); 1114 1115 // Remove old UID do ldap 1116 $user_info_mod_remove['uid'] = $uid; 1117 $this->ldap_functions->remove_user_attributes($new_dn, $user_info_mod_remove); 1118 1119 $this->db_functions->write_log('renomeado usuario',$new_uid,$uid,'',''); 1120 1121 return $return; 1122 */ 1008 return $return; 1123 1009 } 1124 1010 } -
trunk/expressoAdmin1_2/index.php
r27 r64 24 24 $_SESSION['phpgw_info']['expresso']['user'] = $GLOBALS['phpgw_info']['user']; 25 25 $_SESSION['phpgw_info']['expresso']['server'] = $GLOBALS['phpgw_info']['server']; 26 $_SESSION['phpgw_info']['expresso'][' ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null;26 $_SESSION['phpgw_info']['expresso']['cc_ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null; 27 27 $_SESSION['phpgw_info']['expresso']['expressoAdmin'] = $current_config; 28 28 $_SESSION['phpgw_info']['expresso']['global_denied_users'] = $GLOBALS['phpgw_info']['server']['global_denied_users']; -
trunk/expressoAdmin1_2/js/jscode/expressoadmin.js
r2 r64 55 55 } 56 56 57 58 function validade_managers_data()59 {60 if(document.managers_form.manager_lid.value == '') {61 alert('Campo "Manager LID" está vazio.');62 document.managers_form.manager_lid.focus();63 return;64 }65 else if(document.managers_form.context.value == '') {66 alert('Contexto está vazio.');67 document.managers_form.context.focus();68 return;69 }70 document.managers_form.submit();71 }72 73 57 function FormataValor(event, campo) 74 58 { -
trunk/expressoAdmin1_2/js/jscode/users.js
r63 r64 447 447 alert(data.msg); 448 448 else 449 {450 449 alert('Senha default cadastrada com êxito!!'); 451 //location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users";452 }453 450 return; 454 451 } … … 463 460 alert(data.msg); 464 461 else 465 {466 462 alert('Senha do usuário retornado com êxito!!'); 467 //location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users";468 }469 463 return; 470 464 } … … 472 466 } 473 467 474 function delete_user(uid, uidnumber , context)475 { 476 if (confirm("Realmente de letarusuário " + uid + " ??"))468 function delete_user(uid, uidnumber) 469 { 470 if (confirm("Realmente deseja deletar o usuário " + uid + " ??")) 477 471 { 478 472 var handler_delete_user = function(data) … … 486 480 return; 487 481 } 488 cExecute ('$this.user.delete&uidnumber='+uidnumber+'&context='+context, handler_delete_user); 489 } 490 } 491 492 function rename_user(uid, uidnumber, context) 493 { 494 482 cExecute ('$this.user.delete&uidnumber='+uidnumber, handler_delete_user); 483 } 484 } 485 486 function rename_user(uid, uidnumber) 487 { 495 488 if (document.getElementById('accounts_form_imapDelimiter').value == '/') 496 489 var reUid = /^([a-zA-Z0-9_\.\-])+$/; … … 513 506 alert(data.msg); 514 507 else 515 cExecute ('$this.user.rename&uid='+uid+'&new_uid='+new_uid +'&context='+context, handler_rename);508 cExecute ('$this.user.rename&uid='+uid+'&new_uid='+new_uid, handler_rename); 516 509 517 510 return; … … 611 604 function get_available_sambadomains(context, type) 612 605 { 613 if ((type == 'create_user') && (document.getElementById('tabcontent 6').style.display != 'none'))606 if ((type == 'create_user') && (document.getElementById('tabcontent7').style.display != 'none')) 614 607 { 615 608 var handler_get_available_sambadomains = function(data) … … 635 628 } 636 629 } 630 637 631 cExecute ('$this.ldap_functions.exist_sambadomains_in_context&context='+context, handler_get_available_sambadomains); 638 632 } -
trunk/expressoAdmin1_2/setup/setup.inc.php
r47 r64 13 13 $setup_info['expressoAdmin1_2']['title'] = 'ExpressoAdmin 1.2'; 14 14 /* Ao incrementar versão, não esquecer de declarar função do tables_update.inc.php*/ 15 $setup_info['expressoAdmin1_2']['version'] = '1.2 40';15 $setup_info['expressoAdmin1_2']['version'] = '1.250'; 16 16 $setup_info['expressoAdmin1_2']['app_order'] = 1; 17 17 $setup_info['expressoAdmin1_2']['tables'][] = 'phpgw_expressoadmin'; -
trunk/expressoAdmin1_2/setup/tables_update.inc.php
r47 r64 9 9 * option) any later version. * 10 10 \**************************************************************************/ 11 $test[] = '1.2 40';11 $test[] = '1.221'; 12 12 function expressoAdmin1_2_upgrade1_221() 13 13 { … … 27 27 ); 28 28 29 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.24 ';29 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.240'; 30 30 return $GLOBALS['setup_info']['contactcenter']['currentver']; 31 31 } 32 33 function expressoAdmin1_2_upgrade1_240() 32 33 $test[] = '1.240'; 34 function expressoAdmin1_2_upgrade1_240() 34 35 { 35 36 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '1.250'; 37 return $GLOBALS['setup_info']['contactcenter']['currentver']; 36 38 } 39 37 40 ?> -
trunk/expressoAdmin1_2/templates/default/accounts.tpl
r13 r64 13 13 </td> 14 14 <td align="center" "left" width="50%"> 15 {lang_context }: <font color="blue">{context_display}</font>15 {lang_contexts}: <font color="blue">{context_display}</font> 16 16 </td> 17 17 <td align="right" "left" width="25%"> -
trunk/expressoAdmin1_2/templates/default/accounts_form.tpl
r63 r64 13 13 <form action="{action}" enctype="multipart/form-data" name="users_form" method="post"> 14 14 <input type="hidden" name="uidnumber" value="{uidnumber}"> 15 <input type="hidden" name="manager_context" value="{manager_context}">16 15 <input type="hidden" name="photo_exist" value="{photo_exist}"> 17 16 <input type="hidden" name="user_context" value="{user_context}"> … … 29 28 <th id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);">{lang_general_information}</a></th> 30 29 <th id="tab2" class="activetab" style="display:{display_corporative_information}"onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);">{lang_corporative_information}</a></th> 31 <th id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);">{lang_email_config}</a></th>32 <th id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);">{lang_groups_permission}</a></th>33 <th id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);">{lang_lists_permission}</a></th>34 <th id="tab6" class="activetab" onclick="javascript:tab.display(6);"><a href="#" tabindex="0" accesskey="6" onfocus="tab.display(6);" onclick="tab.display(6); return(false);">{lang_aplication_permission}</a></th>35 <th id="tab7" class="activetab" style="display:{display_samba_suport}" 30 <th id="tab3" class="activetab" style="display:{display_emailconfig}" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);">{lang_email_config}</a></th> 31 <th id="tab4" class="activetab" style="display:{display_groups}" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);">{lang_groups_permission}</a></th> 32 <th id="tab5" class="activetab" style="display:{display_emaillists}" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);">{lang_lists_permission}</a></th> 33 <th id="tab6" class="activetab" style="display:{display_applications}" onclick="javascript:tab.display(6);"><a href="#" tabindex="0" accesskey="6" onfocus="tab.display(6);" onclick="tab.display(6); return(false);">{lang_aplication_permission}</a></th> 34 <th id="tab7" class="activetab" style="display:{display_samba_suport}" onclick="javascript:tab.display(7);"><a href="#" tabindex="0" accesskey="7" onfocus="tab.display(7);" onclick="tab.display(7); return(false);">{lang_samba_config}</a></th> 36 35 </tr> 37 36 </table> -
trunk/expressoAdmin1_2/templates/default/config.tpl
r46 r64 2 2 <form method="POST" action="{action_url}"> 3 3 <table border="0" align="center"> 4 <script src="./expressoAdmin1_2/js/jscode/connector.js" type="text/javascript" language="JavaScript1.2"></script> 5 <script> 6 function test_db_connection() 7 { 8 var handler_test = function(data) 9 { 10 var result = document.getElementById('nextid_db_result'); 11 if (data.status) 12 result.innerHTML = '<font color=green><h3>OK</h3></font>'; 13 else 14 result.innerHTML = '<font color=red><h3>Fail</h3></font>'; 15 } 16 17 var host = document.getElementById('nextid_db_host').value; 18 var port = document.getElementById('nextid_db_port').value; 19 var name = document.getElementById('nextid_db_name').value; 20 var user = document.getElementById('nextid_db_user').value; 21 var pass = document.getElementById('nextid_db_password').value; 22 23 cExecute ('$this.db_functions.test_db_connection&host='+host+'&port='+port+'&name='+name+'&user='+user+'&pass='+pass, handler_test); 24 } 25 </script> 26 4 27 <!-- END header --> 5 28 <!-- BEGIN body --> … … 93 116 </td> 94 117 </tr> 118 119 <tr class="th"> 120 <td colspan="2" align="center"><b>{lang_Configurations_to_get_nextID_from_another_DB}<br>{lang_Leave_the_host_field_empty_to_use_the_same_DB_of_the_ExpressoLivre}</b></td> 121 </tr> 122 <tr class="row_off"> 123 <td>{lang_db_host}:</td> 124 <td><input id="nextid_db_host" name="newsettings[expressoAdmin_nextid_db_host]" value="{value_expressoAdmin_nextid_db_host}" size="30" /></td> 125 </tr> 126 <tr class="row_on"> 127 <td>{lang_db_port}:</td> 128 <td><input id="nextid_db_port" name="newsettings[expressoAdmin_nextid_db_port]" value="{value_expressoAdmin_nextid_db_port}" size="30" /></td> 129 </tr> 130 <tr class="row_off"> 131 <td>{lang_db_name}:</td> 132 <td><input id="nextid_db_name" name="newsettings[expressoAdmin_nextid_db_name]" value="{value_expressoAdmin_nextid_db_name}" size="30" /></td> 133 </tr> 134 <tr class="row_on"> 135 <td>{lang_db_user}:</td> 136 <td><input id="nextid_db_user" name="newsettings[expressoAdmin_nextid_db_user]" value="{value_expressoAdmin_nextid_db_user}" size="30" /></td> 137 </tr> 138 <tr class="row_off"> 139 <td>{lang_db_password}:</td> 140 <td><input id="nextid_db_password" name="newsettings[expressoAdmin_nextid_db_password]" value="{value_expressoAdmin_nextid_db_password}" size="30" /></td> 141 </tr> 142 <tr class="row_on"> 143 <td><input type="button" value="{lang_test_connection_with_DB}" onClick="javascript:test_db_connection()"></td> 144 <td><span>{lang_Result}: </span><span id="nextid_db_result"></span></td> 145 </tr> 146 95 147 <!-- END body --> 96 148 <!-- BEGIN footer --> -
trunk/expressoAdmin1_2/templates/default/managers.tpl
r2 r64 14 14 <tr bgcolor="{th_bg}"> 15 15 <td width="20%" align="center"><B>{lang_manager_lid}</B></td> 16 <td width="30%" align="center"><B>{lang_manager_ cn}</B></td>16 <td width="30%" align="center"><B>{lang_manager_name}</B></td> 17 17 <td width="30%" align="center"><B>{lang_context}</B></td> 18 18 <td width="5%" align="center"><B>{lang_edit}</B></td> 19 19 <td width="5%" align="center"><B>{lang_delete}</B></td> 20 <td width="5%" align="center"><B>{lang_copy}</B></td> 20 21 </tr> 21 22 {rows} … … 30 31 <td width="5%" align="center">{link_edit}</td> 31 32 <td width="5%" align="center">{link_delete}</td> 33 <td width="5%" align="center">{link_copy}</td> 32 34 </tr> 33 35 <!-- END row --> -
trunk/expressoAdmin1_2/templates/default/managers_form.tpl
r63 r64 10 10 <input type=hidden name="old_manager_lid" value="{old_manager_lid}"> 11 11 <input type=hidden name="old_context" value="{old_context}"> 12 <input type=hidden name="context"> 12 13 13 14 <table border="0" width="90%"> … … 16 17 <td colspan="2"> 17 18 <input type="button" value="{lang_back}" onclick="javascript:location.href='index.php?menuaction=expressoAdmin1_2.uimanagers.list_managers'"> 18 <input type="button" value="{lang_ add_save_manager}" onclick="javascript:validade_managers_data();">19 <input type="button" value="{lang_save}" onclick="javascript:validade_managers_data();"> 19 20 </td> 20 21 </tr> … … 30 31 <tr bgcolor="{color_font2}"> 31 32 <td>{lang_context}:</td> 32 <td><input type="text" name="context" value="{context}" size=50></input></td> 33 <td id="td_input_context"> 34 <span style="cursor:pointer" onclick="javascript:add_input_context();"> +</span> 35 <br> 36 {input_context_fields} 37 </td> 33 38 </tr> 34 39 <tr bgcolor="{color_bg2}"> … … 41 46 <tr bgcolor="{color_font1}" align='right'> 42 47 <td width="20%">{lang_add_users}:</td> 43 <td width="2%"><input type="checkbox" name="a dd_users" value="1" {add_users}></td>48 <td width="2%"><input type="checkbox" name="acl_add_users" value="1" {acl_add_users}></td> 44 49 <td width="20%">{lang_add_groups}:</td> 45 <td width="2%"><input type="checkbox" name="a dd_groups" value="16" {add_groups}></td>50 <td width="2%"><input type="checkbox" name="acl_add_groups" value="16" {acl_add_groups}></td> 46 51 <td width="20%">{lang_add_email_lists}:</td> 47 <td width="2%"><input type="checkbox" name="a dd_maillists" value="256" {add_maillists}></td>48 <td width="20%">{lang_create_org s}:</td>49 <td width="2%"><input type="checkbox" name=" create_sectors" value="4096" {create_sectors}></td>52 <td width="2%"><input type="checkbox" name="acl_add_maillists" value="256" {acl_add_maillists}></td> 53 <td width="20%">{lang_create_organizations}:</td> 54 <td width="2%"><input type="checkbox" name="acl_create_sectors" value="4096" {acl_create_sectors}></td> 50 55 </tr> 51 56 <tr bgcolor="{color_font2}" align='right'> 52 57 <td>{lang_edit_users}:</td> 53 <td><input type="checkbox" name=" edit_users" value="2" {edit_users}></td>58 <td><input type="checkbox" name="acl_edit_users" value="2" {acl_edit_users}></td> 54 59 <td>{lang_edit_groups}:</td> 55 <td><input type="checkbox" name=" edit_groups" value="32" {edit_groups}></td>60 <td><input type="checkbox" name="acl_edit_groups" value="32" {acl_edit_groups}></td> 56 61 <td>{lang_edit_email_lists}:</td> 57 <td><input type="checkbox" name=" edit_maillists" value="512" {edit_maillists}></td>58 <td>{lang_edit_org s}:</td>59 <td><input type="checkbox" name=" edit_sectors" value="8192" {edit_sectors}></td>62 <td><input type="checkbox" name="acl_edit_maillists" value="512" {acl_edit_maillists}></td> 63 <td>{lang_edit_organizations}:</td> 64 <td><input type="checkbox" name="acl_edit_sectors" value="8192" {acl_edit_sectors}></td> 60 65 </tr> 61 66 <tr bgcolor="{color_font1}" align='right'> 62 67 <td>{lang_delete_users}:</td> 63 <td><input type="checkbox" name=" delete_users" value="4" {delete_users}></td>68 <td><input type="checkbox" name="acl_delete_users" value="4" {acl_delete_users}></td> 64 69 <td>{lang_delete_groups}:</td> 65 <td><input type="checkbox" name=" delete_groups" value="64" {delete_groups}></td>70 <td><input type="checkbox" name="acl_delete_groups" value="64" {acl_delete_groups}></td> 66 71 <td>{lang_delete_email_lists}:</td> 67 <td><input type="checkbox" name=" delete_maillists" value="1024" {delete_maillists}></td>68 <td>{lang_delete_org s}:</td>69 <td><input type="checkbox" name=" delete_sectors" value="16384" {delete_sectors}></td>72 <td><input type="checkbox" name="acl_delete_maillists" value="1024" {acl_delete_maillists}></td> 73 <td>{lang_delete_organizations}:</td> 74 <td><input type="checkbox" name="acl_delete_sectors" value="16384" {acl_delete_sectors}></td> 70 75 </tr> 71 76 <tr bgcolor="{color_font2}" align='right'> 72 <td>{lang_rename_user }:</td>73 <td><input type="checkbox" name=" rename_users" value="8388608" {rename_users}></td>77 <td>{lang_rename_users}:</td> 78 <td><input type="checkbox" name="acl_rename_users" value="8388608" {acl_rename_users}></td> 74 79 <td>{lang_edit_email_attribute_from_the_groups}:</td> 75 <td><input type="checkbox" name=" edit_email_groups" value="67108864" {edit_email_groups}></td>80 <td><input type="checkbox" name="acl_edit_email_groups" value="67108864" {acl_edit_email_groups}></td> 76 81 </tr> 77 82 <tr bgcolor="{color_font1}" align='right'> 78 83 <td>{lang_manipulate_corporative_information}:</td> 79 <td><input type="checkbox" name=" manipulate_corporative_information" value="268435456" {manipulate_corporative_information}></td>84 <td><input type="checkbox" name="acl_manipulate_corporative_information" value="268435456" {acl_manipulate_corporative_information}></td> 80 85 </tr> 81 86 <tr bgcolor="{color_font1}" align='right'> 82 87 <td>{lang_view_user}:</td> 83 <td><input type="checkbox" name=" view_users" value="33554432" {view_users}></td>88 <td><input type="checkbox" name="acl_view_users" value="33554432" {acl_view_users}></td> 84 89 </tr> 85 90 <tr bgcolor="{color_font2}" align='right'> 86 <td>{lang_change_user _password}:</td>87 <td><input type="checkbox" name=" change_users_password" value="128" {change_users_password}></td>91 <td>{lang_change_users_password}:</td> 92 <td><input type="checkbox" name="acl_change_users_password" value="128" {acl_change_users_password}></td> 88 93 </tr> 89 94 <tr bgcolor="{color_font1}" align='right'> 90 95 <td>{lang_change_users_quote}:</td> 91 <td><input type="checkbox" name=" change_users_quote" value="262144" {change_users_quote}></td>96 <td><input type="checkbox" name="acl_change_users_quote" value="262144" {acl_change_users_quote}></td> 92 97 </tr> 93 98 <tr bgcolor="{color_font2}" align='right'> 94 <td>{lang_set_ user_default_password}:</td>95 <td><input type="checkbox" name=" set_user_default_password" value="524288" {set_user_default_password}></td>99 <td>{lang_set_default_users_password}:</td> 100 <td><input type="checkbox" name="acl_set_user_default_password" value="524288" {acl_set_user_default_password}></td> 96 101 </tr> 97 102 <tr bgcolor="{color_font1}" align='right'> 98 103 <td>{lang_empty_user_inbox}:</td> 99 <td><input type="checkbox" name=" empty_user_inbox" value="134217728" {empty_user_inbox}></td>104 <td><input type="checkbox" name="acl_empty_user_inbox" value="134217728" {acl_empty_user_inbox}></td> 100 105 </tr> 101 106 102 107 <tr><td> </td></tr> 103 108 <tr bgcolor="{color_font1}" align='right'> 104 <td style="{display_samba_suport}">{lang_edit_ sambausers_attributes}:</td>105 <td style="{display_samba_suport}"><input type="checkbox" name=" edit_sambausers_attributes" value="32768" {edit_sambausers_attributes}></td>109 <td style="{display_samba_suport}">{lang_edit_SAMBA_users_attributes}:</td> 110 <td style="{display_samba_suport}"><input type="checkbox" name="acl_edit_sambausers_attributes" value="32768" {acl_edit_sambausers_attributes}></td> 106 111 </tr> 107 112 <tr bgcolor="{color_font2}" align='right'> 108 <td style="{display_samba_suport}">{lang_edit_ sambadomains}:</td>109 <td style="{display_samba_suport}"><input type="checkbox" name=" edit_sambadomains" value="16777216" {edit_sambadomains}></td>113 <td style="{display_samba_suport}">{lang_edit_SAMBA_domains}:</td> 114 <td style="{display_samba_suport}"><input type="checkbox" name="acl_edit_sambadomains" value="16777216" {acl_edit_sambadomains}></td> 110 115 </tr> 111 116 <tr><td> </td></tr> 112 117 113 118 <tr bgcolor="{color_font2}" align='right'> 114 <td>{lang_ view_global_sessions}:</td>115 <td><input type="checkbox" name=" view_global_sessions" value="65536" {view_global_sessions}></td>119 <td>{lang_show_sessions}:</td> 120 <td><input type="checkbox" name="acl_view_global_sessions" value="65536" {acl_view_global_sessions}></td> 116 121 <td style="{display_samba_suport}">{lang_create_computers}:</td> 117 <td style="{display_samba_suport}"><input type="checkbox" name=" create_computers" value="1048576" {create_computers}></td>122 <td style="{display_samba_suport}"><input type="checkbox" name="acl_create_computers" value="1048576" {acl_create_computers}></td> 118 123 </tr> 119 124 <tr bgcolor="{color_font1}" align='right'> 120 125 <td>{lang_view_logs}:</td> 121 <td><input type="checkbox" name=" view_logs" value="131072" {view_logs}></td>126 <td><input type="checkbox" name="acl_view_logs" value="131072" {acl_view_logs}></td> 122 127 <td style="{display_samba_suport}">{lang_edit_computers}:</td> 123 <td style="{display_samba_suport}"><input type="checkbox" name=" edit_computers" value="2097152" {edit_computers}></td>128 <td style="{display_samba_suport}"><input type="checkbox" name="acl_edit_computers" value="2097152" {acl_edit_computers}></td> 124 129 </tr> 125 130 <tr bgcolor="{color_font2}" align='right'> … … 127 132 <td> </td> 128 133 <td style="{display_samba_suport}">{lang_delete_computers}:</td> 129 <td style="{display_samba_suport}"><input type="checkbox" name=" delete_computers" value="4194304" {delete_computers}></td>134 <td style="{display_samba_suport}"><input type="checkbox" name="acl_delete_computers" value="4194304" {acl_delete_computers}></td> 130 135 </tr> 131 136 </table></td></tr> … … 142 147 <tr bgcolor={color_bg1} align="left"> 143 148 <td> 144 <input type="button" value="{lang_ add_save_manager}" onclick="javascript:validade_managers_data();">149 <input type="button" value="{lang_save}" onclick="javascript:validade_managers_data();"> 145 150 <input type="button" value="{lang_back}" onclick="javascript:location.href='index.php?menuaction=expressoAdmin1_2.uimanagers.list_managers'"> 146 151 </td> -
trunk/expressoMail1_2/inc/class.ScriptS.inc.php
r51 r64 196 196 $special_char = false; 197 197 for ( $i = 0; $i < strlen($input); $i++ ) 198 if ( preg_match('/[ áéíóúàèìòùçãõâêôç]/', $input[$i]) )198 if ( preg_match('/[ÁáÉéÍíÓóÚúÀàÈèÌìÒòÙùÇçÃãÕõÂâÊêÔô]/', $input[$i]) ) 199 199 { 200 200 $special_char = true; -
trunk/expressoMail1_2/inc/class.exporteml.inc.php
r51 r64 44 44 45 45 // create EML File. 46 function createFileEml($sEMLData, $tempDir )46 function createFileEml($sEMLData, $tempDir, $id) 47 47 { 48 $file = "email_".md5(microtime()).".eml"; 48 if($id){ 49 $header = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $id), 80, 255); 50 $subject = $this->decode_subject($header->fetchsubject); 51 $subject = ereg_replace('/', '\'', $subject); 52 $file = $subject."_".$id.".eml"; 53 } 54 else{ 55 $file = "email_".md5(microtime()).".eml"; 56 } 49 57 $f = fopen($tempDir.'/'.$file,"w"); 50 58 … … 58 66 } 59 67 60 function createFileZip($files, $tempDir){ 61 68 function createFileZip($files, $tempDir){ 62 69 $tmp_zip_filename = "email_".md5(microtime()).".zip"; 63 70 $command = "cd " . $tempDir . "; nice zip -m " . $tmp_zip_filename . " " . $files; … … 85 92 $body = $this-> getBody($nMsgs); 86 93 $sEMLData = $this -> parseEml($header, $body); 87 $fileName = $this -> CreateFileEml($sEMLData, $tempDir );94 $fileName = $this -> CreateFileEml($sEMLData, $tempDir,$nMsgs); 88 95 if(!$fileName) { 89 96 $error = True; … … 91 98 } 92 99 else 93 $fileNames .= $fileName.' ';100 $fileNames .= "\"".$fileName."\" "; 94 101 95 102 } … … 124 131 for($i = 0; $i < count($array_ids); $i++) { 125 132 126 $header = $this-> getHeader($array_ids[$i]); 133 $header = $this-> getHeader($array_ids[$i]); 127 134 $body = $this-> getBody($array_ids[$i]); 128 $sEMLData = $this -> parseEml($header, $body); 129 $fileName = $this -> CreateFileEml($sEMLData, $tempDir );135 $sEMLData = $this -> parseEml($header, $body); 136 $fileName = $this -> CreateFileEml($sEMLData, $tempDir, $array_ids[$i]); 130 137 131 138 if(!$fileName) { … … 134 141 } 135 142 else 136 $fileNames .= $fileName.' ';143 $fileNames .= "\"".$fileName."\" "; 137 144 138 145 } … … 241 248 } 242 249 250 function decode_subject($string){ 251 if ((strpos(strtolower($string), '=?iso-8859-1') !== false) 252 || (strpos(strtolower($string), '=?windows-1252') !== false)){ 253 $elements = imap_mime_header_decode($string); 254 foreach ($elements as $el) 255 $return .= $el->text; 256 } 257 else if (strpos(strtolower($string), '=?utf-8') !== false) { 258 $elements = imap_mime_header_decode($string); 259 foreach ($elements as $el){ 260 $charset = $el->charset; 261 $text = $el->text; 262 if(!strcasecmp($charset, "utf-8") || 263 !strcasecmp($charset, "utf-7")) { 264 $text = iconv($charset, "ISO-8859-1", $text); 265 } 266 $return .= $text; 267 } 268 } 269 else 270 $return = $string; 271 272 return $this->remove_accents($return); 273 } 243 274 } 244 275 // END CLASS -
trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
r37 r64 108 108 '<td class="cc">' . 109 109 '<span name="cn">' . $contacts_result[$i]['cn'] . '</span>' . '<br>' . 110 '<a onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result[$i]["cn"].'\', \''.$contacts_result[$i]["mail"].'\')">' . 111 '<font color=blue>' . 112 '<span name="mail">' . $contacts_result[$i]['mail'] . '</span>' . '<br>' . 113 '</font>' . 114 '</a>' . 110 '<a href="#" onClick="javascript:QuickSearchUser.create_new_message(\''.$contacts_result[$i]["cn"].'\', \''.$contacts_result[$i]["mail"].'\')">'.$contacts_result[$i]['mail'].'</a><br>'. 115 111 $contacts_result[$i]['phone'] . 116 112 '</td>' . -
trunk/expressoMail1_2/js/QuickSearchUser.js
r37 r64 80 80 } 81 81 82 /*83 emQuickSearchUser.prototype.select_cc = function (cc) {84 table = cc.parentNode;85 table_children = table.childNodes;86 for (var i=0; i<table_children.length; i++)87 {88 if (table_children[i].nodeName === 'TR')89 {90 table_children[i].className = 'quicksearchcontacts_unselected';91 }92 }93 94 if (cc.className == 'quicksearchcontacts_unselected')95 {96 cc.className = 'quicksearchcontacts_selected'97 }98 }99 */100 101 82 emQuickSearchUser.prototype.create_new_message = function (cn, mail) { 102 83 _this.close_window(); -
trunk/expressoMail1_2/templates/default/index.tpl
r60 r64 30 30 <div align="center"> 31 31 <input type="text" id="em_message_search" size="18" maxlength="22"/> 32 <a class=''onMouseOut="window.status='';return true;" title="Abrir janela de Pesquisa..." onMouseOver="window.status='Abrir janela de Pesquisa...';return true;" href="javascript:void(0);" onClick="javascript:search_emails(Element('em_message_search').value)">32 <a onMouseOut="window.status='';return true;" title="Abrir janela de Pesquisa..." onMouseOver="window.status='Abrir janela de Pesquisa...';return true;" href="javascript:void(0);" onClick="javascript:search_emails(Element('em_message_search').value)"> 33 33 <img valign="center" align="center" src="templates/default/images/search.gif"> 34 34 </a> 35 <a class=''onMouseOut="window.status='';return true;" title="Pesquisar usuário..." onMouseOver="window.status='Pesquisar usuário...';return true;" href="javascript:void(0);" onClick="javascript:emQuickSearch(Element('em_message_search').value, 'null', 'null')">35 <a onMouseOut="window.status='';return true;" title="Pesquisar usuário..." onMouseOver="window.status='Pesquisar usuário...';return true;" href="javascript:void(0);" onClick="javascript:emQuickSearch(Element('em_message_search').value, 'null', 'null')"> 36 36 <img valign="center" align="center" src="templates/default/images/users.png"> 37 37 </a> -
trunk/instant_messenger/IMManager.php
r63 r64 3 3 4 4 require_once('inc/IMConfigure.php'); 5 5 require_once('inc/Jabberd2.abstract.php'); 6 7 ## limit to indefinite execution 8 set_time_limit (0); 9 6 10 ### 7 11 # definitions of socket - BEGIN … … 21 25 } 22 26 23 include 'inc/Jabberd2.abstract.php';24 25 27 $master = array(SOCKET_NON_SECURITY); 26 27 28 $users = array(); 28 29 29 $send = false; 30 30 31 while ( 1)31 while ( true ) 32 32 { 33 33 $read = $master; … … 36 36 37 37 $mod_fd = @stream_select($read, $_w , $_e , READ_SOCKET_AFTER_OF ); 38 38 39 39 if ( $mod_fd === FALSE ) 40 { 40 41 break; 42 } 41 43 42 44 for ( $i = 0; $i < $mod_fd; ++$i ) … … 65 67 $headers = (split("\n", $sock_data)); 66 68 67 preg_match('/^(GET|POST) \/(.+) HTTP\/1\. 1/U', $headers[0], $request);69 preg_match('/^(GET|POST) \/(.+) HTTP\/1\.\d/U', $headers[0], $request); 68 70 preg_match('/^Host: \w*:(.+)/', $headers[1], $host); 69 71 … … 90 92 foreach ( $users as $key => $val ) 91 93 { 92 if( $users[$key]['time0'] != $users[$key]['time1'])94 if( $users[$key]['time0'] > $users[$key]['time1'] ) 93 95 { 94 96 $users[$key]['time1'] = $users[$key]['time0']; 95 97 $users[$key]['attempt'] = 0; 96 readSocket($key); 97 //readSocket($users, $key); 98 readSocket($users, $key); 98 99 } 99 100 else … … 107 108 else 108 109 { 109 readSocket($key); 110 //readSocket($users, $key); 110 readSocket($users, $key); 111 111 } 112 112 } 113 114 //print_r("Session : " . $key . " | Count : " . count($users) . " | time 0 : " . $users[$key]['time0'] . " | time 1 : " . $users[$key]['time1'] . " | tentativas : " . $users[$key]['attempt'] . " \n"); 115 } 116 117 } 118 113 } 114 } 119 115 120 116 exit(0); 121 117 122 123 118 function connect(&$pUsers, $pSession) 124 119 { 120 global $users; 121 125 122 $sessionpath = explode(';', session_save_path()); 126 123 foreach ( $sessionpath as $path ) … … 182 179 } 183 180 184 //function readSocket(&$pUsers, $pSession) 185 function readSocket($pSession) 186 { 187 global $users; 181 function readSocket(&$pUsers, $pSession) 182 { 188 183 global $send; 189 184 $sessionpath = explode(';', session_save_path()); … … 204 199 if ( $is_user ) 205 200 { 206 $ users[$pSession]['time0'] = $_SESSION['phpgw_info']['instant_messenger']['time'];207 $readSocket = $users[$pSession]['jabber']->readSocket();201 $pUsers[$pSession]['time0'] = $_SESSION['phpgw_info']['instant_messenger']['time']; 202 $readSocket = @$pUsers[$pSession]['jabber']->readSocket(); 208 203 209 if ( $readSocket !== false ) 204 $connection_close_timeout = strpos($readSocket, "<stream:error"); 205 $connection_close_server = strpos($readSocket,"</stream:stream>"); 206 207 if ( ($readSocket !== false) && ($connection_close_timeout === false ) && ($connection_close_server === false )) 210 208 { 211 209 if ( !empty($readSocket) ) … … 221 219 if ( !is_null($value) ) 222 220 { 223 $ users[$pSession]['jabber']->writeSocket($value);221 $pUsers[$pSession]['jabber']->writeSocket($value); 224 222 $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] = NULL; 225 223 } … … 231 229 foreach ( $value as $key => $val ) 232 230 { 233 $ users[$pSession]['jabber']->getVcard($val);231 $pUsers[$pSession]['jabber']->getVcard($val); 234 232 unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out']['vcard'][$key]); 235 233 } … … 238 236 else 239 237 { 240 if ( method_exists($ users[$pSession]['jabber'], $action) )238 if ( method_exists($pUsers[$pSession]['jabber'], $action) ) 241 239 if ( $value ) 242 $ users[$pSession]['jabber']->$action($value);240 $pUsers[$pSession]['jabber']->$action($value); 243 241 else 244 $ users[$pSession]['jabber']->$action();242 $pUsers[$pSession]['jabber']->$action(); 245 243 unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out'][$action]); 246 244 } … … 249 247 else 250 248 { 251 close($pSession); 252 } 253 session_write_close(); 249 close($pSession); 250 } 254 251 break; 255 252 } 256 session_write_close(); 257 } 258 } 253 else 254 { 255 close($pSession); 256 } 257 break; 258 } 259 } 260 session_write_close(); 259 261 } 260 262 ?> -
trunk/instant_messenger/inc/Jabber.abstract.php
r55 r64 35 35 { 36 36 try 37 { 37 { 38 38 if ( !preg_match('/^(.+)@(.+)\/(.+):(\d+)$/',$pUser, $matches) ) 39 39 throw new Exception('[connect] #1 ' . $pUser . ' must be [USER]@[DOMAIN]/[RESOURCE]:[PORT] and [PORT] is integer. File: ' . __FILE__ . ' :: ' . __LINE__); … … 49 49 $xml .= "<stream:stream to='" . $SERVER . "' xmlns='jabber:client' "; 50 50 $xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"; 51 51 52 if ( $this->write($xml) === false ) 52 53 throw new Exception('[connect] #3 it isn\'t possible write in the socket ' . $socket . '. File: ' . __FILE__ . ' :: ' . __LINE__); … … 65 66 66 67 protected function connect( $pUser = false, $pPassword = false ) 67 { 68 { 68 69 try 69 70 { 70 71 $this->_connect($pUser, $pPassword); 72 71 73 if ( ($xml = $this->read()) === false ) 72 74 throw new Exception('[connect] #1 it isn\'t possible read the socket. File: ' . __FILE__ . ' :: ' . __LINE__); 73 75 74 76 if ( preg_match('/(<starttls .*<required\/><\/starttls>)/', $xml, $matches) ) 75 77 { … … 80 82 } 81 83 else 84 { 82 85 if ( !$this->_plain() ) 83 86 throw new Exception('[connect] #3 it isn\'t possible carry out the verification. File: ' . __FILE__ . ' :: ' . __LINE__); 87 } 84 88 85 89 return true; … … 170 174 throw new Exception('[_plain] #2 it isn\'t possible carry out the verification. File: ' . __FILE__ . ' :: ' . __LINE__); 171 175 172 while ( !preg_match("/<iq xmlns='jabber:client' id='auth_1' type='result'\/>/", ($readSocket = $this->read()), $matches) ) 173 usleep(10000); 176 while ( !preg_match("/<iq xmlns='jabber:client' id='auth_1' type='(result|error)'/", ($readSocket = $this->read()), $matches) ) 177 usleep(10000); 178 179 if($matches[1] == "error") 180 return false; 174 181 175 182 if ( ($xml = $this->read()) === false ) -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r63 r64 10 10 { 11 11 $return = null; 12 12 13 13 $_SESSION['phpgw_info']['instant_messenger']['time'] = time(); 14 14 $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = true; 15 15 $xml = $_SESSION['phpgw_info']['instant_messenger']['socket']['in']; 16 16 17 17 unset($_SESSION['phpgw_info']['instant_messenger']['socket']['in']); 18 18 $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = false; … … 110 110 } 111 111 ### - Fim vcard - ### 112 113 112 ## Final do Listen; 114 113 … … 437 436 function requireVcard() 438 437 { 438 439 439 $contacts = array(); 440 440 $contacts = $_SESSION['phpgw_info']['instant_messenger']['contacts']; -
trunk/instant_messenger/inc/im_acl.inc.php
r63 r64 30 30 $js = array( 31 31 $webserver_url . 'js/XMLTools.js', 32 $webserver_url . 'js/json.js',33 32 $webserver_url . 'js/im_functions.js', 34 33 $webserver_url . 'js/im_fcommon.js', 35 34 $webserver_url . 'js/im_var_globals.js', 36 35 $webserver_url . 'js/im_images.js', 36 $webserver_url . 'js/im_smiles.js', 37 37 $webserver_url . 'js/im_templates.js', 38 38 $webserver_url . 'js/im_win.js', … … 41 41 $webserver_url . 'js/im_preferences.js', 42 42 $webserver_url . 'js/im_init.js', 43 $webserver_url . 'js/im_subscription.js',43 $webserver_url . 'js/im_subscription.js', 44 44 ); 45 45 46 46 require_once('load_lang.php'); 47 47 48 /* 49 Os método PORTA (PROGRAMAÇÂO ORIENTADA A RECURSO TÉCNICO ALTERNATIVO) mais exatamente 50 métodos POG (PROGRAMAÇÂO ORIENTADO A GAMBIARRA) usados a seguir é devido a integração 51 dos diverso módulos do expresso com o mensageiro instantâneo e para manter a aplicação 52 crossbrowser! 53 54 [NUTS] Rodrigo Souza - 29/01/2007 55 */ 56 57 print ' 48 print ' 58 49 <link rel="stylesheet" href="' . $webserver_url . 'templates/default/css.css" /> 59 50 <link rel="stylesheet" href="' . $webserver_url . 'templates/default/messenger.css" /> … … 69 60 } 70 61 </script>'; 71 /* 72 isso se faz necessário para que não seja carregado duas vezes o arquivo wz_dragdrop 73 e que a função SET_DHTML seja executada uma única vez, caso contrário causa um erro 74 que finaliza a execução de todos as chamadas javascript em execução e as futuras 75 chamadas também não serão executadas 76 */ 77 78 print ' 62 63 print ' 79 64 <script> 80 65 if ( ini_wzdd ) … … 82 67 </script>'; 83 68 84 foreach ( $js as $key => $val ) 85 print '<script src="' . $val . '?' . filemtime($_SERVER['DOCUMENT_ROOT'] . '/' . $val) . '"></script>'; 86 87 /* 88 instrução break utilizada decorrente ao fato que o usuário pode ter multiplas permissão de 89 acesso ao modulo de mensagem instantanea ou seja pode possuir permissão tanto nos diversos 90 grupos que faz parte assim como permissão individual de acesso (permissão de acesso dada 91 especificamente ao usuaário) 92 */ 69 foreach ( $js as $key => $val ) 70 print '<script src="' . $val . '?' . filemtime($_SERVER['DOCUMENT_ROOT'] . '/' . $val) . '"></script>'; 93 71 94 72 } 95 96 73 break; 97 74 } -
trunk/instant_messenger/js/im_functions.js
r63 r64 9 9 this.im_time_ = false; 10 10 } 11 11 12 12 IM.prototype.load_im = function() 13 13 { 14 14 IM.listen(); 15 15 IM.requireContacts(); 16 16 17 17 var handler_Status = function(XmlData) 18 18 { … … 27 27 XMLTools.request('$this.Ujabber.MyPresence', 'GET', handler_Status); 28 28 }; 29 29 30 30 IM.prototype.listen = function() 31 31 { 32 32 if ( !this._listen ) 33 33 return false; 34 34 35 35 var _this = this; 36 36 var handler = function(data) … … 43 43 IM_Preferences.GetYourPreferences(); 44 44 } 45 45 46 46 _this.getContacts(data); 47 47 _this.getPresence(data); … … 49 49 _this.getMessages(data); 50 50 _this.getVcard(data); 51 51 52 52 if(!_this.vcards) 53 53 { … … 68 68 }; 69 69 70 /* 70 /* 71 71 * Contacts 72 72 */ 73 73 74 74 IM.prototype.requireContacts = function() 75 75 { … … 99 99 var a = document.createElement('div'); 100 100 a.innerHTML = XMLTools.transform(node, xsl); 101 101 102 102 div.innerHTML = ''; 103 103 div.appendChild(img); 104 104 div.appendChild(document.createTextNode(this.get_lang('List of Contacts'))); 105 105 div.appendChild(a); 106 106 107 107 var group = func.byId("all_groups").firstChild; 108 108 while ( group ) … … 123 123 img.id = "img_" + group.id; 124 124 var el_parent = group; 125 125 126 126 el_parent.insertBefore(img,el_parent.firstChild); 127 127 128 128 } catch(e){} 129 129 group = group.nextSibling; … … 136 136 //alert('getContacts()' + e); 137 137 } 138 139 }; 140 141 /* 138 139 }; 140 141 /* 142 142 * Visible / Unvisible 143 143 */ … … 152 152 img.src = img_group_close.src; 153 153 } 154 154 155 155 IM.prototype.unvisible_group = function(el) 156 156 { … … 162 162 img.src = img_group_open.src; 163 163 } 164 164 165 165 /* 166 166 * Presence 167 167 */ 168 168 169 169 IM.prototype.getPresence = function(data) 170 170 { … … 187 187 else 188 188 var status_message = false; 189 190 191 189 192 190 if( from ) … … 203 201 } 204 202 break; 205 206 203 case 'subscribed' : 207 204 // 208 205 break; 209 210 case 'unsubscribe' : 206 case 'unsubscribe' : 211 207 Subscription.unsubscribe(from); 212 208 type = 'unavailable'; 213 209 func.byId(from).firstChild.src = eval('img_' + type + '.src'); 214 210 break; 215 case 'unsubscribed' : 211 case 'unsubscribed' : 216 212 Subscription.unsubscribed(from); 217 213 type = 'unavailable'; … … 232 228 else 233 229 status.innerHTML = ''; 234 235 230 } 236 231 … … 244 239 if( status_message != "available" ) 245 240 lbl.innerHTML = "<span style='margin-left:10px'><br/> ( " + status_message + " )</span>"; 246 func.byId(from).appendChild(lbl); 241 func.byId(from).appendChild(lbl); 247 242 }else{ 248 243 var lbl = document.getElementById('status_message_' + from); … … 266 261 } 267 262 }; 268 263 269 264 /* 270 265 * Contatos - Offline 271 266 */ 272 267 273 268 IM.prototype.Contacts_Offline = function() 274 269 { … … 296 291 } 297 292 } 298 293 299 294 /* 300 295 * Get / Send - Messages 301 296 */ 302 297 303 298 IM.prototype.getMessages = function(data) 304 299 { … … 325 320 nickname = func.trim(nickname); 326 321 } 327 322 328 323 var win = document.getElementById(from + '_chatMessages'); 329 324 if ( !win ) … … 332 327 win = document.getElementById(from + '_chatMessages'); 333 328 } 334 329 335 330 var el = message.firstChild; 336 331 while ( el ) … … 338 333 var xsl = XMLTools.load(im_path + 'xsl/message.xsl?' + Date.parse(new Date)); 339 334 var next = el.nextSibling; 340 335 341 336 var label = document.createElement('strong'); 342 337 if(nickname) 343 338 label.appendChild(document.createTextNode(nickname)); 344 339 else 345 label.appendChild(document.createTextNode(from)); 340 label.appendChild(document.createTextNode(from)); 346 341 win.appendChild(label); 347 342 win.appendChild(document.createElement('br')); … … 352 347 win.scrollTop = win.scrollHeight; 353 348 im_win.newMessageNotification(); 354 349 355 350 el = next; 356 351 } … … 370 365 } 371 366 } 372 367 373 368 IM.prototype.sendMessage = function (pJID) 374 369 { … … 391 386 392 387 envio.innerHTML = ''; 393 388 394 389 var message_element = document.getElementById(pJID + '_chatMessages'); 395 390 var nickname = "me "; … … 401 396 nickname = nickname.substr(nickname.indexOf(':') + 1 , nickname.length); 402 397 } 403 398 404 399 message_element.innerHTML += '<strong>' + nickname + ' '; 405 400 message_element.innerHTML += ' ' + _this.get_lang('speak') + ':</strong><br/>'; 406 401 message_element.innerHTML += message_text + '<br/>'; 407 402 message_element.scrollTop = message_element.scrollHeight; 408 403 409 404 var handler_sendMessage = function(data) 410 405 { … … 416 411 } 417 412 }; 418 413 419 414 IM.prototype.getComposing = function(data) 420 415 { … … 429 424 if ( composing.style.display = 'none' ) 430 425 composing.style.display = 'block'; 431 426 432 427 if ( node.nodeName == 'paused' ) 433 428 if ( (composing = func.byId(node.getAttribute('from') + '_composing')) ) … … 439 434 } 440 435 }; 441 436 442 437 /* 443 438 * Get_lang 444 439 */ 445 440 446 441 IM.prototype.get_lang = function(_key, _arg1, _arg2, _arg3, _arg4) 447 442 { 448 443 var _value = ""; 449 444 450 445 if ( !lang_im[_key.toLowerCase()] ) 451 446 return _key + "*"; 452 447 453 448 _value = lang_im[_key.toLowerCase()]; 454 449 455 450 if ( _arg1 || _arg2 ||_arg3 || _arg4 ) 456 451 { … … 462 457 } 463 458 } 464 459 465 460 return _value; 466 461 }; 467 462 468 463 IM.prototype.getWinContactsState = function() 469 464 { … … 474 469 win_state = ( win_state ) ? win_state : ( windowItems['contacts'].state == WINDOW_STATE_MAXIMIZED ) ? true : false; 475 470 return win_state; 476 471 477 472 }catch(e){} 478 473 }; 479 474 480 475 IM.prototype.showContacts = function() 481 476 { … … 488 483 } 489 484 }; 490 485 491 486 /* 492 487 * Smiles … … 503 498 return pEmotion; 504 499 } 505 500 506 501 IM.prototype.atalho = function() 507 502 { … … 548 543 * Vcard 549 544 */ 550 545 551 546 IM.prototype.requireVcard = function() 552 547 { … … 561 556 XMLTools.request('$this.Ujabber.requireVcard','GET',handler_getVcard); 562 557 } 563 558 564 559 IM.prototype.getVcard = function(data) 565 560 { 566 561 var _this = this; 567 562 try 568 { 563 { 569 564 if ( data.getElementsByTagName('vcard').length > 0 && !_this.statusvcard ) 570 565 { … … 572 567 var xsl = XMLTools.load(im_path + 'xsl/vcard_contacts.xsl?' + Date.parse(new Date)); 573 568 _this.statusvcard = true; 574 569 575 570 div.innerHTML = ""; 576 571 div.innerHTML += XMLTools.transform(data, xsl); … … 580 575 }catch(e){} 581 576 582 583 }; 584 577 578 }; 579 585 580 IM.prototype.open_chat = function(pJID) 586 581 { 587 582 im_win.open_chat(pJID); 588 583 }; 589 584 590 585 IM.prototype.action_button = function(pEv, pJid) 591 586 { … … 618 613 } 619 614 }; 620 615 621 616 IM.prototype.menu_button_right = function(pElement, pX, pY) 622 617 { … … 637 632 /* 638 633 * Menu 639 */ 634 */ 640 635 641 636 IM.prototype.menu_preferences = function() … … 644 639 var posy = 0; 645 640 var pEv = arguments[0]; 646 641 647 642 if (pEv.pageX || pEv.pageY) 648 643 { … … 655 650 posy = pEv.clientY + document.body.scrollTop + document.documentElement.scrollTop; 656 651 } 657 652 658 653 var p_element = document.getElementById(arguments[1]); 659 var _xmlDoc = ""; 654 var _xmlDoc = ""; 660 655 var _this = this; 661 656 662 _xmlDoc = '<menu>' + 663 '<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' + 657 _xmlDoc = '<menu>' + 658 '<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' + 664 659 '<item function="IM_Preferences.Remove_userLoad()" lang="'+IM.get_lang('Remove Contact')+'"/>' + 665 660 '<item function="IM_Preferences.vCard()" lang="'+IM.get_lang('Information')+'"/>' + 666 661 '<item function="IM_Preferences.yourPreferences()" lang="'+IM.get_lang('preferences')+'"/>' + 667 662 '</menu>'; 668 663 669 664 im_menu_action.menu(p_element.id,parse_XmlXsl(_xmlDoc,'menu_preferences.xsl')); 670 665 func.byId(p_element).style.top = posy; … … 674 669 _this.Load_Images_menu(); 675 670 } 676 671 677 672 IM.prototype.Load_Images_menu = function(Element) 678 673 { … … 681 676 var group = document.getElementById("dl_im_menu_preferences"); 682 677 var Child = group.childNodes; 683 678 684 679 for(var i = 0; i < Child.length; i++) 685 680 { … … 689 684 } 690 685 }catch (e){} 691 692 686 } 693 687 694 688 /* 695 689 * Função Provisória - By AlC … … 698 692 function parse_XmlXsl(_xmlDoc, form_xsl) 699 693 { 700 var xslWin = false; 701 694 var xslWin = false; 695 702 696 if ( !xslWin ) xslWin = XMLTools.load(im_path + 'xsl/' + form_xsl + '?' + Date.parse(new Date)); 703 697 704 698 a = document.createElement('div'); 705 699 if (window.ActiveXObject) … … 715 709 } 716 710 a.innerHTML = XMLTools.transform(xmlDoc, xslWin); 717 711 718 712 return a; 719 713 720 714 } 721 715 … … 724 718 var _dt = func.newEl('dt', 'dt', 'dt', 'dt', 'dt'); 725 719 var _a = func.newEl('a', 'a', 'a', 'a', 'a'); 726 720 727 721 for ( var i in _dt ) 728 722 { … … 732 726 eval('var option' + (parseInt(i)+1) + '_link = _a[' + i + '];'); 733 727 } 734 728 735 729 var _img = func.newEl('img', 'img', 'img', 'img','img'); 736 730 737 731 for ( var i in _img ) 738 732 { … … 741 735 eval('var option' + (parseInt(i)+1) + '_image = _img[' + i + '];'); 742 736 } 743 737 744 738 option1_link.onclick = function(){statusFlag = 'available'; IM.setStatus('available');}; 745 739 option2_link.onclick = function(){statusFlag = 'xa'; IM.setStatus('xa');}; … … 747 741 option4_link.onclick = function(){statusFlag = 'unavailable'; IM.setStatus('unavailable');}; 748 742 option5_link.onclick = function(){IM.setStatus('custom')}; 749 743 750 744 func.confEl(option1_image, 'src', img_available.src); 751 745 func.confEl(option1_image, 'style', 'width:16px;height:16px;cursor:pointer;'); … … 758 752 func.confEl(option5_image, 'src', img_edit.src); 759 753 func.confEl(option5_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 760 754 761 755 func.insEl(option1_image, IM.get_lang('online'), option1_link); 762 756 func.confEl(option1_link, 'style','cursor:pointer;'); … … 778 772 func.confEl(option5_link, 'style','cursor:pointer;'); 779 773 func.insEl(option5_link, option5); 780 774 781 775 im_menu_action.menu('fast_menu_im', option1, option2, option3, option4, option5); 782 776 }; … … 817 811 catch(e){} 818 812 }; 819 813 820 814 IM.prototype.ImgStatus = function(pStatus) 821 815 { … … 841 835 } 842 836 }; 843 837 844 838 IM.prototype.infoContact = function(pUid) 845 839 { -
trunk/instant_messenger/js/im_images.js
r55 r64 1 1 // Instant Messenger 2 // Images.js2 // im_images.js 3 3 4 4 var navbar = new Image(); … … 8 8 var img_group_open = new Image(); 9 9 img_group_open.src = im_path + "templates/default/images/group_open.gif"; 10 var img_down = new Image();11 img_down.src = im_path + "templates/default/images/down.gif";12 var img_up = new Image();13 img_up.src = im_path + "templates/default/images/up.gif";14 10 var img_available = new Image(); 15 11 img_available.src = im_path + "templates/default/images/available.gif"; … … 18 14 var img_busy = new Image(); 19 15 img_busy.src = im_path + "templates/default/images/busy.gif"; 20 var img_not_authorized = new Image();21 img_not_authorized.src = im_path + "templates/default/images/not_authorized.gif";22 16 var img_chat = new Image(); 23 17 img_chat.src = im_path + "templates/default/images/chat.gif"; 24 var img_open_box = new Image();25 img_open_box.src = im_path + "templates/default/images/open_box.gif";26 var img_close_box = new Image();27 img_close_box.src = im_path + "templates/default/images/close_box.gif";28 18 var img_photo = new Image(); 29 19 img_photo.src = im_path + "templates/default/images/photo.png"; 30 20 var img_menu = new Image(); 31 21 img_menu.src = im_path + "templates/default/images/menu.gif"; 32 var img_wait = new Image();33 img_wait.src = im_path + "templates/default/images/wait.gif";34 22 var img_chat_bubble = new Image(); 35 23 img_chat_bubble.src = im_path + "templates/default/images/chat_bubble.gif"; … … 38 26 var img_edit = new Image(); 39 27 img_edit.src = im_path + "templates/default/images/img/icon_edit.gif"; 40 41 28 var img_xa = new Image(); 42 29 img_xa.src = im_path + "templates/default/images/xa.gif"; … … 45 32 var img_dnd = new Image(); 46 33 img_dnd.src = im_path + "templates/default/images/dnd.gif"; 47 48 49 var smile_1 = new Image();50 smile_1.src = im_path + "templates/default/images/img/smiles/1.gif"51 var smile_2 = new Image();52 smile_2.src = im_path + "templates/default/images/img/smiles/2.gif"53 var smile_3 = new Image();54 smile_3.src = im_path + "templates/default/images/img/smiles/3.gif"55 var smile_4 = new Image();56 smile_4.src = im_path + "templates/default/images/img/smiles/4.gif"57 var smile_5 = new Image();58 smile_5.src = im_path + "templates/default/images/img/smiles/5.gif"59 var smile_6 = new Image();60 smile_6.src = im_path + "templates/default/images/img/smiles/6.gif"61 var smile_7 = new Image();62 smile_7.src = im_path + "templates/default/images/img/smiles/7.gif"63 var smile_8 = new Image();64 smile_8.src = im_path + "templates/default/images/img/smiles/8.gif"65 var smile_9 = new Image();66 smile_9.src = im_path + "templates/default/images/img/smiles/9.gif"67 var smile_10 = new Image();68 smile_10.src = im_path + "templates/default/images/img/smiles/10.gif"69 var smile_11 = new Image();70 smile_11.src = im_path + "templates/default/images/img/smiles/11.gif"71 var smile_12 = new Image();72 smile_12.src = im_path + "templates/default/images/img/smiles/12.gif"73 var smile_13 = new Image();74 smile_13.src = im_path + "templates/default/images/img/smiles/13.gif"75 var smile_14 = new Image();76 smile_14.src = im_path + "templates/default/images/img/smiles/14.gif"77 var smile_15 = new Image();78 smile_15.src = im_path + "templates/default/images/img/smiles/15.gif"79 var smile_16 = new Image();80 smile_16.src = im_path + "templates/default/images/img/smiles/16.gif"81 var smile_17 = new Image();82 smile_17.src = im_path + "templates/default/images/img/smiles/17.gif"83 var smile_18 = new Image();84 smile_18.src = im_path + "templates/default/images/img/smiles/18.gif"85 var smile_19 = new Image();86 smile_19.src = im_path + "templates/default/images/img/smiles/19.gif"87 var smile_20 = new Image();88 smile_20.src = im_path + "templates/default/images/img/smiles/20.gif"89 var smile_21 = new Image();90 smile_21.src = im_path + "templates/default/images/img/smiles/21.gif"91 var smile_22 = new Image();92 smile_22.src = im_path + "templates/default/images/img/smiles/22.gif"93 var smile_23 = new Image();94 smile_23.src = im_path + "templates/default/images/img/smiles/23.gif"95 var smile_24 = new Image();96 smile_24.src = im_path + "templates/default/images/img/smiles/24.gif"97 var smile_25 = new Image();98 smile_25.src = im_path + "templates/default/images/img/smiles/25.gif"99 var smile_26 = new Image();100 smile_26.src = im_path + "templates/default/images/img/smiles/26.gif"101 var smile_27 = new Image();102 smile_27.src = im_path + "templates/default/images/img/smiles/27.gif"103 var smile_28 = new Image();104 smile_28.src = im_path + "templates/default/images/img/smiles/28.gif"105 var smile_29 = new Image();106 smile_29.src = im_path + "templates/default/images/img/smiles/29.gif"107 var smile_30 = new Image();108 smile_30.src = im_path + "templates/default/images/img/smiles/30.gif"109 var smile_31 = new Image();110 smile_31.src = im_path + "templates/default/images/img/smiles/31.gif"111 var smile_32 = new Image();112 smile_32.src = im_path + "templates/default/images/img/smiles/32.gif"113 var smile_33 = new Image();114 smile_33.src = im_path + "templates/default/images/img/smiles/33.gif"115 var smile_34 = new Image();116 smile_34.src = im_path + "templates/default/images/img/smiles/34.gif"117 var smile_35 = new Image();118 smile_35.src = im_path + "templates/default/images/img/smiles/35.gif"119 var smile_36 = new Image();120 smile_36.src = im_path + "templates/default/images/img/smiles/36.gif"121 var smile_37 = new Image();122 smile_37.src = im_path + "templates/default/images/img/smiles/37.gif"123 var smile_38 = new Image();124 smile_38.src = im_path + "templates/default/images/img/smiles/38.gif"125 var smile_39 = new Image();126 smile_39.src = im_path + "templates/default/images/img/smiles/39.gif"127 var smile_40 = new Image();128 smile_40.src = im_path + "templates/default/images/img/smiles/40.gif"129 var smile_41 = new Image();130 smile_41.src = im_path + "templates/default/images/img/smiles/41.gif"131 var smile_42 = new Image();132 smile_42.src = im_path + "templates/default/images/img/smiles/42.gif"133 var smile_43 = new Image();134 smile_43.src = im_path + "templates/default/images/img/smiles/43.gif"135 var smile_44 = new Image();136 smile_44.src = im_path + "templates/default/images/img/smiles/44.gif"137 var smile_45 = new Image();138 smile_45.src = im_path + "templates/default/images/img/smiles/45.gif"139 var smile_46 = new Image();140 smile_46.src = im_path + "templates/default/images/img/smiles/46.gif"141 var smile_47 = new Image();142 smile_47.src = im_path + "templates/default/images/img/smiles/47.gif"143 var smile_48 = new Image();144 smile_48.src = im_path + "templates/default/images/img/smiles/48.gif"145 var smile_49 = new Image();146 smile_49.src = im_path + "templates/default/images/img/smiles/49.gif"147 var smile_50 = new Image();148 smile_50.src = im_path + "templates/default/images/img/smiles/50.gif"149 var smile_51 = new Image();150 smile_51.src = im_path + "templates/default/images/img/smiles/51.gif"151 var smile_52 = new Image();152 smile_52.src = im_path + "templates/default/images/img/smiles/52.gif"153 var smile_53 = new Image();154 smile_53.src = im_path + "templates/default/images/img/smiles/53.gif"155 var smile_54 = new Image();156 smile_54.src = im_path + "templates/default/images/img/smiles/54.gif" -
trunk/instant_messenger/js/im_init.js
r55 r64 3 3 try 4 4 { 5 if ( window.IM )5 if ( window.IM && window.im_win && window.func ) 6 6 IM.load_im(); 7 7 else -
trunk/instant_messenger/js/im_preferences.js
r60 r64 433 433 { 434 434 var numbers = /^\d+$/; 435 if(numbers.test(func.byId('in_time').value) )435 if(numbers.test(func.byId('in_time').value) && func.byId('in_time').value != "0") 436 436 var minutes = func.byId('in_time').value; 437 437 else 438 438 { 439 alert('Informe valores numéricos');439 alert('Informe valores válidos !'); 440 440 func.byId('in_time').focus(); 441 441 return false; -
trunk/instant_messenger/js/im_templates.js
r59 r64 139 139 Templates.prototype.emotions = function() 140 140 { 141 var smiles = new Array("\':)\'#smile_1.src","\':d\'#smile_2.src","\';)\'#smile_3.src","\':o\'#smile_4.src","\':p\'#smile_5.src","\'(h)\'#smile_6.src","\':@\'#smile_7.src","\':$\'#smile_8.src","\':s\'#smile_9.src","\':(\'#smile_10.src","\':\\\'\(\'#smile_11.src","\':|\'#smile_12.src"); 141 142 var grid = ''; 142 143 grid += '<table cellpadding="0" cellspacing="0" border="0">'; 143 grid += ' <tr>'; 144 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':)\')" id="sendMessageMenuId"><img alt=":)" width="19" height="19" src="' + smile_1.src + '" /></div></td>'; 145 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':d\')" id="sendMessageMenuId"><img alt=":d" width="19" height="19" src="' + smile_2.src + '" /></div></td>'; 146 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\';)\')" id="sendMessageMenuId"><img alt=";)" width="19" height="19" src="' + smile_3.src + '" /></div></td>'; 147 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':o\')" id="sendMessageMenuId"><img alt=":o" width="19" height="19" src="' + smile_4.src + '" /></div></td>'; 148 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':p\')" id="sendMessageMenuId"><img alt=":p" width="19" height="19" src="' + smile_5.src + '" /></div></td>'; 149 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(h)\')" id="sendMessageMenuId"><img alt="(h)" width="19" height="19" src="' + smile_6.src + '" /></div></td>'; 150 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':@\')" id="sendMessageMenuId"><img alt=":@" width="19" height="19" src="' + smile_7.src + '" /></div></td>'; 151 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':$\')" id="sendMessageMenuId"><img alt=":$" width="19" height="19" src="' + smile_8.src + '" /></div></td>'; 152 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':s\')" id="sendMessageMenuId"><img alt=":s" width="19" height="19" src="' + smile_9.src + '" /></div></td>'; 153 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':(\')" id="sendMessageMenuId"><img alt=":(" width="19" height="19" src="' + smile_10.src + '" /></div></td>'; 154 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':\\\'\(\')" id="sendMessageMenuId"><img alt=":\'(" width="19" height="19" src="' + smile_11.src + '" /></div></td>'; 155 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':|\')" id="sendMessageMenuId"><img alt=":|" width="19" height="19" src="' + smile_12.src + '" /></div></td>'; 156 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(6)\')" id="sendMessageMenuId"><img alt="(6)" width="19" height="19" src="' + smile_13.src + '" /></div></td>'; 157 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(a)\')" id="sendMessageMenuId"><img alt="(a)" width="19" height="19" src="' + smile_14.src + '" /></div></td>'; 158 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(l)\')" id="sendMessageMenuId"><img alt="(l)" width="19" height="19" src="' + smile_15.src + '" /></div></td>'; 159 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(u)\')" id="sendMessageMenuId"><img alt="(u)" width="19" height="19" src="' + smile_16.src + '" /></div></td>'; 160 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(m)\')" id="sendMessageMenuId"><img alt="(m)" width="19" height="19" src="' + smile_17.src + '" /></div></td>'; 161 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(@)\')" id="sendMessageMenuId"><img alt="(@)" width="19" height="19" src="' + smile_18.src + '" /></div></td>'; 162 grid += ' </tr>'; 163 grid += ' <tr>'; 164 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(&)\')" id="sendMessageMenuId"><img alt="(&)" width="19" height="19" src="' + smile_19.src + '" /></div></td>'; 165 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(S)\')" id="sendMessageMenuId"><img alt="(S)" width="19" height="19" src="' + smile_20.src + '" /></div></td>'; 166 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(*)\')" id="sendMessageMenuId"><img alt="(*)" width="19" height="19" src="' + smile_21.src + '" /></div></td>'; 167 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(~)\')" id="sendMessageMenuId"><img alt="(~)" width="19" height="19" src="' + smile_22.src + '" /></div></td>'; 168 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(8)\')" id="sendMessageMenuId"><img alt="(8)" width="19" height="19" src="' + smile_23.src + '" /></div></td>'; 169 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(e)\')" id="sendMessageMenuId"><img alt="(e)" width="19" height="19" src="' + smile_24.src + '" /></div></td>'; 170 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(f)\')" id="sendMessageMenuId"><img alt="(f)" width="19" height="19" src="' + smile_25.src + '" /></div></td>'; 171 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(w)\')" id="sendMessageMenuId"><img alt="(w)" width="19" height="19" src="' + smile_26.src + '" /></div></td>'; 172 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(o)\')" id="sendMessageMenuId"><img alt="(o)" width="19" height="19" src="' + smile_27.src + '" /></div></td>'; 173 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(k)\')" id="sendMessageMenuId"><img alt="(k)" width="19" height="19" src="' + smile_28.src + '" /></div></td>'; 174 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(g)\')" id="sendMessageMenuId"><img alt="(g)" width="19" height="19" src="' + smile_29.src + '" /></div></td>'; 175 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(^)\')" id="sendMessageMenuId"><img alt="(^)" width="19" height="19" src="' + smile_30.src + '" /></div></td>'; 176 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(p)\')" id="sendMessageMenuId"><img alt="(p)" width="19" height="19" src="' + smile_31.src + '" /></div></td>'; 177 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(i)\')" id="sendMessageMenuId"><img alt="(i)" width="19" height="19" src="' + smile_32.src + '" /></div></td>'; 178 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(c)\')" id="sendMessageMenuId"><img alt="(c)" width="19" height="19" src="' + smile_33.src + '" /></div></td>'; 179 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(t)\')" id="sendMessageMenuId"><img alt="(t)" width="19" height="19" src="' + smile_34.src + '" /></div></td>'; 180 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'({)\')" id="sendMessageMenuId"><img alt="({)" width="19" height="19" src="' + smile_35.src + '" /></div></td>'; 181 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(})\')" id="sendMessageMenuId"><img alt="(})" width="19" height="19" src="' + smile_36.src + '" /></div></td>'; 182 grid += ' </tr>'; 183 grid += ' <tr>'; 184 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(b)\')" id="sendMessageMenuId"><img alt="(b)" width="19" height="19" src="' + smile_37.src + '" /></div></td>'; 185 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(d)\')" id="sendMessageMenuId"><img alt="(d)" width="19" height="19" src="' + smile_38.src + '" /></div></td>'; 186 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(z)\')" id="sendMessageMenuId"><img alt="(z)" width="19" height="19" src="' + smile_39.src + '" /></div></td>'; 187 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(x)\')" id="sendMessageMenuId"><img alt="(x)" width="19" height="19" src="' + smile_40.src + '" /></div></td>'; 188 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(y)\')" id="sendMessageMenuId"><img alt="(y)" width="19" height="19" src="' + smile_41.src + '" /></div></td>'; 189 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(n)\')" id="sendMessageMenuId"><img alt="(n)" width="19" height="19" src="' + smile_42.src + '" /></div></td>'; 190 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':[\')" id="sendMessageMenuId"><img alt=":[" width="19" height="19" src="' + smile_43.src + '" /></div></td>'; 191 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(?)\')" id="sendMessageMenuId"><img alt="(?)" width="19" height="19" src="' + smile_44.src + '" /></div></td>'; 192 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(%)\')" id="sendMessageMenuId"><img alt="(%)" width="19" height="19" src="' + smile_45.src + '" /></div></td>'; 193 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(#)\')" id="sendMessageMenuId"><img alt="(#)" width="19" height="19" src="' + smile_46.src + '" /></div></td>'; 194 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(r)\')" id="sendMessageMenuId"><img alt="(r)" width="19" height="19" src="' + smile_47.src + '" /></div></td>'; 195 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':-#\')" id="sendMessageMenuId"><img alt=":-#" width="19" height="19" src="' + smile_48.src + '" /></div></td>'; 196 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'8o|\')" id="sendMessageMenuId"><img alt="8o|" width="19" height="19" src="' + smile_49.src + '" /></div></td>'; 197 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'8-|\')" id="sendMessageMenuId"><img alt="8-|" width="19" height="19" src="' + smile_50.src + '" /></div></td>'; 198 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'^o)\')" id="sendMessageMenuId"><img alt="^o)" width="19" height="19" src="' + smile_51.src + '" /></div></td>'; 199 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':-*\')" id="sendMessageMenuId"><img alt=":-*" width="19" height="19" src="' + smile_52.src + '" /></div></td>'; 200 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'+o(\')" id="sendMessageMenuId"><img alt="+o(" width="19" height="19" src="' + smile_53.src + '" /></div></td>'; 201 grid += ' <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(sn)\')" id="sendMessageMenuId"><img alt="(sn)" width="19" height="19" src="' + smile_54.src + '" /></div></td>'; 202 grid += ' </tr>'; 203 grid += ' <tr>'; 204 grid += ' <td colspan="18"><hr style="background:#cccccc;margin:1px:size:1px;"/></td>'; 205 grid += ' </tr>'; 206 grid += ' <tr>'; 207 grid += ' </tr>'; 208 grid += ' <td colspan="18"><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideEmotionSelection()" id="closeEmotionSelectionDiv">Close This Menu</div></td>'; 209 grid += ' </tr>'; 144 grid += '<tr>'; 145 for(var i = 0 ; i < 4; i++) 146 grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>'; 147 grid += '</tr>'; 148 grid += '<tr>'; 149 for(var i = 4 ; i < 8; i++) 150 grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>'; 151 grid += '</tr>'; 152 grid += '<tr>'; 153 for(var i = 8 ; i < 12; i++) 154 grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>'; 155 grid += '</tr>'; 156 grid += '<tr>'; 157 grid += '<td colspan="18"><hr style="background:#cccccc;margin:1px:size:1px;"/></td>'; 158 grid += '</tr>'; 159 grid += '<tr>'; 160 grid += '<td colspan="18"><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideEmotionSelection()" id="closeEmotionSelectionDiv">Close This Menu</div></td>'; 161 grid += '</tr>'; 210 162 grid += '</table>'; 211 212 return grid; 163 return grid; 213 164 } 214 165 215 166 Templates.prototype.font_name = function() 216 167 { 168 var fonts_n = new Array("Arial:Arial","Courier:Courier","Times:Times New Roman"); 217 169 var grid = ''; 218 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Arial\')" id="fontStyle1" style="width:120px;font-family:arial">Arial</div>'; 219 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Courier\')" id="fontStyle1" style="width:120px;font-family:Courier">Courier</div>'; 220 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Times\')" id="fontStyle1" style="width:120px;font-family:Times New Roman">Times New Roman</div>'; 221 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 222 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontNameSelection()" id="fontStyle1" style="width:120px">Close This Menu</div>'; 170 171 for(var i in fonts_n ) 172 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'' + fonts_n[i].substr(0,fonts_n[i].indexOf(':') + 1 )+'\')" id="fontStyle1" style="width:120px;font-family:'+fonts_n[i].substr(fonts_n[i].indexOf(':') + 1 )+'">' + fonts_n[i].substr(fonts_n[i].indexOf(':') + 1 ) + '</div>'; 173 174 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 175 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontNameSelection()" id="fontStyle1" style="width:120px">Close This Menu</div>'; 176 223 177 return grid; 224 178 } … … 226 180 Templates.prototype.font_size = function() 227 181 { 182 var fonts_s = new Array("9pt:9","10pt:10","11pt:11","12pt:12","14pt:14","16pt:16","18pt:18"); 228 183 var grid = ''; 229 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'9pt\');" id="fontStyle1" style="width:100px">9</div>'; 230 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'10pt\');" id="fontStyle1" style="width:100px">10</div>'; 231 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'11pt\');" id="fontStyle1" style="width:100px">11</div>'; 232 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'12pt\');" id="fontStyle1" style="width:100px">12</div>'; 233 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'14pt\');" id="fontStyle1" style="width:1!00px">14</div>'; 234 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'16pt\');" id="fontStyle1" style="width:100px">16</div>'; 235 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'18pt\');" id="fontStyle1" style="width:100px">18</div>'; 236 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 237 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontSizeSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>'; 184 185 for(var i in fonts_s) 186 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'' + fonts_s[i].substr(0,fonts_s[i].indexOf(':')) + '\');" id="fontStyle1" style="width:100px">' + fonts_s[i].substr(fonts_s[i].indexOf(':') + 1 ) + '</div>'; 187 188 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 189 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontSizeSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>'; 190 238 191 return grid; 239 192 } … … 241 194 Templates.prototype.font_color = function() 242 195 { 243 var grid = ''; 244 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#000000\')" id="fontStyle1" style="width:100px">Black</div>'; 245 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#c0c0c0\')" id="fontStyle1" style="width:100px">Silver</div>'; 246 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#ffff00\')" id="fontStyle1" style="width:100px">Yellow</div>'; 247 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#ff0000\')" id="fontStyle1" style="width:100px">Red</div>'; 248 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#ff00ff\')" id="fontStyle1" style="width:100px">Pink</div>'; 249 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#00ff00\')" id="fontStyle1" style="width:100px">Green</div>'; 250 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#1111ff\')" id="fontStyle1" style="width:100px">Blue</div>'; 251 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#800080\')" id="fontStyle1" style="width:100px">Magenta</div>'; 252 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 253 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontColorSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>'; 196 var fonts_c = new Array("#000000:Black","#c0c0c0:Silver","#ffff00:Yellow","#ff0000:Red","#ff00ff:Pink","#00ff00:Green","#1111ff:Blue","#800080:Magenta"); 197 var grid = ''; 198 199 for(var i in fonts_c) 200 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'' + fonts_c[i].substr(0,fonts_c[i].indexOf(':')) + '\')" id="fontStyle1" style="width:100px">' + fonts_c[i].substr(fonts_c[i].indexOf(':') + 1 ) + '</div>'; 201 202 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 203 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontColorSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>'; 204 254 205 return grid; 255 206 } … … 257 208 Templates.prototype.font_style = function() 258 209 { 210 var fonts = new Array("normal:Regular","italic:Italic","bold:Bold"); 259 211 var grid = ''; 260 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'normal\')" id="fontStyle1" style="width:100px">Regular</div>';261 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'italic\')" id="fontStyle1" style="width:100px"><i>Italic</i></div>';262 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'bold\')" id="fontStyle1" style="width:100px"><b>Bold</b></div>';263 264 265 266 212 213 for(var i in fonts) 214 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'' + fonts[i].substr(0,fonts.indexOf(':')) + '\')" id="fontStyle1" style="width:100px">' + fonts[i].substr( fonts[i].indexOf(':') + 1 ) + '</div>'; 215 grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>'; 216 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontStyleSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>'; 217 218 return grid; 267 219 } 268 220 … … 313 265 this.transfer = 0; 314 266 this.time_set = ""; 315 // Envia a Mensagem para a baixa do arquivo; 267 316 268 var h_name_file = function(data){ 317 //var pJID = "alexandrecorreia@im.pr.gov.br";318 269 var pJID = pJid; 319 270 var message_conf = '<iframe name="IM_down_file" style="display:none"></iframe>'+ -
trunk/instant_messenger/js/im_var_globals.js
r55 r64 80 80 cod_emotions[11] = /\:\'\(/gi; 81 81 cod_emotions[12] = /\:\|/gi; 82 cod_emotions[13] = /\(6\)/gi;83 cod_emotions[14] = /\(a\)/gi;84 cod_emotions[15] = /\(l\)/gi;85 cod_emotions[16] = /\(u\)/gi;86 cod_emotions[17] = /\(m\)/gi;87 cod_emotions[18] = /\(\@\)/gi;88 cod_emotions[19] = /\(\&\)/gi;89 cod_emotions[20] = /\(S\)/gi;90 cod_emotions[21] = /\(\*\)/gi;91 cod_emotions[22] = /\(\~\)/gi;92 cod_emotions[23] = /\(8\)/gi;93 cod_emotions[24] = /\(e\)/gi;94 cod_emotions[25] = /\(f\)/gi;95 cod_emotions[26] = /\(w\)/gi;96 cod_emotions[27] = /\(o\)/gi;97 cod_emotions[28] = /\(k\)/gi;98 cod_emotions[29] = /\(g\)/gi;99 cod_emotions[30] = /\(\^\)/gi;100 cod_emotions[31] = /\(p\)/gi;101 cod_emotions[32] = /\(i\)/gi;102 cod_emotions[33] = /\(c\)/gi;103 cod_emotions[34] = /\(t\)/gi;104 cod_emotions[35] = /\(\{\)/gi;105 cod_emotions[36] = /\(\}\)/gi;106 cod_emotions[37] = /\(b\)/gi;107 cod_emotions[38] = /\(d\)/gi;108 cod_emotions[39] = /\(z\)/gi;109 cod_emotions[40] = /\(x\)/gi;110 cod_emotions[41] = /\(y\)/gi;111 cod_emotions[42] = /\(n\)/gi;112 cod_emotions[43] = /\:\[/gi;113 cod_emotions[44] = /\(\?\)/gi;114 cod_emotions[45] = /\(\%\)/gi;115 cod_emotions[46] = /\(\#\)/gi;116 cod_emotions[47] = /\(r\)/gi;117 cod_emotions[48] = /\:\-\#/gi;118 cod_emotions[49] = /8o\|/gi;119 cod_emotions[50] = /8\-\|/gi;120 cod_emotions[51] = /\^o\)/gi;121 cod_emotions[52] = /\:\-\*/gi;122 cod_emotions[53] = /\+o\(/gi;123 cod_emotions[54] = /\(sn\)/gi; -
trunk/instant_messenger/js/im_win.js
r63 r64 50 50 font_size.innerHTML = Templates.font_size(); 51 51 font_color.innerHTML = Templates.font_color(); 52 font_style.innerHTML = Templates.font_style();52 /*font_style.innerHTML = Templates.font_style();*/ 53 53 54 54 var pId = 'contacts'; … … 670 670 text += '</dl>'; 671 671 text += '<div id="' + pId + '_divEdita" style="margin: 0px 2px"><iframe name="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '_edita" class="edit_message" id="' + pId + '_edita" frameborder="0" style="margin: 3px 1px 0px 2px; width:220px; height:50px; float:left;"></iframe></div>'; 672 text += '<br/><a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left;margin: 0px 2px;"><img src="' + im_path + 'templates/default/images/ img/skins/deathdart/send.gif" width="50" height="25" border=0 style="margin-top:3px"></a>';672 text += '<br/><a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left;margin: 0px 2px;"><img src="' + im_path + 'templates/default/images/send.gif" width="50" height="25" border=0 style="margin-top:3px"></a>'; 673 673 text += '<br style="clear:both" /><span id="' + pId + '_im_window_message" style="margin-left: 2px" />'; 674 674 … … 783 783 "addEmotion" : function(emotion) 784 784 { 785 786 787 788 789 this.hideEmotionSelection();785 var n_document = document.getElementById(this.chat_pJid + '_edita'); 786 var edita = n_document.contentWindow.document.getElementsByTagName('body').item(0); 787 edita.innerHTML += IM.emotions_icons(emotion); 788 789 this.hideEmotionSelection(); 790 790 }, 791 791
Note: See TracChangeset
for help on using the changeset viewer.