@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | Authorize the user to use setup app and load the database |
| 20 | 20 | Does not return unless user is authorized |
| 21 | 21 | */ |
| 22 | -if(!$GLOBALS['egw_setup']->auth('Config') || @$_POST['cancel']) |
|
| 22 | +if (!$GLOBALS['egw_setup']->auth('Config') || @$_POST['cancel']) |
|
| 23 | 23 | { |
| 24 | 24 | Header('Location: index.php'); |
| 25 | 25 | exit; |
@@ -55,35 +55,35 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $newsettings = $_POST['newsettings']; |
| 57 | 57 | |
| 58 | -if(@$_POST['submit'] && @$newsettings) |
|
| 58 | +if (@$_POST['submit'] && @$newsettings) |
|
| 59 | 59 | { |
| 60 | 60 | /* Load hook file with functions to validate each config (one/none/all) */ |
| 61 | - $GLOBALS['egw_setup']->hook('config_validate','setup'); |
|
| 61 | + $GLOBALS['egw_setup']->hook('config_validate', 'setup'); |
|
| 62 | 62 | |
| 63 | - $newsettings['tz_offset'] = date('Z')/3600; |
|
| 63 | + $newsettings['tz_offset'] = date('Z') / 3600; |
|
| 64 | 64 | |
| 65 | 65 | $GLOBALS['egw_setup']->db->transaction_begin(); |
| 66 | - foreach($newsettings as $setting => $value) |
|
| 66 | + foreach ($newsettings as $setting => $value) |
|
| 67 | 67 | { |
| 68 | - if(in_array($setting, (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && function_exists($setting)) |
|
| 68 | + if (in_array($setting, (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && function_exists($setting)) |
|
| 69 | 69 | { |
| 70 | 70 | $setting($newsettings); |
| 71 | - if($GLOBALS['config_error']) |
|
| 71 | + if ($GLOBALS['config_error']) |
|
| 72 | 72 | { |
| 73 | - $GLOBALS['error'] .= '<b>'.$GLOBALS['config_error'] ."</b><br />\n"; |
|
| 73 | + $GLOBALS['error'] .= '<b>'.$GLOBALS['config_error']."</b><br />\n"; |
|
| 74 | 74 | $GLOBALS['config_error'] = ''; |
| 75 | 75 | /* Bail out, stop writing config data */ |
| 76 | 76 | break; |
| 77 | 77 | } |
| 78 | - $value = $newsettings[$setting]; // it might be changed by the validation hook |
|
| 78 | + $value = $newsettings[$setting]; // it might be changed by the validation hook |
|
| 79 | 79 | } |
| 80 | 80 | /* Don't erase passwords, since we also do not print them below */ |
| 81 | - if(!empty($value) || !(stristr($setting,'passwd') || stristr($setting,'password') || stristr($setting,'root_pw'))) |
|
| 81 | + if (!empty($value) || !(stristr($setting, 'passwd') || stristr($setting, 'password') || stristr($setting, 'root_pw'))) |
|
| 82 | 82 | { |
| 83 | 83 | Api\Config::save_value($setting, $value, 'phpgwapi'); |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | - if(!$GLOBALS['error']) |
|
| 86 | + if (!$GLOBALS['error']) |
|
| 87 | 87 | { |
| 88 | 88 | $GLOBALS['egw_setup']->db->transaction_commit(); |
| 89 | 89 | // unset cached config, as this is the primary source for configuration now |
@@ -94,21 +94,21 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -$GLOBALS['egw_setup']->html->show_header(lang('Configuration'),False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
| 97 | +$GLOBALS['egw_setup']->html->show_header(lang('Configuration'), False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
| 98 | 98 | |
| 99 | 99 | // if we have an validation error, use the new settings made by the user and not the stored config |
| 100 | -if($GLOBALS['error'] && is_array($newsettings)) |
|
| 100 | +if ($GLOBALS['error'] && is_array($newsettings)) |
|
| 101 | 101 | { |
| 102 | 102 | $GLOBALS['current_config'] = $newsettings; |
| 103 | 103 | } |
| 104 | 104 | else |
| 105 | 105 | { |
| 106 | - foreach($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table,'*',false,__LINES__,__FILE__) as $row) |
|
| 106 | + foreach ($GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->config_table, '*', false, __LINES__, __FILE__) as $row) |
|
| 107 | 107 | { |
| 108 | 108 | $GLOBALS['current_config'][$row['config_name']] = $row['config_value']; |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | -$setup_tpl->pparse('out','T_config_pre_script'); |
|
| 111 | +$setup_tpl->pparse('out', 'T_config_pre_script'); |
|
| 112 | 112 | |
| 113 | 113 | /* Now parse each of the templates we want to show here */ |
| 114 | 114 | class phpgw |
@@ -118,84 +118,84 @@ discard block |
||
| 118 | 118 | var $db; |
| 119 | 119 | } |
| 120 | 120 | $GLOBALS['egw'] = new phpgw; |
| 121 | -$GLOBALS['egw']->db =& $GLOBALS['egw_setup']->db; |
|
| 121 | +$GLOBALS['egw']->db = & $GLOBALS['egw_setup']->db; |
|
| 122 | 122 | |
| 123 | 123 | $t = new Framework\Template(Framework\Template::get_dir('setup')); |
| 124 | 124 | |
| 125 | 125 | $t->set_unknowns('keep'); |
| 126 | 126 | $t->set_file(array('config' => 'config.tpl')); |
| 127 | -$t->set_block('config','body','body'); |
|
| 127 | +$t->set_block('config', 'body', 'body'); |
|
| 128 | 128 | |
| 129 | 129 | $vars = $t->get_undefined('body'); |
| 130 | -$GLOBALS['egw_setup']->hook('config','setup'); |
|
| 130 | +$GLOBALS['egw_setup']->hook('config', 'setup'); |
|
| 131 | 131 | |
| 132 | -foreach($vars as $value) |
|
| 132 | +foreach ($vars as $value) |
|
| 133 | 133 | { |
| 134 | - $valarray = explode('_',$value); |
|
| 134 | + $valarray = explode('_', $value); |
|
| 135 | 135 | $type = array_shift($valarray); |
| 136 | - $newval = implode(' ',$valarray); |
|
| 136 | + $newval = implode(' ', $valarray); |
|
| 137 | 137 | |
| 138 | 138 | switch ($type) |
| 139 | 139 | { |
| 140 | 140 | case 'lang': |
| 141 | - $t->set_var($value,lang($newval)); |
|
| 141 | + $t->set_var($value, lang($newval)); |
|
| 142 | 142 | break; |
| 143 | 143 | case 'value': |
| 144 | - $newval = str_replace(' ','_',$newval); |
|
| 144 | + $newval = str_replace(' ', '_', $newval); |
|
| 145 | 145 | /* Don't show passwords in the form */ |
| 146 | - if(strpos($value,'passwd') !== false || strpos($value,'password') !== false || strpos($value,'root_pw') !== false) |
|
| 146 | + if (strpos($value, 'passwd') !== false || strpos($value, 'password') !== false || strpos($value, 'root_pw') !== false) |
|
| 147 | 147 | { |
| 148 | - $t->set_var($value,''); |
|
| 148 | + $t->set_var($value, ''); |
|
| 149 | 149 | } |
| 150 | 150 | else |
| 151 | 151 | { |
| 152 | - $t->set_var($value,@$current_config[$newval]); |
|
| 152 | + $t->set_var($value, @$current_config[$newval]); |
|
| 153 | 153 | } |
| 154 | 154 | break; |
| 155 | 155 | case 'selected': |
| 156 | - $newvals = explode(' ',$newval); |
|
| 156 | + $newvals = explode(' ', $newval); |
|
| 157 | 157 | $setting = array_pop($newvals); |
| 158 | - $config = implode('_',$newvals); |
|
| 158 | + $config = implode('_', $newvals); |
|
| 159 | 159 | /* echo $config . '=' . $current_config[$config]; */ |
| 160 | - if(@$current_config[$config] == $setting) |
|
| 160 | + if (@$current_config[$config] == $setting) |
|
| 161 | 161 | { |
| 162 | - $t->set_var($value,' selected'); |
|
| 162 | + $t->set_var($value, ' selected'); |
|
| 163 | 163 | } |
| 164 | 164 | else |
| 165 | 165 | { |
| 166 | - $t->set_var($value,''); |
|
| 166 | + $t->set_var($value, ''); |
|
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | case 'hook': |
| 170 | - $newval = str_replace(' ','_',$newval); |
|
| 171 | - $t->set_var($value,$newval($current_config)); |
|
| 170 | + $newval = str_replace(' ', '_', $newval); |
|
| 171 | + $t->set_var($value, $newval($current_config)); |
|
| 172 | 172 | break; |
| 173 | 173 | default: |
| 174 | - $t->set_var($value,''); |
|
| 174 | + $t->set_var($value, ''); |
|
| 175 | 175 | break; |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | -if($GLOBALS['error']) |
|
| 179 | +if ($GLOBALS['error']) |
|
| 180 | 180 | { |
| 181 | - if($GLOBALS['error'] == 'badldapconnection') |
|
| 181 | + if ($GLOBALS['error'] == 'badldapconnection') |
|
| 182 | 182 | { |
| 183 | 183 | /* Please check the number and dial again :) */ |
| 184 | 184 | $GLOBALS['egw_setup']->html->show_alert_msg('Error', |
| 185 | 185 | lang('There was a problem trying to connect to your LDAP server. <br />' |
| 186 | - .'please check your LDAP server configuration') . '.'); |
|
| 186 | + .'please check your LDAP server configuration').'.'); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $GLOBALS['egw_setup']->html->show_alert_msg('Error',$GLOBALS['error'].'<p>'); |
|
| 189 | + $GLOBALS['egw_setup']->html->show_alert_msg('Error', $GLOBALS['error'].'<p>'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | -$t->pfp('out','body'); |
|
| 192 | +$t->pfp('out', 'body'); |
|
| 193 | 193 | unset($t); |
| 194 | 194 | |
| 195 | -$setup_tpl->set_var('more_configs',lang('Please login to egroupware and run the admin application for additional site configuration') . '.'); |
|
| 195 | +$setup_tpl->set_var('more_configs', lang('Please login to egroupware and run the admin application for additional site configuration').'.'); |
|
| 196 | 196 | |
| 197 | -$setup_tpl->set_var('lang_submit',lang('Save')); |
|
| 198 | -$setup_tpl->set_var('lang_cancel',lang('Cancel')); |
|
| 199 | -$setup_tpl->pparse('out','T_config_post_script'); |
|
| 197 | +$setup_tpl->set_var('lang_submit', lang('Save')); |
|
| 198 | +$setup_tpl->set_var('lang_cancel', lang('Cancel')); |
|
| 199 | +$setup_tpl->pparse('out', 'T_config_post_script'); |
|
| 200 | 200 | |
| 201 | 201 | $GLOBALS['egw_setup']->html->show_footer(); |