* * http://www.egroupware.org * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ class uiconfig { var $public_functions = array('index' => True); function index() { if ($GLOBALS['phpgw']->acl->check('site_config_access',1,'admin')) { $GLOBALS['phpgw']->redirect_link('/index.php'); } if(get_magic_quotes_gpc() && is_array($_POST['newsettings'])) { $_POST['newsettings'] = array_map("stripslashes", $_POST['newsettings']); } switch($_GET['appname']) { case 'admin': case 'addressbook': case 'calendar': case 'email': case 'instant_messenger': case 'jabberit_messenger': case 'nntp': /* Other special apps can go here for now, e.g.: case 'bogusappname': */ $appname = $_GET['appname']; $config_appname = 'phpgwapi'; break; case 'phpgwapi': case '': /* This keeps the admin from getting into what is a setup-only config */ $GLOBALS['phpgw']->redirect_link('/admin/index.php'); break; default: $appname = $_GET['appname']; $config_appname = $appname; break; } $t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir($appname)); $t->set_unknowns('keep'); $t->set_file(array('config' => 'config.tpl')); $t->set_block('config','header','header'); $t->set_block('config','body','body'); $t->set_block('config','footer','footer'); $c = CreateObject('phpgwapi.config',$config_appname); $c->read_repository(); if ($c->config_data) { $current_config = $c->config_data; } if ($_POST['cancel'] || $_POST['submit'] && $GLOBALS['phpgw']->acl->check('site_config_access',2,'admin')) { $GLOBALS['phpgw']->redirect_link('/admin/index.php'); } if ($_POST['submit']) { /* Load hook file with functions to validate each config (one/none/all) */ $GLOBALS['phpgw']->hooks->single('config_validate',$appname); if (!isset($_POST['newsettings']['cc_allow_details'])) { $_POST['newsettings']['cc_allow_details'] = "false"; } foreach($_POST['newsettings'] as $key => $config) { if ($config) { // Código adicionado if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && (function_exists($key) || function_exists(substr($key,0,strrpos($key,'_')))) ) { if(function_exists(substr($key,0,strrpos($key,'_')))) { call_user_func(substr($key,0,strrpos($key,'_')),&$config); } else { call_user_func($key,&$config); } if($GLOBALS['config_error']) { $errors .= lang($GLOBALS['config_error']) . ' '; $GLOBALS['config_error'] = False; } else { $c->config_data[$key] = $config; } } else { $c->config_data[$key] = $config; } } else { /* don't erase passwords, since we also don't print them */ if(!ereg('passwd',$key) && !ereg('password',$key) && !ereg('root_pw',$key) && !ereg('pw',$key)) { unset($c->config_data[$key]); } } } if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && function_exists('final_validation')) { final_validation($c->config_data); if($GLOBALS['config_error']) { $errors .= lang($GLOBALS['config_error']) . ' '; $GLOBALS['config_error'] = False; } unset($GLOBALS['phpgw_info']['server']['found_validation_hook']); } $c->save_repository(); if(!$errors) { $GLOBALS['phpgw']->redirect_link('/admin/index.php'); } } if($errors) { $t->set_var('error',lang('Error') . ': ' . $errors); $t->set_var('th_err','#FF8888'); unset($errors); unset($GLOBALS['config_error']); } else { $t->set_var('error',''); $t->set_var('th_err',$GLOBALS['phpgw_info']['theme']['th_bg']); } if(!@is_object($GLOBALS['phpgw']->js)) { $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); } $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); $campos = ''; $checked_box = array(); $i = 0; if($appname=="contactcenter") { foreach ($c->config_data as $key => $config) { $parts = explode('_', $key); if (is_numeric($parts[3]) && $parts[1]=='attribute') { $fields[$parts[3]][$key] = $config; } if($key == 'cc_allow_details') { $checkedCoisa = 'value="details"'; if ($config=='true') { $checkedCoisa = 'value="details" checked="checked"'; } } } $campos_vazio = true; $campos = " "; foreach ($fields as $i => $line) { if ($line["cc_attribute_name_$i"] != '' && $line["cc_attribute_ldapname_$i"] != '') { $campos_vazio = false; $selectedText = $line["cc_attribute_type_$i"] == 'text' ? 'selected="selected"' : ''; $selectedTMult = $line["cc_attribute_type_$i"] == 'multivalues' ? 'selected="selected"' : ''; $selectedYes = $line["cc_attribute_searchable_$i"] == 'true' ? 'selected="selected"' : ''; $selectedNo = $line["cc_attribute_searchable_$i"] == 'false' ? 'selected="selected"' : ''; $campos = $campos . " "; } } if ($campos_vazio) { $campos .= ""; } $campos = $campos . "
" . lang('Name') . " " . lang('Corresponding LDAP') . " " . lang('Type') . " " . lang('Searchable') . "
\"".
\"".
"; $t->set_var('lang_add_button', lang('Add')); $t->set_var('lang_cc_Set_details_attributes', lang('Details on the Global Catalog Address')); $t->set_var('lang_cc_Allow_view_details_label', lang('Enable display of contact details for the Global Catalog')); $t->set_var('attribute_fields', $campos); $t->set_var('cc_config_js', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_config.js'); $t->set_var('cc_allow_view_details_value', $checkedCoisa); } if($appname=="expressoAdmin1_2") { /* Varre a pasta inc do admin do expresso procurando scripts de geração de login automático (classes com nomes iniciados pela string 'login', procedida da string '_' mais o nome do algoritmo. */ $dir = $GLOBALS['phpgw']->common->get_app_dir($appname) . "/inc"; $options = ' '; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { $temp = explode(".",$file); if( (substr($temp[1],0,5) =='login') && ($temp[0] == 'class') ) { $options .= "